X)vmadeline-alpha.phar.vendor/daverandom/libdns/examples/SOAQuery.php` #\` eZ{,vendor/daverandom/libdns/examples/AQuery.php#\X.vendor/daverandom/libdns/examples/autoload.php#\&vendor/daverandom/libdns/composer.json#\xez5vendor/daverandom/libdns/tools/autoload_generator.php #\ ̘Z.vendor/daverandom/libdns/src/Records/RData.php#\F7vendor/daverandom/libdns/src/Records/ResourceQTypes.php#\\^,8vendor/daverandom/libdns/src/Records/ResourceFactory.php#\p7Ͷ1vendor/daverandom/libdns/src/Records/Question.php#\]1vendor/daverandom/libdns/src/Records/Resource.php#\V~8vendor/daverandom/libdns/src/Records/ResourceClasses.php#\v8vendor/daverandom/libdns/src/Records/ResourceBuilder.php#\t%Y6vendor/daverandom/libdns/src/Records/ResourceTypes.php#\z|[8vendor/daverandom/libdns/src/Records/QuestionFactory.phpE#\EPӭHvendor/daverandom/libdns/src/Records/TypeDefinitions/FieldDefinition.php#\<Nvendor/daverandom/libdns/src/Records/TypeDefinitions/TypeDefinitionFactory.phpa#\a:_׶Ovendor/daverandom/libdns/src/Records/TypeDefinitions/FieldDefinitionFactory.phpG#\GGBj׶Gvendor/daverandom/libdns/src/Records/TypeDefinitions/TypeDefinition.php#\^X޶Uvendor/daverandom/libdns/src/Records/TypeDefinitions/TypeDefinitionManagerFactory.php#\p[Nvendor/daverandom/libdns/src/Records/TypeDefinitions/TypeDefinitionManager.php;)#\;)1]>>vendor/daverandom/libdns/src/Records/Types/CharacterString.phpZ#\ZJ3:vendor/daverandom/libdns/src/Records/Types/TypeFactory.php #\ 5vendor/daverandom/libdns/src/Records/Types/BitMap.php#\ku7vendor/daverandom/libdns/src/Records/Types/Anything.php]#\]24vendor/daverandom/libdns/src/Records/Types/Short.php#\9vendor/daverandom/libdns/src/Records/Types/DomainName.php1 #\1 Q3vendor/daverandom/libdns/src/Records/Types/Long.php#\w+:vendor/daverandom/libdns/src/Records/Types/TypeBuilder.phpU#\Ut3vendor/daverandom/libdns/src/Records/Types/Type.php#\Շ#!:vendor/daverandom/libdns/src/Records/Types/IPv6Address.php#\p 3vendor/daverandom/libdns/src/Records/Types/Char.php#\>9^:vendor/daverandom/libdns/src/Records/Types/IPv4Address.php #\ Il4vendor/daverandom/libdns/src/Records/Types/Types.php#\P9vendor/daverandom/libdns/src/Records/ResourceQClasses.php#\5vendor/daverandom/libdns/src/Records/RDataFactory.phpn#\n.j5vendor/daverandom/libdns/src/Records/RDataBuilder.phpt#\t|?vendor/daverandom/libdns/src/Records/ResourceBuilderFactory.php#\hL9vendor/daverandom/libdns/src/Records/RecordCollection.php #\ ʲ4vendor/daverandom/libdns/src/Records/RecordTypes.php#\0/vendor/daverandom/libdns/src/Records/Record.php! #\! @vendor/daverandom/libdns/src/Records/RecordCollectionFactory.php#\M )*vendor/daverandom/libdns/src/functions.php#\M?vendor/daverandom/libdns/src/Encoder/EncodingContextFactory.php#\n϶7vendor/daverandom/libdns/src/Encoder/EncoderFactory.php#\ ζ0vendor/daverandom/libdns/src/Encoder/Encoder.php+#\+qH8vendor/daverandom/libdns/src/Encoder/EncodingContext.php#\146vendor/daverandom/libdns/src/Packets/LabelRegistry.phpA#\Auf/vendor/daverandom/libdns/src/Packets/Packet.php #\ GP6vendor/daverandom/libdns/src/Packets/PacketFactory.php#\i@0vendor/daverandom/libdns/src/Decoder/Decoder.phpI#\I-U8vendor/daverandom/libdns/src/Decoder/DecodingContext.php#\$W:A?vendor/daverandom/libdns/src/Decoder/DecodingContextFactory.php#\Y)7vendor/daverandom/libdns/src/Decoder/DecoderFactory.phpa#\a/o6vendor/daverandom/libdns/src/Messages/MessageTypes.php#\T+8vendor/daverandom/libdns/src/Messages/MessageOpCodes.php#\`iB1vendor/daverandom/libdns/src/Messages/Message.phpp#\p&7>vendor/daverandom/libdns/src/Messages/MessageResponseCodes.php #\ b7'8vendor/daverandom/libdns/src/Messages/MessageFactory.php#\Oٳ',vendor/daverandom/libdns/src/Enumeration.php#\{ %vendor/erusev/parsedown/Parsedown.php#\0]%vendor/erusev/parsedown/composer.json#\4%vendor/psr/log/Psr/Log/NullLogger.php#\Zf*vendor/psr/log/Psr/Log/LoggerInterface.php #\ ?}3vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php^#\^zʶ*vendor/psr/log/Psr/Log/Test/TestLogger.php#\Q)vendor/psr/log/Psr/Log/AbstractLogger.php #\ Gl&vendor/psr/log/Psr/Log/LoggerTrait.php #\ ý+vendor/psr/log/Psr/Log/LoggerAwareTrait.php#\z%3vendor/psr/log/Psr/Log/InvalidArgumentException.php`#\` X1/vendor/psr/log/Psr/Log/LoggerAwareInterface.php)#\)j #vendor/psr/log/Psr/Log/LogLevel.phpP#\Pvendor/psr/log/composer.json1#\1ܶ'vendor/danog/madelineproto/makephar.php#\)vendor/danog/madelineproto/build_docs.php#\ /$vendor/danog/madelineproto/index.php#\23+vendor/danog/madelineproto/combined_bot.phpd #\d 𞀶)vendor/danog/madelineproto/secret_bot.php"#\"7%۶"vendor/danog/madelineproto/bot.phpD #\D f_)vendor/danog/madelineproto/translator.php#\O%=vendor/danog/madelineproto/userbots/pwrtelegram_debug_bot.php0,#\0,@9vendor/danog/madelineproto/userbots/MadelineProto_bot.phps##\s#20vendor/danog/madelineproto/userbots/pipesbot.php96#\96~(vendor/danog/madelineproto/composer.jsonO#\OҠĶ*vendor/danog/madelineproto/phartesting.php(E#\(EY#vendor/danog/madelineproto/phar.php( #\( ȏ|+vendor/danog/madelineproto/lua/madeline.phpS#\SF[ %vendor/danog/madelineproto/lua/td.phpO#\O /vendor/danog/madelineproto/multiprocess_bot.phpa #\a QS$vendor/danog/madelineproto/songs.php#\W/vendor/danog/madelineproto/build_docs_index.php5#\5.vendor/danog/madelineproto/src/Collectable.phpy#\y㿪,vendor/danog/madelineproto/src/HttpProxy.php#\S':vendor/danog/madelineproto/src/danog/MadelineProto/API.php*#\*(ƶOvendor/danog/madelineproto/src/danog/MadelineProto/SecretChats/SeqNoHandler.php#\[VQvendor/danog/madelineproto/src/danog/MadelineProto/SecretChats/AuthKeyHandler.php <#\ <Y|=Qvendor/danog/madelineproto/src/danog/MadelineProto/SecretChats/MessageHandler.php+#\+[Rvendor/danog/madelineproto/src/danog/MadelineProto/SecretChats/ResponseHandler.php#\yGvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v41.json#\aBvendor/danog/madelineproto/src/danog/MadelineProto/InternalDoc.phpy#\yREvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v86.tl8]#\8]`?vendor/danog/madelineproto/src/danog/MadelineProto/TL_socket.tlZ#\ZGbGvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v55.json'#\' ZBAvendor/danog/madelineproto/src/danog/MadelineProto/Conversion.phpS#\SEvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v89.tldj#\dj=8Evendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v68.tl6#\6`DGvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v51.json#\)ĶQvendor/danog/madelineproto/src/danog/MadelineProto/Loop/Connection/UpdateLoop.php- #\- \պ:Pvendor/danog/madelineproto/src/danog/MadelineProto/Loop/Connection/WriteLoop.php@#\@F rPvendor/danog/madelineproto/src/danog/MadelineProto/Loop/Connection/CheckLoop.php"#\"yȕSvendor/danog/madelineproto/src/danog/MadelineProto/Loop/Connection/HttpWaitLoop.phpD#\DTM@Ovendor/danog/madelineproto/src/danog/MadelineProto/Loop/Connection/ReadLoop.php&#\&$v%Ovendor/danog/madelineproto/src/danog/MadelineProto/Loop/SignalLoopInterface.php#\NIvendor/danog/madelineproto/src/danog/MadelineProto/Loop/LoopInterface.php#\v6Rvendor/danog/madelineproto/src/danog/MadelineProto/Loop/ResumableLoopInterface.php#\D%^Evendor/danog/madelineproto/src/danog/MadelineProto/Loop/Impl/Loop.php#\ GsTvendor/danog/madelineproto/src/danog/MadelineProto/Loop/Impl/ResumableSignalLoop.php #\ #Kvendor/danog/madelineproto/src/danog/MadelineProto/Loop/Impl/SignalLoop.phpZ#\Zx<vendor/danog/madelineproto/src/danog/MadelineProto/Tools.php #\ yEvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v72.tlC#\C?a>vendor/danog/madelineproto/src/danog/MadelineProto/MTProto.phpC#\CKJEvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v91.tlp#\plJ?Cvendor/danog/madelineproto/src/danog/MadelineProto/TL_mtproto_v1.tlW#\WrnֶGvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v38.json [#\ [Y;?vendor/danog/madelineproto/src/danog/MadelineProto/TL_secret.tl#\7Zvendor/danog/madelineproto/src/danog/MadelineProto/Stream/BufferedProxyStreamInterface.php#\0KGMvendor/danog/madelineproto/src/danog/MadelineProto/Stream/StreamInterface.php#\IUvendor/danog/madelineproto/src/danog/MadelineProto/Stream/Transport/DefaultStream.phph #\h epPvendor/danog/madelineproto/src/danog/MadelineProto/Stream/Transport/WsStream.phpU#\UW>Qvendor/danog/madelineproto/src/danog/MadelineProto/Stream/Transport/WssStream.phpG#\Gõ<Rvendor/danog/madelineproto/src/danog/MadelineProto/Stream/ProxyStreamInterface.php #\ ꈶVvendor/danog/madelineproto/src/danog/MadelineProto/Stream/Common/BufferedRawStream.php#\ͶYvendor/danog/madelineproto/src/danog/MadelineProto/Stream/Common/HashedBufferedStream.php"#\"] ͶPvendor/danog/madelineproto/src/danog/MadelineProto/Stream/RawStreamInterface.php#\'tCUvendor/danog/madelineproto/src/danog/MadelineProto/Stream/BufferedStreamInterface.php#\BToRvendor/danog/madelineproto/src/danog/MadelineProto/Stream/Async/BufferedStream.php> #\> r?Jvendor/danog/madelineproto/src/danog/MadelineProto/Stream/Async/Buffer.php#\S.Mvendor/danog/madelineproto/src/danog/MadelineProto/Stream/Async/RawStream.php:#\:gi:Jvendor/danog/madelineproto/src/danog/MadelineProto/Stream/Async/Stream.php#\XyMvendor/danog/madelineproto/src/danog/MadelineProto/Stream/Proxy/HttpProxy.php#\mHNvendor/danog/madelineproto/src/danog/MadelineProto/Stream/Proxy/SocksProxy.php#\Tavendor/danog/madelineproto/src/danog/MadelineProto/Stream/MTProtoTransport/IntermediateStream.phpu #\u $XG_vendor/danog/madelineproto/src/danog/MadelineProto/Stream/MTProtoTransport/ObfuscatedStream.php#\GYvendor/danog/madelineproto/src/danog/MadelineProto/Stream/MTProtoTransport/HttpStream.phpK#\KB Zvendor/danog/madelineproto/src/danog/MadelineProto/Stream/MTProtoTransport/HttpsStream.php#\5]vendor/danog/madelineproto/src/danog/MadelineProto/Stream/MTProtoTransport/AbridgedStream.php #\ %NzYvendor/danog/madelineproto/src/danog/MadelineProto/Stream/MTProtoTransport/FullStream.php2#\2۶gvendor/danog/madelineproto/src/danog/MadelineProto/Stream/MTProtoTransport/IntermediatePaddedStream.php( #\( GUvendor/danog/madelineproto/src/danog/MadelineProto/Stream/RawProxyStreamInterface.php#\g Tvendor/danog/madelineproto/src/danog/MadelineProto/Stream/MTProtoBufferInterface.php#\7Wvendor/danog/madelineproto/src/danog/MadelineProto/Stream/MTProtoTools/MsgIdHandler.php"#\"$Wvendor/danog/madelineproto/src/danog/MadelineProto/Stream/MTProtoTools/SeqNoHandler.phpr #\r PMVvendor/danog/madelineproto/src/danog/MadelineProto/Stream/MTProtoTools/SaltHandler.php#\uMvendor/danog/madelineproto/src/danog/MadelineProto/Stream/BufferInterface.php#\ϑ4Ovendor/danog/madelineproto/src/danog/MadelineProto/Stream/ConnectionContext.php#\>0Jvendor/danog/madelineproto/src/danog/MadelineProto/VoIP/AuthKeyHandler.php:?#\:?-Evendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v71.tl=#\=1Kvendor/danog/madelineproto/src/danog/MadelineProto/Threads/SocketReader.phpG #\G 23Lvendor/danog/madelineproto/src/danog/MadelineProto/Threads/SocketHandler.php #\ W>vendor/danog/madelineproto/src/danog/MadelineProto/TL_calls.tlj#\jp=ĶRvendor/danog/madelineproto/src/danog/MadelineProto/NothingInTheSocketException.php1#\1bxN=vendor/danog/madelineproto/src/danog/MadelineProto/Logger.php6#\6;Kvendor/danog/madelineproto/src/danog/MadelineProto/CombinedEventHandler.phpm#\meǶEvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v65.tl#\<ɶGvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v44.json#\B@Gvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v40.json'#\'$ 0Avendor/danog/madelineproto/src/danog/MadelineProto/Connection.php##\#9RGvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v45.json#\*0!Evendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v81.tlTR#\TR4?vendor/danog/madelineproto/src/danog/MadelineProto/Absolute.php$#\$g)(;vendor/danog/madelineproto/src/danog/MadelineProto/TL_td.tl#\?tͶGvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v25.json#\c]ǶEvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v46.tl#\m'ڶGvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v27.json#\՗U<vendor/danog/madelineproto/src/danog/MadelineProto/Proxy.phpk#\k`Lvendor/danog/madelineproto/src/danog/MadelineProto/Async/AsyncParameters.php#\%Ry$Gvendor/danog/madelineproto/src/danog/MadelineProto/Async/Parameters.php#\d,Evendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v70.tl8#\8yaHvendor/danog/madelineproto/src/danog/MadelineProto/SecurityException.php#\hECvendor/danog/madelineproto/src/danog/MadelineProto/EventHandler.php #\ ƦHvendor/danog/madelineproto/src/danog/MadelineProto/RPCErrorException.php##\#fvAvendor/danog/madelineproto/src/danog/MadelineProto/APIFactory.php+#\+}:vendor/danog/madelineproto/src/danog/MadelineProto/RSA.phpK #\K lEvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v62.tl#\o$:vendor/danog/madelineproto/src/danog/MadelineProto/Lua.php#\<vendor/danog/madelineproto/src/danog/MadelineProto/Magic.php[4#\[45zGvendor/danog/madelineproto/src/danog/MadelineProto/TL_telegram_v42.jsonj#\j&ŶDvendor/danog/madelineproto/src/danog/MadelineProto/PayloadStream.php#\r Cvendor/danog/madelineproto/src/danog/MadelineProto/Wrappers/TOS.phpH #\H N ݶDvendor/danog/madelineproto/src/danog/MadelineProto/Wrappers/Loop.php|#\|FʶHvendor/danog/madelineproto/src/danog/MadelineProto/Wrappers/Callback.php#\dHvendor/danog/madelineproto/src/danog/MadelineProto/Wrappers/ApiStart.php#\ǶMvendor/danog/madelineproto/src/danog/MadelineProto/Wrappers/DialogHandler.php@ #\@ NtEvendor/danog/madelineproto/src/danog/MadelineProto/Wrappers/Login.php)#\)8ӦIvendor/danog/madelineproto/src/danog/MadelineProto/Wrappers/Templates.php #\ łvLvendor/danog/madelineproto/src/danog/MadelineProto/Wrappers/ApiTemplates.phpZ#\Z-vendor/danog/madelineproto/src/BigIntegor.php/#\/ x)vendor/danog/madelineproto/src/Worker.php7#\7"#ƶ2vendor/danog/madelineproto/src/CustomHTTPProxy.php#\apk+vendor/danog/madelineproto/src/Threaded.php#\~OD$vendor/danog/madelineproto/magna.php:#\:^:$vendor/danog/magicalserializer/b.php#\Ž&{,vendor/danog/magicalserializer/composer.json#\އ$vendor/danog/magicalserializer/a.phpN#\N]9vendor/danog/magicalserializer/src/danog/Serializable.php#\Y:vendor/danog/magicalserializer/src/danog/Serialization.php#\V8vendor/danog/magicalserializer/src/danog/PlaceHolder.phpt#\t't&vendor/danog/primemodule/composer.jsonF#\F0Su/vendor/danog/primemodule/lib/danog/alt_prime.py#\_3{+vendor/danog/primemodule/lib/danog/prime.pyI/#\I/2vendor/danog/primemodule/lib/danog/PrimeModule.php 9#\ 9o,SҶ"vendor/composer/autoload_files.php #\ MW#vendor/composer/autoload_static.php)#\)Q !vendor/composer/autoload_real.phpn #\n !vendor/composer/autoload_psr4.php#\dFvendor/composer/ClassLoader.php4#\4zvendor/composer/installed.json#\y%vendor/composer/autoload_classmap.php#\b'vendor/composer/autoload_namespaces.php#\-k$vendor/monolog/monolog/composer.json #\ :vendor/monolog/monolog/src/Monolog/ResettableInterface.php#\4n3vendor/monolog/monolog/src/Monolog/ErrorHandler.php!#\!ᱶDvendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php#\Cڶ<vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.phpF#\FtӶ:vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php#\r->vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php#\߶=vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.phpf#\f:vendor/monolog/monolog/src/Monolog/Handler/MailHandler.phpV#\VYyW;vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.phpB#\B8 ?vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php# #\# 3ֶ<vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.phpd#\d+9vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php#\(rDvendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php#\L9>vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php#\EU?vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php #\ VcŶ:vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php#\MM:vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php#\ufAvendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.phpl #\l  ƶ>vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php #\ m=vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php#\c#=vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php> #\> H@vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.phpR#\RB]<vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.phpU#\UBBvendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php#\?vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php #\ $sնHvendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php#\]Cvendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.phpg#\gʚ0Dvendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php+ #\+ Ѷ8vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php#\;vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php6#\6-*Avendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php#\R޽;vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.phpI #\I nL=vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php*#\*>vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.phpr #\r Y@vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.phpO#\OV=vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.phpF#\F/g;vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php #\ }׶@vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php'#\'ns|ʶ>vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php@ #\@ }OEvendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php#\~>vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php #\ biBvendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.phpV#\VŶBvendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php#\&Bvendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.phpy#\ykM>vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.phpB#\BV&Hvendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php#\唘Yvendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php#\m{Zvendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php#\V vܶ\vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php#\oV<vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php3#\3Vƶ@vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php) #\) j;vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php#\*?vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php#\CZE=vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.phpW#\WteFvendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php#\f>vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.phpL #\L `:vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php#\9<vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.phpT&#\T&k>vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.phpl#\l"3ֶCvendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.phpU #\U 9:vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php#\zYM<vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php; #\; W߶-vendor/monolog/monolog/src/Monolog/Logger.php5V#\5VyŶ4vendor/monolog/monolog/src/Monolog/SignalHandler.phpm#\m+d0=vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php#\6A=vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php #\ xOj=vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php#\)Gvendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php #\ p+Cvendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php\#\\םEvendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php#\aoODCvendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php#\ u_Cvendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php #\ \e3Gvendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php0#\0@vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php)#\)y=vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.phpR#\RddIvendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php#\@/vendor/monolog/monolog/src/Monolog/Registry.php#\ն@vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php*#\*wBvendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php-#\-Evendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php8#\81lBvendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php #\ ֶCvendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php#\WܑAvendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php #\ iHCvendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php#\;`aiDvendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php'#\'Bvendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php #\ (@vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php#\^>vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php#\ ƊBvendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php#\.hݶAvendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.phps#\s->vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php#\<>vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php#\J3,vendor/monolog/monolog/src/Monolog/Utils.php#\ vendor/amphp/amp/composer.json#\z81vendor/amphp/amp/lib/TimeoutCancellationToken.php#\U +vendor/amphp/amp/lib/CancelledException.phpT#\T& vendor/amphp/amp/lib/Emitter.php1#\1f!vendor/amphp/amp/lib/Iterator.php#\ı@޶)vendor/amphp/amp/lib/TimeoutException.phpt#\tPMS!vendor/amphp/amp/lib/Producer.phpu#\u$~Ƕvendor/amphp/amp/lib/Loop.phpD#\D]а1vendor/amphp/amp/lib/Internal/ResolutionQueue.php?#\?BvB*vendor/amphp/amp/lib/Internal/Producer.php#\aݶ0vendor/amphp/amp/lib/Internal/PrivatePromise.php#\vJ +vendor/amphp/amp/lib/Internal/functions.phpz#\zxD^-vendor/amphp/amp/lib/Internal/Placeholder.php#\mb1vendor/amphp/amp/lib/Internal/PrivateIterator.phpg#\g.Y%vendor/amphp/amp/lib/Loop/Watcher.phpJ#\Jsy1vendor/amphp/amp/lib/Loop/InvalidWatcherError.php#\#4&vendor/amphp/amp/lib/Loop/EvDriver.php#\h T#*vendor/amphp/amp/lib/Loop/NativeDriver.php3#\3w&vendor/amphp/amp/lib/Loop/UvDriver.php$#\$_+vendor/amphp/amp/lib/Loop/DriverFactory.phpA#\A9vendor/amphp/amp/lib/Loop/UnsupportedFeatureException.php#\0`$vendor/amphp/amp/lib/Loop/Driver.phpd#\dB9)vendor/amphp/amp/lib/Loop/EventDriver.php"#\"[*vendor/amphp/amp/lib/CancellationToken.php#\ ȭ"vendor/amphp/amp/lib/functions.phpX#\Xv-Dݶ vendor/amphp/amp/lib/Failure.php?#\?L!vendor/amphp/amp/lib/Deferred.php7#\7|À.vendor/amphp/amp/lib/NullCancellationToken.php#\u8-vendor/amphp/amp/lib/MultiReasonException.php@#\@>S$vendor/amphp/amp/lib/LazyPromise.php[#\[ѳ vendor/amphp/amp/lib/Success.phpl#\l8 vendor/amphp/amp/lib/Promise.phpK#\K鹗vendor/amphp/amp/lib/Struct.php#\"vendor/amphp/amp/lib/Coroutine.php#\Si&vendor/amphp/amp/lib/CallableMaker.php #\ h vendor/amphp/amp/lib/Delayed.phpO#\ONR*vendor/amphp/amp/lib/InvalidYieldError.phpd#\dKƭ0vendor/amphp/amp/lib/CancellationTokenSource.php|#\|Y/:vendor/amphp/byte-stream/examples/benchmark-throughput.php#\6Pc5vendor/amphp/byte-stream/examples/gzip-decompress.php#\˱k϶3vendor/amphp/byte-stream/examples/gzip-compress.php#\&vendor/amphp/byte-stream/composer.json#\=/vendor/amphp/byte-stream/lib/IteratorStream.php#\U>T*vendor/amphp/byte-stream/lib/functions.php\ #\\ b<1vendor/amphp/byte-stream/lib/PendingReadError.php#\^0vendor/amphp/byte-stream/lib/ZlibInputStream.phpc #\c m-vendor/amphp/byte-stream/lib/OutputStream.php#\+Xb0vendor/amphp/byte-stream/lib/ClosedException.phpZ#\Z -vendor/amphp/byte-stream/lib/OutputBuffer.phpr#\rL,vendor/amphp/byte-stream/lib/InputStream.php#\Iж4vendor/amphp/byte-stream/lib/ResourceInputStream.php#\t(Yx(vendor/amphp/byte-stream/lib/Message.php#\<1vendor/amphp/byte-stream/lib/ZlibOutputStream.php\ #\\ /vendor/amphp/byte-stream/lib/InMemoryStream.php5#\5z$0vendor/amphp/byte-stream/lib/StreamException.phpO#\Oکݶ(vendor/amphp/byte-stream/lib/Payload.php #\ ڶ5vendor/amphp/byte-stream/lib/ResourceOutputStream.php!##\!#ۂ~!vendor/amphp/socket/composer.json0#\0XYy.vendor/amphp/socket/src/Internal/functions.php#\X}%vendor/amphp/socket/src/functions.phpP%#\P%!ֶ+vendor/amphp/socket/src/BasicSocketPool.php#\Hi(vendor/amphp/socket/src/ServerSocket.phpR#\RlU.vendor/amphp/socket/src/PendingAcceptError.php#\Vg"vendor/amphp/socket/src/Socket.php #\ )3%/vendor/amphp/socket/src/ServerListenContext.phpU #\U Cw'vendor/amphp/socket/src/Certificate.phpB#\B?+vendor/amphp/socket/src/CryptoException.phpP#\Ps ,vendor/amphp/socket/src/ServerTlsContext.php-#\-OQζ,vendor/amphp/socket/src/ConnectException.phpQ#\Q {F+vendor/amphp/socket/src/SocketException.phpu#\u (vendor/amphp/socket/src/ClientSocket.phpi#\iv,vendor/amphp/socket/src/ClientTlsContext.php&#\&,vendor/amphp/socket/src/StaticSocketPool.php #\ YC\&vendor/amphp/socket/src/SocketPool.php#\"vendor/amphp/socket/src/Server.php)#\)D0vendor/amphp/socket/src/ClientConnectContext.php #\ dsvendor/amphp/dns/composer.jsonH#\Hqc&vendor/amphp/dns/lib/BasicResolver.php=#\=iѶ)vendor/amphp/dns/lib/TimeoutException.phpR#\RB+vendor/amphp/dns/lib/Internal/UdpSocket.php!#\!ڔk(vendor/amphp/dns/lib/Internal/Socket.php#\V򥯶+vendor/amphp/dns/lib/Internal/TcpSocket.php #\ Gq)vendor/amphp/dns/lib/UnixConfigLoader.php #\ "vendor/amphp/dns/lib/functions.php#\h (vendor/amphp/dns/lib/ConfigException.phpD#\D+|.%vendor/amphp/dns/lib/ConfigLoader.phps#\sHӶ,vendor/amphp/dns/lib/ResolutionException.phpL#\LV)vendor/amphp/dns/lib/InvalidNameError.phpE#\Emw!vendor/amphp/dns/lib/Resolver.php#\l#vendor/amphp/dns/lib/HostLoader.php#\[*vendor/amphp/dns/lib/NoRecordException.phpS#\S؈vendor/amphp/dns/lib/Record.php} #\} ܶvendor/amphp/dns/lib/Config.php4 #\4 IӶ,vendor/amphp/dns/lib/WindowsConfigLoader.php #\ fvendor/amphp/uri/composer.json#\l0vendor/amphp/uri/src/InvalidDnsNameException.phpP#\PEm"vendor/amphp/uri/src/functions.phpt#\tcNvendor/amphp/uri/src/Uri.php2#\2XR,vendor/amphp/uri/src/InvalidUriException.phpL#\LGvendor/amphp/sync/composer.json#\Ƕ/vendor/amphp/sync/lib/Internal/MutexStorage.php5#\5ڶ3vendor/amphp/sync/lib/Internal/SemaphoreStorage.php3#\3#l̶#vendor/amphp/sync/lib/functions.phpr#\rG#vendor/amphp/sync/lib/Semaphore.php#\ Kɶ(vendor/amphp/sync/lib/PosixSemaphore.php#\z#vendor/amphp/sync/lib/FileMutex.php#\ y$vendor/amphp/sync/lib/LocalMutex.php#\f>W+vendor/amphp/sync/lib/ThreadedSemaphore.php6#\6L-'vendor/amphp/sync/lib/SyncException.phpG#\GU8vendor/amphp/sync/lib/Lock.php#\Q'övendor/amphp/sync/lib/Mutex.php#\X(vendor/amphp/sync/lib/LocalSemaphore.php#\ 'vendor/amphp/sync/lib/ThreadedMutex.php.#\.(vendor/amphp/sync/lib/SemaphoreMutex.php#\5K!vendor/amphp/parser/composer.json#\r1vendor/amphp/parser/lib/InvalidDelimiterError.phpk#\kaNe"vendor/amphp/parser/lib/Parser.php]#\]f੶#vendor/amphp/parallel/composer.jsong#\g߸ 32vendor/amphp/parallel/lib/Worker/WorkerProcess.phpW#\WqD9vendor/amphp/parallel/lib/Worker/DefaultWorkerFactory.php#\},)vendor/amphp/parallel/lib/Worker/Task.php#\Zs/vendor/amphp/parallel/lib/Worker/TaskWorker.php#\JQO5vendor/amphp/parallel/lib/Worker/BasicEnvironment.php#\l|);vendor/amphp/parallel/lib/Worker/Internal/WorkerProcess.phpJ#\J&^:vendor/amphp/parallel/lib/Worker/Internal/PooledWorker.phpj#\j8u<vendor/amphp/parallel/lib/Worker/Internal/worker-process.phpx#\xbh9vendor/amphp/parallel/lib/Worker/Internal/TaskSuccess.php#\\8vendor/amphp/parallel/lib/Worker/Internal/TaskResult.phpN#\NrU1vendor/amphp/parallel/lib/Worker/Internal/Job.php3#\3ۗ9vendor/amphp/parallel/lib/Worker/Internal/TaskFailure.php_#\_Y:)vendor/amphp/parallel/lib/Worker/Pool.php#\ojG.vendor/amphp/parallel/lib/Worker/functions.php#\,4vendor/amphp/parallel/lib/Worker/WorkerException.phpT#\T G2vendor/amphp/parallel/lib/Worker/TaskException.php #\ WR;0vendor/amphp/parallel/lib/Worker/Environment.php#\ƶ2vendor/amphp/parallel/lib/Worker/WorkerFactory.php#\KR.vendor/amphp/parallel/lib/Worker/TaskError.php#\gG-1vendor/amphp/parallel/lib/Worker/WorkerThread.php#\R~ٶ/vendor/amphp/parallel/lib/Worker/TaskRunner.php#\ ?00vendor/amphp/parallel/lib/Worker/DefaultPool.php#\l/+vendor/amphp/parallel/lib/Worker/Worker.php#\Sa9vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php#\+x=vendor/amphp/parallel/lib/Context/Internal/process-runner.phpW #\W ٦5vendor/amphp/parallel/lib/Context/Internal/Thread.php#\!o6vendor/amphp/parallel/lib/Context/ContextException.phpV#\Vͺ,vendor/amphp/parallel/lib/Context/Thread.php##\#d<-vendor/amphp/parallel/lib/Context/Context.php#\6-vendor/amphp/parallel/lib/Context/Process.phpi*#\i*1vendor/amphp/parallel/lib/Context/StatusError.phpM#\Mr9vendor/amphp/parallel/lib/Sync/SerializationException.phpY#\YZ+w7vendor/amphp/parallel/lib/Sync/SynchronizationError.phpS#\S\7|9vendor/amphp/parallel/lib/Sync/Internal/ParcelStorage.php#\Y50vendor/amphp/parallel/lib/Sync/ChannelParser.php #\ qŇ*vendor/amphp/parallel/lib/Sync/Channel.php#\AiL-vendor/amphp/parallel/lib/Sync/ExitResult.php'#\'| 8vendor/amphp/parallel/lib/Sync/SharedMemoryException.phpX#\X,y)vendor/amphp/parallel/lib/Sync/Parcel.php#\G3vendor/amphp/parallel/lib/Sync/ChannelledSocket.php#\T5vendor/amphp/parallel/lib/Sync/SharedMemoryParcel.php0#\0].vendor/amphp/parallel/lib/Sync/ExitSuccess.phpI#\I^Ƕ.vendor/amphp/parallel/lib/Sync/ExitFailure.php#\}l-vendor/amphp/parallel/lib/Sync/PanicError.php#\h=K'3vendor/amphp/parallel/lib/Sync/ChannelException.phpS#\S1vendor/amphp/parallel/lib/Sync/ThreadedParcel.phpX#\XC}3vendor/amphp/parallel/lib/Sync/ChannelledStream.php#\H0vendor/amphp/websocket-client/examples/aerys.phpv#\v7T<vendor/amphp/websocket-client/examples/kaazing-echo-demo.php#\W6vendor/amphp/websocket-client/test-autobahn/runner.php> #\> CEvendor/amphp/websocket-client/test-autobahn/config/fuzzingserver.json#\+vendor/amphp/websocket-client/composer.jsonD#\D+%>vendor/amphp/websocket-client/test/Helper/WebsocketAdapter.php #\  54vendor/amphp/websocket-client/test/WebSocketTest.phpK#\KW*/vendor/amphp/websocket-client/lib/Handshake.php#\S/vendor/amphp/websocket-client/lib/functions.php>#\>a5vendor/amphp/websocket-client/lib/ClosedException.php|#\|>t0vendor/amphp/websocket-client/lib/Connection.php #\ a;7vendor/amphp/websocket-client/lib/Rfc6455Connection.phpT#\TX'*vendor/amphp/websocket-client/lib/Code.php0#\0K-vendor/amphp/websocket-client/lib/Options.php #\ (<-vendor/amphp/websocket-client/lib/Message.phpa #\a l̟8vendor/amphp/websocket-client/lib/WebSocketException.phpQ#\Q/vendor/amphp/file/composer.json2#\2d #vendor/amphp/file/lib/StatCache.php#\")vendor/amphp/file/lib/Internal/UvPoll.php#\.*vendor/amphp/file/lib/Internal/EioPoll.php#\h +vendor/amphp/file/lib/Internal/FileTask.php #\ 2ۀ#vendor/amphp/file/lib/EioHandle.php!#\! e3#vendor/amphp/file/lib/functions.php #\ ?ŗ(vendor/amphp/file/lib/BlockingHandle.php#\uC"vendor/amphp/file/lib/UvDriver.php;H#\;H Ӷ vendor/amphp/file/lib/Handle.php #\ O2(vendor/amphp/file/lib/ParallelHandle.php#\{ /vendor/amphp/file/lib/PendingOperationError.phpS#\Sxͺ"vendor/amphp/file/lib/UvHandle.php #\ U6 vendor/amphp/file/lib/Driver.php#\Ò#vendor/amphp/file/lib/EioDriver.phpD#\D}Ҁ(vendor/amphp/file/lib/BlockingDriver.php'#\'-vendor/amphp/file/lib/FilesystemException.php#\(vendor/amphp/file/lib/ParallelDriver.php#\<"vendor/amphp/process/composer.json?#\?&vendor/amphp/process/lib/constants.phps#\s,o3vendor/amphp/process/lib/Internal/ProcessRunner.php#\So62vendor/amphp/process/lib/Internal/Posix/Runner.php#\ P@2vendor/amphp/process/lib/Internal/Posix/Handle.php#\x.Y4vendor/amphp/process/lib/Internal/Windows/Runner.php#\)Avendor/amphp/process/lib/Internal/Windows/PendingSocketClient.php1#\1+^4vendor/amphp/process/lib/Internal/Windows/Handle.php#\T=vendor/amphp/process/lib/Internal/Windows/HandshakeStatus.php#\aض8vendor/amphp/process/lib/Internal/Windows/SignalCode.php]#\]TZ/=vendor/amphp/process/lib/Internal/Windows/SocketConnector.php1#\17\d3vendor/amphp/process/lib/Internal/ProcessHandle.php#\>f3vendor/amphp/process/lib/Internal/ProcessStatus.php#\ʍ 0vendor/amphp/process/lib/ProcessOutputStream.php: #\: $/vendor/amphp/process/lib/ProcessInputStream.php) #\) U-vendor/amphp/process/lib/ProcessException.phpM#\M$vendor/amphp/process/lib/Process.php&#\&J0/(vendor/amphp/process/lib/StatusError.phpD#\DT9+vendor/amphp/windows-registry/composer.jsont#\tJ;5vendor/amphp/windows-registry/lib/WindowsRegistry.php3#\3K}:vendor/amphp/windows-registry/lib/KeyNotFoundException.phpY#\Y4])vendor/amphp/log/examples/hello-world.php #\ ^vendor/amphp/log/composer.json8#\8בm&vendor/amphp/log/src/StreamHandler.php#\jL"vendor/amphp/log/src/functions.php#\Nƶ)vendor/amphp/log/src/ConsoleFormatter.php #\ ա vendor/amphp/cache/composer.jsonu#\u%)vendor/amphp/cache/lib/CacheException.php#\ŭ &vendor/amphp/cache/lib/PrefixCache.php#\C7%vendor/amphp/cache/lib/ArrayCache.php #\ l2b vendor/amphp/cache/lib/Cache.phpF#\Fh$vendor/amphp/cache/lib/NullCache.php,#\,!ւն$vendor/rollbar/rollbar/composer.json#\1ζ3vendor/rollbar/rollbar/src/TransformerInterface.phpf#\f} u_+vendor/rollbar/rollbar/src/LevelFactory.php^#\^y]+vendor/rollbar/rollbar/src/ErrorWrapper.php#\i'vendor/rollbar/rollbar/src/Response.php?#\?[ 'vendor/rollbar/rollbar/src/Scrubber.php#\80vendor/rollbar/rollbar/src/ScrubberInterface.phpk#\k\V7vendor/rollbar/rollbar/src/Handlers/AbstractHandler.php #\ f4vendor/rollbar/rollbar/src/Handlers/ErrorHandler.phpv#\v3 8vendor/rollbar/rollbar/src/Handlers/ExceptionHandler.phpC#\CٕD4vendor/rollbar/rollbar/src/Handlers/FatalHandler.php|#\|Qr=vendor/rollbar/rollbar/src/Monolog/Handler/RollbarHandler.php#\Aq3vendor/rollbar/rollbar/src/DataBuilderInterface.phpu#\uʶ.vendor/rollbar/rollbar/src/RollbarJsHelper.phps#\sU2vendor/rollbar/rollbar/src/Senders/AgentSender.phpt#\tyņ6vendor/rollbar/rollbar/src/Senders/SenderInterface.phpF#\F\3vendor/rollbar/rollbar/src/Senders/FluentSender.php #\ )2 1vendor/rollbar/rollbar/src/Senders/CurlSender.php#\,vendor/rollbar/rollbar/src/RollbarLogger.phpm#\mҎb.vendor/rollbar/rollbar/src/FilterInterface.phpp#\p$GԶ'vendor/rollbar/rollbar/src/Defaults.php`'#\`'c#5vendor/rollbar/rollbar/src/Truncation/RawStrategy.php#\JP58vendor/rollbar/rollbar/src/Truncation/FramesStrategy.phpO#\O^I:vendor/rollbar/rollbar/src/Truncation/AbstractStrategy.php#\+9vendor/rollbar/rollbar/src/Truncation/MinBodyStrategy.php#\e3vendor/rollbar/rollbar/src/Truncation/IStrategy.phpX#\Xde4vendor/rollbar/rollbar/src/Truncation/Truncation.php#\xyT9vendor/rollbar/rollbar/src/Truncation/StringsStrategy.php#\M,(vendor/rollbar/rollbar/src/Utilities.php#\A 37vendor/rollbar/rollbar/src/ResponseHandlerInterface.phpz#\z檶-vendor/rollbar/rollbar/src/Payload/Person.php#\0M,vendor/rollbar/rollbar/src/Payload/Level.php#\_c,vendor/rollbar/rollbar/src/Payload/Trace.php#\F%+vendor/rollbar/rollbar/src/Payload/Data.phpk#\k9v0[+vendor/rollbar/rollbar/src/Payload/Body.php#\ȹ1vendor/rollbar/rollbar/src/Payload/TraceChain.phpU#\U0B%/vendor/rollbar/rollbar/src/Payload/Notifier.php#\:$.vendor/rollbar/rollbar/src/Payload/Context.php1#\1qw.vendor/rollbar/rollbar/src/Payload/Message.php>#\>i2-`.vendor/rollbar/rollbar/src/Payload/Request.phpV #\V z".vendor/rollbar/rollbar/src/Payload/Payload.php#\Q67vendor/rollbar/rollbar/src/Payload/ContentInterface.phpu#\us-,vendor/rollbar/rollbar/src/Payload/Frame.php#\0-vendor/rollbar/rollbar/src/Payload/Server.php#\+ȁ4vendor/rollbar/rollbar/src/Payload/ExceptionInfo.php#\F-5vendor/rollbar/rollbar/src/Payload/EncodedPayload.phpl#\l_}.[%vendor/rollbar/rollbar/src/Config.phpeZ#\eZ8Fö*vendor/rollbar/rollbar/src/DataBuilder.php#\@ӧ&vendor/rollbar/rollbar/src/Rollbar.phpN#\Ni'6vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php#\n6e.2vendor/phpseclib/phpseclib/phpseclib/Crypt/AES.php#\je8vendor/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php5#\5\I>vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Keys/MSBLOB.php#\ ;vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Keys/Raw.php #\ 8 #;vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Keys/XML.php#\4j(?vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Keys/OpenSSH.php #\ -=vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Keys/PKCS8.phpz #\z I=vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Keys/PKCS1.phpM#\M\=vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Keys/PuTTY.phpF#\FC43vendor/phpseclib/phpseclib/phpseclib/Crypt/Hash.php0<#\0<=`I2vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php #\ fʶ2vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php1U#\1U(E5vendor/phpseclib/phpseclib/phpseclib/Crypt/Random.phpC$#\C${dBvendor/phpseclib/phpseclib/phpseclib/Crypt/Common/SymmetricKey.php#\I}Avendor/phpseclib/phpseclib/phpseclib/Crypt/Common/BlockCipher.php[#\[Bvendor/phpseclib/phpseclib/phpseclib/Crypt/Common/StreamCipher.php`#\`ô_Bvendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Keys/OpenSSH.php #\ .@vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Keys/PKCS8.php T#\ T~@vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Keys/PKCS1.php_#\_N?vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Keys/PKCS.php#\x[n@vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Keys/PuTTY.phpF#\FೊCvendor/phpseclib/phpseclib/phpseclib/Crypt/Common/AsymmetricKey.php@#\@:K^Cvendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Signature/Raw.phpz#\zBn̶;vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Keys/Raw.php #\ nе;vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Keys/XML.php#\?vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Keys/OpenSSH.php #\ =vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Keys/PKCS8.php#\Y=vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Keys/PKCS1.phpM#\MQP=vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Keys/PuTTY.php#\\_Avendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Signature/SSH2.php #\ JK@vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Signature/Raw.phpA#\A"Avendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Signature/PKCS.php#\|uж7vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.phpc#\c[!2vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.phpN#\Nco۶7vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php#\|.2vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA.phpO9#\O9Rh2vendor/phpseclib/phpseclib/phpseclib/Crypt/RC4.php!#\! =9vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php&#\&ڶBvendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php#\_Φ8vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.phpJ#\JaZRvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP/DefaultEngine.php#\$7Wvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php+#\+0ёWvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Classic.php#\'^vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/MontgomeryMult.php #\ t?Zvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Montgomery.php`#\`=$3[vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/EvalBarrett.phpf<#\f<'%ܶZvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/PowerOfTwo.php#\pJ3Lvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/OpenSSL.php#\d{Ivendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Base.php#\Rvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/DefaultEngine.php#\f![Ovendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Montgomery.phpC #\C w Hvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/OpenSSL.phpV#\V~c˶Dvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php#\XfVZvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php#\7V^vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.phpu #\u sѶOvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php#\sOvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/OpenSSL.php#\fAضLvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Base.php #\ Uvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/DefaultEngine.php#\ .#Fvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP32.php!#\!ʜ[Dvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP.php:#\:@'t˶Gvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath.phpYG#\YGIGvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.phpց#\ցvFvendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP64.php'!#\'!2wAvendor/phpseclib/phpseclib/phpseclib/Common/Functions/Strings.phpk#\kAvendor/phpseclib/phpseclib/phpseclib/Common/Functions/Objects.php#\.+2vendor/phpseclib/phpseclib/phpseclib/bootstrap.phph#\hUA2vendor/phpseclib/phpseclib/phpseclib/File/X509.php#\L2vendor/phpseclib/phpseclib/phpseclib/File/ANSI.phpO#\O*x:vendor/phpseclib/phpseclib/phpseclib/File/ASN1/Element.php#\ ̸Hvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OrganizationName.php?#\?2Ivendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateDomainName.php#\fDvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBKDF2params.phpi#\iq-Cvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralName.php#\8Cvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBES2params.php#\T< Evendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSAPrivateKey.php#\ʏڶDvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EDIPartyName.php#\KRvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectDirectoryAttributes.php#\ZBvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/UserNotice.php#\QJEvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PostalAddress.php#\Fvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NetworkAddress.php7#\7w#Kvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AlgorithmIdentifier.php5#\5FgKvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyQualifierInfo.php#\7Mvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKeyAndChallenge.php#\|MMvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKeyUsagePeriod.php#\(!<vendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Name.phpt#\t[Gvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NameConstraints.php#\伡Mvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DistributionPointName.php#\e~Dvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertPolicyId.php4#\4uNvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_ca_policy_url.phpK#\KewJCvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DssSigValue.php#\aE<vendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Time.php#\жJvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_cert_type.php#\ ĤFvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKeyInfo.php#\#@Evendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKeyInfo.phpx#\xLq\Bvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Extensions.php$#\$9XfCvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AnotherName.php#\OFvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeValue.php,#\,7ԝIvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DistributionPoint.php#\d9QBvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Attributes.php#\e7ζGvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NoticeReference.php#\Fvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TBSCertificate.php #\ ӝJvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RevokedCertificate.php#\"JVvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttributes.php#\dCȶBvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKey.php)#\)#WCvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DisplayText.phpg#\g-x5Qvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RelativeDistinguishedName.php(#\(P0Mvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLDistributionPoints.php#\0߶Nvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AuthorityKeyIdentifier.php#\f 6Avendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLReason.php.#\.'9Bvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DigestInfo.php #\ sC|Kvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificatePolicies.php#\[yἶIvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyInformation.php+#\+,Qvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInStandardAttributes.php #\ 5?'Svendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SignedPublicKeyAndChallenge.phpZ#\Zl}Ovendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EncryptedPrivateKeyInfo.php#\q1wAvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLNumber.php!#\!o3`Mvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NumericUserIdentifier.phpL#\L;XKvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtensionAttributes.php#\cmǹCvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PKCS9String.php#\7Fvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyMappings.php#\Gvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateList.php##\#mLvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificationRequest.phpQ#\QO|ж@vendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyUsage.phpV#\V۹=Jvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtensionAttribute.php\#\\Ivendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtKeyUsageSyntax.php#\Ovendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateSerialNumber.phpK#\KyfoӶGvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DirectoryString.php#\ևCvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Certificate.php#\¢8{Evendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EncryptedData.php2#\2kz Kvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/HoldInstructionCode.phpI#\I&Fvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OtherPrimeInfo.phpc#\cbiSDvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSAPublicKey.php#\Dvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBEParameter.php#\;3"Cvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TBSCertList.php#\Dvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BaseDistance.php*#\*lLGvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralSubtrees.php#\gAvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAParams.php#\i[Gvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OtherPrimeInfos.php#\ꂶCvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ReasonFlags.phph#\h$P6@vendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Validity.php#\Qvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AuthorityInfoAccessSyntax.php#\nIvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AccessDescription.php#\>Dvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAPublicKey.php*#\*cOvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OrganizationalUnitNames.php#\ Pvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AdministrationDomainName.php#\ Avendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ORAddress.php#\.?Uvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttribute.php#\k^Ivendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyQualifierId.phpC#\CAvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Extension.php#\A~7Hvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BasicConstraints.php]#\]b Z[Fvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectAltName.php##\#0 RMvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeTypeAndValue.php#\̶Ivendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateIssuer.php,#\,%Evendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeType.php7#\7"aCFvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralSubtree.phpt#\tX#Fvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/InvalidityDate.php9#\9K}Jvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TerminalIdentifier.phpE#\ENGvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RC2CBCParameter.phpg#\gqCDvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyPurposeId.php4#\4%௶Pvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/IssuingDistributionPoint.php #\ צPvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificationRequestInfo.php#\(+Dvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralNames.php#\9Dvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PersonalName.php#\s!9Cvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RDNSequence.php^#\^Lvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectPublicKeyInfo.php#\nuHvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_comment.php9#\9>vendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CPSuri.php#\0Hvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/UniqueIdentifier.php9#\9754Evendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyIdentifier.php2#\2߮Evendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/IssuerAltName.php #\ c^4Cvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CountryName.php#\Avendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Attribute.phpR#\R]Evendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAPrivateKey.php#\O]Dvendor/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBMAC1params.php#\ 2vendor/phpseclib/phpseclib/phpseclib/File/ASN1.phpM#\MsQvendor/phpseclib/phpseclib/phpseclib/Exception/NoSupportedAlgorithmsException.phpH#\HnPvendor/phpseclib/phpseclib/phpseclib/Exception/UnsupportedAlgorithmException.phpC#\C_/Lvendor/phpseclib/phpseclib/phpseclib/Exception/BadConfigurationException.php/#\/.Gvendor/phpseclib/phpseclib/phpseclib/Exception/NoKeyLoadedException.php#\,Hvendor/phpseclib/phpseclib/phpseclib/Exception/FileNotFoundException.php#\GPvendor/phpseclib/phpseclib/phpseclib/Exception/UnsupportedOperationException.phpC#\CF|1vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php)vendor/vlucas/phpdotenv/src/Validator.phpF#\F7.&vendor/vlucas/phpdotenv/src/Loader.phpy,#\y,XMh&vendor/vlucas/phpdotenv/src/Dotenv.php4 #\4 UP<vendor/vlucas/phpdotenv/src/Exception/ExceptionInterface.phpx#\xlO>vendor/vlucas/phpdotenv/src/Exception/InvalidFileException.php#\u9¶>vendor/vlucas/phpdotenv/src/Exception/InvalidPathException.php#\=vendor/vlucas/phpdotenv/src/Exception/ValidationException.php#\ Bvendor/vlucas/phpdotenv/src/Exception/InvalidCallbackException.php#\΢1vendor/paragonie/random_compat/psalm-autoload.php#\,vendor/paragonie/random_compat/composer.json#\;ǻ1vendor/paragonie/random_compat/lib/random_int.php;#\;dM=vendor/paragonie/random_compat/lib/random_bytes_libsodium.php #\ P׶Dvendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.phpq #\q rն>vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php #\ 3c?vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php#\ M2Ӷ-vendor/paragonie/random_compat/lib/random.php #\  ö5vendor/paragonie/random_compat/lib/error_polyfill.php#\[5:vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php2 #\2 >Ͻ2vendor/paragonie/random_compat/lib/cast_to_int.php #\ 8vendor/paragonie/random_compat/lib/byte_safe_strings.php#\;3vendor/paragonie/random_compat/other/build_phar.phpa#\ak}45vendor/paragonie/constant_time_encoding/composer.json#\8vendor/paragonie/constant_time_encoding/src/Encoding.php#\,9Ķ@vendor/paragonie/constant_time_encoding/src/EncoderInterface.php5#\5i'6vendor/paragonie/constant_time_encoding/src/Binary.php #\ @9_3vendor/paragonie/constant_time_encoding/src/Hex.phpT#\T)=vendor/paragonie/constant_time_encoding/src/Base64UrlSafe.phpn #\n m~B7vendor/paragonie/constant_time_encoding/src/RFC4648.php#\<>vendor/paragonie/constant_time_encoding/src/Base64DotSlash.php #\ oN89vendor/paragonie/constant_time_encoding/src/Base32Hex.php #\ s36vendor/paragonie/constant_time_encoding/src/Base32.phpN8#\N8r6vendor/paragonie/constant_time_encoding/src/Base64.php #\ REvendor/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php #\ oz/vendor/autoload.php#\NC composer.json#\_R 1vendor/danog/madelineproto/.git/refs/heads/master(#\(Ř.git/refs/heads/master(#\(Ř * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 1.0.0 */ namespace LibDNS\Examples; use \LibDNS\Messages\MessageFactory; use \LibDNS\Messages\MessageTypes; use \LibDNS\Records\QuestionFactory; use \LibDNS\Records\ResourceTypes; use \LibDNS\Records\ResourceQTypes; use \LibDNS\Encoder\EncoderFactory; use \LibDNS\Decoder\DecoderFactory; use \LibDNS\Records\TypeDefinitions\TypeDefinitionManagerFactory; // Config $queryName = 'google.com'; $serverIP = '8.8.8.8'; $requestTimeout = 3; require __DIR__ . '/autoload.php'; // Create question record $question = (new QuestionFactory)->create(ResourceQTypes::SOA); $question->setName($queryName); // Create request message $request = (new MessageFactory)->create(MessageTypes::QUERY); $request->getQuestionRecords()->add($question); $request->isRecursionDesired(true); // Encode request message $encoder = (new EncoderFactory)->create(); $requestPacket = $encoder->encode($request); echo "\n" . $queryName . ":\n"; // Send request $socket = stream_socket_client("udp://$serverIP:53"); stream_socket_sendto($socket, $requestPacket); $r = [$socket]; $w = $e = []; if (!stream_select($r, $w, $e, $requestTimeout)) { echo " Request timeout.\n"; exit; } // Create type definition manager for custom manipulation $typeDefs = (new TypeDefinitionManagerFactory)->create(); $typeDefs->getTypeDefinition(ResourceTypes::SOA)->setToStringFunction(function($mname, $rname, $serial, $refresh, $retry, $expire, $minimum) { return <<create($typeDefs); $responsePacket = fread($socket, 512); $response = $decoder->decode($responsePacket); // Handle response if ($response->getResponseCode() !== 0) { echo " Server returned error code " . $response->getResponseCode() . ".\n"; exit; } $answers = $response->getAnswerRecords(); if (count($answers)) { foreach ($response->getAnswerRecords() as $record) { /** @var \LibDNS\Records\Resource $record */ echo " " . $record->getData() . "\n"; } } else { echo " Not found.\n"; } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 1.0.0 */ namespace LibDNS\Examples; use \LibDNS\Messages\MessageFactory; use \LibDNS\Messages\MessageTypes; use \LibDNS\Records\QuestionFactory; use \LibDNS\Records\ResourceQTypes; use \LibDNS\Encoder\EncoderFactory; use \LibDNS\Decoder\DecoderFactory; // Config $queryName = 'faß.de'; $serverIP = '8.8.8.8'; $requestTimeout = 3; require __DIR__ . '/autoload.php'; // Create question record $question = (new QuestionFactory)->create(ResourceQTypes::A); $question->setName($queryName); // Create request message $request = (new MessageFactory)->create(MessageTypes::QUERY); $request->getQuestionRecords()->add($question); $request->isRecursionDesired(true); // Encode request message $encoder = (new EncoderFactory)->create(); $requestPacket = $encoder->encode($request); echo "\n" . $queryName . ":\n"; // Send request $socket = stream_socket_client("udp://$serverIP:53"); stream_socket_sendto($socket, $requestPacket); $r = [$socket]; $w = $e = []; if (!stream_select($r, $w, $e, $requestTimeout)) { echo " Request timeout.\n"; exit; } // Decode response message $decoder = (new DecoderFactory)->create(); $responsePacket = fread($socket, 512); $response = $decoder->decode($responsePacket); // Handle response if ($response->getResponseCode() !== 0) { echo " Server returned error code " . $response->getResponseCode() . ".\n"; exit; } $answers = $response->getAnswerRecords(); if (count($answers)) { foreach ($response->getAnswerRecords() as $record) { /** @var \LibDNS\Records\Resource $record */ echo " " . $record->getData() . "\n"; } } else { echo " Not found.\n"; } __DIR__ . '/../src/Decoder/Decoder.php', 'libdns\decoder\decoderfactory' => __DIR__ . '/../src/Decoder/DecoderFactory.php', 'libdns\decoder\decodingcontext' => __DIR__ . '/../src/Decoder/DecodingContext.php', 'libdns\decoder\decodingcontextfactory' => __DIR__ . '/../src/Decoder/DecodingContextFactory.php', 'libdns\encoder\encoder' => __DIR__ . '/../src/Encoder/Encoder.php', 'libdns\encoder\encoderfactory' => __DIR__ . '/../src/Encoder/EncoderFactory.php', 'libdns\encoder\encodingcontext' => __DIR__ . '/../src/Encoder/EncodingContext.php', 'libdns\encoder\encodingcontextfactory' => __DIR__ . '/../src/Encoder/EncodingContextFactory.php', 'libdns\enumeration' => __DIR__ . '/../src/Enumeration.php', 'libdns\messages\message' => __DIR__ . '/../src/Messages/Message.php', 'libdns\messages\messagefactory' => __DIR__ . '/../src/Messages/MessageFactory.php', 'libdns\messages\messageopcodes' => __DIR__ . '/../src/Messages/MessageOpCodes.php', 'libdns\messages\messageresponsecodes' => __DIR__ . '/../src/Messages/MessageResponseCodes.php', 'libdns\messages\messagetypes' => __DIR__ . '/../src/Messages/MessageTypes.php', 'libdns\packets\labelregistry' => __DIR__ . '/../src/Packets/LabelRegistry.php', 'libdns\packets\packet' => __DIR__ . '/../src/Packets/Packet.php', 'libdns\packets\packetfactory' => __DIR__ . '/../src/Packets/PacketFactory.php', 'libdns\records\question' => __DIR__ . '/../src/Records/Question.php', 'libdns\records\questionfactory' => __DIR__ . '/../src/Records/QuestionFactory.php', 'libdns\records\rdata' => __DIR__ . '/../src/Records/RData.php', 'libdns\records\rdatabuilder' => __DIR__ . '/../src/Records/RDataBuilder.php', 'libdns\records\rdatafactory' => __DIR__ . '/../src/Records/RDataFactory.php', 'libdns\records\record' => __DIR__ . '/../src/Records/Record.php', 'libdns\records\recordcollection' => __DIR__ . '/../src/Records/RecordCollection.php', 'libdns\records\recordcollectionfactory' => __DIR__ . '/../src/Records/RecordCollectionFactory.php', 'libdns\records\recordtypes' => __DIR__ . '/../src/Records/RecordTypes.php', 'libdns\records\resource' => __DIR__ . '/../src/Records/Resource.php', 'libdns\records\resourcebuilder' => __DIR__ . '/../src/Records/ResourceBuilder.php', 'libdns\records\resourcebuilderfactory' => __DIR__ . '/../src/Records/ResourceBuilderFactory.php', 'libdns\records\resourceclasses' => __DIR__ . '/../src/Records/ResourceClasses.php', 'libdns\records\resourcefactory' => __DIR__ . '/../src/Records/ResourceFactory.php', 'libdns\records\resourceqclasses' => __DIR__ . '/../src/Records/ResourceQClasses.php', 'libdns\records\resourceqtypes' => __DIR__ . '/../src/Records/ResourceQTypes.php', 'libdns\records\resourcetypes' => __DIR__ . '/../src/Records/ResourceTypes.php', 'libdns\records\typedefinitions\fielddefinition' => __DIR__ . '/../src/Records/TypeDefinitions/FieldDefinition.php', 'libdns\records\typedefinitions\fielddefinitionfactory' => __DIR__ . '/../src/Records/TypeDefinitions/FieldDefinitionFactory.php', 'libdns\records\typedefinitions\typedefinition' => __DIR__ . '/../src/Records/TypeDefinitions/TypeDefinition.php', 'libdns\records\typedefinitions\typedefinitionfactory' => __DIR__ . '/../src/Records/TypeDefinitions/TypeDefinitionFactory.php', 'libdns\records\typedefinitions\typedefinitionmanager' => __DIR__ . '/../src/Records/TypeDefinitions/TypeDefinitionManager.php', 'libdns\records\typedefinitions\typedefinitionmanagerfactory' => __DIR__ . '/../src/Records/TypeDefinitions/TypeDefinitionManagerFactory.php', 'libdns\records\types\anything' => __DIR__ . '/../src/Records/Types/Anything.php', 'libdns\records\types\bitmap' => __DIR__ . '/../src/Records/Types/BitMap.php', 'libdns\records\types\char' => __DIR__ . '/../src/Records/Types/Char.php', 'libdns\records\types\characterstring' => __DIR__ . '/../src/Records/Types/CharacterString.php', 'libdns\records\types\domainname' => __DIR__ . '/../src/Records/Types/DomainName.php', 'libdns\records\types\ipv4address' => __DIR__ . '/../src/Records/Types/IPv4Address.php', 'libdns\records\types\ipv6address' => __DIR__ . '/../src/Records/Types/IPv6Address.php', 'libdns\records\types\long' => __DIR__ . '/../src/Records/Types/Long.php', 'libdns\records\types\short' => __DIR__ . '/../src/Records/Types/Short.php', 'libdns\records\types\type' => __DIR__ . '/../src/Records/Types/Type.php', 'libdns\records\types\typebuilder' => __DIR__ . '/../src/Records/Types/TypeBuilder.php', 'libdns\records\types\typefactory' => __DIR__ . '/../src/Records/Types/TypeFactory.php', 'libdns\records\types\types' => __DIR__ . '/../src/Records/Types/Types.php', ]; } $className = strtolower($className); if (isset($classMap[$className])) { /** @noinspection PhpIncludeInspection */ require $classMap[$className]; } }); { "name": "daverandom/libdns", "description": "DNS protocol implementation written in pure PHP", "license": "MIT", "keywords": ["dns"], "require": { "php": ">=7.0", "ext-ctype": "*" }, "autoload": { "psr-4": { "LibDNS\\": "src/" }, "files": ["src/functions.php"] }, "support": { "issues": "https://github.com/DaveRandom/LibDNS/issues" }, "suggest": { "ext-intl": "Required for IDN support" } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 1.0.0 */ namespace LibDNS\Tools; use \RecursiveIteratorIterator; use \RecursiveDirectoryIterator; use \FilesystemIterator; error_reporting(0); ini_set('display_errors', 0); if (!isset($argv[1])) { $srcDir = getcwd(); } else if (in_array(strtolower($argv[1]), ['--help', '?', '/?'])) { exit("Syntax: " . __FILE__ . " [source directory]\n"); } else if (!is_dir($srcDir = $argv[1])) { exit("Invalid source directory\n\nSyntax: " . __FILE__ . " [source directory]\n"); } $srcDir = str_replace('\\', '/', $srcDir); $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $srcDir, FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS ) ); $items = []; $stripLength = strlen($srcDir) + 1; $maxLength = 0; foreach ($iterator as $item) { if ($item->isFile() && $item->getFilename() !== 'autoload.php' && strtolower($item->getExtension()) === 'php') { $classPath = substr($item->getPath() . '\\' . $item->getBasename('.' . $item->getExtension()), $stripLength); $lookupName = strtolower(str_replace('/', '\\', $classPath)); $loadPath = "__DIR__ . '/$srcDir/" . str_replace('\\', '/', $classPath) . ".php'"; $length = strlen($classPath); if ($length > $maxLength) { $maxLength = $length; } $items[$lookupName] = $loadPath; } } unset($iterator); $output = <<<'PHP' $loadPath) { $output .= "\n " . str_pad("'" . $lookupName . "'", $maxLength, ' ', STR_PAD_RIGHT) . " => $loadPath,"; } $output .= <<<'PHP' ]; } $className = strtolower($className); if (isset($classMap[$className])) { /** @noinspection PhpIncludeInspection */ require $classMap[$className]; } }); PHP; file_put_contents(getcwd() . '/autoload.php', $output); * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; use \LibDNS\Records\Types\Type; use \LibDNS\Records\TypeDefinitions\TypeDefinition; /** * Represents a data type comprising multiple simple types * * @category LibDNS * @package Records * @author Chris Wright */ class RData implements \IteratorAggregate, \Countable { /** * @var \LibDNS\Records\Types\Type[] The items that make up the complex type */ private $fields = []; /** * @var \LibDNS\Records\TypeDefinitions\TypeDefinition Structural definition of the fields */ private $typeDef; /** * Constructor * * @param \LibDNS\Records\TypeDefinitions\TypeDefinition $typeDef */ public function __construct(TypeDefinition $typeDef) { $this->typeDef = $typeDef; } /** * Magic method for type coersion to string * * @return string */ public function __toString() { if ($handler = $this->typeDef->getToStringFunction()) { $result = \call_user_func_array($handler, $this->fields); } else { $result = \implode(',', $this->fields); } return $result; } /** * Get the field indicated by the supplied index * * @param int $index * @return \LibDNS\Records\Types\Type * @throws \OutOfBoundsException When the supplied index does not refer to a valid field */ public function getField(int $index) { if (!isset($this->fields[$index])) { throw new \OutOfBoundsException('Index ' . $index . ' does not refer to a valid field'); } return $this->fields[$index]; } /** * Set the field indicated by the supplied index * * @param int $index * @param \LibDNS\Records\Types\Type $value * @throws \InvalidArgumentException When the supplied index/value pair does not match the type definition */ public function setField(int $index, Type $value) { if (!$this->typeDef->getFieldDefinition($index)->assertDataValid($value)) { throw new \InvalidArgumentException('The supplied value is not valid for the specified index'); } $this->fields[$index] = $value; } /** * Get the field indicated by the supplied name * * @param string $name * @return \LibDNS\Records\Types\Type * @throws \OutOfBoundsException When the supplied name does not refer to a valid field */ public function getFieldByName(string $name): Type { return $this->getField($this->typeDef->getFieldIndexByName($name)); } /** * Set the field indicated by the supplied name * * @param string $name * @param \LibDNS\Records\Types\Type $value * @throws \OutOfBoundsException When the supplied name does not refer to a valid field * @throws \InvalidArgumentException When the supplied value does not match the type definition */ public function setFieldByName(string $name, Type $value) { $this->setField($this->typeDef->getFieldIndexByName($name), $value); } /** * Get the structural definition of the fields * * @return \LibDNS\Records\TypeDefinitions\TypeDefinition */ public function getTypeDefinition(): TypeDefinition { return $this->typeDef; } /** * Retrieve an iterator (IteratorAggregate interface) * * @return \Iterator */ public function getIterator(): \Iterator { return new \ArrayIterator($this->fields); } /** * Get the number of fields (Countable interface) * * @return int */ public function count(): int { return \count($this->fields); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; /** * Enumeration of possible resource QTYPE values * * @category LibDNS * @package Records * @author Chris Wright */ final class ResourceQTypes extends ResourceTypes { const AXFR = 252; const MAILB = 253; const MAILA = 254; const ALL = 255; } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; use \LibDNS\Records\Types\TypeFactory; /** * Creates Resource objects * * @category LibDNS * @package Records * @author Chris Wright */ class ResourceFactory { /** * Create a new Resource object * * @param int $type Can be indicated using the ResourceTypes enum * @param \LibDNS\Records\RData $data * @return \LibDNS\Records\Resource */ public function create(int $type, RData $data): Resource { return new Resource(new TypeFactory, $type, $data); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; use \LibDNS\Records\Types\TypeFactory; /** * Represents a DNS question record * * @category LibDNS * @package Records * @author Chris Wright */ class Question extends Record { /** * Constructor * * @param \LibDNS\Records\Types\TypeFactory $typeFactory * @param int $type Resource type being requested, can be indicated using the ResourceQTypes enum */ public function __construct(TypeFactory $typeFactory, int $type) { $this->typeFactory = $typeFactory; $this->type = $type; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; use \LibDNS\Records\Types\TypeFactory; /** * Represents a DNS resource record * * @category LibDNS * @package Records * @author Chris Wright */ class Resource extends Record { /** * @var int Value of the resource's time-to-live property */ private $ttl; /** * @var \LibDNS\Records\RData */ private $data; /** * Constructor * * @param \LibDNS\Records\Types\TypeFactory $typeFactory * @param int $type Can be indicated using the ResourceTypes enum * @param \LibDNS\Records\RData $data */ public function __construct(TypeFactory $typeFactory, int $type, RData $data) { $this->typeFactory = $typeFactory; $this->type = $type; $this->data = $data; } /** * Get the value of the record TTL field * * @return int */ public function getTTL(): int { return $this->ttl; } /** * Set the value of the record TTL field * * @param int $ttl The new value * @throws \RangeException When the supplied value is outside the valid range 0 - 4294967296 */ public function setTTL(int $ttl) { if ($ttl < 0 || $ttl > 4294967296) { throw new \RangeException('Record class must be in the range 0 - 4294967296'); } $this->ttl = $ttl; } /** * Get the value of the resource data field * * @return \LibDNS\Records\RData */ public function getData(): RData { return $this->data; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; use \LibDNS\Enumeration; /** * Enumeration of possible resource CLASS values * * @category LibDNS * @package Records * @author Chris Wright */ abstract class ResourceClasses extends Enumeration { const IN = 1; const CS = 2; const CH = 3; const HS = 4; } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; use \LibDNS\Records\TypeDefinitions\TypeDefinitionManager; /** * Builds Resource objects of a specific type * * @category LibDNS * @package Records * @author Chris Wright */ class ResourceBuilder { /** * @var \LibDNS\Records\ResourceFactory */ private $resourceFactory; /** * @var \LibDNS\Records\RDataBuilder */ private $rDataBuilder; /** * @var \LibDNS\Records\TypeDefinitions\TypeDefinitionManager */ private $typeDefinitionManager; /** * Constructor * * @param \LibDNS\Records\ResourceFactory $resourceFactory * @param \LibDNS\Records\RDataBuilder $rDataBuilder * @param \LibDNS\Records\TypeDefinitions\TypeDefinitionManager $typeDefinitionManager */ public function __construct(ResourceFactory $resourceFactory, RDataBuilder $rDataBuilder, TypeDefinitionManager $typeDefinitionManager) { $this->resourceFactory = $resourceFactory; $this->rDataBuilder = $rDataBuilder; $this->typeDefinitionManager = $typeDefinitionManager; } /** * Create a new Resource object * * @param int $type Type of the resource, can be indicated using the ResourceTypes enum * @return \LibDNS\Records\Resource */ public function build(int $type): Resource { $typeDefinition = $this->typeDefinitionManager->getTypeDefinition($type); $rData = $this->rDataBuilder->build($typeDefinition); return $this->resourceFactory->create($type, $rData); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; use \LibDNS\Enumeration; /** * Enumeration of possible resource TYPE values * * @category LibDNS * @package Records * @author Chris Wright */ abstract class ResourceTypes extends Enumeration { const A = 1; const AAAA = 28; const AFSDB = 18; // const APL = 42; const CAA = 257; const CERT = 37; const CNAME = 5; const DHCID = 49; const DLV = 32769; const DNAME = 39; const DNSKEY = 48; const DS = 43; const HINFO = 13; // const HIP = 55; // const IPSECKEY = 45; const KEY = 25; const KX = 36; const ISDN = 20; const LOC = 29; const MB = 7; const MD = 3; const MF = 4; const MG = 8; const MINFO = 14; const MR = 9; const MX = 15; const NAPTR = 35; const NS = 2; // const NSEC = 47; // const NSEC3 = 50; // const NSEC3PARAM = 50; const NULL = 10; const PTR = 12; const RP = 17; // const RRSIG = 46; const RT = 21; const SIG = 24; const SOA = 6; const SPF = 99; const SRV = 33; const TXT = 16; const WKS = 11; const X25 = 19; } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; use \LibDNS\Records\Types\TypeFactory; /** * Creates Question objects * * @category LibDNS * @package Records * @author Chris Wright */ class QuestionFactory { /** * Create a new Question object * * @param int $type The resource type * @return \LibDNS\Records\Question */ public function create(int $type): Question { return new Question(new TypeFactory, $type); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\TypeDefinitions; use \LibDNS\Records\Types\Type; use \LibDNS\Records\Types\Anything; use \LibDNS\Records\Types\BitMap; use \LibDNS\Records\Types\Char; use \LibDNS\Records\Types\CharacterString; use \LibDNS\Records\Types\DomainName; use \LibDNS\Records\Types\IPv4Address; use \LibDNS\Records\Types\IPv6Address; use \LibDNS\Records\Types\Long; use \LibDNS\Records\Types\Short; use \LibDNS\Records\Types\Types; /** * Defines a field in a type * * @category LibDNS * @package TypeDefinitions * @author Chris Wright */ class FieldDefinition { /** * @var int */ private $index; /** * @var string */ private $name; /** * @var int */ private $type; /** * @var bool */ private $allowsMultiple; /** * @var int */ private $minimumValues; /** * Constructor * * @param int $index * @param string $name * @param int $type * @param bool $allowsMultiple * @param int $minimumValues */ public function __construct(int $index, string $name, int $type, bool $allowsMultiple, int $minimumValues) { $this->index = $index; $this->name = $name; $this->type = $type; $this->allowsMultiple = $allowsMultiple; $this->minimumValues = $minimumValues; } /** * Get the index of the field in the containing type * * @return int */ public function getIndex(): int { return $this->index; } /** * Get the name of the field * * @return string */ public function getName(): string { return $this->name; } /** * Get the type of the field * * @return int */ public function getType(): int { return $this->type; } /** * Determine whether the field allows multiple values * * @return bool */ public function allowsMultiple(): bool { return $this->allowsMultiple; } /** * Get the minimum number of values for the field * * @return int */ public function getMinimumValues(): int { return $this->minimumValues; } /** * Assert that a Type object is valid for this field * * @param \LibDNS\Records\Types\Type * @return bool */ public function assertDataValid(Type $value): bool { return (($this->type & Types::ANYTHING) && $value instanceof Anything) || (($this->type & Types::BITMAP) && $value instanceof BitMap) || (($this->type & Types::CHAR) && $value instanceof Char) || (($this->type & Types::CHARACTER_STRING) && $value instanceof CharacterString) || (($this->type & Types::DOMAIN_NAME) && $value instanceof DomainName) || (($this->type & Types::IPV4_ADDRESS) && $value instanceof IPv4Address) || (($this->type & Types::IPV6_ADDRESS) && $value instanceof IPv6Address) || (($this->type & Types::LONG) && $value instanceof Long) || (($this->type & Types::SHORT) && $value instanceof Short); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\TypeDefinitions; /** * Creates TypeDefinition objects * * @category LibDNS * @package TypeDefinitions * @author Chris Wright */ class TypeDefinitionFactory { /** * Create a new TypeDefinition object * * @param FieldDefinitionFactory $fieldDefinitionFactory * @param int[] $definition Structural definition of the fields * @return \LibDNS\Records\TypeDefinitions\TypeDefinition * @throws \InvalidArgumentException When the type definition is invalid */ public function create(FieldDefinitionFactory $fieldDefinitionFactory, array $definition): TypeDefinition { return new TypeDefinition($fieldDefinitionFactory, $definition); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\TypeDefinitions; /** * Creates FieldDefinition objects * * @category LibDNS * @package TypeDefinitions * @author Chris Wright */ class FieldDefinitionFactory { /** * Create a new FieldDefinition object * * @param int $index * @param string $name * @param int $type * @param bool $allowsMultiple * @param int $minimumValues * @return \LibDNS\Records\TypeDefinitions\FieldDefinition */ public function create(int $index, string $name, int $type, bool $allowsMultiple, int $minimumValues): FieldDefinition { return new FieldDefinition($index, $name, $type, $allowsMultiple, $minimumValues); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\TypeDefinitions; /** * Defines a data type comprising multiple fields * * @category LibDNS * @package TypeDefinitions * @author Chris Wright */ class TypeDefinition implements \IteratorAggregate, \Countable { /** * @var FieldDefinitionFactory Creates FieldDefinition objects */ private $fieldDefFactory; /** * @var int Number of fields in the type */ private $fieldCount; /** * @var \LibDNS\Records\TypeDefinitions\FieldDefinition The last field defined by the type */ private $lastField; /** * @var int[] Map of field indexes to type identifiers */ private $fieldDefs = []; /** * @var int[] Map of field names to indexes */ private $fieldNameMap = []; /** * @var callable Custom implementation for __toString() handling */ private $toStringFunction; /** * Constructor * * @param FieldDefinitionFactory $fieldDefFactory * @param array $definition Structural definition of the fields * @throws \InvalidArgumentException When the type definition is invalid */ public function __construct(FieldDefinitionFactory $fieldDefFactory, array $definition) { $this->fieldDefFactory = $fieldDefFactory; if (isset($definition['__toString'])) { if (!\is_callable($definition['__toString'])) { throw new \InvalidArgumentException('Invalid type definition: __toString() implementation is not callable'); } $this->toStringFunction = $definition['__toString']; unset($definition['__toString']); } $this->fieldCount = \count($definition); $index = 0; foreach ($definition as $name => $type) { $this->registerField($index++, $name, $type); } } /** * Register a field from the type definition * * @param int $index * @param string $name * @param int $type * @throws \InvalidArgumentException When the field definition is invalid */ private function registerField(int $index, string $name, int $type) { if (!\preg_match('/^(?P[\w\-]+)(?P\+|\*)?(?P(?<=\+)\d+)?$/', \strtolower($name), $matches)) { throw new \InvalidArgumentException('Invalid field definition ' . $name . ': Syntax error'); } if (isset($matches['quantifier'])) { if ($index !== $this->fieldCount - 1) { throw new \InvalidArgumentException('Invalid field definition ' . $name . ': Quantifiers only allowed in last field'); } if (!isset($matches['minimum'])) { $matches['minimum'] = $matches['quantifier'] === '+' ? 1 : 0; } $allowsMultiple = true; $minimumValues = (int) $matches['minimum']; } else { $allowsMultiple = false; $minimumValues = 0; } $this->fieldDefs[$index] = $this->fieldDefFactory->create($index, $matches['name'], $type, $allowsMultiple, $minimumValues); if ($index === $this->fieldCount - 1) { $this->lastField = $this->fieldDefs[$index]; } $this->fieldNameMap[$matches['name']] = $index; } /** * Get the field definition indicated by the supplied index * * @param int $index * @return \LibDNS\Records\TypeDefinitions\FieldDefinition * @throws \OutOfBoundsException When the supplied index does not refer to a valid field */ public function getFieldDefinition(int $index): FieldDefinition { if (isset($this->fieldDefs[$index])) { $fieldDef = $this->fieldDefs[$index]; } else if ($index >= 0 && $this->lastField->allowsMultiple()) { $fieldDef = $this->lastField; } else { throw new \OutOfBoundsException('Index ' . $index . ' does not refer to a valid field'); } return $fieldDef; } /** * Get the field index indicated by the supplied name * * @param string $name * @return int * @throws \OutOfBoundsException When the supplied name does not refer to a valid field */ public function getFieldIndexByName($name): int { $fieldName = \strtolower($name); if (!isset($this->fieldNameMap[$fieldName])) { throw new \OutOfBoundsException('Name ' . $name . ' does not refer to a valid field'); } return $this->fieldNameMap[$fieldName]; } /** * Get the __toString() implementation * * @return callable|null */ public function getToStringFunction() { return $this->toStringFunction; } /** * Set the __toString() implementation * * @param callable $function */ public function setToStringFunction(callable $function) { $this->toStringFunction = $function; } /** * Retrieve an iterator (IteratorAggregate interface) * * @return \Iterator */ public function getIterator(): \Iterator { return new \ArrayIterator($this->fieldDefs); } /** * Get the number of fields (Countable interface) * * @return int */ public function count(): int { return $this->fieldCount; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\TypeDefinitions; /** * Creates TypeDefinitionManager objects * * @category LibDNS * @package TypeDefinitions * @author Chris Wright */ class TypeDefinitionManagerFactory { /** * Create a new TypeDefinitionManager object * * @return \LibDNS\Records\TypeDefinitions\TypeDefinitionManager */ public function create(): TypeDefinitionManager { return new TypeDefinitionManager(new TypeDefinitionFactory, new FieldDefinitionFactory); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\TypeDefinitions; use \LibDNS\Records\ResourceTypes; use \LibDNS\Records\Types\Types; use \LibDNS\Records\Types\DomainName; /** * Holds data about how the RDATA sections of known resource record types are structured * * @category LibDNS * @package TypeDefinitions * @author Chris Wright */ class TypeDefinitionManager { /** * @var array[] How the RDATA sections of known resource record types are structured */ private $definitions = []; /** * @var array Cache of created definitions */ private $typeDefs = []; /** * @var \LibDNS\Records\TypeDefinitions\TypeDefinitionFactory */ private $typeDefFactory; /** * @var \LibDNS\Records\TypeDefinitions\FieldDefinitionFactory */ private $fieldDefFactory; /** * Constructor * * @param \LibDNS\Records\TypeDefinitions\TypeDefinitionFactory $typeDefFactory * @param \LibDNS\Records\TypeDefinitions\FieldDefinitionFactory $fieldDefFactory */ public function __construct(TypeDefinitionFactory $typeDefFactory, FieldDefinitionFactory $fieldDefFactory) { $this->typeDefFactory = $typeDefFactory; $this->fieldDefFactory = $fieldDefFactory; $this->setDefinitions(); } /** * Set the internal definitions structure */ private function setDefinitions() { // This is defined in a method because PHP doesn't let you define properties with // expressions at the class level. If anyone has a better way to do this I am open // to any and all suggestions. $this->definitions = [ ResourceTypes::A => [ // RFC 1035 'address' => Types::IPV4_ADDRESS, ], ResourceTypes::AAAA => [ // RFC 3596 'address' => Types::IPV6_ADDRESS, ], ResourceTypes::AFSDB => [ // RFC 1183 'subtype' => Types::SHORT, 'hostname' => Types::DOMAIN_NAME, ], ResourceTypes::CAA => [ // RFC 6844 'flags' => Types::DOMAIN_NAME, 'tag' => Types::CHARACTER_STRING, 'value' => Types::ANYTHING, ], ResourceTypes::CERT => [ // RFC 4398 'type' => Types::SHORT, 'key-tag' => Types::SHORT, 'algorithm' => Types::CHAR, 'certificate' => Types::ANYTHING, ], ResourceTypes::CNAME => [ // RFC 1035 'cname' => Types::DOMAIN_NAME, ], ResourceTypes::DHCID => [ // RFC 4701 'identifier-type' => Types::SHORT, 'digest-type' => Types::CHAR, 'digest' => Types::ANYTHING, ], ResourceTypes::DLV => [ // RFC 4034 'key-tag' => Types::SHORT, 'algorithm' => Types::CHAR, 'digest-type' => Types::CHAR, 'digest' => Types::ANYTHING, ], ResourceTypes::DNAME => [ // RFC 4034 'target' => Types::DOMAIN_NAME, ], ResourceTypes::DNSKEY => [ // RFC 6672 'flags' => Types::SHORT, 'protocol' => Types::CHAR, 'algorithm' => Types::CHAR, 'public-key' => Types::ANYTHING, ], ResourceTypes::DS => [ // RFC 4034 'key-tag' => Types::SHORT, 'algorithm' => Types::CHAR, 'digest-type' => Types::CHAR, 'digest' => Types::ANYTHING, ], ResourceTypes::HINFO => [ // RFC 1035 'cpu' => Types::CHARACTER_STRING, 'os' => Types::CHARACTER_STRING, ], ResourceTypes::ISDN => [ // RFC 1183 'isdn-address' => Types::CHARACTER_STRING, 'sa' => Types::CHARACTER_STRING, ], ResourceTypes::KEY => [ // RFC 2535 'flags' => Types::SHORT, 'protocol' => Types::CHAR, 'algorithm' => Types::CHAR, 'public-key' => Types::ANYTHING, ], ResourceTypes::KX => [ // RFC 2230 'preference' => Types::SHORT, 'exchange' => Types::DOMAIN_NAME, ], ResourceTypes::LOC => [ // RFC 1876 'version' => Types::CHAR, 'size' => Types::CHAR, 'horizontal-precision' => Types::CHAR, 'vertical-precision' => Types::CHAR, 'latitude' => Types::LONG, 'longitude' => Types::LONG, 'altitude' => Types::LONG, ], ResourceTypes::MB => [ // RFC 1035 'madname' => Types::DOMAIN_NAME, ], ResourceTypes::MD => [ // RFC 1035 'madname' => Types::DOMAIN_NAME, ], ResourceTypes::MF => [ // RFC 1035 'madname' => Types::DOMAIN_NAME, ], ResourceTypes::MG => [ // RFC 1035 'mgmname' => Types::DOMAIN_NAME, ], ResourceTypes::MINFO => [ // RFC 1035 'rmailbx' => Types::DOMAIN_NAME, 'emailbx' => Types::DOMAIN_NAME, ], ResourceTypes::MR => [ // RFC 1035 'newname' => Types::DOMAIN_NAME, ], ResourceTypes::MX => [ // RFC 1035 'preference' => Types::SHORT, 'exchange' => Types::DOMAIN_NAME, ], ResourceTypes::NAPTR => [ // RFC 3403 'order' => Types::SHORT, 'preference' => Types::SHORT, 'flags' => Types::CHARACTER_STRING, 'services' => Types::CHARACTER_STRING, 'regexp' => Types::CHARACTER_STRING, 'replacement' => Types::DOMAIN_NAME, ], ResourceTypes::NS => [ // RFC 1035 'nsdname' => Types::DOMAIN_NAME, ], ResourceTypes::NULL => [ // RFC 1035 'data' => Types::ANYTHING, ], ResourceTypes::PTR => [ // RFC 1035 'ptrdname' => Types::DOMAIN_NAME, ], ResourceTypes::RP => [ // RFC 1183 'mbox-dname' => Types::DOMAIN_NAME, 'txt-dname' => Types::DOMAIN_NAME, ], ResourceTypes::RT => [ // RFC 1183 'preference' => Types::SHORT, 'intermediate-host' => Types::DOMAIN_NAME, ], ResourceTypes::SIG => [ // RFC 4034 'type-covered' => Types::SHORT, 'algorithm' => Types::CHAR, 'labels' => Types::CHAR, 'original-ttl' => Types::LONG, 'signature-expiration' => Types::LONG, 'signature-inception' => Types::LONG, 'key-tag' => Types::SHORT, 'signers-name' => Types::DOMAIN_NAME, 'signature' => Types::ANYTHING, ], ResourceTypes::SOA => [ // RFC 1035 'mname' => Types::DOMAIN_NAME, 'rname' => Types::DOMAIN_NAME, 'serial' => Types::LONG, 'refresh' => Types::LONG, 'retry' => Types::LONG, 'expire' => Types::LONG, 'minimum' => Types::LONG, ], ResourceTypes::SPF => [ // RFC 4408 'data+' => Types::CHARACTER_STRING, ], ResourceTypes::SRV => [ // RFC 2782 'priority' => Types::SHORT, 'weight' => Types::SHORT, 'port' => Types::SHORT, 'name' => Types::DOMAIN_NAME | DomainName::FLAG_NO_COMPRESSION, ], ResourceTypes::TXT => [ // RFC 1035 'txtdata+' => Types::CHARACTER_STRING, ], ResourceTypes::WKS => [ // RFC 1035 'address' => Types::IPV4_ADDRESS, 'protocol' => Types::SHORT, 'bit-map' => Types::BITMAP, ], ResourceTypes::X25 => [ // RFC 1183 'psdn-address' => Types::CHARACTER_STRING, ], ]; } /** * Get a type definition for a record type if it is known * * @param int $recordType Resource type, can be indicated using the ResourceTypes enum * @return \LibDNS\Records\TypeDefinitions\TypeDefinition */ public function getTypeDefinition(int $recordType) { if (!isset($this->typeDefs[$recordType])) { $definition = isset($this->definitions[$recordType]) ? $this->definitions[$recordType] : ['data' => Types::ANYTHING]; $this->typeDefs[$recordType] = $this->typeDefFactory->create($this->fieldDefFactory, $definition); } return $this->typeDefs[$recordType]; } /** * Register a custom type definition * * @param int $recordType Resource type, can be indicated using the ResourceTypes enum * @param int[]|\LibDNS\Records\TypeDefinitions\TypeDefinition $definition * @throws \InvalidArgumentException When the type definition is invalid */ public function registerTypeDefinition(int $recordType, $definition) { if (!($definition instanceof TypeDefinition)) { if (!\is_array($definition)) { throw new \InvalidArgumentException('Definition must be an array or an instance of ' . __NAMESPACE__ . '\TypeDefinition'); } $definition = $this->typeDefFactory->create($this->fieldDefFactory, $definition); } $this->typeDefs[$recordType] = $definition; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\Types; /** * Represents a binary character string * * @category LibDNS * @package Types * @author Chris Wright */ class CharacterString extends Type { /** * @var string */ protected $value = ''; /** * Set the internal value * * @param string $value The new value * @throws \UnexpectedValueException When the supplied value is outside the valid length range 0 - 255 */ public function setValue($value) { $value = (string)$value; if (\strlen($value) > 255) { throw new \UnexpectedValueException('Character string length must be in the range 0 - 255'); } $this->value = $value; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\Types; /** * Creates Type objects * * @category LibDNS * @package Types * @author Chris Wright */ class TypeFactory { /** * Create a new Anything object * * @param string $value * @return \LibDNS\Records\Types\Anything */ public function createAnything(string $value = null) { return new Anything($value); } /** * Create a new BitMap object * * @param string $value * @return \LibDNS\Records\Types\BitMap */ public function createBitMap(string $value = null) { return new BitMap($value); } /** * Create a new Char object * * @param int $value * @return \LibDNS\Records\Types\Char */ public function createChar(int $value = null) { return new Char((string)$value); } /** * Create a new CharacterString object * * @param string $value * @return \LibDNS\Records\Types\CharacterString */ public function createCharacterString(string $value = null) { return new CharacterString($value); } /** * Create a new DomainName object * * @param string|string[] $value * @return \LibDNS\Records\Types\DomainName */ public function createDomainName($value = null) { return new DomainName($value); } /** * Create a new IPv4Address object * * @param string|int[] $value * @return \LibDNS\Records\Types\IPv4Address */ public function createIPv4Address($value = null) { return new IPv4Address($value); } /** * Create a new IPv6Address object * * @param string|int[] $value * @return \LibDNS\Records\Types\IPv6Address */ public function createIPv6Address($value = null) { return new IPv6Address($value); } /** * Create a new Long object * * @param int $value * @return \LibDNS\Records\Types\Long */ public function createLong(int $value = null) { return new Long((string)$value); } /** * Create a new Short object * * @param int $value * @return \LibDNS\Records\Types\Short */ public function createShort(int $value = null) { return new Short((string)$value); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\Types; /** * Represents a bit map * * @category LibDNS * @package Types * @author Chris Wright */ class BitMap extends Type { /** * @var string */ protected $value = ''; /** * Set the internal value * * @param string $value The new value */ public function setValue($value) { $this->value = (string)$value; } /** * Inspect the value of the bit at the specific index and optionally set a new value * * @param int $index * @param bool $newValue The new value * @return bool The old value */ public function isBitSet(int $index, bool $newValue = null): bool { $charIndex = (int)($index / 8); $bitMask = 0b10000000 >> ($index % 8); $result = false; if (isset($this->value[$charIndex])) { $result = (bool) (\ord($this->value[$charIndex]) & $bitMask); } if (isset($newValue) && $newValue != $result) { if (!isset($this->value[$charIndex])) { $this->value = \str_pad($this->value, $charIndex + 1, "\x00", STR_PAD_RIGHT); } $this->value[$charIndex] = \chr((\ord($this->value[$charIndex]) & ~$bitMask) | ($newValue ? $bitMask : 0)); } return $result; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\Types; /** * Represents a generic binary data string * * @category LibDNS * @package Types * @author Chris Wright */ class Anything extends Type { /** * @var string */ protected $value = ''; /** * Set the internal value * * @param string $value The new value * @throws \UnexpectedValueException When the supplied value is outside the valid length range 0 - 65535 */ public function setValue($value) { $value = (string)$value; if (\strlen($value) > 65535) { throw new \UnexpectedValueException('Untyped string length must be in the range 0 - 65535'); } $this->value = $value; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\Types; /** * Represents a 16-bit unsigned integer * * @category LibDNS * @package Types * @author Chris Wright */ class Short extends Type { /** * @var int */ protected $value = 0; /** * Set the internal value * * @param string $value The new value * @throws \UnderflowException When the supplied value is less than 0 * @throws \OverflowException When the supplied value is greater than 65535 */ public function setValue($value) { $value = (int)$value; if ($value < 0) { throw new \UnderflowException('Short integer value must be in the range 0 - 65535'); } else if ($value > 0xffff) { throw new \OverflowException('Short integer value must be in the range 0 - 65535'); } $this->value = $value; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\Types; /** * Represents a fully qualified domain name * * @category LibDNS * @package Types * @author Chris Wright */ class DomainName extends Type { const FLAG_NO_COMPRESSION = 0x80000000; /** * @var string */ protected $value = ''; /** * @var string[] The value as a list of labels */ private $labels = []; /** * Constructor * * @param string|string[] $value * @throws \UnexpectedValueException When the supplied value is not a valid domain name */ public function __construct($value = null) { if (\is_array($value)) { $this->setLabels($value); } else { parent::__construct($value); } } /** * Set the internal value * * @param string $value The new value * @throws \UnexpectedValueException When the supplied value is not a valid domain name */ public function setValue($value) { $this->setLabels(\explode('.', (string)$value)); } /** * Get the domain name labels * * @param bool $tldFirst Whether to return the label list ordered with the TLD label first * @return string[] */ public function getLabels($tldFirst = false): array { return $tldFirst ? \array_reverse($this->labels) : $this->labels; } /** * Set the domain name labels * * @param string[] $labels The new label list * @param bool $tldFirst Whether the supplied label list is ordered with the TLD label first * @throws \UnexpectedValueException When the supplied label list is not a valid domain name */ public function setLabels(array $labels, $tldFirst = false) { if (!$labels) { $this->labels = []; $this->value = ''; return; } $length = $count = 0; foreach ($labels as &$label) { $label = \LibDNS\normalize_name($label); $labelLength = \strlen($label); if ($labelLength > 63) { throw new \InvalidArgumentException('Label list is not a valid domain name: Label ' . $label . ' length exceeds 63 byte limit'); } $length += $labelLength + 1; $count++; } $tld = $tldFirst ? $labels[0] : $labels[$count - 1]; if ($tld === '') { $length--; } if ($length + 1 > 255) { throw new \InvalidArgumentException('Label list is not a valid domain name: Total length exceeds 255 byte limit'); } $this->labels = $tldFirst ? \array_reverse($labels) : $labels; $this->value = \implode('.', $this->labels); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\Types; /** * Represents a 32-bit unsigned integer * * @category LibDNS * @package Types * @author Chris Wright */ class Long extends Type { /** * @var int */ protected $value = 0; /** * Set the internal value * * @param string $value The new value * @throws \UnderflowException When the supplied value is less than 0 * @throws \OverflowException When the supplied value is greater than 4294967296 */ public function setValue($value) { $value = (int)$value; if ($value < 0) { throw new \UnderflowException('Long integer value must be in the range 0 - 4294967296'); } else if ($value > 0xffffffff) { throw new \OverflowException('Long integer value must be in the range 0 - 4294967296'); } $this->value = $value; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\Types; /** * Builds Types from type definitions * * @category LibDNS * @package Types * @author Chris Wright */ class TypeBuilder { /** * @var \LibDNS\Records\Types\TypeFactory */ private $typeFactory; /** * Constructor * * @param \LibDNS\Records\Types\TypeFactory $typeFactory */ public function __construct(TypeFactory $typeFactory) { $this->typeFactory = $typeFactory; } /** * Build a new Type object corresponding to a resource record type * * @param int $type Data type, can be indicated using the Types enum * @return \LibDNS\Records\Types\Type */ public function build(int $type): Type { static $typeMap = [ Types::ANYTHING => 'createAnything', Types::BITMAP => 'createBitMap', Types::CHAR => 'createChar', Types::CHARACTER_STRING => 'createCharacterString', Types::DOMAIN_NAME => 'createDomainName', Types::IPV4_ADDRESS => 'createIPv4Address', Types::IPV6_ADDRESS => 'createIPv6Address', Types::LONG => 'createLong', Types::SHORT => 'createShort', ]; if (!isset($typeMap[$type])) { throw new \InvalidArgumentException('Invalid Type identifier ' . $type); } return $this->typeFactory->{$typeMap[$type]}(); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\Types; /** * Base class for simple data types * * @category LibDNS * @package Types * @author Chris Wright */ abstract class Type { /** * @var mixed The internal value */ protected $value; /** * Constructor * * @param string $value Internal value * @throws \RuntimeException When the supplied value is invalid */ public function __construct(string $value = null) { if (isset($value)) { $this->setValue($value); } } /** * Magic method for type coercion to string * * @return string */ public function __toString(): string { return (string) $this->value; } /** * Get the internal value * * @return mixed */ public function getValue() { return $this->value; } /** * Set the internal value * * @param string $value The new value * @throws \RuntimeException When the supplied value is invalid */ abstract public function setValue($value); } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\Types; /** * Represents an IPv6 address * * @category LibDNS * @package Types * @author Chris Wright */ class IPv6Address extends Type { /** * @var string */ protected $value = '::'; /** * @var int[] The shorts of the address */ private $shorts = [0, 0, 0, 0, 0, 0, 0, 0]; /** * Create a compressed string representation of an IPv6 address * * @param int[] $shorts Address shorts * @return string */ private function createCompressedString($shorts) { $compressLen = $compressPos = $currentLen = $currentPos = 0; $inBlock = false; for ($i = 0; $i < 8; $i++) { if ($shorts[$i] === 0) { if (!$inBlock) { $inBlock = true; $currentPos = $i; } $currentLen++; } else if ($inBlock) { if ($currentLen > $compressLen) { $compressLen = $currentLen; $compressPos = $currentPos; } $inBlock = false; $currentPos = $currentLen = 0; } $shorts[$i] = \dechex($shorts[$i]); } if ($inBlock) { $compressLen = $currentLen; $compressPos = $currentPos; } if ($compressLen > 1) { if ($compressLen === 8) { $replace = ['', '', '']; } else if ($compressPos === 0 || $compressPos + $compressLen === 8) { $replace = ['', '']; } else { $replace = ['']; } \array_splice($shorts, $compressPos, $compressLen, $replace); } return \implode(':', $shorts); } /** * Constructor * * @param string|int[] $value String representation or shorts list * @throws \UnexpectedValueException When the supplied value is not a valid IPv6 address */ public function __construct($value = null) { if (\is_array($value)) { $this->setShorts($value); } else { parent::__construct($value); } } /** * Set the internal value * * @param string $value The new value * @throws \UnexpectedValueException When the supplied value is outside the valid length range 0 - 65535 */ public function setValue($value) { $shorts = \explode(':', (string)$value); $count = \count($shorts); if ($count < 3 || $count > 8) { throw new \UnexpectedValueException('Value is not a valid IPv6 address: invalid short count'); } else if ($shorts[0] === '' && $shorts[1] === '') { $shorts = \array_pad($shorts, -8, '0'); } else if ($shorts[$count - 2] === '' && $shorts[$count - 1] === '') { $shorts = \array_pad($shorts, 8, '0'); } else if (false !== $pos = \array_search('', $shorts, true)) { \array_splice($shorts, $pos, 1, \array_fill(0, 8 - ($count - 1), '0')); } $this->setShorts(\array_map('hexdec', $shorts)); } /** * Get the address shorts * * @return int[] */ public function getShorts(): array { return $this->shorts; } /** * Set the address shorts * * @param int[] $shorts The new address shorts * @throws \UnexpectedValueException When the supplied short list is not a valid IPv6 address */ public function setShorts(array $shorts) { if (\count($shorts) !== 8) { throw new \UnexpectedValueException('Short list is not a valid IPv6 address: invalid short count'); } foreach ($shorts as &$short) { if ((!\is_int($short) && !\ctype_digit((string)$short)) || $short < 0x0000 || $short > 0xffff) { throw new \UnexpectedValueException('Short list is not a valid IPv6 address: invalid short value ' . $short); } $short = (int) $short; } $this->shorts = \array_values($shorts); $this->value = $this->createCompressedString($this->shorts); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\Types; /** * Represents an 8-bit unsigned integer * * @category LibDNS * @package Types * @author Chris Wright */ class Char extends Type { /** * @var int */ protected $value = 0; /** * Set the internal value * * @param string $value The new value * @throws \UnderflowException When the supplied value is less than 0 * @throws \OverflowException When the supplied value is greater than 255 */ public function setValue($value) { $value = (int) $value; if ($value < 0) { throw new \UnderflowException('Char value must be in the range 0 - 255'); } else if ($value > 255) { throw new \OverflowException('Char value must be in the range 0 - 255'); } $this->value = $value; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\Types; /** * Represents an IPv4 address * * @category LibDNS * @package Types * @author Chris Wright */ class IPv4Address extends Type { /** * @var string */ protected $value = '0.0.0.0'; /** * @var int[] The octets of the address */ private $octets = [0, 0, 0, 0]; /** * Constructor * * @param string|int[] $value String representation or octet list * @throws \UnexpectedValueException When the supplied value is not a valid IPv4 address */ public function __construct($value = null) { if (\is_array($value)) { $this->setOctets($value); } else { parent::__construct($value); } } /** * Set the internal value * * @param string $value The new value * @throws \UnexpectedValueException When the supplied value is outside the valid length range 0 - 65535 */ public function setValue($value) { $this->setOctets(\explode('.', (string)$value)); } /** * Get the address octets * * @return int[] */ public function getOctets(): array { return $this->octets; } /** * Set the address octets * * @param int[] $octets The new address octets * @throws \UnexpectedValueException When the supplied octet list is not a valid IPv4 address */ public function setOctets(array $octets) { if (\count($octets) !== 4) { throw new \UnexpectedValueException('Octet list is not a valid IPv4 address: invalid octet count'); } foreach ($octets as &$octet) { if ((!\is_int($octet) && !\ctype_digit((string)$octet)) || $octet < 0x00 || $octet > 0xff) { throw new \UnexpectedValueException('Octet list is not a valid IPv4 address: invalid octet value ' . $octet); } $octet = (int) $octet; } $this->octets = \array_values($octets); $this->value = \implode('.', $this->octets); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records\Types; use \LibDNS\Enumeration; /** * Enumeration of simple data types * * @category LibDNS * @package Types * @author Chris Wright */ final class Types extends Enumeration { const ANYTHING = 0b000000001; const BITMAP = 0b000000010; const CHAR = 0b000000100; const CHARACTER_STRING = 0b000001000; const DOMAIN_NAME = 0b000010000; const IPV4_ADDRESS = 0b000100000; const IPV6_ADDRESS = 0b001000000; const LONG = 0b010000000; const SHORT = 0b100000000; } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; /** * Enumeration of possible resource QCLASS values * * @category LibDNS * @package Records * @author Chris Wright */ final class ResourceQClasses extends ResourceClasses { const ANY = 255; } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; use \LibDNS\Records\TypeDefinitions\TypeDefinition; /** * Creates RData objects * * @category LibDNS * @package Records * @author Chris Wright */ class RDataFactory { /** * Create a new RData object * * @param \LibDNS\Records\TypeDefinitions\TypeDefinition $typeDefinition * @return \LibDNS\Records\RData */ public function create(TypeDefinition $typeDefinition): RData { return new RData($typeDefinition); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; use \LibDNS\Records\TypeDefinitions\TypeDefinition; use \LibDNS\Records\Types\TypeBuilder; /** * Creates RData objects * * @category LibDNS * @package Records * @author Chris Wright */ class RDataBuilder { /** * @var \LibDNS\Records\RDataFactory */ private $rDataFactory; /** * @var \LibDNS\Records\Types\TypeBuilder */ private $typeBuilder; /** * Constructor * * @param \LibDNS\Records\RDataFactory $rDataFactory * @param \LibDNS\Records\Types\TypeBuilder $typeBuilder */ public function __construct(RDataFactory $rDataFactory, TypeBuilder $typeBuilder) { $this->rDataFactory = $rDataFactory; $this->typeBuilder = $typeBuilder; } /** * Create a new RData object * * @param \LibDNS\Records\TypeDefinitions\TypeDefinition $typeDefinition * @return \LibDNS\Records\RData */ public function build(TypeDefinition $typeDefinition): RData { $rData = $this->rDataFactory->create($typeDefinition); foreach ($typeDefinition as $index => $type) { $rData->setField($index, $this->typeBuilder->build($type->getType())); } return $rData; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; use \LibDNS\Records\Types\TypeBuilder; use \LibDNS\Records\Types\TypeFactory; use \LibDNS\Records\TypeDefinitions\TypeDefinitionManager; use \LibDNS\Records\TypeDefinitions\TypeDefinitionFactory; use \LibDNS\Records\TypeDefinitions\FieldDefinitionFactory; /** * Creates ResourceBuilder objects * * @category LibDNS * @package Records * @author Chris Wright */ class ResourceBuilderFactory { /** * Create a new ResourceBuilder object * * @param \LibDNS\Records\TypeDefinitions\TypeDefinitionManager $typeDefinitionManager * @return \LibDNS\Records\ResourceBuilder */ public function create(TypeDefinitionManager $typeDefinitionManager = null): ResourceBuilder { return new ResourceBuilder( new ResourceFactory, new RDataBuilder( new RDataFactory, new TypeBuilder(new TypeFactory) ), $typeDefinitionManager ?: new TypeDefinitionManager( new TypeDefinitionFactory, new FieldDefinitionFactory ) ); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; /** * Collection of Record objects * * @category LibDNS * @package Records * @author Chris Wright */ class RecordCollection implements \IteratorAggregate, \Countable { /** * @var \LibDNS\Records\Record[] List of records held in the collection */ private $records = []; /** * @var \LibDNS\Records\Record[][] Map of Records in the collection grouped by record name */ private $nameMap = []; /** * @var int Number of Records in the collection */ private $length = 0; /** * @var int Whether the collection holds question or resource records */ private $type; /** * Constructor * * @param int $type Can be indicated using the RecordTypes enum * @throws \InvalidArgumentException When the specified record type is invalid */ public function __construct($type) { if ($type !== RecordTypes::QUESTION && $type !== RecordTypes::RESOURCE) { throw new \InvalidArgumentException('Record type must be QUESTION or RESOURCE'); } $this->type = $type; } /** * Add a record to the correct bucket in the name map * * @param \LibDNS\Records\Record $record The record to add */ private function addToNameMap(Record $record) { if (!isset($this->nameMap[$name = (string) $record->getName()])) { $this->nameMap[$name] = []; } $this->nameMap[$name][] = $record; } /** * Remove a record from the name map * * @param \LibDNS\Records\Record $record The record to remove */ private function removeFromNameMap(Record $record) { if (!empty($this->nameMap[$name = (string) $record->getName()])) { foreach ($this->nameMap[$name] as $key => $item) { if ($item === $record) { \array_splice($this->nameMap[$name], $key, 1); break; } } } if (empty($this->nameMap[$name])) { unset($this->nameMap[$name]); } } /** * Add a record to the collection * * @param \LibDNS\Records\Record $record The record to add * @throws \InvalidArgumentException When the wrong record type is supplied */ public function add(Record $record) { if (($this->type === RecordTypes::QUESTION && !($record instanceof Question)) || ($this->type === RecordTypes::RESOURCE && !($record instanceof Resource))) { throw new \InvalidArgumentException('Incorrect record type for this collection'); } $this->records[] = $record; $this->addToNameMap($record); $this->length++; } /** * Remove a record from the collection * * @param \LibDNS\Records\Record $record The record to remove */ public function remove(Record $record) { foreach ($this->records as $key => $item) { if ($item === $record) { array_splice($this->records, $key, 1); $this->removeFromNameMap($record); $this->length--; return; } } throw new \InvalidArgumentException('The supplied record is not a member of this collection'); } /** * Test whether the collection contains a specific record * * @param \LibDNS\Records\Record $record The record to search for * @param bool $sameInstance Whether to perform strict comparisons in search * @return bool */ public function contains(Record $record, bool $sameInstance = false): bool { return \in_array($record, $this->records, $sameInstance); } /** * Get all records in the collection that refer to the specified name * * @param string $name The name to match records against * @return \LibDNS\Records\Record[] */ public function getRecordsByName(string $name): array { return $this->nameMap[\strtolower($name)] ?? []; } /** * Get a record from the collection by index * * @param int $index Record index * @return \LibDNS\Records\Record * @throws \OutOfBoundsException When the supplied index does not refer to a valid record */ public function getRecordByIndex(int $index): Record { if (isset($this->records[$index])) { return $this->records[$index]; } throw new \OutOfBoundsException('The specified index ' . $index . ' does not exist in the collection'); } /** * Remove all records in the collection that refer to the specified name * * @param string $name The name to match records against * @return int The number of records removed */ public function clearRecordsByName(string $name): int { $count = 0; if (isset($this->nameMap[$name = \strtolower($name)])) { unset($this->nameMap[$name]); foreach ($this->records as $index => $record) { if ($record->getName() === $name) { unset($this->records[$index]); $count++; } } $this->records = \array_values($this->records); } return $count; } /** * Remove all records from the collection */ public function clear() { $this->records = $this->nameMap = []; $this->length = 0; } /** * Get a list of all names referenced by records in the collection * * @return string[] */ public function getNames(): array { return \array_keys($this->nameMap); } /** * Get whether the collection holds question or resource records * * @return int */ public function getType(): int { return $this->type; } /** * Retrieve an iterator (IteratorAggregate interface) * * @return \Iterator */ public function getIterator(): \Iterator { return new \ArrayIterator($this->records); } /** * Get the number of records in the collection (Countable interface) * * @return int */ public function count(): int { return $this->length; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; use \LibDNS\Enumeration; /** * Enumeration of possible record types * * @category LibDNS * @package Records * @author Chris Wright */ final class RecordTypes extends Enumeration { const QUESTION = 0; const RESOURCE = 1; } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; use \LibDNS\Records\Types\DomainName; /** * Represents a DNS record * * @category LibDNS * @package Records * @author Chris Wright */ abstract class Record { /** * @var \LibDNS\Records\Types\TypeFactory */ protected $typeFactory; /** * @var \LibDNS\Records\Types\DomainName */ protected $name; /** * @var int */ protected $type; /** * @var int */ protected $class = ResourceClasses::IN; /** * Get the value of the record name field * * @return \LibDNS\Records\Types\DomainName */ public function getName(): DomainName { return $this->name; } /** * Set the value of the record name field * * @param string|\LibDNS\Records\Types\DomainName $name * @throws \UnexpectedValueException When the supplied value is not a valid domain name */ public function setName($name) { if (!($name instanceof DomainName)) { $name = $this->typeFactory->createDomainName((string)$name); } $this->name = $name; } /** * Get the value of the record type field * * @return int */ public function getType(): int { return $this->type; } /** * Get the value of the record class field * * @return int */ public function getClass(): int { return $this->class; } /** * Set the value of the record class field * * @param int $class The new value, can be indicated using the ResourceClasses/ResourceQClasses enums * @throws \RangeException When the supplied value is outside the valid range 0 - 65535 */ public function setClass(int $class) { if ($class < 0 || $class > 65535) { throw new \RangeException('Record class must be in the range 0 - 65535'); } $this->class = $class; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Records; /** * Creates RecordCollection objects * * @category LibDNS * @package Records * @author Chris Wright */ class RecordCollectionFactory { /** * Create a new RecordCollection object * * @param int $type Can be indicated using the RecordTypes enum * @return \LibDNS\Records\RecordCollection * @throws \InvalidArgumentException When the specified record type is invalid */ public function create(int $type): RecordCollection { return new RecordCollection($type); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Encoder; use \LibDNS\Packets\Packet; use \LibDNS\Packets\LabelRegistry; /** * Creates EncodingContext objects * * @category LibDNS * @package Encoder * @author Chris Wright */ class EncodingContextFactory { /** * Create a new EncodingContext object * * @param \LibDNS\Packets\Packet $packet The packet to be decoded * @param bool $compress Whether message compression is enabled * @return \LibDNS\Encoder\EncodingContext */ public function create(Packet $packet, bool $compress): EncodingContext { return new EncodingContext($packet, new LabelRegistry, $compress); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Encoder; use \LibDNS\Packets\PacketFactory; /** * Creates Encoder objects * * @category LibDNS * @package Encoder * @author Chris Wright */ class EncoderFactory { /** * Create a new Encoder object * * @return \LibDNS\Encoder\Encoder */ public function create(): Encoder { return new Encoder(new PacketFactory, new EncodingContextFactory); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Encoder; use \LibDNS\Packets\PacketFactory; use \LibDNS\Messages\Message; use \LibDNS\Records\Question; use \LibDNS\Records\Resource; use \LibDNS\Records\Types\Type; use \LibDNS\Records\Types\Anything; use \LibDNS\Records\Types\BitMap; use \LibDNS\Records\Types\Char; use \LibDNS\Records\Types\CharacterString; use \LibDNS\Records\Types\DomainName; use \LibDNS\Records\Types\IPv4Address; use \LibDNS\Records\Types\IPv6Address; use \LibDNS\Records\Types\Long; use \LibDNS\Records\Types\Short; /** * Encodes Message objects to raw network data * * @category LibDNS * @package Encoder * @author Chris Wright */ class Encoder { /** * @var \LibDNS\Packets\PacketFactory */ private $packetFactory; /** * @var \LibDNS\Encoder\EncodingContextFactory */ private $encodingContextFactory; /** * Constructor * * @param \LibDNS\Packets\PacketFactory $packetFactory * @param \LibDNS\Encoder\EncodingContextFactory $encodingContextFactory */ public function __construct(PacketFactory $packetFactory, EncodingContextFactory $encodingContextFactory) { $this->packetFactory = $packetFactory; $this->encodingContextFactory = $encodingContextFactory; } /** * Encode the header section of the message * * @param \LibDNS\Encoder\EncodingContext $encodingContext * @param \LibDNS\Messages\Message $message * @return string * @throws \UnexpectedValueException When the header section is invalid */ private function encodeHeader(EncodingContext $encodingContext, Message $message): string { $header = [ 'id' => $message->getID(), 'meta' => 0, 'qd' => $message->getQuestionRecords()->count(), 'an' => $message->getAnswerRecords()->count(), 'ns' => $message->getAuthorityRecords()->count(), 'ar' => $message->getAdditionalRecords()->count() ]; $header['meta'] |= $message->getType() << 15; $header['meta'] |= $message->getOpCode() << 11; $header['meta'] |= ((int) $message->isAuthoritative()) << 10; $header['meta'] |= ((int) $encodingContext->isTruncated()) << 9; $header['meta'] |= ((int) $message->isRecursionDesired()) << 8; $header['meta'] |= ((int) $message->isRecursionAvailable()) << 7; $header['meta'] |= $message->getResponseCode(); return \pack('n*', $header['id'], $header['meta'], $header['qd'], $header['an'], $header['ns'], $header['ar']); } /** * Encode an Anything field * * @param \LibDNS\Records\Types\Anything $anything * @return string */ private function encodeAnything(Anything $anything): string { return $anything->getValue(); } /** * Encode a BitMap field * * @param \LibDNS\Records\Types\BitMap $bitMap * @return string */ private function encodeBitMap(BitMap $bitMap): string { return $bitMap->getValue(); } /** * Encode a Char field * * @param \LibDNS\Records\Types\Char $char * @return string */ private function encodeChar(Char $char): string { return \chr($char->getValue()); } /** * Encode a CharacterString field * * @param \LibDNS\Records\Types\CharacterString $characterString * @return string */ private function encodeCharacterString(CharacterString $characterString): string { $data = $characterString->getValue(); return \chr(\strlen($data)) . $data; } /** * Encode a DomainName field * * @param \LibDNS\Records\Types\DomainName $domainName * @param \LibDNS\Encoder\EncodingContext $encodingContext * @return string */ private function encodeDomainName(DomainName $domainName, EncodingContext $encodingContext): string { $packetIndex = $encodingContext->getPacket()->getLength() + 12; $labelRegistry = $encodingContext->getLabelRegistry(); $result = ''; $labels = $domainName->getLabels(); if ($encodingContext->useCompression()) { do { $part = \implode('.', $labels); $index = $labelRegistry->lookupIndex($part); if ($index === null) { $labelRegistry->register($part, $packetIndex); $label = \array_shift($labels); $length = \strlen($label); $result .= \chr($length) . $label; $packetIndex += $length + 1; } else { $result .= \pack('n', 0b1100000000000000 | $index); break; } } while($labels); if (!$labels) { $result .= "\x00"; } } else { foreach ($labels as $label) { $result .= \chr(\strlen($label)) . $label; } $result .= "\x00"; } return $result; } /** * Encode an IPv4Address field * * @param \LibDNS\Records\Types\IPv4Address $ipv4Address * @return string */ private function encodeIPv4Address(IPv4Address $ipv4Address): string { $octets = $ipv4Address->getOctets(); return \pack('C*', $octets[0], $octets[1], $octets[2], $octets[3]); } /** * Encode an IPv6Address field * * @param \LibDNS\Records\Types\IPv6Address $ipv6Address * @return string */ private function encodeIPv6Address(IPv6Address $ipv6Address): string { $shorts = $ipv6Address->getShorts(); return \pack('n*', $shorts[0], $shorts[1], $shorts[2], $shorts[3], $shorts[4], $shorts[5], $shorts[6], $shorts[7]); } /** * Encode a Long field * * @param \LibDNS\Records\Types\Long $long * @return string */ private function encodeLong(Long $long): string { return \pack('N', $long->getValue()); } /** * Encode a Short field * * @param \LibDNS\Records\Types\Short $short * @return string */ private function encodeShort(Short $short): string { return \pack('n', $short->getValue()); } /** * Encode a type object * * @param \LibDNS\Encoder\EncodingContext $encodingContext * @param \LibDNS\Records\Types\Type $type * @return string */ private function encodeType(EncodingContext $encodingContext, Type $type): string { if ($type instanceof Anything) { $result = $this->encodeAnything($type); } else if ($type instanceof BitMap) { $result = $this->encodeBitMap($type); } else if ($type instanceof Char) { $result = $this->encodeChar($type); } else if ($type instanceof CharacterString) { $result = $this->encodeCharacterString($type); } else if ($type instanceof DomainName) { $result = $this->encodeDomainName($type, $encodingContext); } else if ($type instanceof IPv4Address) { $result = $this->encodeIPv4Address($type); } else if ($type instanceof IPv6Address) { $result = $this->encodeIPv6Address($type); } else if ($type instanceof Long) { $result = $this->encodeLong($type); } else if ($type instanceof Short) { $result = $this->encodeShort($type); } else { throw new \InvalidArgumentException('Unknown Type ' . \get_class($type)); } return $result; } /** * Encode a question record * * @param \LibDNS\Encoder\EncodingContext $encodingContext * @param \LibDNS\Records\Question $record */ private function encodeQuestionRecord(EncodingContext $encodingContext, Question $record) { if (!$encodingContext->isTruncated()) { $packet = $encodingContext->getPacket(); $name = $this->encodeDomainName($record->getName(), $encodingContext); $meta = \pack('n*', $record->getType(), $record->getClass()); if (12 + $packet->getLength() + \strlen($name) + 4 > 512) { $encodingContext->isTruncated(true); } else { $packet->write($name); $packet->write($meta); } } } /** * Encode a resource record * * @param \LibDNS\Encoder\EncodingContext $encodingContext * @param \LibDNS\Records\Resource $record */ private function encodeResourceRecord(EncodingContext $encodingContext, Resource $record) { if (!$encodingContext->isTruncated()) { $packet = $encodingContext->getPacket(); $name = $this->encodeDomainName($record->getName(), $encodingContext); $data = ''; foreach ($record->getData() as $field) { $data .= $this->encodeType($encodingContext, $field); } $meta = \pack('n2Nn', $record->getType(), $record->getClass(), $record->getTTL(), \strlen($data)); if (12 + $packet->getLength() + \strlen($name) + 10 + \strlen($data) > 512) { $encodingContext->isTruncated(true); } else { $packet->write($name); $packet->write($meta); $packet->write($data); } } } /** * Encode a Message to raw network data * * @param \LibDNS\Messages\Message $message The Message to encode * @param bool $compress Enable message compression * @return string */ public function encode(Message $message, $compress = true): string { $packet = $this->packetFactory->create(); $encodingContext = $this->encodingContextFactory->create($packet, $compress); foreach ($message->getQuestionRecords() as $record) { /** @var \LibDNS\Records\Question $record */ $this->encodeQuestionRecord($encodingContext, $record); } foreach ($message->getAnswerRecords() as $record) { /** @var \LibDNS\Records\Resource $record */ $this->encodeResourceRecord($encodingContext, $record); } foreach ($message->getAuthorityRecords() as $record) { /** @var \LibDNS\Records\Resource $record */ $this->encodeResourceRecord($encodingContext, $record); } foreach ($message->getAdditionalRecords() as $record) { /** @var \LibDNS\Records\Resource $record */ $this->encodeResourceRecord($encodingContext, $record); } return $this->encodeHeader($encodingContext, $message) . $packet->read($packet->getLength()); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Encoder; use \LibDNS\Packets\Packet; use \LibDNS\Packets\LabelRegistry; /** * Holds data associated with an encode operation * * @category LibDNS * @package Encoder * @author Chris Wright */ class EncodingContext { /** * @var \LibDNS\Packets\Packet */ private $packet; /** * @var \LibDNS\Packets\LabelRegistry */ private $labelRegistry; /** * @var bool */ private $compress; /** * @var bool */ private $truncate = false; /** * Constructor * * @param \LibDNS\Packets\Packet $packet * @param \LibDNS\Packets\LabelRegistry $labelRegistry * @param bool $compress */ public function __construct(Packet $packet, LabelRegistry $labelRegistry, bool $compress) { $this->packet = $packet; $this->labelRegistry = $labelRegistry; $this->compress = $compress; } /** * Get the packet * * @return \LibDNS\Packets\Packet */ public function getPacket(): Packet { return $this->packet; } /** * Get the label registry * * @return \LibDNS\Packets\LabelRegistry */ public function getLabelRegistry(): LabelRegistry { return $this->labelRegistry; } /** * Determine whether compression is enabled * * @return bool */ public function useCompression(): bool { return $this->compress; } /** * Determine or set whether the message is truncated * * @param bool $truncate * @return bool */ public function isTruncated(bool $truncate = null): bool { $result = $this->truncate; if ($truncate !== null) { $this->truncate = $truncate; } return $result; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Packets; /** * Creates Packet objects * * @category LibDNS * @package Packets * @author Chris Wright */ class LabelRegistry { /** * @var int[] Map of labels to indexes */ private $labels = []; /** * @var string[][] Map of indexes to labels */ private $indexes = []; /** * Register a new relationship * * @param string|string[] $labels * @param int $index */ public function register($labels, int $index) { if (\is_array($labels)) { $labelsArr = $labels; $labelsStr = \implode('.', $labels); } else { $labelsArr = \explode('.', $labels); $labelsStr = (string) $labels; } if (!isset($this->labels[$labelsStr]) || $index < $this->labels[$labelsStr]) { $this->labels[$labelsStr] = $index; } $this->indexes[$index] = $labelsArr; } /** * Lookup the index of a label * * @param string $label * @return int|null */ public function lookupIndex(string $label) { return $this->labels[$label] ?? null; } /** * Lookup the label at an index * * @param int $index * @return string[]|null */ public function lookupLabel(int $index) { return $this->indexes[$index] ?? null; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Packets; /** * Represents a raw network data packet * * @category LibDNS * @package Packets * @author Chris Wright */ class Packet { /** * @var string */ private $data; /** * @var int Data length */ private $length; /** * @var int Read pointer */ private $pointer = 0; /** * Constructor * * @param string $data The initial packet raw data */ public function __construct(string $data = '') { $this->data = $data; $this->length = \strlen($this->data); } /** * Read bytes from the packet data * * @param int $length The number of bytes to read * @return string * @throws \OutOfBoundsException When the pointer position is invalid or the supplied length is negative */ public function read(int $length = null): string { if ($this->pointer > $this->length) { throw new \OutOfBoundsException('Pointer position invalid'); } if ($length === null) { $result = \substr($this->data, $this->pointer); $this->pointer = $this->length; } else { if ($length < 0) { throw new \OutOfBoundsException('Length must be a positive integer'); } $result = \substr($this->data, $this->pointer, $length); $this->pointer += $length; } return $result; } /** * Append data to the packet * * @param string $data The data to append * @return int The number of bytes written */ public function write(string $data): int { $length = \strlen($data); $this->data .= $data; $this->length += $length; return $length; } /** * Reset the read pointer */ public function reset() { $this->pointer = 0; } /** * Get the pointer index * * @return int */ public function getPointer(): int { return $this->pointer; } /** * Get the data length * * @return int */ public function getLength(): int { return $this->length; } /** * Get the number of remaining bytes from the pointer position * * @return int */ public function getBytesRemaining(): int { return $this->length - $this->pointer; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Packets; /** * Creates Packet objects * * @category LibDNS * @package Packets * @author Chris Wright */ class PacketFactory { /** * Create a new Packet object * * @param string $data * @return \LibDNS\Packets\Packet */ public function create(string $data = ''): Packet { return new Packet($data); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Decoder; use LibDNS\Messages\Message; use LibDNS\Messages\MessageFactory; use LibDNS\Packets\Packet; use LibDNS\Packets\PacketFactory; use LibDNS\Records\Question; use LibDNS\Records\QuestionFactory; use LibDNS\Records\Resource; use LibDNS\Records\ResourceBuilder; use LibDNS\Records\Types\Anything; use LibDNS\Records\Types\BitMap; use LibDNS\Records\Types\Char; use LibDNS\Records\Types\CharacterString; use LibDNS\Records\Types\DomainName; use LibDNS\Records\Types\IPv4Address; use LibDNS\Records\Types\IPv6Address; use LibDNS\Records\Types\Long; use LibDNS\Records\Types\Short; use LibDNS\Records\Types\Type; use LibDNS\Records\Types\TypeBuilder; use LibDNS\Records\Types\Types; /** * Decodes raw network data to Message objects * * @category LibDNS * @package Decoder * @author Chris Wright */ class Decoder { /** * @var \LibDNS\Packets\PacketFactory */ private $packetFactory; /** * @var \LibDNS\Messages\MessageFactory */ private $messageFactory; /** * @var \LibDNS\Records\QuestionFactory */ private $questionFactory; /** * @var \LibDNS\Records\ResourceBuilder */ private $resourceBuilder; /** * @var \LibDNS\Records\Types\TypeBuilder */ private $typeBuilder; /** * @var \LibDNS\Decoder\DecodingContextFactory */ private $decodingContextFactory; /** * @var bool */ private $allowTrailingData; /** * Constructor * * @param \LibDNS\Packets\PacketFactory $packetFactory * @param \LibDNS\Messages\MessageFactory $messageFactory * @param \LibDNS\Records\QuestionFactory $questionFactory * @param \LibDNS\Records\ResourceBuilder $resourceBuilder * @param \LibDNS\Records\Types\TypeBuilder $typeBuilder * @param \LibDNS\Decoder\DecodingContextFactory $decodingContextFactory * @param bool $allowTrailingData */ public function __construct( PacketFactory $packetFactory, MessageFactory $messageFactory, QuestionFactory $questionFactory, ResourceBuilder $resourceBuilder, TypeBuilder $typeBuilder, DecodingContextFactory $decodingContextFactory, bool $allowTrailingData = true ) { $this->packetFactory = $packetFactory; $this->messageFactory = $messageFactory; $this->questionFactory = $questionFactory; $this->resourceBuilder = $resourceBuilder; $this->typeBuilder = $typeBuilder; $this->decodingContextFactory = $decodingContextFactory; $this->allowTrailingData = $allowTrailingData; } /** * Read a specified number of bytes of data from a packet * * @param \LibDNS\Packets\Packet $packet * @param int $length * @return string * @throws \UnexpectedValueException When the read operation does not result in the requested number of bytes */ private function readDataFromPacket(Packet $packet, int $length): string { if ($packet->getBytesRemaining() < $length) { throw new \UnexpectedValueException('Decode error: Incomplete packet (tried to read ' . $length . ' bytes from index ' . $packet->getPointer()); } return $packet->read($length); } /** * Decode the header section of the message * * @param \LibDNS\Decoder\DecodingContext $decodingContext * @param \LibDNS\Messages\Message $message * @throws \UnexpectedValueException When the header section is invalid */ private function decodeHeader(DecodingContext $decodingContext, Message $message) { $header = \unpack('nid/nmeta/nqd/nan/nns/nar', $this->readDataFromPacket($decodingContext->getPacket(), 12)); if (!$header) { throw new \UnexpectedValueException('Decode error: Header unpack failed'); } $message->setID($header['id']); $message->setType(($header['meta'] & 0b1000000000000000) >> 15); $message->setOpCode(($header['meta'] & 0b0111100000000000) >> 11); $message->isAuthoritative((bool)(($header['meta'] & 0b0000010000000000) >> 10)); $message->isTruncated((bool)(($header['meta'] & 0b0000001000000000) >> 9)); $message->isRecursionDesired((bool)(($header['meta'] & 0b0000000100000000) >> 8)); $message->isRecursionAvailable((bool)(($header['meta'] & 0b0000000010000000) >> 7)); $message->setResponseCode($header['meta'] & 0b0000000000001111); $decodingContext->setExpectedQuestionRecords($header['qd']); $decodingContext->setExpectedAnswerRecords($header['an']); $decodingContext->setExpectedAuthorityRecords($header['ns']); $decodingContext->setExpectedAdditionalRecords($header['ar']); } /** * Decode an Anything field * * @param \LibDNS\Decoder\DecodingContext $decodingContext * @param \LibDNS\Records\Types\Anything $anything The object to populate with the result * @param int $length * @return int The number of packet bytes consumed by the operation * @throws \UnexpectedValueException When the packet data is invalid */ private function decodeAnything(DecodingContext $decodingContext, Anything $anything, int $length): int { $anything->setValue($this->readDataFromPacket($decodingContext->getPacket(), $length)); return $length; } /** * Decode a BitMap field * * @param \LibDNS\Decoder\DecodingContext $decodingContext * @param \LibDNS\Records\Types\BitMap $bitMap The object to populate with the result * @param int $length * @return int The number of packet bytes consumed by the operation * @throws \UnexpectedValueException When the packet data is invalid */ private function decodeBitMap(DecodingContext $decodingContext, BitMap $bitMap, int $length): int { $bitMap->setValue($this->readDataFromPacket($decodingContext->getPacket(), $length)); return $length; } /** * Decode a Char field * * @param \LibDNS\Decoder\DecodingContext $decodingContext * @param \LibDNS\Records\Types\Char $char The object to populate with the result * @return int The number of packet bytes consumed by the operation * @throws \UnexpectedValueException When the packet data is invalid */ private function decodeChar(DecodingContext $decodingContext, Char $char): int { $value = \unpack('C', $this->readDataFromPacket($decodingContext->getPacket(), 1))[1]; $char->setValue($value); return 1; } /** * Decode a CharacterString field * * @param \LibDNS\Decoder\DecodingContext $decodingContext * @param \LibDNS\Records\Types\CharacterString $characterString The object to populate with the result * @return int The number of packet bytes consumed by the operation * @throws \UnexpectedValueException When the packet data is invalid */ private function decodeCharacterString(DecodingContext $decodingContext, CharacterString $characterString): int { $packet = $decodingContext->getPacket(); $length = \ord($this->readDataFromPacket($packet, 1)); $characterString->setValue($this->readDataFromPacket($packet, $length)); return $length + 1; } /** * Decode a DomainName field * * @param \LibDNS\Decoder\DecodingContext $decodingContext * @param \LibDNS\Records\Types\DomainName $domainName The object to populate with the result * @return int The number of packet bytes consumed by the operation * @throws \UnexpectedValueException When the packet data is invalid */ private function decodeDomainName(DecodingContext $decodingContext, DomainName $domainName): int { $packet = $decodingContext->getPacket(); $startIndex = '0x' . \dechex($packet->getPointer()); $labelRegistry = $decodingContext->getLabelRegistry(); $labels = []; $totalLength = 0; while (++$totalLength && $length = \ord($this->readDataFromPacket($packet, 1))) { $labelType = $length & 0b11000000; if ($labelType === 0b00000000) { $index = $packet->getPointer() - 1; $label = $this->readDataFromPacket($packet, $length); \array_unshift($labels, [$index, $label]); $totalLength += $length; } else if ($labelType === 0b11000000) { $index = (($length & 0b00111111) << 8) | \ord($this->readDataFromPacket($packet, 1)); $ref = $labelRegistry->lookupLabel($index); if ($ref === null) { throw new \UnexpectedValueException('Decode error: Invalid compression pointer reference in domain name at position ' . $startIndex); } \array_unshift($labels, $ref); $totalLength++; break; } else { throw new \UnexpectedValueException('Decode error: Invalid label type ' . $labelType . 'in domain name at position ' . $startIndex); } } $result = []; foreach ($labels as $label) { if (\is_int($label[0])) { \array_unshift($result, $label[1]); $labelRegistry->register($result, $label[0]); } else { $result = $label; } } $domainName->setLabels($result); return $totalLength; } /** * Decode an IPv4Address field * * @param \LibDNS\Decoder\DecodingContext $decodingContext * @param \LibDNS\Records\Types\IPv4Address $ipv4Address The object to populate with the result * @return int The number of packet bytes consumed by the operation * @throws \UnexpectedValueException When the packet data is invalid */ private function decodeIPv4Address(DecodingContext $decodingContext, IPv4Address $ipv4Address): int { $octets = \unpack('C4', $this->readDataFromPacket($decodingContext->getPacket(), 4)); $ipv4Address->setOctets($octets); return 4; } /** * Decode an IPv6Address field * * @param \LibDNS\Decoder\DecodingContext $decodingContext * @param \LibDNS\Records\Types\IPv6Address $ipv6Address The object to populate with the result * @return int The number of packet bytes consumed by the operation * @throws \UnexpectedValueException When the packet data is invalid */ private function decodeIPv6Address(DecodingContext $decodingContext, IPv6Address $ipv6Address): int { $shorts = \unpack('n8', $this->readDataFromPacket($decodingContext->getPacket(), 16)); $ipv6Address->setShorts($shorts); return 16; } /** * Decode a Long field * * @param \LibDNS\Decoder\DecodingContext $decodingContext * @param \LibDNS\Records\Types\Long $long The object to populate with the result * @return int The number of packet bytes consumed by the operation * @throws \UnexpectedValueException When the packet data is invalid */ private function decodeLong(DecodingContext $decodingContext, Long $long): int { $value = \unpack('N', $this->readDataFromPacket($decodingContext->getPacket(), 4))[1]; $long->setValue($value); return 4; } /** * Decode a Short field * * @param \LibDNS\Decoder\DecodingContext $decodingContext * @param \LibDNS\Records\Types\Short $short The object to populate with the result * @return int The number of packet bytes consumed by the operation * @throws \UnexpectedValueException When the packet data is invalid */ private function decodeShort(DecodingContext $decodingContext, Short $short): int { $value = \unpack('n', $this->readDataFromPacket($decodingContext->getPacket(), 2))[1]; $short->setValue($value); return 2; } /** * Decode a Type field * * @param \LibDNS\Decoder\DecodingContext $decodingContext * @param \LibDNS\Records\Types\Type $type The object to populate with the result * @param int $length Expected data length * @return int The number of packet bytes consumed by the operation * @throws \UnexpectedValueException When the packet data is invalid * @throws \InvalidArgumentException When the Type subtype is unknown */ private function decodeType(DecodingContext $decodingContext, Type $type, int $length): int { if ($type instanceof Anything) { $result = $this->decodeAnything($decodingContext, $type, $length); } else if ($type instanceof BitMap) { $result = $this->decodeBitMap($decodingContext, $type, $length); } else if ($type instanceof Char) { $result = $this->decodeChar($decodingContext, $type); } else if ($type instanceof CharacterString) { $result = $this->decodeCharacterString($decodingContext, $type); } else if ($type instanceof DomainName) { $result = $this->decodeDomainName($decodingContext, $type); } else if ($type instanceof IPv4Address) { $result = $this->decodeIPv4Address($decodingContext, $type); } else if ($type instanceof IPv6Address) { $result = $this->decodeIPv6Address($decodingContext, $type); } else if ($type instanceof Long) { $result = $this->decodeLong($decodingContext, $type); } else if ($type instanceof Short) { $result = $this->decodeShort($decodingContext, $type); } else { throw new \InvalidArgumentException('Unknown Type ' . \get_class($type)); } return $result; } /** * Decode a question record * * @param \LibDNS\Decoder\DecodingContext $decodingContext * @return \LibDNS\Records\Question * @throws \UnexpectedValueException When the record is invalid */ private function decodeQuestionRecord(DecodingContext $decodingContext): Question { /** @var \LibDNS\Records\Types\DomainName $domainName */ $domainName = $this->typeBuilder->build(Types::DOMAIN_NAME); $this->decodeDomainName($decodingContext, $domainName); $meta = \unpack('ntype/nclass', $this->readDataFromPacket($decodingContext->getPacket(), 4)); $question = $this->questionFactory->create($meta['type']); $question->setName($domainName); $question->setClass($meta['class']); return $question; } /** * Decode a resource record * * @param \LibDNS\Decoder\DecodingContext $decodingContext * @return \LibDNS\Records\Resource * @throws \UnexpectedValueException When the record is invalid * @throws \InvalidArgumentException When a type subtype is unknown */ private function decodeResourceRecord(DecodingContext $decodingContext): Resource { /** @var \LibDNS\Records\Types\DomainName $domainName */ $domainName = $this->typeBuilder->build(Types::DOMAIN_NAME); $this->decodeDomainName($decodingContext, $domainName); $meta = \unpack('ntype/nclass/Nttl/nlength', $this->readDataFromPacket($decodingContext->getPacket(), 10)); $resource = $this->resourceBuilder->build($meta['type']); $resource->setName($domainName); $resource->setClass($meta['class']); $resource->setTTL($meta['ttl']); $data = $resource->getData(); $remainingLength = $meta['length']; $fieldDef = $index = null; foreach ($resource->getData()->getTypeDefinition() as $index => $fieldDef) { $field = $this->typeBuilder->build($fieldDef->getType()); $remainingLength -= $this->decodeType($decodingContext, $field, $remainingLength); $data->setField($index, $field); } if ($fieldDef->allowsMultiple()) { while ($remainingLength) { $field = $this->typeBuilder->build($fieldDef->getType()); $remainingLength -= $this->decodeType($decodingContext, $field, $remainingLength); $data->setField(++$index, $field); } } if ($remainingLength !== 0) { throw new \UnexpectedValueException('Decode error: Invalid length for record data section'); } return $resource; } /** * Decode a Message from raw network data * * @param string $data The data string to decode * @return \LibDNS\Messages\Message * @throws \UnexpectedValueException When the packet data is invalid * @throws \InvalidArgumentException When a type subtype is unknown */ public function decode(string $data): Message { $packet = $this->packetFactory->create($data); $decodingContext = $this->decodingContextFactory->create($packet); $message = $this->messageFactory->create(); $this->decodeHeader($decodingContext, $message); $questionRecords = $message->getQuestionRecords(); $expected = $decodingContext->getExpectedQuestionRecords(); for ($i = 0; $i < $expected; $i++) { $questionRecords->add($this->decodeQuestionRecord($decodingContext)); } $answerRecords = $message->getAnswerRecords(); $expected = $decodingContext->getExpectedAnswerRecords(); for ($i = 0; $i < $expected; $i++) { $answerRecords->add($this->decodeResourceRecord($decodingContext)); } $authorityRecords = $message->getAuthorityRecords(); $expected = $decodingContext->getExpectedAuthorityRecords(); for ($i = 0; $i < $expected; $i++) { $authorityRecords->add($this->decodeResourceRecord($decodingContext)); } $additionalRecords = $message->getAdditionalRecords(); $expected = $decodingContext->getExpectedAdditionalRecords(); for ($i = 0; $i < $expected; $i++) { $additionalRecords->add($this->decodeResourceRecord($decodingContext)); } if (!$this->allowTrailingData && $packet->getBytesRemaining() !== 0) { throw new \UnexpectedValueException('Decode error: Unexpected data at end of packet'); } return $message; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Decoder; use \LibDNS\Packets\Packet; use \LibDNS\Packets\LabelRegistry; /** * Holds data associated with a decode operation * * @category LibDNS * @package Decoder * @author Chris Wright */ class DecodingContext { /** * @var \LibDNS\Packets\Packet */ private $packet; /** * @var \LibDNS\Packets\LabelRegistry */ private $labelRegistry; /** * @var int */ private $expectedQuestionRecords = 0; /** * @var int */ private $expectedAnswerRecords = 0; /** * @var int */ private $expectedAuthorityRecords = 0; /** * @var int */ private $expectedAdditionalRecords = 0; /** * Constructor * * @param \LibDNS\Packets\Packet $packet * @param \LibDNS\Packets\LabelRegistry $labelRegistry */ public function __construct(Packet $packet, LabelRegistry $labelRegistry) { $this->packet = $packet; $this->labelRegistry = $labelRegistry; } /** * Get the packet * * @return \LibDNS\Packets\Packet */ public function getPacket(): Packet { return $this->packet; } /** * Get the label registry * * @return \LibDNS\Packets\LabelRegistry */ public function getLabelRegistry(): LabelRegistry { return $this->labelRegistry; } /** * Get the number of question records expected in the message * * @return int */ public function getExpectedQuestionRecords(): int { return $this->expectedQuestionRecords; } /** * Get the number of question records expected in the message * * @param int $expectedQuestionRecords */ public function setExpectedQuestionRecords(int $expectedQuestionRecords) { $this->expectedQuestionRecords = $expectedQuestionRecords; } /** * Get the number of answer records expected in the message * * @return int */ public function getExpectedAnswerRecords(): int { return $this->expectedAnswerRecords; } /** * Set the number of answer records expected in the message * * @param int $expectedAnswerRecords */ public function setExpectedAnswerRecords(int $expectedAnswerRecords) { $this->expectedAnswerRecords = $expectedAnswerRecords; } /** * Get the number of authority records expected in the message * * @return int */ public function getExpectedAuthorityRecords(): int { return $this->expectedAuthorityRecords; } /** * Set the number of authority records expected in the message * * @param int $expectedAuthorityRecords */ public function setExpectedAuthorityRecords(int $expectedAuthorityRecords) { $this->expectedAuthorityRecords = $expectedAuthorityRecords; } /** * Get the number of additional records expected in the message * * @return int */ public function getExpectedAdditionalRecords(): int { return $this->expectedAdditionalRecords; } /** * Set the number of additional records expected in the message * * @param int $expectedAdditionalRecords */ public function setExpectedAdditionalRecords(int $expectedAdditionalRecords) { $this->expectedAdditionalRecords = $expectedAdditionalRecords; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Decoder; use \LibDNS\Packets\Packet; use \LibDNS\Packets\LabelRegistry; /** * Creates DecodingContext objects * * @category LibDNS * @package Decoder * @author Chris Wright */ class DecodingContextFactory { /** * Create a new DecodingContext object * * @param \LibDNS\Packets\Packet $packet The packet to be decoded * @return \LibDNS\Decoder\DecodingContext */ public function create(Packet $packet): DecodingContext { return new DecodingContext($packet, new LabelRegistry); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Decoder; use \LibDNS\Packets\PacketFactory; use \LibDNS\Messages\MessageFactory; use \LibDNS\Records\RecordCollectionFactory; use \LibDNS\Records\QuestionFactory; use \LibDNS\Records\ResourceBuilder; use \LibDNS\Records\ResourceFactory; use \LibDNS\Records\RDataBuilder; use \LibDNS\Records\RDataFactory; use \LibDNS\Records\Types\TypeBuilder; use \LibDNS\Records\Types\TypeFactory; use \LibDNS\Records\TypeDefinitions\TypeDefinitionManager; use \LibDNS\Records\TypeDefinitions\TypeDefinitionFactory; use \LibDNS\Records\TypeDefinitions\FieldDefinitionFactory; /** * Creates Decoder objects * * @category LibDNS * @package Decoder * @author Chris Wright */ class DecoderFactory { /** * Create a new Decoder object * * @param \LibDNS\Records\TypeDefinitions\TypeDefinitionManager $typeDefinitionManager * @param bool $allowTrailingData * @return Decoder */ public function create(TypeDefinitionManager $typeDefinitionManager = null, bool $allowTrailingData = true): Decoder { $typeBuilder = new TypeBuilder(new TypeFactory); return new Decoder( new PacketFactory, new MessageFactory(new RecordCollectionFactory), new QuestionFactory, new ResourceBuilder( new ResourceFactory, new RDataBuilder( new RDataFactory, $typeBuilder ), $typeDefinitionManager ?: new TypeDefinitionManager( new TypeDefinitionFactory, new FieldDefinitionFactory ) ), $typeBuilder, new DecodingContextFactory, $allowTrailingData ); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Messages; use \LibDNS\Enumeration; /** * Enumeration of possible message types * * @category LibDNS * @package Messages * @author Chris Wright */ final class MessageTypes extends Enumeration { const QUERY = 0; const RESPONSE = 1; } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Messages; use \LibDNS\Enumeration; /** * Enumeration of possible message types * * @category LibDNS * @package Messages * @author Chris Wright */ final class MessageOpCodes extends Enumeration { const QUERY = 0; const IQUERY = 1; const STATUS = 2; } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Messages; use LibDNS\Records\RecordCollection; use \LibDNS\Records\RecordCollectionFactory; use \LibDNS\Records\RecordTypes; /** * Represents a DNS protocol message * * @category LibDNS * @package Messages * @author Chris Wright */ class Message { /** * @var int Unsigned short that identifies the DNS transaction */ private $id = 0; /** * @var int Indicates the type of the message, can be indicated using the MessageTypes enum */ private $type = -1; /** * @var int Message opcode, can be indicated using the MessageOpCodes enum */ private $opCode = MessageOpCodes::QUERY; /** * @var bool Whether a response message is authoritative */ private $authoritative = false; /** * @var bool Whether the message is truncated */ private $truncated = false; /** * @var bool Whether a query desires the server to recurse the lookup */ private $recursionDesired = true; /** * @var bool Whether a server could provide recursion in a response */ private $recursionAvailable = false; /** * @var int Message response code, can be indicated using the MessageResponseCodes enum */ private $responseCode = MessageResponseCodes::NO_ERROR; /** * @var \LibDNS\Records\RecordCollection Collection of question records */ private $questionRecords; /** * @var \LibDNS\Records\RecordCollection Collection of question records */ private $answerRecords; /** * @var \LibDNS\Records\RecordCollection Collection of authority records */ private $authorityRecords; /** * @var \LibDNS\Records\RecordCollection Collection of authority records */ private $additionalRecords; /** * Constructor * * @param \LibDNS\Records\RecordCollectionFactory $recordCollectionFactory Factory which makes RecordCollection objects * @param int $type Value of the message type field * @throws \RangeException When the supplied message type is outside the valid range 0 - 1 */ public function __construct(RecordCollectionFactory $recordCollectionFactory, int $type = null) { $this->questionRecords = $recordCollectionFactory->create(RecordTypes::QUESTION); $this->answerRecords = $recordCollectionFactory->create(RecordTypes::RESOURCE); $this->authorityRecords = $recordCollectionFactory->create(RecordTypes::RESOURCE); $this->additionalRecords = $recordCollectionFactory->create(RecordTypes::RESOURCE); if ($type !== null) { $this->setType($type); } } /** * Get the value of the message ID field * * @return int */ public function getID(): int { return $this->id; } /** * Set the value of the message ID field * * @param int $id The new value * @throws \RangeException When the supplied value is outside the valid range 0 - 65535 */ public function setID(int $id) { if ($id < 0 || $id > 65535) { throw new \RangeException('Message ID must be in the range 0 - 65535'); } $this->id = $id; } /** * Get the value of the message type field * * @return int */ public function getType(): int { return $this->type; } /** * Set the value of the message type field * * @param int $type The new value * @throws \RangeException When the supplied value is outside the valid range 0 - 1 */ public function setType(int $type) { if ($type < 0 || $type > 1) { throw new \RangeException('Message type must be in the range 0 - 1'); } $this->type = $type; } /** * Get the value of the message opcode field * * @return int */ public function getOpCode(): int { return $this->opCode; } /** * Set the value of the message opcode field * * @param int $opCode The new value * @throws \RangeException When the supplied value is outside the valid range 0 - 15 */ public function setOpCode(int $opCode) { if ($opCode < 0 || $opCode > 15) { throw new \RangeException('Message opcode must be in the range 0 - 15'); } $this->opCode = $opCode; } /** * Inspect the value of the authoritative field and optionally set a new value * * @param bool $newValue The new value * @return bool The old value */ public function isAuthoritative(bool $newValue = null): bool { $result = $this->authoritative; if ($newValue !== null) { $this->authoritative = $newValue; } return $result; } /** * Inspect the value of the truncated field and optionally set a new value * * @param bool $newValue The new value * @return bool The old value */ public function isTruncated(bool $newValue = null): bool { $result = $this->truncated; if ($newValue !== null) { $this->truncated = $newValue; } return $result; } /** * Inspect the value of the recusion desired field and optionally set a new value * * @param bool $newValue The new value * @return bool The old value */ public function isRecursionDesired(bool $newValue = null): bool { $result = $this->recursionDesired; if ($newValue !== null) { $this->recursionDesired = $newValue; } return $result; } /** * Inspect the value of the recursion available field and optionally set a new value * * @param bool $newValue The new value * @return bool The old value */ public function isRecursionAvailable(bool $newValue = null): bool { $result = $this->recursionAvailable; if ($newValue !== null) { $this->recursionAvailable = $newValue; } return $result; } /** * Get the value of the message response code field * * @return int */ public function getResponseCode(): int { return $this->opCode; } /** * Set the value of the message response code field * * @param int $responseCode The new value * @throws \RangeException When the supplied value is outside the valid range 0 - 15 */ public function setResponseCode(int $responseCode) { if ($responseCode < 0 || $responseCode > 15) { throw new \RangeException('Message response code must be in the range 0 - 15'); } $this->responseCode = $responseCode; } /** * Get the question records collection * * @return \LibDNS\Records\RecordCollection */ public function getQuestionRecords(): RecordCollection { return $this->questionRecords; } /** * Get the answer records collection * * @return \LibDNS\Records\RecordCollection */ public function getAnswerRecords(): RecordCollection { return $this->answerRecords; } /** * Get the authority records collection * * @return \LibDNS\Records\RecordCollection */ public function getAuthorityRecords(): RecordCollection { return $this->authorityRecords; } /** * Get the additional records collection * * @return \LibDNS\Records\RecordCollection */ public function getAdditionalRecords(): RecordCollection { return $this->additionalRecords; } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Messages; use \LibDNS\Enumeration; /** * Enumeration of possible message types * * @category LibDNS * @package Messages * @author Chris Wright */ final class MessageResponseCodes extends Enumeration { const NO_ERROR = 0; const FORMAT_ERROR = 1; const SERVER_FAILURE = 2; const NAME_ERROR = 3; const NOT_IMPLEMENTED = 4; const REFUSED = 5; } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS\Messages; use \LibDNS\Records\RecordCollectionFactory; /** * Factory which creates Message objects * * @category LibDNS * @package Messages * @author Chris Wright */ class MessageFactory { /** * Create a new Message object * * @param int $type Value of the message type field * @return \LibDNS\Messages\Message */ public function create(int $type = null): Message { return new Message(new RecordCollectionFactory, $type); } } * @copyright Copyright (c) Chris Wright * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 2.0.0 */ namespace LibDNS; /** * Base class for enumerations to prevent instantiation * * @category LibDNS * @package LibDNS * @author Chris Wright */ abstract class Enumeration { final protected function __construct() { throw new \LogicException('Enumerations cannot be instantiated'); } } textElements($text); # convert to markup $markup = $this->elements($Elements); # trim line breaks $markup = trim($markup, "\n"); return $markup; } protected function textElements($text) { # make sure no definitions are set $this->DefinitionData = array(); # standardize line breaks $text = str_replace(array("\r\n", "\r"), "\n", $text); # remove surrounding line breaks $text = trim($text, "\n"); # split text into lines $lines = explode("\n", $text); # iterate through lines to identify blocks return $this->linesElements($lines); } # # Setters # function setBreaksEnabled($breaksEnabled) { $this->breaksEnabled = $breaksEnabled; return $this; } protected $breaksEnabled; function setMarkupEscaped($markupEscaped) { $this->markupEscaped = $markupEscaped; return $this; } protected $markupEscaped; function setUrlsLinked($urlsLinked) { $this->urlsLinked = $urlsLinked; return $this; } protected $urlsLinked = true; function setSafeMode($safeMode) { $this->safeMode = (bool) $safeMode; return $this; } protected $safeMode; function setStrictMode($strictMode) { $this->strictMode = (bool) $strictMode; return $this; } protected $strictMode; protected $safeLinksWhitelist = array( 'http://', 'https://', 'ftp://', 'ftps://', 'mailto:', 'data:image/png;base64,', 'data:image/gif;base64,', 'data:image/jpeg;base64,', 'irc:', 'ircs:', 'git:', 'ssh:', 'news:', 'steam:', ); # # Lines # protected $BlockTypes = array( '#' => array('Header'), '*' => array('Rule', 'List'), '+' => array('List'), '-' => array('SetextHeader', 'Table', 'Rule', 'List'), '0' => array('List'), '1' => array('List'), '2' => array('List'), '3' => array('List'), '4' => array('List'), '5' => array('List'), '6' => array('List'), '7' => array('List'), '8' => array('List'), '9' => array('List'), ':' => array('Table'), '<' => array('Comment', 'Markup'), '=' => array('SetextHeader'), '>' => array('Quote'), '[' => array('Reference'), '_' => array('Rule'), '`' => array('FencedCode'), '|' => array('Table'), '~' => array('FencedCode'), ); # ~ protected $unmarkedBlockTypes = array( 'Code', ); # # Blocks # protected function lines(array $lines) { return $this->elements($this->linesElements($lines)); } protected function linesElements(array $lines) { $Elements = array(); $CurrentBlock = null; foreach ($lines as $line) { if (chop($line) === '') { if (isset($CurrentBlock)) { $CurrentBlock['interrupted'] = (isset($CurrentBlock['interrupted']) ? $CurrentBlock['interrupted'] + 1 : 1 ); } continue; } while (($beforeTab = strstr($line, "\t", true)) !== false) { $shortage = 4 - mb_strlen($beforeTab, 'utf-8') % 4; $line = $beforeTab . str_repeat(' ', $shortage) . substr($line, strlen($beforeTab) + 1) ; } $indent = strspn($line, ' '); $text = $indent > 0 ? substr($line, $indent) : $line; # ~ $Line = array('body' => $line, 'indent' => $indent, 'text' => $text); # ~ if (isset($CurrentBlock['continuable'])) { $methodName = 'block' . $CurrentBlock['type'] . 'Continue'; $Block = $this->$methodName($Line, $CurrentBlock); if (isset($Block)) { $CurrentBlock = $Block; continue; } else { if ($this->isBlockCompletable($CurrentBlock['type'])) { $methodName = 'block' . $CurrentBlock['type'] . 'Complete'; $CurrentBlock = $this->$methodName($CurrentBlock); } } } # ~ $marker = $text[0]; # ~ $blockTypes = $this->unmarkedBlockTypes; if (isset($this->BlockTypes[$marker])) { foreach ($this->BlockTypes[$marker] as $blockType) { $blockTypes []= $blockType; } } # # ~ foreach ($blockTypes as $blockType) { $Block = $this->{"block$blockType"}($Line, $CurrentBlock); if (isset($Block)) { $Block['type'] = $blockType; if ( ! isset($Block['identified'])) { if (isset($CurrentBlock)) { $Elements[] = $this->extractElement($CurrentBlock); } $Block['identified'] = true; } if ($this->isBlockContinuable($blockType)) { $Block['continuable'] = true; } $CurrentBlock = $Block; continue 2; } } # ~ if (isset($CurrentBlock) and $CurrentBlock['type'] === 'Paragraph') { $Block = $this->paragraphContinue($Line, $CurrentBlock); } if (isset($Block)) { $CurrentBlock = $Block; } else { if (isset($CurrentBlock)) { $Elements[] = $this->extractElement($CurrentBlock); } $CurrentBlock = $this->paragraph($Line); $CurrentBlock['identified'] = true; } } # ~ if (isset($CurrentBlock['continuable']) and $this->isBlockCompletable($CurrentBlock['type'])) { $methodName = 'block' . $CurrentBlock['type'] . 'Complete'; $CurrentBlock = $this->$methodName($CurrentBlock); } # ~ if (isset($CurrentBlock)) { $Elements[] = $this->extractElement($CurrentBlock); } # ~ return $Elements; } protected function extractElement(array $Component) { if ( ! isset($Component['element'])) { if (isset($Component['markup'])) { $Component['element'] = array('rawHtml' => $Component['markup']); } elseif (isset($Component['hidden'])) { $Component['element'] = array(); } } return $Component['element']; } protected function isBlockContinuable($Type) { return method_exists($this, 'block' . $Type . 'Continue'); } protected function isBlockCompletable($Type) { return method_exists($this, 'block' . $Type . 'Complete'); } # # Code protected function blockCode($Line, $Block = null) { if (isset($Block) and $Block['type'] === 'Paragraph' and ! isset($Block['interrupted'])) { return; } if ($Line['indent'] >= 4) { $text = substr($Line['body'], 4); $Block = array( 'element' => array( 'name' => 'pre', 'element' => array( 'name' => 'code', 'text' => $text, ), ), ); return $Block; } } protected function blockCodeContinue($Line, $Block) { if ($Line['indent'] >= 4) { if (isset($Block['interrupted'])) { $Block['element']['element']['text'] .= str_repeat("\n", $Block['interrupted']); unset($Block['interrupted']); } $Block['element']['element']['text'] .= "\n"; $text = substr($Line['body'], 4); $Block['element']['element']['text'] .= $text; return $Block; } } protected function blockCodeComplete($Block) { return $Block; } # # Comment protected function blockComment($Line) { if ($this->markupEscaped or $this->safeMode) { return; } if (strpos($Line['text'], '') !== false) { $Block['closed'] = true; } return $Block; } } protected function blockCommentContinue($Line, array $Block) { if (isset($Block['closed'])) { return; } $Block['element']['rawHtml'] .= "\n" . $Line['body']; if (strpos($Line['text'], '-->') !== false) { $Block['closed'] = true; } return $Block; } # # Fenced Code protected function blockFencedCode($Line) { $marker = $Line['text'][0]; $openerLength = strspn($Line['text'], $marker); if ($openerLength < 3) { return; } $infostring = trim(substr($Line['text'], $openerLength), "\t "); if (strpos($infostring, '`') !== false) { return; } $Element = array( 'name' => 'code', 'text' => '', ); if ($infostring !== '') { $Element['attributes'] = array('class' => "language-$infostring"); } $Block = array( 'char' => $marker, 'openerLength' => $openerLength, 'element' => array( 'name' => 'pre', 'element' => $Element, ), ); return $Block; } protected function blockFencedCodeContinue($Line, $Block) { if (isset($Block['complete'])) { return; } if (isset($Block['interrupted'])) { $Block['element']['element']['text'] .= str_repeat("\n", $Block['interrupted']); unset($Block['interrupted']); } if (($len = strspn($Line['text'], $Block['char'])) >= $Block['openerLength'] and chop(substr($Line['text'], $len), ' ') === '' ) { $Block['element']['element']['text'] = substr($Block['element']['element']['text'], 1); $Block['complete'] = true; return $Block; } $Block['element']['element']['text'] .= "\n" . $Line['body']; return $Block; } protected function blockFencedCodeComplete($Block) { return $Block; } # # Header protected function blockHeader($Line) { $level = strspn($Line['text'], '#'); if ($level > 6) { return; } $text = trim($Line['text'], '#'); if ($this->strictMode and isset($text[0]) and $text[0] !== ' ') { return; } $text = trim($text, ' '); $Block = array( 'element' => array( 'name' => 'h' . min(6, $level), 'handler' => array( 'function' => 'lineElements', 'argument' => $text, 'destination' => 'elements', ) ), ); return $Block; } # # List protected function blockList($Line, array $CurrentBlock = null) { list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]{1,9}+[.\)]'); if (preg_match('/^('.$pattern.'([ ]++|$))(.*+)/', $Line['text'], $matches)) { $contentIndent = strlen($matches[2]); if ($contentIndent >= 5) { $contentIndent -= 1; $matches[1] = substr($matches[1], 0, -$contentIndent); $matches[3] = str_repeat(' ', $contentIndent) . $matches[3]; } elseif ($contentIndent === 0) { $matches[1] .= ' '; } $markerWithoutWhitespace = strstr($matches[1], ' ', true); $Block = array( 'indent' => $Line['indent'], 'pattern' => $pattern, 'data' => array( 'type' => $name, 'marker' => $matches[1], 'markerType' => ($name === 'ul' ? $markerWithoutWhitespace : substr($markerWithoutWhitespace, -1)), ), 'element' => array( 'name' => $name, 'elements' => array(), ), ); $Block['data']['markerTypeRegex'] = preg_quote($Block['data']['markerType'], '/'); if ($name === 'ol') { $listStart = ltrim(strstr($matches[1], $Block['data']['markerType'], true), '0') ?: '0'; if ($listStart !== '1') { if ( isset($CurrentBlock) and $CurrentBlock['type'] === 'Paragraph' and ! isset($CurrentBlock['interrupted']) ) { return; } $Block['element']['attributes'] = array('start' => $listStart); } } $Block['li'] = array( 'name' => 'li', 'handler' => array( 'function' => 'li', 'argument' => !empty($matches[3]) ? array($matches[3]) : array(), 'destination' => 'elements' ) ); $Block['element']['elements'] []= & $Block['li']; return $Block; } } protected function blockListContinue($Line, array $Block) { if (isset($Block['interrupted']) and empty($Block['li']['handler']['argument'])) { return null; } $requiredIndent = ($Block['indent'] + strlen($Block['data']['marker'])); if ($Line['indent'] < $requiredIndent and ( ( $Block['data']['type'] === 'ol' and preg_match('/^[0-9]++'.$Block['data']['markerTypeRegex'].'(?:[ ]++(.*)|$)/', $Line['text'], $matches) ) or ( $Block['data']['type'] === 'ul' and preg_match('/^'.$Block['data']['markerTypeRegex'].'(?:[ ]++(.*)|$)/', $Line['text'], $matches) ) ) ) { if (isset($Block['interrupted'])) { $Block['li']['handler']['argument'] []= ''; $Block['loose'] = true; unset($Block['interrupted']); } unset($Block['li']); $text = isset($matches[1]) ? $matches[1] : ''; $Block['indent'] = $Line['indent']; $Block['li'] = array( 'name' => 'li', 'handler' => array( 'function' => 'li', 'argument' => array($text), 'destination' => 'elements' ) ); $Block['element']['elements'] []= & $Block['li']; return $Block; } elseif ($Line['indent'] < $requiredIndent and $this->blockList($Line)) { return null; } if ($Line['text'][0] === '[' and $this->blockReference($Line)) { return $Block; } if ($Line['indent'] >= $requiredIndent) { if (isset($Block['interrupted'])) { $Block['li']['handler']['argument'] []= ''; $Block['loose'] = true; unset($Block['interrupted']); } $text = substr($Line['body'], $requiredIndent); $Block['li']['handler']['argument'] []= $text; return $Block; } if ( ! isset($Block['interrupted'])) { $text = preg_replace('/^[ ]{0,'.$requiredIndent.'}+/', '', $Line['body']); $Block['li']['handler']['argument'] []= $text; return $Block; } } protected function blockListComplete(array $Block) { if (isset($Block['loose'])) { foreach ($Block['element']['elements'] as &$li) { if (end($li['handler']['argument']) !== '') { $li['handler']['argument'] []= ''; } } } return $Block; } # # Quote protected function blockQuote($Line) { if (preg_match('/^>[ ]?+(.*+)/', $Line['text'], $matches)) { $Block = array( 'element' => array( 'name' => 'blockquote', 'handler' => array( 'function' => 'linesElements', 'argument' => (array) $matches[1], 'destination' => 'elements', ) ), ); return $Block; } } protected function blockQuoteContinue($Line, array $Block) { if (isset($Block['interrupted'])) { return; } if ($Line['text'][0] === '>' and preg_match('/^>[ ]?+(.*+)/', $Line['text'], $matches)) { $Block['element']['handler']['argument'] []= $matches[1]; return $Block; } if ( ! isset($Block['interrupted'])) { $Block['element']['handler']['argument'] []= $Line['text']; return $Block; } } # # Rule protected function blockRule($Line) { $marker = $Line['text'][0]; if (substr_count($Line['text'], $marker) >= 3 and chop($Line['text'], " $marker") === '') { $Block = array( 'element' => array( 'name' => 'hr', ), ); return $Block; } } # # Setext protected function blockSetextHeader($Line, array $Block = null) { if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted'])) { return; } if ($Line['indent'] < 4 and chop(chop($Line['text'], ' '), $Line['text'][0]) === '') { $Block['element']['name'] = $Line['text'][0] === '=' ? 'h1' : 'h2'; return $Block; } } # # Markup protected function blockMarkup($Line) { if ($this->markupEscaped or $this->safeMode) { return; } if (preg_match('/^<[\/]?+(\w*)(?:[ ]*+'.$this->regexHtmlAttribute.')*+[ ]*+(\/)?>/', $Line['text'], $matches)) { $element = strtolower($matches[1]); if (in_array($element, $this->textLevelElements)) { return; } $Block = array( 'name' => $matches[1], 'element' => array( 'rawHtml' => $Line['text'], 'autobreak' => true, ), ); return $Block; } } protected function blockMarkupContinue($Line, array $Block) { if (isset($Block['closed']) or isset($Block['interrupted'])) { return; } $Block['element']['rawHtml'] .= "\n" . $Line['body']; return $Block; } # # Reference protected function blockReference($Line) { if (strpos($Line['text'], ']') !== false and preg_match('/^\[(.+?)\]:[ ]*+?(?:[ ]+["\'(](.+)["\')])?[ ]*+$/', $Line['text'], $matches) ) { $id = strtolower($matches[1]); $Data = array( 'url' => $matches[2], 'title' => isset($matches[3]) ? $matches[3] : null, ); $this->DefinitionData['Reference'][$id] = $Data; $Block = array( 'element' => array(), ); return $Block; } } # # Table protected function blockTable($Line, array $Block = null) { if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted'])) { return; } if ( strpos($Block['element']['handler']['argument'], '|') === false and strpos($Line['text'], '|') === false and strpos($Line['text'], ':') === false or strpos($Block['element']['handler']['argument'], "\n") !== false ) { return; } if (chop($Line['text'], ' -:|') !== '') { return; } $alignments = array(); $divider = $Line['text']; $divider = trim($divider); $divider = trim($divider, '|'); $dividerCells = explode('|', $divider); foreach ($dividerCells as $dividerCell) { $dividerCell = trim($dividerCell); if ($dividerCell === '') { return; } $alignment = null; if ($dividerCell[0] === ':') { $alignment = 'left'; } if (substr($dividerCell, - 1) === ':') { $alignment = $alignment === 'left' ? 'center' : 'right'; } $alignments []= $alignment; } # ~ $HeaderElements = array(); $header = $Block['element']['handler']['argument']; $header = trim($header); $header = trim($header, '|'); $headerCells = explode('|', $header); if (count($headerCells) !== count($alignments)) { return; } foreach ($headerCells as $index => $headerCell) { $headerCell = trim($headerCell); $HeaderElement = array( 'name' => 'th', 'handler' => array( 'function' => 'lineElements', 'argument' => $headerCell, 'destination' => 'elements', ) ); if (isset($alignments[$index])) { $alignment = $alignments[$index]; $HeaderElement['attributes'] = array( 'style' => "text-align: $alignment;", ); } $HeaderElements []= $HeaderElement; } # ~ $Block = array( 'alignments' => $alignments, 'identified' => true, 'element' => array( 'name' => 'table', 'elements' => array(), ), ); $Block['element']['elements'] []= array( 'name' => 'thead', ); $Block['element']['elements'] []= array( 'name' => 'tbody', 'elements' => array(), ); $Block['element']['elements'][0]['elements'] []= array( 'name' => 'tr', 'elements' => $HeaderElements, ); return $Block; } protected function blockTableContinue($Line, array $Block) { if (isset($Block['interrupted'])) { return; } if (count($Block['alignments']) === 1 or $Line['text'][0] === '|' or strpos($Line['text'], '|')) { $Elements = array(); $row = $Line['text']; $row = trim($row); $row = trim($row, '|'); preg_match_all('/(?:(\\\\[|])|[^|`]|`[^`]++`|`)++/', $row, $matches); $cells = array_slice($matches[0], 0, count($Block['alignments'])); foreach ($cells as $index => $cell) { $cell = trim($cell); $Element = array( 'name' => 'td', 'handler' => array( 'function' => 'lineElements', 'argument' => $cell, 'destination' => 'elements', ) ); if (isset($Block['alignments'][$index])) { $Element['attributes'] = array( 'style' => 'text-align: ' . $Block['alignments'][$index] . ';', ); } $Elements []= $Element; } $Element = array( 'name' => 'tr', 'elements' => $Elements, ); $Block['element']['elements'][1]['elements'] []= $Element; return $Block; } } # # ~ # protected function paragraph($Line) { return array( 'type' => 'Paragraph', 'element' => array( 'name' => 'p', 'handler' => array( 'function' => 'lineElements', 'argument' => $Line['text'], 'destination' => 'elements', ), ), ); } protected function paragraphContinue($Line, array $Block) { if (isset($Block['interrupted'])) { return; } $Block['element']['handler']['argument'] .= "\n".$Line['text']; return $Block; } # # Inline Elements # protected $InlineTypes = array( '!' => array('Image'), '&' => array('SpecialCharacter'), '*' => array('Emphasis'), ':' => array('Url'), '<' => array('UrlTag', 'EmailTag', 'Markup'), '[' => array('Link'), '_' => array('Emphasis'), '`' => array('Code'), '~' => array('Strikethrough'), '\\' => array('EscapeSequence'), ); # ~ protected $inlineMarkerList = '!*_&[:<`~\\'; # # ~ # public function line($text, $nonNestables = array()) { return $this->elements($this->lineElements($text, $nonNestables)); } protected function lineElements($text, $nonNestables = array()) { $Elements = array(); $nonNestables = (empty($nonNestables) ? array() : array_combine($nonNestables, $nonNestables) ); # $excerpt is based on the first occurrence of a marker while ($excerpt = strpbrk($text, $this->inlineMarkerList)) { $marker = $excerpt[0]; $markerPosition = strlen($text) - strlen($excerpt); $Excerpt = array('text' => $excerpt, 'context' => $text); foreach ($this->InlineTypes[$marker] as $inlineType) { # check to see if the current inline type is nestable in the current context if (isset($nonNestables[$inlineType])) { continue; } $Inline = $this->{"inline$inlineType"}($Excerpt); if ( ! isset($Inline)) { continue; } # makes sure that the inline belongs to "our" marker if (isset($Inline['position']) and $Inline['position'] > $markerPosition) { continue; } # sets a default inline position if ( ! isset($Inline['position'])) { $Inline['position'] = $markerPosition; } # cause the new element to 'inherit' our non nestables $Inline['element']['nonNestables'] = isset($Inline['element']['nonNestables']) ? array_merge($Inline['element']['nonNestables'], $nonNestables) : $nonNestables ; # the text that comes before the inline $unmarkedText = substr($text, 0, $Inline['position']); # compile the unmarked text $InlineText = $this->inlineText($unmarkedText); $Elements[] = $InlineText['element']; # compile the inline $Elements[] = $this->extractElement($Inline); # remove the examined text $text = substr($text, $Inline['position'] + $Inline['extent']); continue 2; } # the marker does not belong to an inline $unmarkedText = substr($text, 0, $markerPosition + 1); $InlineText = $this->inlineText($unmarkedText); $Elements[] = $InlineText['element']; $text = substr($text, $markerPosition + 1); } $InlineText = $this->inlineText($text); $Elements[] = $InlineText['element']; foreach ($Elements as &$Element) { if ( ! isset($Element['autobreak'])) { $Element['autobreak'] = false; } } return $Elements; } # # ~ # protected function inlineText($text) { $Inline = array( 'extent' => strlen($text), 'element' => array(), ); $Inline['element']['elements'] = self::pregReplaceElements( $this->breaksEnabled ? '/[ ]*+\n/' : '/(?:[ ]*+\\\\|[ ]{2,}+)\n/', array( array('name' => 'br'), array('text' => "\n"), ), $text ); return $Inline; } protected function inlineCode($Excerpt) { $marker = $Excerpt['text'][0]; if (preg_match('/^(['.$marker.']++)[ ]*+(.+?)[ ]*+(? strlen($matches[0]), 'element' => array( 'name' => 'code', 'text' => $text, ), ); } } protected function inlineEmailTag($Excerpt) { $hostnameLabel = '[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?'; $commonMarkEmail = '[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]++@' . $hostnameLabel . '(?:\.' . $hostnameLabel . ')*'; if (strpos($Excerpt['text'], '>') !== false and preg_match("/^<((mailto:)?$commonMarkEmail)>/i", $Excerpt['text'], $matches) ){ $url = $matches[1]; if ( ! isset($matches[2])) { $url = "mailto:$url"; } return array( 'extent' => strlen($matches[0]), 'element' => array( 'name' => 'a', 'text' => $matches[1], 'attributes' => array( 'href' => $url, ), ), ); } } protected function inlineEmphasis($Excerpt) { if ( ! isset($Excerpt['text'][1])) { return; } $marker = $Excerpt['text'][0]; if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) { $emphasis = 'strong'; } elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) { $emphasis = 'em'; } else { return; } return array( 'extent' => strlen($matches[0]), 'element' => array( 'name' => $emphasis, 'handler' => array( 'function' => 'lineElements', 'argument' => $matches[1], 'destination' => 'elements', ) ), ); } protected function inlineEscapeSequence($Excerpt) { if (isset($Excerpt['text'][1]) and in_array($Excerpt['text'][1], $this->specialCharacters)) { return array( 'element' => array('rawHtml' => $Excerpt['text'][1]), 'extent' => 2, ); } } protected function inlineImage($Excerpt) { if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[') { return; } $Excerpt['text']= substr($Excerpt['text'], 1); $Link = $this->inlineLink($Excerpt); if ($Link === null) { return; } $Inline = array( 'extent' => $Link['extent'] + 1, 'element' => array( 'name' => 'img', 'attributes' => array( 'src' => $Link['element']['attributes']['href'], 'alt' => $Link['element']['handler']['argument'], ), 'autobreak' => true, ), ); $Inline['element']['attributes'] += $Link['element']['attributes']; unset($Inline['element']['attributes']['href']); return $Inline; } protected function inlineLink($Excerpt) { $Element = array( 'name' => 'a', 'handler' => array( 'function' => 'lineElements', 'argument' => null, 'destination' => 'elements', ), 'nonNestables' => array('Url', 'Link'), 'attributes' => array( 'href' => null, 'title' => null, ), ); $extent = 0; $remainder = $Excerpt['text']; if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches)) { $Element['handler']['argument'] = $matches[1]; $extent += strlen($matches[0]); $remainder = substr($remainder, $extent); } else { return; } if (preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*+"|\'[^\']*+\'))?\s*+[)]/', $remainder, $matches)) { $Element['attributes']['href'] = $matches[1]; if (isset($matches[2])) { $Element['attributes']['title'] = substr($matches[2], 1, - 1); } $extent += strlen($matches[0]); } else { if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches)) { $definition = strlen($matches[1]) ? $matches[1] : $Element['handler']['argument']; $definition = strtolower($definition); $extent += strlen($matches[0]); } else { $definition = strtolower($Element['handler']['argument']); } if ( ! isset($this->DefinitionData['Reference'][$definition])) { return; } $Definition = $this->DefinitionData['Reference'][$definition]; $Element['attributes']['href'] = $Definition['url']; $Element['attributes']['title'] = $Definition['title']; } return array( 'extent' => $extent, 'element' => $Element, ); } protected function inlineMarkup($Excerpt) { if ($this->markupEscaped or $this->safeMode or strpos($Excerpt['text'], '>') === false) { return; } if ($Excerpt['text'][1] === '/' and preg_match('/^<\/\w[\w-]*+[ ]*+>/s', $Excerpt['text'], $matches)) { return array( 'element' => array('rawHtml' => $matches[0]), 'extent' => strlen($matches[0]), ); } if ($Excerpt['text'][1] === '!' and preg_match('/^/s', $Excerpt['text'], $matches)) { return array( 'element' => array('rawHtml' => $matches[0]), 'extent' => strlen($matches[0]), ); } if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w[\w-]*+(?:[ ]*+'.$this->regexHtmlAttribute.')*+[ ]*+\/?>/s', $Excerpt['text'], $matches)) { return array( 'element' => array('rawHtml' => $matches[0]), 'extent' => strlen($matches[0]), ); } } protected function inlineSpecialCharacter($Excerpt) { if ($Excerpt['text'][1] !== ' ' and strpos($Excerpt['text'], ';') !== false and preg_match('/^&(#?+[0-9a-zA-Z]++);/', $Excerpt['text'], $matches) ) { return array( 'element' => array('rawHtml' => '&' . $matches[1] . ';'), 'extent' => strlen($matches[0]), ); } return; } protected function inlineStrikethrough($Excerpt) { if ( ! isset($Excerpt['text'][1])) { return; } if ($Excerpt['text'][1] === '~' and preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $Excerpt['text'], $matches)) { return array( 'extent' => strlen($matches[0]), 'element' => array( 'name' => 'del', 'handler' => array( 'function' => 'lineElements', 'argument' => $matches[1], 'destination' => 'elements', ) ), ); } } protected function inlineUrl($Excerpt) { if ($this->urlsLinked !== true or ! isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/') { return; } if (strpos($Excerpt['context'], 'http') !== false and preg_match('/\bhttps?+:[\/]{2}[^\s<]+\b\/*+/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE) ) { $url = $matches[0][0]; $Inline = array( 'extent' => strlen($matches[0][0]), 'position' => $matches[0][1], 'element' => array( 'name' => 'a', 'text' => $url, 'attributes' => array( 'href' => $url, ), ), ); return $Inline; } } protected function inlineUrlTag($Excerpt) { if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(\w++:\/{2}[^ >]++)>/i', $Excerpt['text'], $matches)) { $url = $matches[1]; return array( 'extent' => strlen($matches[0]), 'element' => array( 'name' => 'a', 'text' => $url, 'attributes' => array( 'href' => $url, ), ), ); } } # ~ protected function unmarkedText($text) { $Inline = $this->inlineText($text); return $this->element($Inline['element']); } # # Handlers # protected function handle(array $Element) { if (isset($Element['handler'])) { if (!isset($Element['nonNestables'])) { $Element['nonNestables'] = array(); } if (is_string($Element['handler'])) { $function = $Element['handler']; $argument = $Element['text']; unset($Element['text']); $destination = 'rawHtml'; } else { $function = $Element['handler']['function']; $argument = $Element['handler']['argument']; $destination = $Element['handler']['destination']; } $Element[$destination] = $this->{$function}($argument, $Element['nonNestables']); if ($destination === 'handler') { $Element = $this->handle($Element); } unset($Element['handler']); } return $Element; } protected function handleElementRecursive(array $Element) { return $this->elementApplyRecursive(array($this, 'handle'), $Element); } protected function handleElementsRecursive(array $Elements) { return $this->elementsApplyRecursive(array($this, 'handle'), $Elements); } protected function elementApplyRecursive($closure, array $Element) { $Element = call_user_func($closure, $Element); if (isset($Element['elements'])) { $Element['elements'] = $this->elementsApplyRecursive($closure, $Element['elements']); } elseif (isset($Element['element'])) { $Element['element'] = $this->elementApplyRecursive($closure, $Element['element']); } return $Element; } protected function elementApplyRecursiveDepthFirst($closure, array $Element) { if (isset($Element['elements'])) { $Element['elements'] = $this->elementsApplyRecursiveDepthFirst($closure, $Element['elements']); } elseif (isset($Element['element'])) { $Element['element'] = $this->elementsApplyRecursiveDepthFirst($closure, $Element['element']); } $Element = call_user_func($closure, $Element); return $Element; } protected function elementsApplyRecursive($closure, array $Elements) { foreach ($Elements as &$Element) { $Element = $this->elementApplyRecursive($closure, $Element); } return $Elements; } protected function elementsApplyRecursiveDepthFirst($closure, array $Elements) { foreach ($Elements as &$Element) { $Element = $this->elementApplyRecursiveDepthFirst($closure, $Element); } return $Elements; } protected function element(array $Element) { if ($this->safeMode) { $Element = $this->sanitiseElement($Element); } # identity map if element has no handler $Element = $this->handle($Element); $hasName = isset($Element['name']); $markup = ''; if ($hasName) { $markup .= '<' . $Element['name']; if (isset($Element['attributes'])) { foreach ($Element['attributes'] as $name => $value) { if ($value === null) { continue; } $markup .= " $name=\"".self::escape($value).'"'; } } } $permitRawHtml = false; if (isset($Element['text'])) { $text = $Element['text']; } // very strongly consider an alternative if you're writing an // extension elseif (isset($Element['rawHtml'])) { $text = $Element['rawHtml']; $allowRawHtmlInSafeMode = isset($Element['allowRawHtmlInSafeMode']) && $Element['allowRawHtmlInSafeMode']; $permitRawHtml = !$this->safeMode || $allowRawHtmlInSafeMode; } $hasContent = isset($text) || isset($Element['element']) || isset($Element['elements']); if ($hasContent) { $markup .= $hasName ? '>' : ''; if (isset($Element['elements'])) { $markup .= $this->elements($Element['elements']); } elseif (isset($Element['element'])) { $markup .= $this->element($Element['element']); } else { if (!$permitRawHtml) { $markup .= self::escape($text, true); } else { $markup .= $text; } } $markup .= $hasName ? '' : ''; } elseif ($hasName) { $markup .= ' />'; } return $markup; } protected function elements(array $Elements) { $markup = ''; $autoBreak = true; foreach ($Elements as $Element) { if (empty($Element)) { continue; } $autoBreakNext = (isset($Element['autobreak']) ? $Element['autobreak'] : isset($Element['name']) ); // (autobreak === false) covers both sides of an element $autoBreak = !$autoBreak ? $autoBreak : $autoBreakNext; $markup .= ($autoBreak ? "\n" : '') . $this->element($Element); $autoBreak = $autoBreakNext; } $markup .= $autoBreak ? "\n" : ''; return $markup; } # ~ protected function li($lines) { $Elements = $this->linesElements($lines); if ( ! in_array('', $lines) and isset($Elements[0]) and isset($Elements[0]['name']) and $Elements[0]['name'] === 'p' ) { unset($Elements[0]['name']); } return $Elements; } # # AST Convenience # /** * Replace occurrences $regexp with $Elements in $text. Return an array of * elements representing the replacement. */ protected static function pregReplaceElements($regexp, $Elements, $text) { $newElements = array(); while (preg_match($regexp, $text, $matches, PREG_OFFSET_CAPTURE)) { $offset = $matches[0][1]; $before = substr($text, 0, $offset); $after = substr($text, $offset + strlen($matches[0][0])); $newElements[] = array('text' => $before); foreach ($Elements as $Element) { $newElements[] = $Element; } $text = $after; } $newElements[] = array('text' => $text); return $newElements; } # # Deprecated Methods # function parse($text) { $markup = $this->text($text); return $markup; } protected function sanitiseElement(array $Element) { static $goodAttribute = '/^[a-zA-Z0-9][a-zA-Z0-9-_]*+$/'; static $safeUrlNameToAtt = array( 'a' => 'href', 'img' => 'src', ); if ( ! isset($Element['name'])) { unset($Element['attributes']); return $Element; } if (isset($safeUrlNameToAtt[$Element['name']])) { $Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]); } if ( ! empty($Element['attributes'])) { foreach ($Element['attributes'] as $att => $val) { # filter out badly parsed attribute if ( ! preg_match($goodAttribute, $att)) { unset($Element['attributes'][$att]); } # dump onevent attribute elseif (self::striAtStart($att, 'on')) { unset($Element['attributes'][$att]); } } } return $Element; } protected function filterUnsafeUrlInAttribute(array $Element, $attribute) { foreach ($this->safeLinksWhitelist as $scheme) { if (self::striAtStart($Element['attributes'][$attribute], $scheme)) { return $Element; } } $Element['attributes'][$attribute] = str_replace(':', '%3A', $Element['attributes'][$attribute]); return $Element; } # # Static Methods # protected static function escape($text, $allowQuotes = false) { return htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8'); } protected static function striAtStart($string, $needle) { $len = strlen($needle); if ($len > strlen($string)) { return false; } else { return strtolower(substr($string, 0, $len)) === strtolower($needle); } } static function instance($name = 'default') { if (isset(self::$instances[$name])) { return self::$instances[$name]; } $instance = new static(); self::$instances[$name] = $instance; return $instance; } private static $instances = array(); # # Fields # protected $DefinitionData; # # Read-Only protected $specialCharacters = array( '\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!', '|', '~' ); protected $StrongRegex = array( '*' => '/^[*]{2}((?:\\\\\*|[^*]|[*][^*]*+[*])+?)[*]{2}(?![*])/s', '_' => '/^__((?:\\\\_|[^_]|_[^_]*+_)+?)__(?!_)/us', ); protected $EmRegex = array( '*' => '/^[*]((?:\\\\\*|[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s', '_' => '/^_((?:\\\\_|[^_]|__[^_]*__)+?)_(?!_)\b/us', ); protected $regexHtmlAttribute = '[a-zA-Z_:][\w:.-]*+(?:\s*+=\s*+(?:[^"\'=<>`\s]+|"[^"]*+"|\'[^\']*+\'))?+'; protected $voidElements = array( 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', ); protected $textLevelElements = array( 'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont', 'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing', 'i', 'rp', 'del', 'code', 'strike', 'marquee', 'q', 'rt', 'ins', 'font', 'strong', 's', 'tt', 'kbd', 'mark', 'u', 'xm', 'sub', 'nobr', 'sup', 'ruby', 'var', 'span', 'wbr', 'time', ); } { "name": "erusev/parsedown", "description": "Parser for Markdown.", "keywords": ["markdown", "parser"], "homepage": "http://parsedown.org", "type": "library", "license": "MIT", "authors": [ { "name": "Emanuil Rusev", "email": "hello@erusev.com", "homepage": "http://erusev.com" } ], "require": { "php": ">=5.3.0", "ext-mbstring": "*" }, "require-dev": { "phpunit/phpunit": "^4.8.35" }, "autoload": { "psr-0": {"Parsedown": ""} }, "autoload-dev": { "psr-0": { "TestParsedown": "test/", "ParsedownTest": "test/", "CommonMarkTest": "test/", "CommonMarkTestWeak": "test/" } } } logger) { }` * blocks. */ class NullLogger extends AbstractLogger { /** * Logs with an arbitrary level. * * @param mixed $level * @param string $message * @param array $context * * @return void */ public function log($level, $message, array $context = array()) { // noop } } ". * * Example ->error('Foo') would yield "error Foo". * * @return string[] */ abstract public function getLogs(); public function testImplements() { $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger()); } /** * @dataProvider provideLevelsAndMessages */ public function testLogsAtAllLevels($level, $message) { $logger = $this->getLogger(); $logger->{$level}($message, array('user' => 'Bob')); $logger->log($level, $message, array('user' => 'Bob')); $expected = array( $level.' message of level '.$level.' with context: Bob', $level.' message of level '.$level.' with context: Bob', ); $this->assertEquals($expected, $this->getLogs()); } public function provideLevelsAndMessages() { return array( LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), ); } /** * @expectedException \Psr\Log\InvalidArgumentException */ public function testThrowsOnInvalidLevel() { $logger = $this->getLogger(); $logger->log('invalid level', 'Foo'); } public function testContextReplacement() { $logger = $this->getLogger(); $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); $expected = array('info {Message {nothing} Bob Bar a}'); $this->assertEquals($expected, $this->getLogs()); } public function testObjectCastToString() { if (method_exists($this, 'createPartialMock')) { $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString')); } else { $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString')); } $dummy->expects($this->once()) ->method('__toString') ->will($this->returnValue('DUMMY')); $this->getLogger()->warning($dummy); $expected = array('warning DUMMY'); $this->assertEquals($expected, $this->getLogs()); } public function testContextCanContainAnything() { $closed = fopen('php://memory', 'r'); fclose($closed); $context = array( 'bool' => true, 'null' => null, 'string' => 'Foo', 'int' => 0, 'float' => 0.5, 'nested' => array('with object' => new DummyTest), 'object' => new \DateTime, 'resource' => fopen('php://memory', 'r'), 'closed' => $closed, ); $this->getLogger()->warning('Crazy context data', $context); $expected = array('warning Crazy context data'); $this->assertEquals($expected, $this->getLogs()); } public function testContextExceptionKeyCanBeExceptionOrOtherValues() { $logger = $this->getLogger(); $logger->warning('Random message', array('exception' => 'oops')); $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); $expected = array( 'warning Random message', 'critical Uncaught Exception!' ); $this->assertEquals($expected, $this->getLogs()); } } class DummyTest { public function __toString() { } } $level, 'message' => $message, 'context' => $context, ]; $this->recordsByLevel[$record['level']][] = $record; $this->records[] = $record; } public function hasRecords($level) { return isset($this->recordsByLevel[$level]); } public function hasRecord($record, $level) { if (is_string($record)) { $record = ['message' => $record]; } return $this->hasRecordThatPasses(function ($rec) use ($record) { if ($rec['message'] !== $record['message']) { return false; } if (isset($record['context']) && $rec['context'] !== $record['context']) { return false; } return true; }, $level); } public function hasRecordThatContains($message, $level) { return $this->hasRecordThatPasses(function ($rec) use ($message) { return strpos($rec['message'], $message) !== false; }, $level); } public function hasRecordThatMatches($regex, $level) { return $this->hasRecordThatPasses(function ($rec) use ($regex) { return preg_match($regex, $rec['message']) > 0; }, $level); } public function hasRecordThatPasses(callable $predicate, $level) { if (!isset($this->recordsByLevel[$level])) { return false; } foreach ($this->recordsByLevel[$level] as $i => $rec) { if (call_user_func($predicate, $rec, $i)) { return true; } } return false; } public function __call($method, $args) { if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; $level = strtolower($matches[2]); if (method_exists($this, $genericMethod)) { $args[] = $level; return call_user_func_array([$this, $genericMethod], $args); } } throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); } public function reset() { $this->records = []; } } log(LogLevel::EMERGENCY, $message, $context); } /** * Action must be taken immediately. * * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. * * @param string $message * @param array $context * * @return void */ public function alert($message, array $context = array()) { $this->log(LogLevel::ALERT, $message, $context); } /** * Critical conditions. * * Example: Application component unavailable, unexpected exception. * * @param string $message * @param array $context * * @return void */ public function critical($message, array $context = array()) { $this->log(LogLevel::CRITICAL, $message, $context); } /** * Runtime errors that do not require immediate action but should typically * be logged and monitored. * * @param string $message * @param array $context * * @return void */ public function error($message, array $context = array()) { $this->log(LogLevel::ERROR, $message, $context); } /** * Exceptional occurrences that are not errors. * * Example: Use of deprecated APIs, poor use of an API, undesirable things * that are not necessarily wrong. * * @param string $message * @param array $context * * @return void */ public function warning($message, array $context = array()) { $this->log(LogLevel::WARNING, $message, $context); } /** * Normal but significant events. * * @param string $message * @param array $context * * @return void */ public function notice($message, array $context = array()) { $this->log(LogLevel::NOTICE, $message, $context); } /** * Interesting events. * * Example: User logs in, SQL logs. * * @param string $message * @param array $context * * @return void */ public function info($message, array $context = array()) { $this->log(LogLevel::INFO, $message, $context); } /** * Detailed debug information. * * @param string $message * @param array $context * * @return void */ public function debug($message, array $context = array()) { $this->log(LogLevel::DEBUG, $message, $context); } } log(LogLevel::EMERGENCY, $message, $context); } /** * Action must be taken immediately. * * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. * * @param string $message * @param array $context * * @return void */ public function alert($message, array $context = array()) { $this->log(LogLevel::ALERT, $message, $context); } /** * Critical conditions. * * Example: Application component unavailable, unexpected exception. * * @param string $message * @param array $context * * @return void */ public function critical($message, array $context = array()) { $this->log(LogLevel::CRITICAL, $message, $context); } /** * Runtime errors that do not require immediate action but should typically * be logged and monitored. * * @param string $message * @param array $context * * @return void */ public function error($message, array $context = array()) { $this->log(LogLevel::ERROR, $message, $context); } /** * Exceptional occurrences that are not errors. * * Example: Use of deprecated APIs, poor use of an API, undesirable things * that are not necessarily wrong. * * @param string $message * @param array $context * * @return void */ public function warning($message, array $context = array()) { $this->log(LogLevel::WARNING, $message, $context); } /** * Normal but significant events. * * @param string $message * @param array $context * * @return void */ public function notice($message, array $context = array()) { $this->log(LogLevel::NOTICE, $message, $context); } /** * Interesting events. * * Example: User logs in, SQL logs. * * @param string $message * @param array $context * * @return void */ public function info($message, array $context = array()) { $this->log(LogLevel::INFO, $message, $context); } /** * Detailed debug information. * * @param string $message * @param array $context * * @return void */ public function debug($message, array $context = array()) { $this->log(LogLevel::DEBUG, $message, $context); } /** * Logs with an arbitrary level. * * @param mixed $level * @param string $message * @param array $context * * @return void */ abstract public function log($level, $message, array $context = array()); } logger = $logger; } } =5.3.0" }, "autoload": { "psr-4": { "Psr\\Log\\": "Psr/Log/" } }, "extra": { "branch-alias": { "dev-master": "1.1.x-dev" } } } #!/usr/bin/env php . */ if (!isset($argv[3])) { echo 'Usage: '.$argv[0].' inputDir output.phar ref'.PHP_EOL; die(1); } @unlink($argv[2]); $p = new Phar(__DIR__.'/'.$argv[2], 0, $argv[2]); $p->buildFromDirectory(realpath($argv[1]), '/^((?!tests).)*(\.php|\.py|\.tl|\.json)$/i'); $p->addFromString('vendor/danog/madelineproto/.git/refs/heads/master', $argv[3]); $p->addFromString('.git/refs/heads/master', $argv[3]); $p->setStub(''); #!/usr/bin/env php . */ require 'vendor/autoload.php'; $param = 1; \danog\MadelineProto\Logger::constructor($param); $logger = \danog\MadelineProto\Logger::$default; set_error_handler(['\danog\MadelineProto\Exception', 'ExceptionErrorHandler']); \danog\MadelineProto\Logger::log('Copying readme...', \danog\MadelineProto\Logger::NOTICE); file_put_contents('docs/docs/index.md', '--- title: MadelineProto documentation description: PHP client/server for the telegram MTProto protocol (a better tg-cli) image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- '.str_replace(' ['td' => __DIR__.'/src/danog/MadelineProto/TL_td.tl'], 'title' => 'MadelineProto API documentation (td-lib)', 'description' => 'MadelineProto API documentation (td-lib)', 'output_dir' => __DIR__.'/docs/docs/TD_docs', 'readme' => false, 'td' => true, ], [ 'tl_schema' => ['mtproto' => __DIR__.'/src/danog/MadelineProto/TL_mtproto_v1.json'], 'title' => 'MadelineProto API documentation (mtproto)', 'description' => 'MadelineProto API documentation (mtproto)', 'output_dir' => __DIR__.'/docs/docs/MTProto_docs', 'readme' => false, ], [ 'tl_schema' => ['telegram' => __DIR__.'/src/danog/MadelineProto/TL_telegram_v91.tl', 'calls' => __DIR__.'/src/danog/MadelineProto/TL_calls.tl', 'secret' => __DIR__.'/src/danog/MadelineProto/TL_secret.tl', 'td' => __DIR__.'/src/danog/MadelineProto/TL_td.tl'], 'title' => 'MadelineProto API documentation (layer 91)', 'description' => 'MadelineProto API documentation (layer 91)', 'output_dir' => __DIR__.'/docs/docs/API_docs', 'readme' => false, ], ]; $layer_list = ''; foreach (array_slice(glob(__DIR__.'/src/danog/MadelineProto/TL_telegram_*'), 0, -1) as $file) { $layer = preg_replace(['/.*telegram_/', '/\..+/'], '', $file); $docs[] = [ 'tl_schema' => ['telegram' => $file], 'title' => 'MadelineProto API documentation (layer '.$layer.')', 'description' => 'MadelineProto API documentation (layer '.$layer.')', 'output_dir' => __DIR__.'/docs/old_docs/API_docs_'.$layer, 'readme' => true, ]; $layer_list = '[Layer '.$layer.'](API_docs_'.$layer.'/) '; } file_put_contents('docs/old_docs/README.md', '--- title: Documentations of old mtproto layers description: Documentation of old mtproto layers --- # Documentation of old mtproto layers '.$layer_list); $doc = new \danog\MadelineProto\AnnotationsBuilder($logger, $docs[2]); $doc->mk_annotations(); foreach ($docs as $settings) { $doc = new \danog\MadelineProto\DocsBuilder($logger, $settings); $doc->mk_docs(); } start(); $me = $MadelineProto->get_self(); \danog\MadelineProto\Logger::log($me); if (!$me['bot']) { $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => "Hi!\nThanks for creating MadelineProto! <3"]); $MadelineProto->channels->joinChannel(['channel' => '@MadelineProto']); try { $MadelineProto->messages->importChatInvite(['hash' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg']); } catch (\danog\MadelineProto\RPCErrorException $e) { } $MadelineProto->messages->sendMessage(['peer' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg', 'message' => 'Testing MadelineProto!']); } echo 'OK, done!'.PHP_EOL; #!/usr/bin/env php . */ set_include_path(get_include_path().':'.realpath(dirname(__FILE__).'/MadelineProto/')); /* * Various ways to load MadelineProto */ if (!file_exists(__DIR__.'/vendor/autoload.php')) { echo 'You did not run composer update, using madeline.php'.PHP_EOL; if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; } else { require_once 'vendor/autoload.php'; } class EventHandler extends \danog\MadelineProto\CombinedEventHandler { public function onAny($update, $path) { if (isset($update['message']['out']) && $update['message']['out']) { return; } $MadelineProto = $this->{$path}; if (isset($update['message']['media'])) { yield $MadelineProto->messages->sendMedia(['peer' => $update, 'message' => $update['message']['message'], 'media' => $update]); } $res = json_encode($update, JSON_PRETTY_PRINT); if ($res == '') { $res = var_export($update, true); } yield $MadelineProto->sleep_async(3); try { yield $MadelineProto->messages->sendMessage(['peer' => $update, 'message' => "$res\n\nDopo 3 secondi, in modo asincrono", 'reply_to_msg_id' => isset($update['message']['id']) ? $update['message']['id'] : null, 'parse_mode' => 'HTML']); //'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]); } catch (\danog\MadelineProto\RPCErrorException $e) { \danog\MadelineProto\Logger::log((string) $e, \danog\MadelineProto\Logger::FATAL_ERROR); } catch (\danog\MadelineProto\Exception $e) { \danog\MadelineProto\Logger::log((string) $e, \danog\MadelineProto\Logger::FATAL_ERROR); //$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } } } $settings = ['logger' => ['logger_level' => 5]]; $CombinedMadelineProto = new \danog\MadelineProto\CombinedAPI('combined_session.madeline', ['bot.madeline' => $settings, 'user.madeline' => $settings]); \danog\MadelineProto\Logger::log('Bot login', \danog\MadelineProto\Logger::WARNING); $CombinedMadelineProto->instances['bot.madeline']->start(); \danog\MadelineProto\Logger::log('Userbot login'); $CombinedMadelineProto->instances['user.madeline']->start(); $CombinedMadelineProto->setEventHandler('\EventHandler'); $CombinedMadelineProto->loop(); $CombinedMadelineProto->async(true); $CombinedMadelineProto->setEventHandler('\EventHandler'); $CombinedMadelineProto->loop(); #!/usr/bin/env php . */ set_include_path(get_include_path().':'.realpath(dirname(__FILE__).'/MadelineProto/')); /* * Various ways to load MadelineProto */ if (!file_exists(__DIR__.'/vendor/autoload.php')) { echo 'You did not run composer update, using madeline.php'.PHP_EOL; if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; } else { require_once 'vendor/autoload.php'; } class EventHandler extends \danog\MadelineProto\EventHandler { private $sent = [-440592694 => true]; public function onUpdateNewEncryptedMessage($update) { try { if (isset($update['message']['decrypted_message']['media'])) { \danog\MadelineProto\Logger::log($this->download_to_dir($update, '.')); } if (isset($this->sent[$update['message']['chat_id']])) { return; } $secret_media = []; // Photo uploaded as document, secret chat $inputEncryptedFile = $this->upload_encrypted('tests/faust.jpg', 'fausticorn.jpg'); // This gets an inputFile object with file name magic $secret_media['document_photo'] = ['peer' => $update, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/faust.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => mime_content_type('tests/faust.jpg'), 'caption' => 'This file was uploaded using MadelineProto', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'faust.jpg', 'size' => filesize('tests/faust.jpg'), 'attributes' => [['_' => 'documentAttributeImageSize', 'w' => 1280, 'h' => 914]]]]]; // Photo, secret chat $secret_media['photo'] = ['peer' => $update, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaPhoto', 'thumb' => file_get_contents('tests/faust.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'caption' => 'This file was uploaded using MadelineProto', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'size' => filesize('tests/faust.jpg'), 'w' => 1280, 'h' => 914]]]; // GIF, secret chat $inputEncryptedFile = $this->upload_encrypted('tests/pony.mp4'); $secret_media['gif'] = ['peer' => $update, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/pony.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => mime_content_type('tests/pony.mp4'), 'caption' => 'test', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'pony.mp4', 'size' => filesize('tests/faust.jpg'), 'attributes' => [['_' => 'documentAttributeAnimated']]]]]; // Sticker, secret chat $inputEncryptedFile = $this->upload_encrypted('tests/lel.webp'); $secret_media['sticker'] = ['peer' => $update, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/lel.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => mime_content_type('tests/lel.webp'), 'caption' => 'test', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'lel.webp', 'size' => filesize('tests/lel.webp'), 'attributes' => [['_' => 'documentAttributeSticker', 'alt' => 'LEL', 'stickerset' => ['_' => 'inputStickerSetEmpty']]]]]]; // Document, secrey chat $time = time(); $inputEncryptedFile = $this->upload_encrypted('tests/60', 'magic'); // This gets an inputFile object with file name magic \danog\MadelineProto\Logger::log(time() - $time); $secret_media['document'] = ['peer' => $update, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/faust.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => 'magic/magic', 'caption' => 'test', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'magic.magic', 'size' => filesize('tests/60'), 'attributes' => [['_' => 'documentAttributeFilename', 'file_name' => 'fairy']]]]]; // Video, secret chat $inputEncryptedFile = $this->upload_encrypted('tests/swing.mp4'); $secret_media['video'] = ['peer' => $update, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/swing.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => mime_content_type('tests/swing.mp4'), 'caption' => 'test', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'swing.mp4', 'size' => filesize('tests/swing.mp4'), 'attributes' => [['_' => 'documentAttributeVideo', 'duration' => 5, 'w' => 1280, 'h' => 720]]]]]; // audio, secret chat $inputEncryptedFile = $this->upload_encrypted('tests/mosconi.mp3'); $secret_media['audio'] = ['peer' => $update, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/faust.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => mime_content_type('tests/mosconi.mp3'), 'caption' => 'test', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'mosconi.mp3', 'size' => filesize('tests/mosconi.mp3'), 'attributes' => [['_' => 'documentAttributeAudio', 'voice' => false, 'duration' => 1, 'title' => 'AH NON LO SO IO', 'performer' => 'IL DIO GERMANO MOSCONI']]]]]; $secret_media['voice'] = ['peer' => $update, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/faust.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => mime_content_type('tests/mosconi.mp3'), 'caption' => 'test', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'mosconi.mp3', 'size' => filesize('tests/mosconi.mp3'), 'attributes' => [['_' => 'documentAttributeAudio', 'voice' => true, 'duration' => 1, 'title' => 'AH NON LO SO IO', 'performer' => 'IL DIO GERMANO MOSCONI']]]]]; foreach ($secret_media as $type => $smessage) { $type = $this->messages->sendEncryptedFile($smessage); } $i = 0; while ($i < 10) { echo "SENDING MESSAGE $i TO ".$update['message']['chat_id'].PHP_EOL; $this->messages->sendEncrypted(['peer' => $update, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => (string) ($i++)]]); } $this->sent[$update['message']['chat_id']] = true; } catch (\danog\MadelineProto\RPCErrorException $e) { \danog\MadelineProto\Logger::log($e); } catch (\danog\MadelineProto\Exception $e) { \danog\MadelineProto\Logger::log($e); } } } if (file_exists('.env')) { echo 'Loading .env...'.PHP_EOL; $dotenv = new Dotenv\Dotenv(getcwd()); $dotenv->load(); } echo 'Loading settings...'.PHP_EOL; $settings = json_decode(getenv('MTPROTO_SETTINGS'), true) ?: []; $MadelineProto = new \danog\MadelineProto\API('s.madeline', $settings); $MadelineProto->start(); $MadelineProto->setEventHandler('\EventHandler'); $MadelineProto->loop(); #!/usr/bin/env php . */ set_include_path(get_include_path().':'.realpath(dirname(__FILE__).'/MadelineProto/')); /* * Various ways to load MadelineProto */ if (!file_exists(__DIR__.'/vendor/autoload.php')) { echo 'You did not run composer update, using madeline.php'.PHP_EOL; if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; } else { require_once 'vendor/autoload.php'; } class EventHandler extends \danog\MadelineProto\EventHandler { public function onAny($update) { if (isset($update['message']['out']) && $update['message']['out']) { return; } if (isset($update['message']['media'])) { yield $this->messages->sendMedia(['peer' => $update, 'message' => $update['message']['message'], 'media' => $update]); } $res = json_encode($update, JSON_PRETTY_PRINT); if ($res == '') { $res = var_export($update, true); } yield $this->sleep_async(3); try { yield $this->messages->sendMessage(['peer' => $update, 'message' => "$res\n\nDopo 3 secondi, in modo asincrono", 'reply_to_msg_id' => isset($update['message']['id']) ? $update['message']['id'] : null, 'parse_mode' => 'HTML']); //'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]); } catch (\danog\MadelineProto\RPCErrorException $e) { \danog\MadelineProto\Logger::log((string) $e, \danog\MadelineProto\Logger::FATAL_ERROR); } catch (\danog\MadelineProto\Exception $e) { \danog\MadelineProto\Logger::log((string) $e, \danog\MadelineProto\Logger::FATAL_ERROR); //$this->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } } } $MadelineProto = new \danog\MadelineProto\API('bot.madeline', ['logger' => ['logger_level' => 5]]); $MadelineProto->start(); $MadelineProto->async(true); $MadelineProto->setEventHandler('\EventHandler'); $MadelineProto->loop(); . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class Lang { public static $lang = %s; // THIS WILL BE OVERWRITTEN BY $lang["en"] public static $current_lang = %s; }'; function from_camel_case($input) { preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches); $ret = $matches[0]; foreach ($ret as &$match) { $match = $match == strtoupper($match) ? strtolower($match) : lcfirst($match); } return implode(' ', $ret); } $lang_code = readline('Enter the language you whish to localize: '); if (!isset(\danog\MadelineProto\Lang::$lang[$lang_code])) { \danog\MadelineProto\Lang::$lang[$lang_code] = \danog\MadelineProto\Lang::$current_lang; echo 'New language detected!'.PHP_EOL.PHP_EOL; } else { echo 'Completing localization of existing language'.PHP_EOL.PHP_EOL; } $count = count(\danog\MadelineProto\Lang::$lang[$lang_code]); $curcount = 0; ksort(\danog\MadelineProto\Lang::$current_lang); foreach (\danog\MadelineProto\Lang::$current_lang as $key => $value) { if (!isset(\danog\MadelineProto\Lang::$lang[$lang_code][$key])) { \danog\MadelineProto\Lang::$lang[$lang_code][$key] = $value; } if (\danog\MadelineProto\Lang::$lang[$lang_code][$key] === $value && ($lang_code !== 'en' || $value == '' || strpos($value, 'You cannot use this method directly') === 0 || strpos($value, 'Update ') === 0 || ctype_lower($value[0]) )) { $value = \danog\MadelineProto\Lang::$lang[$lang_code][$key]; if (in_array($key, ['v_error', 'v_tgerror'])) { $value = hex2bin($value); } if ($value == '') { $value = $key; } preg_match('/^[^_]+_(.*?)(?:_param_(.*)_type_(.*))?$/', $key, $matches); $method_name = isset($matches[1]) ? $matches[1] : ''; $param_name = isset($matches[2]) ? $matches[2] : ''; $param_type = isset($matches[3]) ? $matches[3] : ''; if ($param_name === 'nonce' && $param_type === 'int128') { \danog\MadelineProto\Lang::$lang[$lang_code][$key] = 'Random number for cryptographic security'; } elseif ($param_name === 'server_nonce' && $param_type === 'int128') { \danog\MadelineProto\Lang::$lang[$lang_code][$key] = 'Random number for cryptographic security, given by server'; } elseif ($param_name === 'random_id' && $param_type === 'long') { \danog\MadelineProto\Lang::$lang[$lang_code][$key] = 'Random number for cryptographic security'; } elseif (isset(\danog\MadelineProto\MTProto::DISALLOWED_METHODS[$method_name])) { \danog\MadelineProto\Lang::$lang[$lang_code][$key] = \danog\MadelineProto\MTProto::DISALLOWED_METHODS[$method_name]; } elseif (strpos($value, 'Update ') === 0) { if (!$param_name && strpos($key, 'object_') === 0) { $value = str_replace('Update ', '', $value).' update'; } } elseif (ctype_lower($value[0])) { } else { \danog\MadelineProto\Lang::$lang[$lang_code][$key] = readline($value.' => '); if (\danog\MadelineProto\Lang::$lang[$lang_code][$key] === '') { if ($param_name) { $l = str_replace('_', ' ', $param_name); } else { $l = explode('.', $method_name); $l = from_camel_case(end($l)); } $l = ucfirst(strtolower($l)); if (preg_match('/ empty$/', $l)) { $l = 'Empty '.strtolower(preg_replace('/ empty$/', '', $l)); } foreach (['id', 'url', 'dc'] as $upper) { $l = str_replace([ucfirst($upper), ' '.$upper], [strtoupper($upper), ' '.strtoupper($upper)], $l); } if (in_array($param_type, ['Bool', 'true', 'false'])) { $l .= '?'; } \danog\MadelineProto\Lang::$lang[$lang_code][$key] = $l; echo 'Using default value '.\danog\MadelineProto\Lang::$lang[$lang_code][$key].PHP_EOL; } } \danog\MadelineProto\Lang::$lang[$lang_code][$key] = ucfirst(\danog\MadelineProto\Lang::$lang[$lang_code][$key]); if (in_array($key, ['v_error', 'v_tgerror'])) { \danog\MadelineProto\Lang::$lang[$lang_code][$key] = bin2hex(\danog\MadelineProto\Lang::$lang[$lang_code][$key]); } file_put_contents('src/danog/MadelineProto/Lang.php', sprintf($template, var_export(\danog\MadelineProto\Lang::$lang, true), var_export(\danog\MadelineProto\Lang::$lang['en'], true))); echo 'OK, '.($curcount * 100 / $count).'% done. edit src/danog/MadelineProto/Lang.php to fix mistakes.'.PHP_EOL; } $curcount++; } file_put_contents('src/danog/MadelineProto/Lang.php', sprintf($template, var_export(\danog\MadelineProto\Lang::$lang, true), var_export(\danog\MadelineProto\Lang::$lang['en'], true))); echo 'OK. edit src/danog/MadelineProto/Lang.php to fix mistakes.'.PHP_EOL; #!/usr/bin/env php . */ if (!file_exists(__DIR__.'/../vendor/autoload.php')) { echo 'You did not run composer update, using madeline.php'.PHP_EOL; if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; } else { require_once 'vendor/autoload.php'; } $settings = []; include_once 'token.php'; try { $MadelineProto = new \danog\MadelineProto\API('b.madeline'); } catch (\danog\MadelineProto\Exception $e) { $MadelineProto = new \danog\MadelineProto\API($settings); $authorization = $MadelineProto->bot_login($pwrtelegram_debug_token); \danog\MadelineProto\Logger::log($authorization, \danog\MadelineProto\Logger::NOTICE); } function base64url_decode($data) { return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT)); } function rle_decode($string) { $base256 = ''; $last = ''; foreach (str_split($string) as $cur) { if ($last === chr(0)) { $base256 .= str_repeat($last, ord($cur)); $last = ''; } else { $base256 .= $last; $last = $cur; } } $string = $base256.$last; return $string; } function foreach_offset_length($string) { /* $a = []; $b = []; foreach ([2, 3, 4] as $r) { $a []= chr(0).chr($r); $b []= str_repeat(chr(0), $r); } $string = str_replace($a, $b, $string);*/ $res = []; $strlen = strlen($string); for ($offset = 0; $offset < strlen($string); $offset++) { // for ($length = $strlen - $offset; $length > 0; $length--) { foreach (['i' => 4, 'q' => 8] as $c => $length) { $s = substr($string, $offset, $length); if (strlen($s) === $length) { $number = \danog\PHP\Struct::unpack('<'.$c, $s)[0]; //$number = ord($s); $res[] = ['number' => $number, 'offset' => $offset, 'length' => $length]; } } } return $res; } $res = ['offset' => 0, 'files' => []]; function getfiles($token, &$params) { foreach (json_decode(file_get_contents('https://api.telegram.org/bot'.$token.'/getupdates?offset='.$params['offset']), true)['result'] as $update) { $params['offset'] = $update['update_id'] + 1; if (isset($update['message']['audio'])) { $params['files'][$update['message']['message_id']] = $update['message']['audio']['file_id']; } if (isset($update['message']['document'])) { $params['files'][$update['message']['message_id']] = $update['message']['document']['file_id']; } if (isset($update['message']['video'])) { $params['files'][$update['message']['message_id']] = $update['message']['video']['file_id']; } if (isset($update['message']['sticker'])) { $params['files'][$update['message']['message_id']] = $update['message']['sticker']['file_id']; } if (isset($update['message']['voice'])) { $params['files'][$update['message']['message_id']] = $update['message']['voice']['file_id']; } if (isset($update['message']['photo'])) { $params['files'][$update['message']['message_id']] = end($update['message']['photo'])['file_id']; } } } function recurse($array, $prefix = '') { $res = []; foreach ($array as $k => $v) { if (is_array($v)) { $res = array_merge(recurse($v, $prefix.$k.'->'), $res); } elseif (is_int($v)) { $res[$prefix.$k] = $v; } } return $res; } $offset = 0; while (true) { $updates = $MadelineProto->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout foreach ($updates as $update) { $offset = $update['update_id'] + 1; // Just like in the bot API, the offset must be set to the last update_id switch ($update['update']['_']) { case 'updateNewMessage': if (isset($update['update']['message']['out']) && $update['update']['message']['out']) { continue; } try { if (isset($update['update']['message']['media'])) { getfiles($pwrtelegram_debug_token, $res); $bot_api_id = $message = $res['files'][$update['update']['message']['id']]; $bot_api_id_b256 = base64url_decode($bot_api_id); $bot_api_id_rledecoded = rle_decode($bot_api_id_b256); $message .= PHP_EOL.PHP_EOL; for ($x = 0; $x < strlen($bot_api_id_rledecoded) - 3; $x++) { $message .= 'Bytes '.$x.'-'.($x + 4).': '.\danog\PHP\Struct::unpack('param (value): start-end (length)'.PHP_EOL.PHP_EOL; $bot_api = foreach_offset_length($bot_api_id_rledecoded); //$mtproto = $MadelineProto->get_download_info($update['update']['message']['media'])['InputFileLocation']; //unset($mtproto['_']); $m = []; $mtproto = recurse($update['update']['message']); /* if (isset($mtproto['version'])) { unset($mtproto['version']); } if (isset($update['update']['message']['media']['photo'])) { $mtproto['id'] = $update['update']['message']['media']['photo']['id']; } $mtproto['sender_id'] = $update['update']['message']['from_id']; if (isset($update['update']['message']['media']['photo'])) { $mtproto['access_hash'] = $update['update']['message']['media']['photo']['access_hash']; } if (isset($update['update']['message']['media']['document'])) { $mtproto['id'] = $update['update']['message']['media']['document']['id']; } if (isset($update['update']['message']['media']['document'])) { $mtproto['access_hash'] = $update['update']['message']['media']['document']['access_hash']; }*/ foreach ($mtproto as $key => $n) { foreach ($bot_api as $bn) { if ($bn['number'] === $n) { $m[$bn['offset'] + $bn['length']] = $key.' ('.$n.'): '.$bn['offset'].'-'.($bn['offset'] + $bn['length']).' ('.$bn['length'].') FOUND'.PHP_EOL; unset($mtproto[$key]); } } } ksort($m); foreach ($m as $key => $bn) { $message .= $bn; } foreach ($mtproto as $key => $n) { $message .= $key.' ('.$n.'): not found'.PHP_EOL; } $message .= PHP_EOL.PHP_EOL.'File number: '.\danog\PHP\Struct::unpack('messages->sendMessage(['peer' => $update['update']['message']['from_id'], 'message' => $message, 'reply_to_msg_id' => $update['update']['message']['id'], 'parse_mode' => 'markdown']); } } catch (\danog\MadelineProto\RPCErrorException $e) { $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } catch (\danog\MadelineProto\Exception $e) { $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } try { if (isset($update['update']['message']['media']) && $update['update']['message']['media'] == 'messageMediaPhoto' && $update['update']['message']['media'] == 'messageMediaDocument') { $time = time(); // $file = $MadelineProto->download_to_dir($update['update']['message']['media'], '/tmp'); // $MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['from_id'], 'message' => 'Downloaded to '.$file.' in '.(time() - $time).' seconds', 'reply_to_msg_id' => $update['update']['message']['id'], 'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]); } } catch (\danog\MadelineProto\RPCErrorException $e) { $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } } } echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('b.madeline', $MadelineProto).' bytes'.PHP_EOL; } #!/usr/bin/env php . */ if (!file_exists(__DIR__.'/../vendor/autoload.php')) { echo 'You did not run composer update, using madeline.php'.PHP_EOL; if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; } else { require_once 'vendor/autoload.php'; } $settings = []; $MadelineProto = false; try { $MadelineProto = new \danog\MadelineProto\API('MadelineProto_bot.madeline'); } catch (\danog\MadelineProto\Exception $e) { $MadelineProto = new \danog\MadelineProto\API($settings); $authorization = $MadelineProto->bot_login(readline('Enter a bot token: ')); \danog\MadelineProto\Logger::log($authorization, \danog\MadelineProto\Logger::NOTICE); } if (file_exists('token.php') && $MadelineProto === false) { include_once 'token.php'; $MadelineProto = new \danog\MadelineProto\API($settings); $authorization = $MadelineProto->bot_login($MadelineProto_token); \danog\MadelineProto\Logger::log($authorization, \danog\MadelineProto\Logger::NOTICE); } $offset = 0; $reply_markup = ['inline_keyboard' => [ [ // Row 1 ['text' => 'Row 1 c1'], ['text' => 'Row 1 c2'], ['text' => 'Row 1 c3'], ], [ // Row 2 ['text' => 'Row 2 c1'], ['text' => 'Row 2 c2'], ['text' => 'Row 2 c3'], ], [ // Row 3 ['text' => 'Row 3 c1'], ['text' => 'Row 3 c2'], ['text' => 'Row 3 c3'], ], ], ]; $start = 'This bot can create inline text buttons. To use it, simply type an inline query with the following syntax: @MadelineProto_bot Text to show in message Row 1 c1 | Row 1 c2 | Row 1 c3 Row 2 c1 | Row 2 c2 | Row 2 c3 Row 3 c1 | Row 3 c2 | Row 3 c3 This will create a keyboard exactly like the one used in this message (click the buttons ;D) with the phrase "Text to show in message" instead of this help message. Created by [Daniil Gentili](mention:@danogentili) (@daniilgentili) using the [MadelineProto PHP MTProto client](daniil.it/MadelineProto).'; echo 'Bot started.'.PHP_EOL; while (true) { $updates = $MadelineProto->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout foreach ($updates as $update) { $offset = $update['update_id'] + 1; // Just like in the bot API, the offset must be set to the last update_id switch ($update['update']['_']) { case 'updateNewMessage': if (isset($update['update']['message']['out']) && $update['update']['message']['out']) { continue; } try { if (isset($update['update']['message']['message']) && preg_match('|/start|', $update['update']['message']['message'])) { $MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['from_id'], 'message' => $start, 'reply_to_msg_id' => $update['update']['message']['id'], 'parse_mode' => 'markdown', 'reply_markup' => $reply_markup]); } } catch (\danog\MadelineProto\RPCErrorException $e) { //$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } break; case 'updateNewChannelMessage': if (isset($update['update']['message']['out']) && $update['update']['message']['out']) { continue; } try { if (preg_match('|/start|', $update['update']['message']['message'])) { $MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['to_id'], 'message' => $start, 'reply_to_msg_id' => $update['update']['message']['id'], 'parse_mode' => 'markdown', 'reply_markup' => $reply_markup]); } } catch (\danog\MadelineProto\RPCErrorException $e) { //$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } catch (\danog\MadelineProto\Exception $e) { //$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } break; case 'updateBotInlineQuery': try { $sswitch = ['_' => 'inlineBotSwitchPM', 'text' => 'FAQ', 'start_param' => 'lel']; if ($update['update']['query'] === '') { $MadelineProto->messages->setInlineBotResults(['query_id' => $update['update']['query_id'], 'results' => [], 'cache_time' => 0, 'switch_pm' => $sswitch]); } else { $toset = ['query_id' => $update['update']['query_id'], 'results' => [], 'cache_time' => 0, 'private' => true]; $rows = explode("\n", $update['update']['query']); $text = array_shift($rows); if (empty($rows)) { $MadelineProto->messages->setInlineBotResults(['query_id' => $update['update']['query_id'], 'results' => [], 'cache_time' => 0, 'switch_pm' => $sswitch]); } else { array_walk($rows, function (&$value, $key) { $value = explode('|', $value); array_walk($value, function (&$value, $key) { $value = ['text' => trim($value), 'url' => 'https://yayponies.eu']; }); }); $toset['results'] = [['_' => 'inputBotInlineResult', 'id' => (string) random_int(0, pow(2, 31) - 1), 'type' => 'article', 'title' => $text, 'description' => 'Your keyboard', 'send_message' => ['_' => 'inputBotInlineMessageText', 'message' => $text, 'reply_markup' => ['inline_keyboard' => $rows]]]]; $MadelineProto->messages->setInlineBotResults($toset); } } } catch (\danog\MadelineProto\RPCErrorException $e) { $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); try { $MadelineProto->messages->sendMessage(['peer' => $update['update']['user_id'], 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } catch (\danog\MadelineProto\RPCErrorException $e) { } catch (\danog\MadelineProto\Exception $e) { } try { $toset['switch_pm'] = $sswitch; $MadelineProto->messages->setInlineBotResults($toset); } catch (\danog\MadelineProto\RPCErrorException $e) { } catch (\danog\MadelineProto\Exception $e) { } } catch (\danog\MadelineProto\Exception $e) { try { $MadelineProto->messages->sendMessage(['peer' => $update['update']['user_id'], 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } catch (\danog\MadelineProto\RPCErrorException $e) { } catch (\danog\MadelineProto\Exception $e) { } try { $toset['switch_pm'] = $sswitch; $MadelineProto->messages->setInlineBotResults($toset); } catch (\danog\MadelineProto\RPCErrorException $e) { } catch (\danog\MadelineProto\Exception $e) { } } } } \danog\MadelineProto\Serialization::serialize('MadelineProto_bot.madeline', $MadelineProto); } #!/usr/bin/env php . */ if (!file_exists(__DIR__.'/../vendor/autoload.php')) { echo 'You did not run composer update, using madeline.php'.PHP_EOL; if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; } else { require_once 'vendor/autoload.php'; } $settings = []; $MadelineProto = false; $uMadelineProto = false; try { $MadelineProto = new \danog\MadelineProto\API('pipesbot.madeline'); } catch (\danog\MadelineProto\Exception $e) { \danog\MadelineProto\Logger::log($e->getMessage()); } try { $uMadelineProto = new \danog\MadelineProto\API('pwr.madeline'); } catch (\danog\MadelineProto\Exception $e) { \danog\MadelineProto\Logger::log($e->getMessage()); } if (file_exists('token.php') && $MadelineProto === false) { include_once 'token.php'; $MadelineProto = new \danog\MadelineProto\API($settings); $authorization = $MadelineProto->bot_login($pipes_token); \danog\MadelineProto\Logger::log($authorization, \danog\MadelineProto\Logger::NOTICE); } if ($uMadelineProto === false) { echo 'Loading MadelineProto...'.PHP_EOL; $uMadelineProto = new \danog\MadelineProto\API(array_merge($settings, ['updates' => ['handle_updates' => false]])); $sentCode = $uMadelineProto->phone_login(readline()); \danog\MadelineProto\Logger::log($sentCode, \danog\MadelineProto\Logger::NOTICE); echo 'Enter the code you received: '; $code = fgets(STDIN, (isset($sentCode['type']['length']) ? $sentCode['type']['length'] : 5) + 1); $authorization = $uMadelineProto->complete_phone_login($code); \danog\MadelineProto\Logger::log($authorization, \danog\MadelineProto\Logger::NOTICE); if ($authorization['_'] === 'account.noPassword') { throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!'); } if ($authorization['_'] === 'account.password') { \danog\MadelineProto\Logger::log('2FA is enabled', \danog\MadelineProto\Logger::NOTICE); $authorization = $uMadelineProto->complete_2fa_login(readline('Please enter your password (hint '.$authorization['hint'].'): ')); } echo 'Serializing MadelineProto to session.madeline...'.PHP_EOL; echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('session.madeline', $uMadelineProto).' bytes'.PHP_EOL; } function inputify(&$stuff) { $stuff['_'] = 'input'.ucfirst($stuff['_']); return $stuff; } function translatetext(&$value) { inputify($value); if (isset($value['entities'])) { foreach ($value['entities'] as &$entity) { if ($entity['_'] === 'messageEntityMentionName') { inputify($entity); } } } if (isset($value['geo'])) { $value['geo_point'] = inputify($value['geo']); } } function translate(&$value, $key) { switch ($value['_']) { case 'botInlineResult': $value['_'] = 'inputBotInlineResult'; translatetext($value['send_message']); return $value; case 'botInlineMediaResult': if (isset($value['game'])) { throw new \danog\MadelineProto\RPCErrorException('Games are not supported.'); } if (isset($value['photo'])) { $value['_'] = 'inputBotInlineResultPhoto'; } if (isset($value['document'])) { $value['_'] = 'inputBotInlineResultDocument'; } translatetext($value['send_message']); return $value; } } $offset = 0; $start = "This bot can create a pipeline between inline bots. To use it, simply type an inline query with the following syntax: @pipesbot Hey I'm writing this using the leet filter of @filtersbot w/ @lolcatzbot | @filtersbot:eleet | @lolcatzbot \$ This will make an inline query with text \"Hey I'm writing this using the leet filter of @filtersbot w/ @lolcatzbot\" to @filtersbot, take the result that has the word \"eleet\" (regexes are supported. you can specify just the username to select the first result), in the title, if it's a text message (entities will be ignored, if it's a media message you will be redirected here), then it will make an inline query to @lolcatzbot with the text received out of the first bot fetch all results and return them to you. Note that the query must be terminated by a \$ Created by @danogentili (@daniilgentili) using the daniil.it/MadelineProto PHP MTProto client."; while (true) { $updates = $MadelineProto->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout foreach ($updates as $update) { $offset = $update['update_id'] + 1; // Just like in the bot API, the offset must be set to the last update_id try { switch ($update['update']['_']) { case 'updateNewMessage': if (isset($update['update']['message']['out']) && $update['update']['message']['out']) { continue; } try { if (preg_match('|/start|', $update['update']['message']['message'])) { $MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['from_id'], 'message' => $start, 'reply_to_msg_id' => $update['update']['message']['id']]); } } catch (\danog\MadelineProto\RPCErrorException $e) { $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } break; case 'updateNewChannelMessage': if (isset($update['update']['message']['out']) && $update['update']['message']['out']) { continue; } try { if (preg_match('|/start|', $update['update']['message']['message'])) { $MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['to_id'], 'message' => $start, 'reply_to_msg_id' => $update['update']['message']['id']]); } } catch (\danog\MadelineProto\RPCErrorException $e) { $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } catch (\danog\MadelineProto\Exception $e) { $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } break; case 'updateBotInlineQuery': try { $sswitch = ['_' => 'inlineBotSwitchPM', 'text' => 'FAQ', 'start_param' => 'lel']; if ($update['update']['query'] === '') { $MadelineProto->messages->setInlineBotResults(['query_id' => $update['update']['query_id'], 'results' => [], 'cache_time' => 0, 'switch_pm' => $sswitch]); } else { $toset = ['query_id' => $update['update']['query_id'], 'results' => [], 'cache_time' => 0, 'private' => true]; if (preg_match('|\$\s*$|', $update['update']['query'])) { $exploded = explode('|', preg_replace('/\$\s*$/', '', $update['update']['query'])); array_walk($exploded, function (&$value, $key) { $value = preg_replace(['/^\s+/', '/\s+$/'], '', $value); }); $query = array_shift($exploded); foreach ($exploded as $current => $botq) { $bot = preg_replace('|:.*|', '', $botq); if ($bot === '' || $uMadelineProto->get_info($bot)['bot_api_id'] === $MadelineProto->API->authorization['user']['id']) { $toset['switch_pm'] = $sswitch; break; } $select = preg_replace('|'.$bot.':|', '', $botq); $results = $uMadelineProto->messages->getInlineBotResults(['bot' => $bot, 'peer' => $update['update']['user_id'], 'query' => $query, 'offset' => $offset]); if (isset($results['switch_pm'])) { $toset['switch_pm'] = $results['switch_pm']; break; } $toset['gallery'] = $results['gallery']; $toset['results'] = []; if (is_numeric($select)) { $toset['results'][0] = $results['results'][$select - 1]; } elseif ($select === '') { $toset['results'] = $results['results']; } else { foreach ($results['results'] as $result) { if (isset($result['send_message']['message']) && preg_match('|'.$select.'|', $result['send_message']['message'])) { $toset['results'][0] = $result; } } } if (!isset($toset['results'][0])) { $toset['results'] = $results['results']; } if (count($exploded) - 1 === $current || !isset($toset['results'][0]['send_message']['message'])) { break; } $query = $toset['results'][0]['send_message']['message']; } } if (empty($toset['results'])) { $toset['switch_pm'] = $sswitch; } else { array_walk($toset['results'], 'translate'); } $MadelineProto->messages->setInlineBotResults($toset); } } catch (\danog\MadelineProto\RPCErrorException $e) { try { $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); $MadelineProto->messages->sendMessage(['peer' => $update['update']['user_id'], 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } catch (\danog\MadelineProto\RPCErrorException $e) { \danog\MadelineProto\Logger::log($e->getMessage()); } catch (\danog\MadelineProto\Exception $e) { \danog\MadelineProto\Logger::log($e->getMessage()); } try { $toset['switch_pm'] = $sswitch; $MadelineProto->messages->setInlineBotResults($toset); } catch (\danog\MadelineProto\RPCErrorException $e) { \danog\MadelineProto\Logger::log($e->getMessage()); } catch (\danog\MadelineProto\Exception $e) { \danog\MadelineProto\Logger::log($e->getMessage()); } } catch (\danog\MadelineProto\Exception $e) { try { $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); $MadelineProto->messages->sendMessage(['peer' => $update['update']['user_id'], 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } catch (\danog\MadelineProto\RPCErrorException $e) { \danog\MadelineProto\Logger::log($e->getMessage()); } catch (\danog\MadelineProto\Exception $e) { \danog\MadelineProto\Logger::log($e->getMessage()); } try { $toset['switch_pm'] = $sswitch; $MadelineProto->messages->setInlineBotResults($toset); } catch (\danog\MadelineProto\RPCErrorException $e) { \danog\MadelineProto\Logger::log($e->getMessage()); } catch (\danog\MadelineProto\Exception $e) { \danog\MadelineProto\Logger::log($e->getMessage()); } } } } catch (\danog\MadelineProto\RPCErrorException $e) { } } \danog\MadelineProto\Serialization::serialize('pipesbot.madeline', $MadelineProto); \danog\MadelineProto\Serialization::serialize('pwr.madeline', $uMadelineProto); } { "name": "danog/madelineproto", "description": "PHP implementation of telegram's MTProto protocol.", "type": "project", "license": "AGPL-3.0-only", "homepage": "https://daniil.it/MadelineProto", "keywords": ["telegram", "mtproto", "protocol", "bytes", "messenger", "client", "PHP", "video", "stickers", "audio", "files", "GB"], "conflict": { "krakjoe/pthreads-polyfill": "*" }, "require": { "php": ">=5.6.0", "danog/primemodule": "^1.0.3", "danog/magicalserializer": "^1.0", "phpseclib/phpseclib": "dev-master#27370df", "vlucas/phpdotenv": "^2.4", "erusev/parsedown": "^1.6", "rollbar/rollbar": "dev-master", "ext-curl": "*", "ext-mbstring": "*", "ext-json": "*", "ext-xml": "*", "amphp/amp": "^2.0", "amphp/socket": "^0.10.11", "amphp/log": "^1.0", "amphp/parser": "^1.0", "amphp/dns": "dev-master#861cc857b1ba6e02e8a7439c30403682785fce96 as 0.9.9", "amphp/file": "dev-master#5a69fca406ac5fd220de0aa68c887bc8046eb93c as 0.3.3", "amphp/uri": "dev-master#f3195b163275383909ded7770a11d8eb865cbc86 as 0.1.3", "amphp/websocket-client": "dev-master" }, "require-dev": { "phpdocumentor/reflection-docblock": "^3.1" }, "suggest": { "ext-libtgvoip": "Install the php-libtgvoip extension to make phone calls (https://github.com/danog/php-libtgvoip)", "ext-sockets": "Install the socket extension to speed up MadelineProto" }, "authors": [ { "name": "Daniil Gentili", "email": "daniil@daniil.it" } ], "autoload": { "psr-0": { "danog\\MadelineProto\\": "src/" }, "files": [ "src/BigIntegor.php", "src/Socket.php", "src/Collectable.php", "src/Threaded.php", "src/Volatile.php", "src/Thread.php", "src/Worker.php", "src/Pool.php", "src/HttpProxy.php", "src/SocksProxy.php" ] } } #!/usr/bin/env php . */ require_once 'madeline.phar'; //include 'SocksProxy.php'; if (!function_exists('readline')) { function readline($prompt = null) { if ($prompt) { echo $prompt; } $fp = fopen('php://stdin', 'r'); $line = rtrim(fgets($fp, 1024)); return $line; } } if (file_exists('web_data.php')) { require_once 'web_data.php'; } echo 'Deserializing MadelineProto from testing.madeline...'.PHP_EOL; $MadelineProto = false; try { $MadelineProto = new \danog\MadelineProto\API('testing.madeline'); } catch (\danog\MadelineProto\Exception $e) { \danog\MadelineProto\Logger::log($e->getMessage()); } if (file_exists('.env')) { echo 'Loading .env...'.PHP_EOL; $dotenv = new Dotenv\Dotenv(getcwd()); $dotenv->load(); } if (getenv('TEST_SECRET_CHAT') == '') { die('TEST_SECRET_CHAT is not defined in .env, please define it.'.PHP_EOL); } echo 'Loading settings...'.PHP_EOL; \danog\MadelineProto\Logger::log(getenv('MTPROTO_SETTINGS')); $settings = json_decode(getenv('MTPROTO_SETTINGS'), true) ?: []; //$settings['connection_settings']['all']['proxy'] = '\SocksProxy'; //$settings['connection_settings']['all']['proxy_extra'] = ['address' => '127.0.0.1', 'port' => 1080]; \danog\MadelineProto\Logger::log($settings); if ($MadelineProto === false) { echo 'Loading MadelineProto...'.PHP_EOL; $MadelineProto = new \danog\MadelineProto\API($settings); if (getenv('TRAVIS_COMMIT') == '') { $sentCode = $MadelineProto->phone_login(readline('Enter your phone number: ')); \danog\MadelineProto\Logger::log($sentCode, \danog\MadelineProto\Logger::NOTICE); echo 'Enter the code you received: '; $code = fgets(STDIN, (isset($sentCode['type']['length']) ? $sentCode['type']['length'] : 5) + 1); $authorization = $MadelineProto->complete_phone_login($code); \danog\MadelineProto\Logger::log($authorization, \danog\MadelineProto\Logger::NOTICE); if ($authorization['_'] === 'account.noPassword') { throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!'); } if ($authorization['_'] === 'account.password') { \danog\MadelineProto\Logger::log('2FA is enabled', \danog\MadelineProto\Logger::NOTICE); $authorization = $MadelineProto->complete_2fa_login(readline('Please enter your password (hint '.$authorization['hint'].'): ')); } if ($authorization['_'] === 'account.needSignup') { \danog\MadelineProto\Logger::log('Registering new user', \danog\MadelineProto\Logger::NOTICE); $authorization = $MadelineProto->complete_signup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): ')); } } else { $MadelineProto->bot_login(getenv('BOT_TOKEN')); } } \danog\MadelineProto\Logger::log('hey', \danog\MadelineProto\Logger::ULTRA_VERBOSE); \danog\MadelineProto\Logger::log('hey', \danog\MadelineProto\Logger::VERBOSE); \danog\MadelineProto\Logger::log('hey', \danog\MadelineProto\Logger::NOTICE); \danog\MadelineProto\Logger::log('hey', \danog\MadelineProto\Logger::WARNING); \danog\MadelineProto\Logger::log('hey', \danog\MadelineProto\Logger::ERROR); \danog\MadelineProto\Logger::log('hey', \danog\MadelineProto\Logger::FATAL_ERROR); //$MadelineProto->phone->createGroupCall(['channel' => -1001333587884 $message = (getenv('TRAVIS_COMMIT') == '') ? 'I iz works always (io laborare sembre) (yo lavorar siempre) (mi labori ĉiam) (я всегда работать) (Ik werkuh altijd) (Ngimbonga ngaso sonke isikhathi ukusebenza)' : ('Travis ci tests in progress: commit '.getenv('TRAVIS_COMMIT').', job '.getenv('TRAVIS_JOB_NUMBER').', PHP version: '.getenv('TRAVIS_PHP_VERSION')); echo 'Serializing MadelineProto to testing.madeline...'.PHP_EOL; echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('testing.madeline', $MadelineProto).' bytes'.PHP_EOL; /* $m = new \danog\MadelineProto\API($settings); $m->import_authorization($MadelineProto->export_authorization()); */ if (stripos(readline('Do you want to make a call? (y/n): '), 'y') !== false) { $controller = $MadelineProto->request_call(getenv('TEST_SECRET_CHAT'))->play('input.raw')->then('input.raw')->playOnHold(['input.raw'])->setOutputFile('output.raw'); while ($controller->getCallState() < \danog\MadelineProto\VoIP::CALL_STATE_READY) { $MadelineProto->get_updates(); } //$MadelineProto->messages->sendMessage(['peer' => $controller->getOtherID(), 'message' => 'Emojis: '.implode('', $controller->getVisualization())]); \danog\MadelineProto\Logger::log($controller->configuration); while ($controller->getCallState() < \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { $MadelineProto->get_updates(); } } if (stripos(readline('Do you want to handle incoming calls? (y/n): '), 'y') !== false) { $howmany = readline('How many calls would you like me to handle? '); $offset = 0; while ($howmany > 0) { $updates = $MadelineProto->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout foreach ($updates as $update) { \danog\MadelineProto\Logger::log($update); $offset = $update['update_id'] + 1; // Just like in the bot API, the offset must be set to the last update_id switch ($update['update']['_']) { case 'updatePhoneCall': if (is_object($update['update']['phone_call']) && $update['update']['phone_call']->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_INCOMING) { $update['update']['phone_call']->accept()->play('input.raw')->then('input.raw')->playOnHold(['input.raw'])->setOutputFile('output.raw'); $howmany--; } } } //echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('testing.madeline', $MadelineProto).' bytes'.PHP_EOL; } } if (stripos(readline('Do you want to make the secret chat tests? (y/n): '), 'y') !== false) { $secret = $MadelineProto->API->request_secret_chat(getenv('TEST_SECRET_CHAT')); echo 'Waiting for '.getenv('TEST_SECRET_CHAT').' (secret chat id '.$secret.') to accept the secret chat...'.PHP_EOL; while ($MadelineProto->secret_chat_status($secret) !== 2) { $MadelineProto->get_updates(); } $offset = 0; $InputEncryptedChat = $MadelineProto->get_secret_chat($secret)['InputEncryptedChat']; $sentMessage = $MadelineProto->messages->sendEncrypted(['peer' => $InputEncryptedChat, 'message' => ['_' => 'decryptedMessage', 'media' => ['_' => 'decryptedMessageMediaEmpty'], 'ttl' => 10, 'message' => $message, 'entities' => [['_' => 'messageEntityCode', 'offset' => 0, 'length' => mb_strlen($message)]]]]); // should work with all layers \danog\MadelineProto\Logger::log($sentMessage, \danog\MadelineProto\Logger::NOTICE); /* while (true) { $updates = $MadelineProto->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout //\danog\MadelineProto\Logger::log($updates); foreach ($updates as $update) { $offset = $update['update_id'] + 1; // Just like in the bot API, the offset must be set to the last update_id switch ($update['update']['_']) { case 'updateNewEncryptedMessage': \danog\MadelineProto\Logger::log($update); } echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('testing.madeline', $MadelineProto).' bytes'.PHP_EOL; } }*/ $secret_media = []; // Photo uploaded as document, secret chat $inputEncryptedFile = $MadelineProto->upload_encrypted('tests/faust.jpg', 'fausticorn.jpg'); // This gets an inputFile object with file name magic $secret_media['document_photo'] = ['peer' => $secret, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/faust.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => mime_content_type('tests/faust.jpg'), 'caption' => 'This file was uploaded using MadelineProto', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'faust.jpg', 'size' => filesize('tests/faust.jpg'), 'attributes' => [['_' => 'documentAttributeImageSize', 'w' => 1280, 'h' => 914]]]]]; // Photo, secret chat $secret_media['photo'] = ['peer' => $secret, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaPhoto', 'thumb' => file_get_contents('tests/faust.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'caption' => 'This file was uploaded using MadelineProto', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'size' => filesize('tests/faust.jpg'), 'w' => 1280, 'h' => 914]]]; // GIF, secret chat $inputEncryptedFile = $MadelineProto->upload_encrypted('tests/pony.mp4'); $secret_media['gif'] = ['peer' => $secret, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/pony.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => mime_content_type('tests/pony.mp4'), 'caption' => 'test', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'pony.mp4', 'size' => filesize('tests/faust.jpg'), 'attributes' => [['_' => 'documentAttributeAnimated']]]]]; // Sticker, secret chat $inputEncryptedFile = $MadelineProto->upload_encrypted('tests/lel.webp'); $secret_media['sticker'] = ['peer' => $secret, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/lel.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => mime_content_type('tests/lel.webp'), 'caption' => 'test', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'lel.webp', 'size' => filesize('tests/lel.webp'), 'attributes' => [['_' => 'documentAttributeSticker', 'alt' => 'LEL', 'stickerset' => ['_' => 'inputStickerSetEmpty']]]]]]; // Document, secrey chat $time = time(); $inputEncryptedFile = $MadelineProto->upload_encrypted('tests/60', 'magic'); // This gets an inputFile object with file name magic \danog\MadelineProto\Logger::log(time() - $time); $secret_media['document'] = ['peer' => $secret, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/faust.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => 'magic/magic', 'caption' => 'test', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'magic.magic', 'size' => filesize('tests/60'), 'attributes' => [['_' => 'documentAttributeFilename', 'file_name' => 'fairy']]]]]; // Video, secret chat $inputEncryptedFile = $MadelineProto->upload_encrypted('tests/swing.mp4'); $secret_media['video'] = ['peer' => $secret, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/swing.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => mime_content_type('tests/swing.mp4'), 'caption' => 'test', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'swing.mp4', 'size' => filesize('tests/swing.mp4'), 'attributes' => [['_' => 'documentAttributeVideo', 'duration' => 5, 'w' => 1280, 'h' => 720]]]]]; // audio, secret chat $inputEncryptedFile = $MadelineProto->upload_encrypted('tests/mosconi.mp3'); $secret_media['audio'] = ['peer' => $secret, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/faust.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => mime_content_type('tests/mosconi.mp3'), 'caption' => 'test', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'mosconi.mp3', 'size' => filesize('tests/mosconi.mp3'), 'attributes' => [['_' => 'documentAttributeAudio', 'voice' => false, 'duration' => 1, 'title' => 'AH NON LO SO IO', 'performer' => 'IL DIO GERMANO MOSCONI']]]]]; $secret_media['voice'] = ['peer' => $secret, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/faust.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => mime_content_type('tests/mosconi.mp3'), 'caption' => 'test', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'mosconi.mp3', 'size' => filesize('tests/mosconi.mp3'), 'attributes' => [['_' => 'documentAttributeAudio', 'voice' => true, 'duration' => 1, 'title' => 'AH NON LO SO IO', 'performer' => 'IL DIO GERMANO MOSCONI']]]]]; foreach ($secret_media as $type => $smessage) { $type = $MadelineProto->messages->sendEncryptedFile($smessage); } } $mention = $MadelineProto->get_info(getenv('TEST_USERNAME')); // Returns an array with all of the constructors that can be extracted from a username or an id $mention = $mention['user_id']; // Selects only the numeric user id $media = []; // Sticker $inputFile = $MadelineProto->upload('tests/lel.webp'); \danog\MadelineProto\Logger::log($inputFile); $media['sticker'] = ['_' => 'inputMediaUploadedDocument', 'file' => $inputFile, 'mime_type' => mime_content_type('tests/lel.webp'), 'caption' => 'test', 'attributes' => [['_' => 'documentAttributeSticker', 'alt' => 'LEL', 'stickerset' => ['_' => 'inputStickerSetEmpty']]]]; // Video $inputFile = $MadelineProto->upload('tests/swing.mp4'); $media['video'] = ['_' => 'inputMediaUploadedDocument', 'file' => $inputFile, 'mime_type' => mime_content_type('tests/swing.mp4'), 'caption' => 'test', 'attributes' => [['_' => 'documentAttributeVideo', 'duration' => 5, 'w' => 1280, 'h' => 720]]]; // audio $inputFile = $MadelineProto->upload('tests/mosconi.mp3'); $media['audio'] = ['_' => 'inputMediaUploadedDocument', 'file' => $inputFile, 'mime_type' => mime_content_type('tests/mosconi.mp3'), 'caption' => 'test', 'attributes' => [['_' => 'documentAttributeAudio', 'voice' => false, 'duration' => 1, 'title' => 'AH NON LO SO IO', 'performer' => 'IL DIO GERMANO MOSCONI']]]; // voice $media['voice'] = ['_' => 'inputMediaUploadedDocument', 'file' => $inputFile, 'mime_type' => mime_content_type('tests/mosconi.mp3'), 'caption' => 'test', 'attributes' => [['_' => 'documentAttributeAudio', 'voice' => true, 'duration' => 1, 'title' => 'AH NON LO SO IO', 'performer' => 'IL DIO GERMANO MOSCONI']]]; // Document $time = time(); $inputFile = $MadelineProto->upload('tests/60', 'magic'); // This gets an inputFile object with file name magic \danog\MadelineProto\Logger::log(time() - $time); $media['document'] = ['_' => 'inputMediaUploadedDocument', 'file' => $inputFile, 'mime_type' => 'magic/magic', 'caption' => 'This file was uploaded using MadelineProto', 'attributes' => [['_' => 'documentAttributeFilename', 'file_name' => 'magic.magic']]]; $message = 'yay'; $mention = $MadelineProto->get_info(getenv('TEST_USERNAME')); // Returns an array with all of the constructors that can be extracted from a username or an id $mention = $mention['user_id']; // Selects only the numeric user id foreach (json_decode(getenv('TEST_DESTINATION_GROUPS'), true) as $peer) { $sentMessage = $MadelineProto->messages->sendMessage(['peer' => $peer, 'message' => $message, 'entities' => [['_' => 'inputMessageEntityMentionName', 'offset' => 0, 'length' => mb_strlen($message), 'user_id' => $mention]]]); \danog\MadelineProto\Logger::log($sentMessage, \danog\MadelineProto\Logger::NOTICE); foreach ($media as $type => $inputMedia) { $type = $MadelineProto->messages->sendMedia(['peer' => $peer, 'media' => $inputMedia, 'message' => '['.$message.'](mention:'.$mention.')', 'parse_mode' => 'markdown']); } } foreach (json_decode(getenv('TEST_DESTINATION_GROUPS'), true) as $peer) { $sentMessage = $MadelineProto->messages->sendMessage(['peer' => $peer, 'message' => $message, 'entities' => [['_' => 'inputMessageEntityMentionName', 'offset' => 0, 'length' => mb_strlen($message), 'user_id' => $mention]]]); \danog\MadelineProto\Logger::log($sentMessage, \danog\MadelineProto\Logger::NOTICE); } '.$newline; echo "**********************************************************************$newline"; echo "**********************************************************************$newline$newline"; echo "YOU ARE USING AN OLD AND BUGGED VERSION OF PHP, PLEASE UPDATE TO PHP 7$newline"; echo "PHP 5 USERS WILL NOT RECEIVE MADELINEPROTO UPDATES AND BUGFIXES$newline$newline"; echo "RECOMMENDED VERSION: PHP 7.3$newline"; echo "ALL PHP 7 VERSIONS (7.0, 7.1, 7.2, 7.3) ARE SUPPORTED$newline$newline"; echo "**********************************************************************$newline"; echo "**********************************************************************$newline"; unset($newline); } function ___install_madeline() { if (count(debug_backtrace(0)) === 1) { die('You must include this file in another PHP script'.PHP_EOL); } // MTProxy update $file = debug_backtrace(0, 1)[0]['file']; if (file_exists($file)) { $contents = file_get_contents($file); if (strpos($contents, 'new \danog\MadelineProto\Server') && in_array($contents, [file_get_contents('https://github.com/danog/MadelineProtoPhar/raw/2270bd9a94d168a5e6731ffd7e61821ea244beff/mtproxyd'), file_get_contents('https://github.com/danog/MadelineProtoPhar/raw/7cabb718ec3ccb79e3c8e3d34f5bccbe3f63b0fd/mtproxyd')]) && ($mtproxyd = file_get_contents('https://phar.madelineproto.xyz/mtproxyd?v=new'))) { file_put_contents($file, $mtproxyd); return; } } // MadelineProto update $release_template = 'https://phar.madelineproto.xyz/release%s?v=new'; $phar_template = 'https://phar.madelineproto.xyz/madeline%s.phar?v=new'; $release_branch = defined('MADELINE_BRANCH') ? '-'.MADELINE_BRANCH : ''; $release_default = ''; if (PHP_MAJOR_VERSION === 5) { $release_branch = '5'.$release_branch; $release_default = '5'; } if (!($release = @file_get_contents(sprintf($release_template, $release_branch)))) { if (!($release = @file_get_contents(sprintf($release_template, $release_default)))) { return; } $release_branch = $release_default; } if (!file_exists('madeline.phar') || !file_exists('madeline.phar.version') || file_get_contents('madeline.phar.version') !== $release) { $phar = file_get_contents(sprintf($phar_template, $release_branch)); if ($phar) { file_put_contents('madeline.phar', $phar); file_put_contents('madeline.phar.version', $release); } } } ___install_madeline(); require 'madeline.phar'; #!/usr/bin/env php . */ require '../vendor/autoload.php'; $settings = []; $Lua = false; try { $Lua = \danog\MadelineProto\Serialization::deserialize('bot.madeline'); } catch (\danog\MadelineProto\Exception $e) { } if (!is_object($Lua)) { $MadelineProto = new \danog\MadelineProto\API($settings); while (!in_array(($res = readline('Do you want to login as a user or as a bot (u/b)? ')), ['u', 'b'])) { echo 'Please write either u or b'.PHP_EOL; } switch ($res) { case 'u': $sentCode = $MadelineProto->phone_login(readline('Enter your phone number: ')); \danog\MadelineProto\Logger::log($sentCode, \danog\MadelineProto\Logger::NOTICE); echo 'Enter the code you received: '; $code = fgets(STDIN, (isset($sentCode['type']['length']) ? $sentCode['type']['length'] : 5) + 1); $authorization = $MadelineProto->complete_phone_login($code); \danog\MadelineProto\Logger::log($authorization, \danog\MadelineProto\Logger::NOTICE); if ($authorization['_'] === 'account.noPassword') { throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!'); } if ($authorization['_'] === 'account.password') { \danog\MadelineProto\Logger::log('2FA is enabled', \danog\MadelineProto\Logger::NOTICE); $authorization = $MadelineProto->complete_2fa_login(readline('Please enter your password (hint '.$authorization['hint'].'): ')); } if ($authorization['_'] === 'account.needSignup') { \danog\MadelineProto\Logger::log('Registering new user', \danog\MadelineProto\Logger::NOTICE); $authorization = $MadelineProto->complete_signup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): ')); } \danog\MadelineProto\Logger::log($authorization, \danog\MadelineProto\Logger::NOTICE); $Lua = new \danog\MadelineProto\Lua('madeline.lua', $MadelineProto); break; case 'b': $authorization = $MadelineProto->bot_login(readline('Please enter a bot token: ')); \danog\MadelineProto\Logger::log($authorization, \danog\MadelineProto\Logger::NOTICE); $Lua = new \danog\MadelineProto\Lua('madeline.lua', $MadelineProto); break; } } $offset = 0; while (true) { $updates = $Lua->MadelineProto->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout foreach ($updates as $update) { $offset = $update['update_id'] + 1; // Just like in the bot API, the offset must be set to the last update_id $Lua->madeline_update_callback($update['update']); } echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('bot.madeline', $Lua).' bytes'.PHP_EOL; } #!/usr/bin/env php . */ require '../vendor/autoload.php'; $settings = []; $Lua = false; try { $Lua = \danog\MadelineProto\Serialization::deserialize('td.madeline'); } catch (\danog\MadelineProto\Exception $e) { } if (!is_object($Lua)) { $MadelineProto = new \danog\MadelineProto\API($settings); while (!in_array(($res = readline('Do you want to login as a user or as a bot (u/b)? ')), ['u', 'b'])) { echo 'Please write either u or b'.PHP_EOL; } switch ($res) { case 'u': $sentCode = $MadelineProto->phone_login(readline('Enter your phone number: ')); \danog\MadelineProto\Logger::log($sentCode, \danog\MadelineProto\Logger::NOTICE); echo 'Enter the code you received: '; $code = fgets(STDIN, (isset($sentCode['type']['length']) ? $sentCode['type']['length'] : 5) + 1); $authorization = $MadelineProto->complete_phone_login($code); \danog\MadelineProto\Logger::log($authorization, \danog\MadelineProto\Logger::NOTICE); if ($authorization['_'] === 'account.noPassword') { throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!'); } if ($authorization['_'] === 'account.password') { \danog\MadelineProto\Logger::log('2FA is enabled', \danog\MadelineProto\Logger::NOTICE); $authorization = $MadelineProto->complete_2fa_login(readline('Please enter your password (hint '.$authorization['hint'].'): ')); } if ($authorization['_'] === 'account.needSignup') { \danog\MadelineProto\Logger::log('Registering new user', \danog\MadelineProto\Logger::NOTICE); $authorization = $MadelineProto->complete_signup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): ')); } \danog\MadelineProto\Logger::log($authorization, \danog\MadelineProto\Logger::NOTICE); $Lua = new \danog\MadelineProto\Lua('madeline.lua', $MadelineProto); break; case 'b': $authorization = $MadelineProto->bot_login(readline('Please enter a bot token: ')); \danog\MadelineProto\Logger::log($authorization, \danog\MadelineProto\Logger::NOTICE); $Lua = new \danog\MadelineProto\Lua('madeline.lua', $MadelineProto); break; } } $offset = 0; while (true) { $updates = $Lua->MadelineProto->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout foreach ($updates as $update) { $offset = $update['update_id'] + 1; // Just like in the bot API, the offset must be set to the last update_id $Lua->tdcli_update_callback($update['update']); } echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('td.madeline', $Lua).' bytes'.PHP_EOL; } #!/usr/bin/env php . */ set_include_path(get_include_path().':'.realpath(dirname(__FILE__).'/MadelineProto/')); /* * Various ways to load MadelineProto */ if (!file_exists(__DIR__.'/vendor/autoload.php')) { echo 'You did not run composer update, using madeline.php'.PHP_EOL; if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; } else { require_once 'vendor/autoload.php'; } class EventHandler extends \danog\MadelineProto\EventHandler { public function onUpdateNewChannelMessage($update) { $this->onUpdateNewMessage($update); } public function onUpdateNewMessage($update) { if (isset($update['message']['out']) && $update['message']['out']) { return; } $res = json_encode($update, JSON_PRETTY_PRINT); if ($res == '') { $res = var_export($update, true); } try { $this->messages->sendMessage(['peer' => $update, 'message' => $res, 'reply_to_msg_id' => $update['message']['id'], 'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]); } catch (\danog\MadelineProto\RPCErrorException $e) { $this->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } try { if (isset($update['message']['media']) && ($update['message']['media']['_'] == 'messageMediaPhoto' || $update['message']['media']['_'] == 'messageMediaDocument')) { $time = microtime(true); $file = $this->download_to_dir($update, '/tmp'); $this->messages->sendMessage(['peer' => $update, 'message' => 'Downloaded to '.$file.' in '.(microtime(true) - $time).' seconds', 'reply_to_msg_id' => $update['message']['id'], 'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]); } } catch (\danog\MadelineProto\RPCErrorException $e) { $this->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]); } } } $MadelineProto = new \danog\MadelineProto\API('bot.madeline'); $MadelineProto->start(); $MadelineProto->setEventHandler('\EventHandler'); $MadelineProto->loop(-1); $filename) { $lines = explode("\n", file_get_contents($filename)); while (end($lines) === '' || strpos(end($lines), 'Next')) { unset($lines[count($lines) - 1]); } if ($lines[0] === '---') { array_shift($lines); while ($lines[0] !== '---') { array_shift($lines); } array_shift($lines); } preg_match('|^# (.*)|', $lines[0], $matches); $title = $matches[1]; $description = $lines[2]; array_unshift($lines, '---', 'title: '.$title, 'description: '.$description, 'image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png', '---'); if (isset($orderedfiles[$key + 1])) { $nextfile = 'https://docs.madelineproto.xyz/docs/'.basename($orderedfiles[$key + 1], '.md').'.html'; $prevfile = $key === 0 ? 'https://docs.madelineproto.xyz' : 'https://docs.madelineproto.xyz/docs/'.basename($orderedfiles[$key - 1], '.md').'.html'; $lines[count($lines)] = "\nNext section"; } else { $lines[count($lines)] = "\nNext section"; } file_put_contents($filename, implode("\n", $lines)); $file = file_get_contents($filename); preg_match_all('|( *)\* \[(.*)\]\((.*)\)|', $file, $matches); $file = 'https://docs.madelineproto.xyz/docs/'.basename($filename, '.md').'.html'; $index .= "* [$title]($file)\n"; if (basename($filename) !== 'FEATURES.md') { foreach ($matches[1] as $key => $match) { $spaces = " $match"; $name = $matches[2][$key]; $url = $matches[3][$key][0] === '#' ? $file.$matches[3][$key] : $matches[3][$key]; $index .= "$spaces* [$name]($url)\n"; } } } $readme = explode('## ', file_get_contents('README.md')); foreach ($readme as &$section) { if (explode("\n", $section)[0] === 'Documentation') { $section = "Documentation\n\n".$index."\n"; } } $readme = implode('## ', $readme); file_put_contents('README.md', $readme); file_put_contents('docs/docs/index.md', '--- title: MadelineProto documentation description: PHP client/server for the telegram MTProto protocol (a better tg-cli) image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- '.$readme); . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ class HttpProxy implements \danog\MadelineProto\Proxy { private $domain; private $type; private $protocol; private $extra; private $sock; public function __construct(int $domain, int $type, int $protocol) { if (!in_array($domain, [AF_INET, AF_INET6])) { throw new \danog\MadelineProto\Exception('Wrong protocol family provided'); } if (!in_array($type, [SOCK_STREAM])) { throw new \danog\MadelineProto\Exception('Wrong connection type provided'); } if (!in_array($protocol, [getprotobyname('tcp'), PHP_INT_MAX])) { throw new \danog\MadelineProto\Exception('Wrong protocol provided'); } $this->domain = $domain; $this->type = $type; $this->protocol = $protocol; } public function setExtra(array $extra = []) { $this->extra = $extra; $name = $this->protocol === PHP_INT_MAX ? '\\FSocket' : '\\Socket'; $this->sock = new $name(strlen(@inet_pton($this->extra['address'])) !== 4 ? \AF_INET6 : \AF_INET, \SOCK_STREAM, $this->protocol); } public function setOption(int $level, int $name, $value) { return $this->sock->setOption($level, $name, $value); } public function getOption(int $level, int $name) { return $this->sock->getOption($level, $name); } public function setBlocking(bool $blocking) { return $this->sock->setBlocking($blocking); } public function bind(string $address, int $port = 0) { throw new \danog\MadelineProto\Exception('Not Implemented'); } public function listen(int $backlog = 0) { throw new \danog\MadelineProto\Exception('Not Implemented'); } public function accept() { throw new \danog\MadelineProto\Exception('Not Implemented'); } public function select(array &$read, array &$write, array &$except, int $tv_sec, int $tv_usec = 0) { return $this->sock->select($read, $write, $except, $tv_sec, $tv_usec); } public function connect(string $address, int $port = 0) { $this->sock->connect($this->extra['address'], $this->extra['port']); try { if (strlen(inet_pton($address)) !== 4) { $address = '['.$address.']'; } } catch (\danog\MadelineProto\Exception $e) { } $this->sock->write("CONNECT $address:$port HTTP/1.1\r\nHost: $address:$port\r\nAccept: */*\r\n".$this->getProxyAuthHeader()."Connection: keep-Alive\r\n\r\n"); $response = $this->read_http_payload(); if ($response['code'] !== 200) { \danog\MadelineProto\Logger::log(trim($response['body'])); throw new \danog\MadelineProto\Exception($response['description'], $response['code']); } \danog\MadelineProto\Logger::log('Connected to '.$address.':'.$port.' via http'); return true; } public function read_http_line() { $line = $lastchar = $curchar = ''; while ($lastchar.$curchar !== "\r\n") { $line .= $lastchar; $lastchar = $curchar; $curchar = $this->sock->read(1); } return $line; } public function read_http_payload() { list($protocol, $code, $description) = explode(' ', $this->read_http_line(), 3); list($protocol, $protocol_version) = explode('/', $protocol); if ($protocol !== 'HTTP') { throw new \danog\MadelineProto\Exception('Wrong protocol'); } $code = (int) $code; $headers = []; while (strlen($current_header = $this->read_http_line())) { $current_header = explode(':', $current_header, 2); $headers[strtolower($current_header[0])] = trim($current_header[1]); } $read = ''; if (isset($headers['content-length'])) { $read = $this->sock->read((int) $headers['content-length']); }/* elseif (isset($headers['transfer-encoding']) && $headers['transfer-encoding'] === 'chunked') { do { $length = hexdec($this->read_http_line()); $read .= $this->sock->read($length); $this->read_http_line(); } while ($length); }*/ return ['protocol' => $protocol, 'protocol_version' => $protocol_version, 'code' => $code, 'description' => $description, 'body' => $read, 'headers' => $headers]; } public function read(int $length, int $flags = 0) { return $this->sock->read($length, $flags); } public function write(string $buffer, int $length = -1) { return $this->sock->write($buffer, $length); } public function send(string $data, int $length, int $flags) { throw new \danog\MadelineProto\Exception('Not Implemented'); } public function close() { $this->sock->close(); } public function getPeerName(bool $port = true) { throw new \danog\MadelineProto\Exception('Not Implemented'); } public function getSockName(bool $port = true) { throw new \danog\MadelineProto\Exception('Not Implemented'); } private function getProxyAuthHeader() { if (!isset($this->extra['username']) || !isset($this->extra['password'])) { return ''; } return 'Proxy-Authorization: Basic '.base64_encode($this->extra['username'].':'.$this->extra['password'])."\r\n"; } public function getProxyHeaders() { return ''; } public function getResource() { return $this->sock->getResource(); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class API extends APIFactory { use \danog\Serializable; use \danog\MadelineProto\Wrappers\ApiStart; use \danog\MadelineProto\Wrappers\ApiTemplates; public $session; public $serialized = 0; public $API; public $getting_api_id = false; public $my_telegram_org_wrapper; public function __magic_construct($params = [], $settings = []) { set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']); if (is_string($params)) { $realpaths = Serialization::realpaths($params); $this->session = $realpaths['file']; if (file_exists($realpaths['file'])) { if (!file_exists($realpaths['lockfile'])) { touch($realpaths['lockfile']); clearstatcache(); } $realpaths['lockfile'] = fopen($realpaths['lockfile'], 'r'); \danog\MadelineProto\Logger::log('Waiting for shared lock of serialization lockfile...'); flock($realpaths['lockfile'], LOCK_SH); \danog\MadelineProto\Logger::log('Shared lock acquired, deserializing...'); try { $tounserialize = file_get_contents($realpaths['file']); } finally { flock($realpaths['lockfile'], LOCK_UN); fclose($realpaths['lockfile']); } \danog\MadelineProto\Magic::class_exists(); try { $unserialized = unserialize($tounserialize); } catch (\danog\MadelineProto\Bug74586Exception $e) { class_exists('\\Volatile'); $tounserialize = str_replace('O:26:"danog\\MadelineProto\\Button":', 'O:35:"danog\\MadelineProto\\TL\\Types\\Button":', $tounserialize); foreach (['RSA', 'TL\\TLMethod', 'TL\\TLConstructor', 'MTProto', 'API', 'DataCenter', 'Connection', 'TL\\Types\\Button', 'TL\\Types\\Bytes', 'APIFactory'] as $class) { class_exists('\\danog\\MadelineProto\\'.$class); } $unserialized = \danog\Serialization::unserialize($tounserialize); } catch (\danog\MadelineProto\Exception $e) { class_exists('\\Volatile'); $tounserialize = str_replace('O:26:"danog\\MadelineProto\\Button":', 'O:35:"danog\\MadelineProto\\TL\\Types\\Button":', $tounserialize); foreach (['RSA', 'TL\\TLMethod', 'TL\\TLConstructor', 'MTProto', 'API', 'DataCenter', 'Connection', 'TL\\Types\\Button', 'TL\\Types\\Bytes', 'APIFactory'] as $class) { class_exists('\\danog\\MadelineProto\\'.$class); } Logger::log((string) $e, Logger::ERROR); if (strpos($e->getMessage(), "Erroneous data format for unserializing 'phpseclib\\Math\\BigInteger'") === 0) { $tounserialize = str_replace('phpseclib\\Math\\BigInteger', 'phpseclib\\Math\\BigIntegor', $tounserialize); } $unserialized = \danog\Serialization::unserialize($tounserialize); } if ($unserialized instanceof \danog\PlaceHolder) { $unserialized = \danog\Serialization::unserialize($tounserialize); } if ($unserialized === false) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['deserialization_error']); } $this->web_api_template = $unserialized->web_api_template; $this->my_telegram_org_wrapper = $unserialized->my_telegram_org_wrapper; $this->getting_api_id = $unserialized->getting_api_id; if (isset($unserialized->API)) { $this->API = $unserialized->API; $this->APIFactory(); return; } } $params = $settings; } if (!isset($params['app_info']['api_id']) || !$params['app_info']['api_id']) { $app = $this->api_start(); $params['app_info']['api_id'] = $app['api_id']; $params['app_info']['api_hash'] = $app['api_hash']; } $this->API = new MTProto($params); \danog\MadelineProto\Logger::log(\danog\MadelineProto\Lang::$current_lang['apifactory_start'], Logger::VERBOSE); $this->APIFactory(); \danog\MadelineProto\Logger::log('Ping...', Logger::ULTRA_VERBOSE); $pong = $this->ping(['ping_id' => 3]); \danog\MadelineProto\Logger::log('Pong: '.$pong['ping_id'], Logger::ULTRA_VERBOSE); \danog\MadelineProto\Logger::log(\danog\MadelineProto\Lang::$current_lang['madelineproto_ready'], Logger::NOTICE); } public function async($async) { $this->async = $async; foreach ($this->API->get_methods_namespaced() as $pair) { $namespace = key($pair); $this->{$namespace}->async = $async; } if ($this->API->event_handler && class_exists($this->API->event_handler) && is_subclass_of($this->API->event_handler, '\danog\MadelineProto\EventHandler')) { $this->API->setEventHandler($this->API->event_handler); } } public function __wakeup() { $this->APIFactory(); } public function __destruct() { if (\danog\MadelineProto\Magic::$has_thread && is_object(\Thread::getCurrentThread()) || Magic::is_fork()) { return; } $this->serialize(); //restore_error_handler(); } public function __sleep() { return ['API', 'web_api_template', 'getting_api_id', 'my_telegram_org_wrapper']; } public function &__get($name) { if ($name === 'settings') { $this->API->setdem = true; return $this->API->settings; } return $this->API->storage[$name]; } public function __set($name, $value) { if ($name === 'settings') { if (Magic::is_fork() && !Magic::$processed_fork) { \danog\MadelineProto\Logger::log('Detected fork'); $this->API->reset_session(); foreach ($this->API->datacenter->sockets as $datacenter) { $datacenter->close_and_reopen(); } Magic::$processed_fork = true; } return $this->API->__construct(array_replace_recursive($this->API->settings, $value)); } return $this->API->storage[$name] = $value; } public function __isset($name) { return isset($this->API->storage[$name]); } public function __unset($name) { unset($this->API->storage[$name]); } private function from_camel_case($input) { preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches); $ret = $matches[0]; foreach ($ret as &$match) { $match = $match == strtoupper($match) ? strtolower($match) : lcfirst($match); } return implode('_', $ret); } public function APIFactory() { if ($this->API) { foreach ($this->API->get_method_namespaces() as $namespace) { $this->{$namespace} = new APIFactory($namespace, $this->API); } $methods = get_class_methods($this->API); foreach ($methods as $key => $method) { if ($method == 'method_call_async_read') { unset($methods[array_search('method_call', $methods)]); } elseif (stripos($method, 'async') !== false) { if (strpos($method, '_async') !== false) { unset($methods[array_search(str_ireplace('_async', '', $method), $methods)]); } else { unset($methods[array_search(str_ireplace('async', '', $method), $methods)]); } } } $this->methods = []; foreach ($methods as $method) { $actual_method = $method; if ($method == 'method_call_async_read') { $method = 'method_call'; } elseif (stripos($method, 'async') !== false) { if (strpos($method, '_async') !== false) { $method = str_ireplace('_async', '', $method); } else { $method = str_ireplace('async', '', $method); } } $this->methods[strtolower($method)] = [$this->API, $actual_method]; if (strpos($method, '_') !== false) { $this->methods[strtolower(str_replace('_', '', $method))] = [$this->API, $actual_method]; } else { $this->methods[strtolower($this->from_camel_case($method))] = [$this->API, $actual_method]; } } $this->API->wrapper = $this; if ($this->API->event_handler && class_exists($this->API->event_handler) && is_subclass_of($this->API->event_handler, '\danog\MadelineProto\EventHandler')) { $this->API->setEventHandler($this->API->event_handler); } } } public function get_all_methods() { $methods = []; foreach ($this->API->methods->by_id as $method) { $methods[] = $method['method']; } return array_merge($methods, get_class_methods($this->API)); } public function serialize($params = null) { if ($params === null) { $params = $this->session; } if (empty($params)) { return; } Logger::log(\danog\MadelineProto\Lang::$current_lang['serializing_madelineproto']); return Serialization::serialize($params, $this); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\SecretChats; /** * Manages sequence numbers. */ trait SeqNoHandler { public function check_secret_in_seq_no($chat_id, $seqno) { $seqno = ($seqno - $this->secret_chats[$chat_id]['out_seq_no_x']) / 2; $last = 0; foreach ($this->secret_chats[$chat_id]['incoming'] as $message) { if (isset($message['decrypted_message']['in_seq_no'])) { if (($message['decrypted_message']['in_seq_no'] - $this->secret_chats[$chat_id]['out_seq_no_x']) / 2 < $last) { $this->discard_secret_chat($chat_id); throw new \danog\MadelineProto\SecurityException('in_seq_no is not increasing'); } $last = ($message['decrypted_message']['in_seq_no'] - $this->secret_chats[$chat_id]['out_seq_no_x']) / 2; } } if ($seqno > $this->secret_chats[$chat_id]['out_seq_no'] + 1) { $this->discard_secret_chat($chat_id); throw new \danog\MadelineProto\SecurityException('in_seq_no is too big'); } return true; } public function check_secret_out_seq_no($chat_id, $seqno) { $seqno = ($seqno - $this->secret_chats[$chat_id]['in_seq_no_x']) / 2; $C = 0; foreach ($this->secret_chats[$chat_id]['incoming'] as $message) { if (isset($message['decrypted_message']['out_seq_no']) && $C < $this->secret_chats[$chat_id]['in_seq_no']) { if (($message['decrypted_message']['out_seq_no'] - $this->secret_chats[$chat_id]['in_seq_no_x']) / 2 !== $C) { $this->discard_secret_chat($chat_id); throw new \danog\MadelineProto\SecurityException('out_seq_no hole: should be '.$C.', is '.($message['decrypted_message']['out_seq_no'] - $this->secret_chats[$chat_id]['in_seq_no_x']) / 2); } else { $C++; } } } //$this->logger->logger($C, $seqno); if ($seqno < $C) { // <= C $this->logger->logger('WARNING: dropping repeated message with seqno '.$seqno); return false; } if ($seqno > $C) { // > C+1 $this->discard_secret_chat($chat_id); throw new \danog\MadelineProto\SecurityException('WARNING: out_seq_no gap detected ('.$seqno.' > '.$C.')!'); } return true; } public function generate_secret_in_seq_no($chat) { return $this->secret_chats[$chat]['layer'] > 8 ? $this->secret_chats[$chat]['in_seq_no'] * 2 + $this->secret_chats[$chat]['in_seq_no_x'] : -1; } public function generate_secret_out_seq_no($chat) { return $this->secret_chats[$chat]['layer'] > 8 ? $this->secret_chats[$chat]['out_seq_no'] * 2 + $this->secret_chats[$chat]['out_seq_no_x'] : -1; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\SecretChats; /** * Manages secret chats. * * https://core.telegram.org/api/end-to-end */ trait AuthKeyHandler { protected $temp_requested_secret_chats = []; protected $secret_chats = []; public function accept_secret_chat($params) { //$this->logger->logger($params['id'],$this->secret_chat_status($params['id'])); if ($this->secret_chat_status($params['id']) !== 0) { //$this->logger->logger($this->secret_chat_status($params['id'])); $this->logger->logger("I've already accepted secret chat ".$params['id']); return false; } $dh_config = $this->get_dh_config(); $this->logger->logger('Generating b...', \danog\MadelineProto\Logger::VERBOSE); $b = new \phpseclib\Math\BigInteger($this->random(256), 256); $params['g_a'] = new \phpseclib\Math\BigInteger($params['g_a'], 256); $this->check_G($params['g_a'], $dh_config['p']); $key = ['auth_key' => str_pad($params['g_a']->powMod($b, $dh_config['p'])->toBytes(), 256, chr(0), \STR_PAD_LEFT)]; //$this->logger->logger($key); $key['fingerprint'] = substr(sha1($key['auth_key'], true), -8); $key['visualization_orig'] = substr(sha1($key['auth_key'], true), 16); $key['visualization_46'] = substr(hash('sha256', $key['auth_key'], true), 20); $this->secret_chats[$params['id']] = ['key' => $key, 'admin' => false, 'user_id' => $params['admin_id'], 'InputEncryptedChat' => ['_' => 'inputEncryptedChat', 'chat_id' => $params['id'], 'access_hash' => $params['access_hash']], 'in_seq_no_x' => 1, 'out_seq_no_x' => 0, 'in_seq_no' => 0, 'out_seq_no' => 0, 'layer' => 8, 'ttl' => 0, 'ttr' => 100, 'updated' => time(), 'incoming' => [], 'outgoing' => [], 'created' => time(), 'rekeying' => [0], 'key_x' => 'from server', 'mtproto' => 1]; $g_b = $dh_config['g']->powMod($b, $dh_config['p']); $this->check_G($g_b, $dh_config['p']); $this->method_call('messages.acceptEncryption', ['peer' => $params['id'], 'g_b' => $g_b->toBytes(), 'key_fingerprint' => $key['fingerprint']], ['datacenter' => $this->datacenter->curdc]); $this->notify_layer($params['id']); $this->handle_pending_updates(); $this->logger->logger('Secret chat '.$params['id'].' accepted successfully!', \danog\MadelineProto\Logger::NOTICE); } public function request_secret_chat($user) { $user = $this->get_info($user); if (!isset($user['InputUser'])) { throw new \danog\MadelineProto\Exception('This peer is not present in the internal peer database'); } $user = $user['InputUser']; $this->logger->logger('Creating secret chat with '.$user['user_id'].'...', \danog\MadelineProto\Logger::VERBOSE); $dh_config = $this->get_dh_config(); $this->logger->logger('Generating a...', \danog\MadelineProto\Logger::VERBOSE); $a = new \phpseclib\Math\BigInteger($this->random(256), 256); $this->logger->logger('Generating g_a...', \danog\MadelineProto\Logger::VERBOSE); $g_a = $dh_config['g']->powMod($a, $dh_config['p']); $this->check_G($g_a, $dh_config['p']); $res = $this->method_call('messages.requestEncryption', ['user_id' => $user, 'g_a' => $g_a->toBytes()], ['datacenter' => $this->datacenter->curdc]); $this->temp_requested_secret_chats[$res['id']] = $a; $this->handle_pending_updates(); $this->get_updates_difference(); $this->logger->logger('Secret chat '.$res['id'].' requested successfully!', \danog\MadelineProto\Logger::NOTICE); return $res['id']; } public function complete_secret_chat($params) { if ($this->secret_chat_status($params['id']) !== 1) { //$this->logger->logger($this->secret_chat_status($params['id'])); $this->logger->logger('Could not find and complete secret chat '.$params['id']); return false; } $dh_config = $this->get_dh_config(); $params['g_a_or_b'] = new \phpseclib\Math\BigInteger($params['g_a_or_b'], 256); $this->check_G($params['g_a_or_b'], $dh_config['p']); $key = ['auth_key' => str_pad($params['g_a_or_b']->powMod($this->temp_requested_secret_chats[$params['id']], $dh_config['p'])->toBytes(), 256, chr(0), \STR_PAD_LEFT)]; unset($this->temp_requested_secret_chats[$params['id']]); $key['fingerprint'] = substr(sha1($key['auth_key'], true), -8); //$this->logger->logger($key); if ($key['fingerprint'] !== $params['key_fingerprint']) { $this->discard_secret_chat($params['id']); throw new \danog\MadelineProto\SecurityException('Invalid key fingerprint!'); } $key['visualization_orig'] = substr(sha1($key['auth_key'], true), 16); $key['visualization_46'] = substr(hash('sha256', $key['auth_key'], true), 20); $this->secret_chats[$params['id']] = ['key' => $key, 'admin' => true, 'user_id' => $params['participant_id'], 'InputEncryptedChat' => ['chat_id' => $params['id'], 'access_hash' => $params['access_hash'], '_' => 'inputEncryptedChat'], 'in_seq_no_x' => 0, 'out_seq_no_x' => 1, 'in_seq_no' => 0, 'out_seq_no' => 0, 'layer' => 8, 'ttl' => 0, 'ttr' => 100, 'updated' => time(), 'incoming' => [], 'outgoing' => [], 'created' => time(), 'rekeying' => [0], 'key_x' => 'to server', 'mtproto' => 1]; $this->notify_layer($params['id']); $this->handle_pending_updates(); $this->logger->logger('Secret chat '.$params['id'].' completed successfully!', \danog\MadelineProto\Logger::NOTICE); } public function notify_layer($chat) { $this->method_call('messages.sendEncryptedService', ['peer' => $chat, 'message' => ['_' => 'decryptedMessageService', 'action' => ['_' => 'decryptedMessageActionNotifyLayer', 'layer' => $this->encrypted_layer]]], ['datacenter' => $this->datacenter->curdc]); } protected $temp_rekeyed_secret_chats = []; public function rekey($chat) { if ($this->secret_chats[$chat]['rekeying'][0] !== 0) { return; } $this->logger->logger('Rekeying secret chat '.$chat.'...', \danog\MadelineProto\Logger::VERBOSE); $dh_config = $this->get_dh_config(); $this->logger->logger('Generating a...', \danog\MadelineProto\Logger::VERBOSE); $a = new \phpseclib\Math\BigInteger($this->random(256), 256); $this->logger->logger('Generating g_a...', \danog\MadelineProto\Logger::VERBOSE); $g_a = $dh_config['g']->powMod($a, $dh_config['p']); $this->check_G($g_a, $dh_config['p']); $e = $this->random(8); $this->temp_rekeyed_secret_chats[$e] = $a; $this->secret_chats[$chat]['rekeying'] = [1, $e]; $this->method_call('messages.sendEncryptedService', ['peer' => $chat, 'message' => ['_' => 'decryptedMessageService', 'action' => ['_' => 'decryptedMessageActionRequestKey', 'g_a' => $g_a->toBytes(), 'exchange_id' => $e]]], ['datacenter' => $this->datacenter->curdc]); $this->handle_pending_updates(); $this->get_updates_difference(); return $e; } public function accept_rekey($chat, $params) { if ($this->secret_chats[$chat]['rekeying'][0] !== 0) { $my_exchange_id = new \phpseclib\Math\BigInteger($this->secret_chats[$chat]['rekeying'][1], -256); $other_exchange_id = new \phpseclib\Math\BigInteger($params['exchange_id'], -256); //$this->logger->logger($my, $params); if ($my_exchange_id > $other_exchange_id) { return; } if ($my_exchange_id === $other_exchange_id) { $this->secret_chats[$chat]['rekeying'] = [0]; return; } } $this->logger->logger('Accepting rekeying of secret chat '.$chat.'...', \danog\MadelineProto\Logger::VERBOSE); $dh_config = $this->get_dh_config(); $this->logger->logger('Generating b...', \danog\MadelineProto\Logger::VERBOSE); $b = new \phpseclib\Math\BigInteger($this->random(256), 256); $params['g_a'] = new \phpseclib\Math\BigInteger($params['g_a'], 256); $this->check_G($params['g_a'], $dh_config['p']); $key = ['auth_key' => str_pad($params['g_a']->powMod($b, $dh_config['p'])->toBytes(), 256, chr(0), \STR_PAD_LEFT)]; $key['fingerprint'] = substr(sha1($key['auth_key'], true), -8); $key['visualization_orig'] = $this->secret_chats[$chat]['key']['visualization_orig']; $key['visualization_46'] = substr(hash('sha256', $key['auth_key'], true), 20); $this->temp_rekeyed_secret_chats[$params['exchange_id']] = $key; $this->secret_chats[$chat]['rekeying'] = [2, $params['exchange_id']]; $g_b = $dh_config['g']->powMod($b, $dh_config['p']); $this->check_G($g_b, $dh_config['p']); $this->method_call('messages.sendEncryptedService', ['peer' => $chat, 'message' => ['_' => 'decryptedMessageService', 'action' => ['_' => 'decryptedMessageActionAcceptKey', 'g_b' => $g_b->toBytes(), 'exchange_id' => $params['exchange_id'], 'key_fingerprint' => $key['fingerprint']]]], ['datacenter' => $this->datacenter->curdc]); $this->handle_pending_updates(); $this->get_updates_difference(); } public function commit_rekey($chat, $params) { if ($this->secret_chats[$chat]['rekeying'][0] !== 1 || !isset($this->temp_rekeyed_secret_chats[$params['exchange_id']])) { $this->secret_chats[$chat]['rekeying'] = [0]; return; } $this->logger->logger('Committing rekeying of secret chat '.$chat.'...', \danog\MadelineProto\Logger::VERBOSE); $dh_config = $this->get_dh_config(); $params['g_b'] = new \phpseclib\Math\BigInteger($params['g_b'], 256); $this->check_G($params['g_b'], $dh_config['p']); $key = ['auth_key' => str_pad($params['g_b']->powMod($this->temp_rekeyed_secret_chats[$params['exchange_id']], $dh_config['p'])->toBytes(), 256, chr(0), \STR_PAD_LEFT)]; $key['fingerprint'] = substr(sha1($key['auth_key'], true), -8); $key['visualization_orig'] = $this->secret_chats[$chat]['key']['visualization_orig']; $key['visualization_46'] = substr(hash('sha256', $key['auth_key'], true), 20); if ($key['fingerprint'] !== $params['key_fingerprint']) { $this->method_call('messages.sendEncryptedService', ['peer' => $chat, 'message' => ['_' => 'decryptedMessageService', 'action' => ['_' => 'decryptedMessageActionAbortKey', 'exchange_id' => $params['exchange_id']]]], ['datacenter' => $this->datacenter->curdc]); throw new \danog\MadelineProto\SecurityException('Invalid key fingerprint!'); } $this->method_call('messages.sendEncryptedService', ['peer' => $chat, 'message' => ['_' => 'decryptedMessageService', 'action' => ['_' => 'decryptedMessageActionCommitKey', 'exchange_id' => $params['exchange_id'], 'key_fingerprint' => $key['fingerprint']]]], ['datacenter' => $this->datacenter->curdc]); unset($this->temp_rekeyed_secret_chats[$chat]); $this->secret_chats[$chat]['rekeying'] = [0]; $this->secret_chats[$chat]['old_key'] = $this->secret_chats[$chat]['key']; $this->secret_chats[$chat]['key'] = $key; $this->secret_chats[$chat]['ttr'] = 100; $this->secret_chats[$chat]['updated'] = time(); $this->handle_pending_updates(); $this->get_updates_difference(); } public function complete_rekey($chat, $params) { if ($this->secret_chats[$chat]['rekeying'][0] !== 2 || !isset($this->temp_rekeyed_secret_chats['fingerprint'])) { return; } if ($this->temp_rekeyed_secret_chats['fingerprint'] !== $params['key_fingerprint']) { $this->method_call('messages.sendEncryptedService', ['peer' => $chat, 'message' => ['_' => 'decryptedMessageService', 'action' => ['_' => 'decryptedMessageActionAbortKey', 'exchange_id' => $params['exchange_id']]]], ['datacenter' => $this->datacenter->curdc]); throw new \danog\MadelineProto\SecurityException('Invalid key fingerprint!'); } $this->logger->logger('Completing rekeying of secret chat '.$chat.'...', \danog\MadelineProto\Logger::VERBOSE); $this->secret_chats[$chat]['rekeying'] = [0]; $this->secret_chats[$chat]['old_key'] = $this->secret_chats[$chat]['key']; $this->secret_chats[$chat]['key'] = $this->temp_rekeyed_secret_chats[$chat]; $this->secret_chats[$chat]['ttr'] = 100; $this->secret_chats[$chat]['updated'] = time(); unset($this->temp_rekeyed_secret_chats[$params['exchange_id']]); $this->method_call('messages.sendEncryptedService', ['peer' => $chat, 'message' => ['_' => 'decryptedMessageService', 'action' => ['_' => 'decryptedMessageActionNoop']]], ['datacenter' => $this->datacenter->curdc]); $this->logger->logger('Secret chat '.$chat.' rekeyed successfully!', \danog\MadelineProto\Logger::VERBOSE); return true; } public function secret_chat_status($chat) { if (isset($this->secret_chats[$chat])) { return 2; } if (isset($this->temp_requested_secret_chats[$chat])) { return 1; } return 0; } public function get_secret_chat($chat) { return $this->secret_chats[is_array($chat) ? $chat['chat_id'] : $chat]; } public function discard_secret_chat($chat) { $this->logger->logger('Discarding secret chat '.$chat.'...', \danog\MadelineProto\Logger::VERBOSE); //$this->logger->logger(debug_backtrace(0)[0]); if (isset($this->secret_chats[$chat])) { unset($this->secret_chats[$chat]); } if (isset($this->temp_requested_secret_chats[$chat])) { unset($this->temp_requested_secret_chats[$chat]); } if (isset($this->temp_rekeyed_secret_chats[$chat])) { unset($this->temp_rekeyed_secret_chats[$chat]); } try { $this->method_call('messages.discardEncryption', ['chat_id' => $chat], ['datacenter' => $this->datacenter->curdc]); } catch (\danog\MadelineProto\RPCErrorException $e) { if ($e->rpc !== 'ENCRYPTION_ALREADY_DECLINED') { throw $e; } } } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\SecretChats; /** * Manages packing and unpacking of messages, and the list of sent and received messages. */ trait MessageHandler { public function encrypt_secret_message($chat_id, $message) { if (!isset($this->secret_chats[$chat_id])) { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['secret_chat_skipping'], $chat_id)); return false; } $message['random_id'] = $this->random(8); $this->secret_chats[$chat_id]['ttr']--; if ($this->secret_chats[$chat_id]['layer'] > 8) { if (($this->secret_chats[$chat_id]['ttr'] <= 0 || time() - $this->secret_chats[$chat_id]['updated'] > 7 * 24 * 60 * 60) && $this->secret_chats[$chat_id]['rekeying'][0] === 0) { $this->rekey($chat_id); } $message = ['_' => 'decryptedMessageLayer', 'layer' => $this->secret_chats[$chat_id]['layer'], 'in_seq_no' => $this->generate_secret_in_seq_no($chat_id), 'out_seq_no' => $this->generate_secret_out_seq_no($chat_id), 'message' => $message]; $this->secret_chats[$chat_id]['out_seq_no']++; } $this->secret_chats[$chat_id]['outgoing'][$this->secret_chats[$chat_id]['out_seq_no']] = $message; $message = $this->serialize_object(['type' => $constructor = $this->secret_chats[$chat_id]['layer'] === 8 ? 'DecryptedMessage' : 'DecryptedMessageLayer'], $message, $constructor, $this->secret_chats[$chat_id]['layer']); $message = $this->pack_unsigned_int(strlen($message)).$message; if ($this->secret_chats[$chat_id]['mtproto'] === 2) { $padding = $this->posmod(-strlen($message), 16); if ($padding < 12) { $padding += 16; } $message .= $this->random($padding); $message_key = substr(hash('sha256', substr($this->secret_chats[$chat_id]['key']['auth_key'], 88 + ($this->secret_chats[$chat_id]['admin'] ? 0 : 8), 32).$message, true), 8, 16); list($aes_key, $aes_iv) = $this->aes_calculate($message_key, $this->secret_chats[$chat_id]['key']['auth_key'], $this->secret_chats[$chat_id]['admin']); } else { $message_key = substr(sha1($message, true), -16); list($aes_key, $aes_iv) = $this->old_aes_calculate($message_key, $this->secret_chats[$chat_id]['key']['auth_key'], true); $message .= $this->random($this->posmod(-strlen($message), 16)); } $message = $this->secret_chats[$chat_id]['key']['fingerprint'].$message_key.$this->ige_encrypt($message, $aes_key, $aes_iv); return $message; } public function handle_encrypted_update($message, $test = false) { if (!isset($this->secret_chats[$message['message']['chat_id']])) { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['secret_chat_skipping'], $message['message']['chat_id'])); return false; } $auth_key_id = substr($message['message']['bytes'], 0, 8); $old = false; if ($auth_key_id !== $this->secret_chats[$message['message']['chat_id']]['key']['fingerprint']) { if (isset($this->secret_chats[$message['message']['chat_id']]['old_key']['fingerprint'])) { if ($auth_key_id !== $this->secret_chats[$message['message']['chat_id']]['old_key']['fingerprint']) { $this->discard_secret_chat($message['message']['chat_id']); throw new \danog\MadelineProto\SecurityException(\danog\MadelineProto\Lang::$current_lang['fingerprint_mismatch']); } $old = true; } else { $this->discard_secret_chat($message['message']['chat_id']); throw new \danog\MadelineProto\SecurityException(\danog\MadelineProto\Lang::$current_lang['fingerprint_mismatch']); } } $message_key = substr($message['message']['bytes'], 8, 16); $encrypted_data = substr($message['message']['bytes'], 24); if ($this->secret_chats[$message['message']['chat_id']]['mtproto'] === 2) { $this->logger->logger('Trying MTProto v2 decryption for chat '.$message['message']['chat_id'].'...', \danog\MadelineProto\Logger::NOTICE); try { $message_data = $this->try_mtproto_v2_decrypt($message_key, $message['message']['chat_id'], $old, $encrypted_data); $this->logger->logger('MTProto v2 decryption OK for chat '.$message['message']['chat_id'].'...', \danog\MadelineProto\Logger::NOTICE); } catch (\danog\MadelineProto\SecurityException $e) { $this->logger->logger('MTProto v2 decryption failed with message '.$e->getMessage().', trying MTProto v1 decryption for chat '.$message['message']['chat_id'].'...', \danog\MadelineProto\Logger::NOTICE); $message_data = $this->try_mtproto_v1_decrypt($message_key, $message['message']['chat_id'], $old, $encrypted_data); $this->logger->logger('MTProto v1 decryption OK for chat '.$message['message']['chat_id'].'...', \danog\MadelineProto\Logger::NOTICE); $this->secret_chats[$message['message']['chat_id']]['mtproto'] = 1; } } else { $this->logger->logger('Trying MTProto v1 decryption for chat '.$message['message']['chat_id'].'...', \danog\MadelineProto\Logger::NOTICE); try { $message_data = $this->try_mtproto_v1_decrypt($message_key, $message['message']['chat_id'], $old, $encrypted_data); $this->logger->logger('MTProto v1 decryption OK for chat '.$message['message']['chat_id'].'...', \danog\MadelineProto\Logger::NOTICE); } catch (\danog\MadelineProto\SecurityException $e) { $this->logger->logger('MTProto v1 decryption failed with message '.$e->getMessage().', trying MTProto v2 decryption for chat '.$message['message']['chat_id'].'...', \danog\MadelineProto\Logger::NOTICE); $message_data = $this->try_mtproto_v2_decrypt($message_key, $message['message']['chat_id'], $old, $encrypted_data); $this->logger->logger('MTProto v2 decryption OK for chat '.$message['message']['chat_id'].'...', \danog\MadelineProto\Logger::NOTICE); $this->secret_chats[$message['message']['chat_id']]['mtproto'] = 2; } } $deserialized = $this->deserialize($message_data, ['type' => '']); $this->secret_chats[$message['message']['chat_id']]['ttr']--; if (($this->secret_chats[$message['message']['chat_id']]['ttr'] <= 0 || time() - $this->secret_chats[$message['message']['chat_id']]['updated'] > 7 * 24 * 60 * 60) && $this->secret_chats[$message['message']['chat_id']]['rekeying'][0] === 0) { $this->rekey($message['message']['chat_id']); } unset($message['message']['bytes']); $message['message']['decrypted_message'] = $deserialized; $this->secret_chats[$message['message']['chat_id']]['incoming'][$this->secret_chats[$message['message']['chat_id']]['in_seq_no']] = $message['message']; $this->handle_decrypted_update($message); } public function try_mtproto_v1_decrypt($message_key, $chat_id, $old, $encrypted_data) { list($aes_key, $aes_iv) = $this->old_aes_calculate($message_key, $this->secret_chats[$chat_id][$old ? 'old_key' : 'key']['auth_key'], true); $decrypted_data = $this->ige_decrypt($encrypted_data, $aes_key, $aes_iv); $message_data_length = unpack('V', substr($decrypted_data, 0, 4))[1]; $message_data = substr($decrypted_data, 4, $message_data_length); if ($message_data_length > strlen($decrypted_data)) { throw new \danog\MadelineProto\SecurityException(\danog\MadelineProto\Lang::$current_lang['msg_data_length_too_big']); } if ($message_key != substr(sha1(substr($decrypted_data, 0, 4 + $message_data_length), true), -16)) { throw new \danog\MadelineProto\SecurityException(\danog\MadelineProto\Lang::$current_lang['msg_key_mismatch']); } if (strlen($decrypted_data) - 4 - $message_data_length > 15) { throw new \danog\MadelineProto\SecurityException('difference between message_data_length and the length of the remaining decrypted buffer is too big'); } if (strlen($decrypted_data) % 16 != 0) { throw new \danog\MadelineProto\SecurityException(\danog\MadelineProto\Lang::$current_lang['length_not_divisible_16']); } return $message_data; } public function try_mtproto_v2_decrypt($message_key, $chat_id, $old, $encrypted_data) { list($aes_key, $aes_iv) = $this->aes_calculate($message_key, $this->secret_chats[$chat_id][$old ? 'old_key' : 'key']['auth_key'], !$this->secret_chats[$chat_id]['admin']); $decrypted_data = $this->ige_decrypt($encrypted_data, $aes_key, $aes_iv); $message_data_length = unpack('V', substr($decrypted_data, 0, 4))[1]; $message_data = substr($decrypted_data, 4, $message_data_length); if ($message_data_length > strlen($decrypted_data)) { throw new \danog\MadelineProto\SecurityException(\danog\MadelineProto\Lang::$current_lang['msg_data_length_too_big']); } if ($message_key != substr(hash('sha256', substr($this->secret_chats[$chat_id][$old ? 'old_key' : 'key']['auth_key'], 88 + ($this->secret_chats[$chat_id]['admin'] ? 8 : 0), 32).$decrypted_data, true), 8, 16)) { throw new \danog\MadelineProto\SecurityException(\danog\MadelineProto\Lang::$current_lang['msg_key_mismatch']); } if (strlen($decrypted_data) - 4 - $message_data_length < 12) { throw new \danog\MadelineProto\SecurityException('padding is too small'); } if (strlen($decrypted_data) - 4 - $message_data_length > 1024) { throw new \danog\MadelineProto\SecurityException('padding is too big'); } if (strlen($decrypted_data) % 16 != 0) { throw new \danog\MadelineProto\SecurityException(\danog\MadelineProto\Lang::$current_lang['length_not_divisible_16']); } return $message_data; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\SecretChats; /** * Manages responses. */ trait ResponseHandler { public function handle_decrypted_update($update) { /*if (isset($update['message']['decrypted_message']['random_bytes']) && strlen($update['message']['decrypted_message']['random_bytes']) < 15) { throw new \danog\MadelineProto\ResponseException(\danog\MadelineProto\Lang::$current_lang['rand_bytes_too_short']); }*/ // already checked in TL.php switch ($update['message']['decrypted_message']['_']) { case 'decryptedMessageService': switch ($update['message']['decrypted_message']['action']['_']) { case 'decryptedMessageActionRequestKey': $this->accept_rekey($update['message']['chat_id'], $update['message']['decrypted_message']['action']); return; case 'decryptedMessageActionAcceptKey': $this->commit_rekey($update['message']['chat_id'], $update['message']['decrypted_message']['action']); return; case 'decryptedMessageActionCommitKey': $this->complete_rekey($update['message']['chat_id'], $update['message']['decrypted_message']['action']); return; case 'decryptedMessageActionNotifyLayer': $this->secret_chats[$update['message']['chat_id']]['layer'] = $update['message']['decrypted_message']['action']['layer']; if ($update['message']['decrypted_message']['action']['layer'] >= 17 && time() - $this->secret_chats[$update['message']['chat_id']]['created'] > 15) { $this->notify_layer($update['message']['chat_id']); } if ($update['message']['decrypted_message']['action']['layer'] >= 73) { $this->secret_chats[$update['message']['chat_id']]['mtproto'] = 2; } return; case 'decryptedMessageActionSetMessageTTL': $this->secret_chats[$update['message']['chat_id']]['ttl'] = $update['message']['decrypted_message']['action']['ttl_seconds']; $this->save_update($update); return; case 'decryptedMessageActionNoop': return; case 'decryptedMessageActionResend': $update['message']['decrypted_message']['action']['start_seq_no'] -= $this->secret_chats[$update['message']['chat_id']]['out_seq_no_x']; $update['message']['decrypted_message']['action']['end_seq_no'] -= $this->secret_chats[$update['message']['chat_id']]['out_seq_no_x']; $update['message']['decrypted_message']['action']['start_seq_no'] /= 2; $update['message']['decrypted_message']['action']['end_seq_no'] /= 2; $this->logger->logger('Resending messages for secret chat '.$update['message']['chat_id'], \danog\MadelineProto\Logger::WARNING); foreach ($this->secret_chats[$update['message']['chat_id']]['outgoing'] as $seq => $message) { if ($seq >= $update['message']['decrypted_message']['action']['start_seq_no'] && $seq <= $update['message']['decrypted_message']['action']['end_seq_no']) { //throw new \danog\MadelineProto\ResponseException(\danog\MadelineProto\Lang::$current_lang['resending_unsupported']); $this->method_call('messages.sendEncrypted', ['peer' => $update['message']['chat_id'], 'message' => $update['message']['decrypted_message']], ['datacenter' => $this->datacenter->curdc]); } } return; default: // $this->save_update(['_' => 'updateNewDecryptedMessage', 'peer' => $this->secret_chats[$update['message']['chat_id']]['InputEncryptedChat'], 'in_seq_no' => $this->get_in_seq_no($update['message']['chat_id']), 'out_seq_no' => $this->get_out_seq_no($update['message']['chat_id']), 'message' => $update['message']['decrypted_message']]); $this->save_update($update); } break; case 'decryptedMessage': $this->save_update($update); break; case 'decryptedMessageLayer': if ($this->check_secret_out_seq_no($update['message']['chat_id'], $update['message']['decrypted_message']['out_seq_no']) && $this->check_secret_in_seq_no($update['message']['chat_id'], $update['message']['decrypted_message']['in_seq_no'])) { $this->secret_chats[$update['message']['chat_id']]['in_seq_no']++; if ($update['message']['decrypted_message']['layer'] >= 17) { $this->secret_chats[$update['message']['chat_id']]['layer'] = $update['message']['decrypted_message']['layer']; if ($update['message']['decrypted_message']['layer'] >= 17 && time() - $this->secret_chats[$update['message']['chat_id']]['created'] > 15) { $this->notify_layer($update['message']['chat_id']); } } $update['message']['decrypted_message'] = $update['message']['decrypted_message']['message']; $this->handle_decrypted_update($update); } break; default: throw new \danog\MadelineProto\ResponseException(\danog\MadelineProto\Lang::$current_lang['unrecognized_dec_msg'].var_export($update, true)); break; } } } { "constructors": [ { "id": "-1132882121", "predicate": "boolFalse", "params": [], "type": "Bool" }, { "id": "-1720552011", "predicate": "boolTrue", "params": [], "type": "Bool" }, { "id": "1072550713", "predicate": "true", "params": [], "type": "True" }, { "id": "481674261", "predicate": "vector", "params": [], "type": "Vector t" }, { "id": "-994444869", "predicate": "error", "params": [ { "name": "code", "type": "int" }, { "name": "text", "type": "string" } ], "type": "Error" }, { "id": "1450380236", "predicate": "null", "params": [], "type": "Null" }, { "id": "2134579434", "predicate": "inputPeerEmpty", "params": [], "type": "InputPeer" }, { "id": "2107670217", "predicate": "inputPeerSelf", "params": [], "type": "InputPeer" }, { "id": "396093539", "predicate": "inputPeerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1182234929", "predicate": "inputUserEmpty", "params": [], "type": "InputUser" }, { "id": "-138301121", "predicate": "inputUserSelf", "params": [], "type": "InputUser" }, { "id": "-208488460", "predicate": "inputPhoneContact", "params": [ { "name": "client_id", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputContact" }, { "id": "-181407105", "predicate": "inputFile", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" }, { "name": "md5_checksum", "type": "string" } ], "type": "InputFile" }, { "id": "-1771768449", "predicate": "inputMediaEmpty", "params": [], "type": "InputMedia" }, { "id": "-139464256", "predicate": "inputMediaUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-373312269", "predicate": "inputMediaPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-104578748", "predicate": "inputMediaGeoPoint", "params": [ { "name": "geo_point", "type": "InputGeoPoint" } ], "type": "InputMedia" }, { "id": "-1494984313", "predicate": "inputMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputMedia" }, { "id": "-2106507297", "predicate": "inputMediaUploadedVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "2004934137", "predicate": "inputMediaUploadedThumbVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-1821749571", "predicate": "inputMediaVideo", "params": [ { "name": "id", "type": "InputVideo" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "480546647", "predicate": "inputChatPhotoEmpty", "params": [], "type": "InputChatPhoto" }, { "id": "-1809496270", "predicate": "inputChatUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-1293828344", "predicate": "inputChatPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-457104426", "predicate": "inputGeoPointEmpty", "params": [], "type": "InputGeoPoint" }, { "id": "-206066487", "predicate": "inputGeoPoint", "params": [ { "name": "lat", "type": "double" }, { "name": "long", "type": "double" } ], "type": "InputGeoPoint" }, { "id": "483901197", "predicate": "inputPhotoEmpty", "params": [], "type": "InputPhoto" }, { "id": "-74070332", "predicate": "inputPhoto", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputPhoto" }, { "id": "1426648181", "predicate": "inputVideoEmpty", "params": [], "type": "InputVideo" }, { "id": "-296249774", "predicate": "inputVideo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputVideo" }, { "id": "342061462", "predicate": "inputFileLocation", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1023632620", "predicate": "inputVideoFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-1377390588", "predicate": "inputPhotoCropAuto", "params": [], "type": "InputPhotoCrop" }, { "id": "-644787419", "predicate": "inputPhotoCrop", "params": [ { "name": "crop_left", "type": "double" }, { "name": "crop_top", "type": "double" }, { "name": "crop_width", "type": "double" } ], "type": "InputPhotoCrop" }, { "id": "1996904104", "predicate": "inputAppEvent", "params": [ { "name": "time", "type": "double" }, { "name": "type", "type": "string" }, { "name": "peer", "type": "long" }, { "name": "data", "type": "string" } ], "type": "InputAppEvent" }, { "id": "-1649296275", "predicate": "peerUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "Peer" }, { "id": "-1160714821", "predicate": "peerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Peer" }, { "id": "-1432995067", "predicate": "storage.fileUnknown", "params": [], "type": "storage.FileType" }, { "id": "8322574", "predicate": "storage.fileJpeg", "params": [], "type": "storage.FileType" }, { "id": "-891180321", "predicate": "storage.fileGif", "params": [], "type": "storage.FileType" }, { "id": "172975040", "predicate": "storage.filePng", "params": [], "type": "storage.FileType" }, { "id": "-1373745011", "predicate": "storage.filePdf", "params": [], "type": "storage.FileType" }, { "id": "1384777335", "predicate": "storage.fileMp3", "params": [], "type": "storage.FileType" }, { "id": "1258941372", "predicate": "storage.fileMov", "params": [], "type": "storage.FileType" }, { "id": "1086091090", "predicate": "storage.filePartial", "params": [], "type": "storage.FileType" }, { "id": "-1278304028", "predicate": "storage.fileMp4", "params": [], "type": "storage.FileType" }, { "id": "276907596", "predicate": "storage.fileWebp", "params": [], "type": "storage.FileType" }, { "id": "2086234950", "predicate": "fileLocationUnavailable", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "1406570614", "predicate": "fileLocation", "params": [ { "name": "dc_id", "type": "int" }, { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "537022650", "predicate": "userEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "User" }, { "id": "1326562017", "predicate": "userProfilePhotoEmpty", "params": [], "type": "UserProfilePhoto" }, { "id": "-715532088", "predicate": "userProfilePhoto", "params": [ { "name": "photo_id", "type": "long" }, { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "UserProfilePhoto" }, { "id": "164646985", "predicate": "userStatusEmpty", "params": [], "type": "UserStatus" }, { "id": "-306628279", "predicate": "userStatusOnline", "params": [ { "name": "expires", "type": "int" } ], "type": "UserStatus" }, { "id": "9203775", "predicate": "userStatusOffline", "params": [ { "name": "was_online", "type": "int" } ], "type": "UserStatus" }, { "id": "-1683826688", "predicate": "chatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Chat" }, { "id": "-652419756", "predicate": "chat", "params": [ { "name": "flags", "type": "#" }, { "name": "creator", "type": "flags.0?true" }, { "name": "kicked", "type": "flags.1?true" }, { "name": "left", "type": "flags.2?true" }, { "name": "admins_enabled", "type": "flags.3?true" }, { "name": "admin", "type": "flags.4?true" }, { "name": "deactivated", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" }, { "name": "migrated_to", "type": "flags.6?InputChannel" } ], "type": "Chat" }, { "id": "120753115", "predicate": "chatForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Chat" }, { "id": "771925524", "predicate": "chatFull", "params": [ { "name": "id", "type": "int" }, { "name": "participants", "type": "ChatParticipants" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector" } ], "type": "ChatFull" }, { "id": "-925415106", "predicate": "chatParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "-57668565", "predicate": "chatParticipantsForbidden", "params": [ { "name": "flags", "type": "#" }, { "name": "chat_id", "type": "int" }, { "name": "self_participant", "type": "flags.0?ChatParticipant" } ], "type": "ChatParticipants" }, { "id": "1061556205", "predicate": "chatParticipants", "params": [ { "name": "chat_id", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "version", "type": "int" } ], "type": "ChatParticipants" }, { "id": "935395612", "predicate": "chatPhotoEmpty", "params": [], "type": "ChatPhoto" }, { "id": "1632839530", "predicate": "chatPhoto", "params": [ { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "ChatPhoto" }, { "id": "-2082087340", "predicate": "messageEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Message" }, { "id": "1537633299", "predicate": "message", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "reply_markup", "type": "flags.6?ReplyMarkup" }, { "name": "entities", "type": "flags.7?Vector" }, { "name": "views", "type": "flags.10?int" } ], "type": "Message" }, { "id": "-1066691065", "predicate": "messageService", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "Message" }, { "id": "1038967584", "predicate": "messageMediaEmpty", "params": [], "type": "MessageMedia" }, { "id": "1032643901", "predicate": "messageMediaPhoto", "params": [ { "name": "photo", "type": "Photo" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1540298357", "predicate": "messageMediaVideo", "params": [ { "name": "video", "type": "Video" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1457575028", "predicate": "messageMediaGeo", "params": [ { "name": "geo", "type": "GeoPoint" } ], "type": "MessageMedia" }, { "id": "1585262393", "predicate": "messageMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "user_id", "type": "int" } ], "type": "MessageMedia" }, { "id": "-1618676578", "predicate": "messageMediaUnsupported", "params": [], "type": "MessageMedia" }, { "id": "-1230047312", "predicate": "messageActionEmpty", "params": [], "type": "MessageAction" }, { "id": "-1503425638", "predicate": "messageActionChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "users", "type": "Vector" } ], "type": "MessageAction" }, { "id": "-1247687078", "predicate": "messageActionChatEditTitle", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "2144015272", "predicate": "messageActionChatEditPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageAction" }, { "id": "-1780220945", "predicate": "messageActionChatDeletePhoto", "params": [], "type": "MessageAction" }, { "id": "1581055051", "predicate": "messageActionChatAddUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1297179892", "predicate": "messageActionChatDeleteUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1042448310", "predicate": "dialog", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Dialog" }, { "id": "590459437", "predicate": "photoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Photo" }, { "id": "-840088834", "predicate": "photo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "sizes", "type": "Vector" } ], "type": "Photo" }, { "id": "236446268", "predicate": "photoSizeEmpty", "params": [ { "name": "type", "type": "string" } ], "type": "PhotoSize" }, { "id": "2009052699", "predicate": "photoSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "size", "type": "int" } ], "type": "PhotoSize" }, { "id": "-374917894", "predicate": "photoCachedSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "PhotoSize" }, { "id": "-1056548696", "predicate": "videoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Video" }, { "id": "-148338733", "predicate": "video", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "Video" }, { "id": "286776671", "predicate": "geoPointEmpty", "params": [], "type": "GeoPoint" }, { "id": "541710092", "predicate": "geoPoint", "params": [ { "name": "long", "type": "double" }, { "name": "lat", "type": "double" } ], "type": "GeoPoint" }, { "id": "-2128698738", "predicate": "auth.checkedPhone", "params": [ { "name": "phone_registered", "type": "Bool" } ], "type": "auth.CheckedPhone" }, { "id": "-269659687", "predicate": "auth.sentCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "-16553231", "predicate": "auth.authorization", "params": [ { "name": "user", "type": "User" } ], "type": "auth.Authorization" }, { "id": "-543777747", "predicate": "auth.exportedAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.ExportedAuthorization" }, { "id": "-1195615476", "predicate": "inputNotifyPeer", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "InputNotifyPeer" }, { "id": "423314455", "predicate": "inputNotifyUsers", "params": [], "type": "InputNotifyPeer" }, { "id": "1251338318", "predicate": "inputNotifyChats", "params": [], "type": "InputNotifyPeer" }, { "id": "-1540769658", "predicate": "inputNotifyAll", "params": [], "type": "InputNotifyPeer" }, { "id": "-265263912", "predicate": "inputPeerNotifyEventsEmpty", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "-395694988", "predicate": "inputPeerNotifyEventsAll", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "1185074840", "predicate": "inputPeerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "InputPeerNotifySettings" }, { "id": "-1378534221", "predicate": "peerNotifyEventsEmpty", "params": [], "type": "PeerNotifyEvents" }, { "id": "1830677896", "predicate": "peerNotifyEventsAll", "params": [], "type": "PeerNotifyEvents" }, { "id": "1889961234", "predicate": "peerNotifySettingsEmpty", "params": [], "type": "PeerNotifySettings" }, { "id": "-1923214866", "predicate": "peerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "PeerNotifySettings" }, { "id": "-860866985", "predicate": "wallPaper", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "sizes", "type": "Vector" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "1518971995", "predicate": "userFull", "params": [ { "name": "user", "type": "User" }, { "name": "link", "type": "contacts.Link" }, { "name": "profile_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "blocked", "type": "Bool" }, { "name": "bot_info", "type": "BotInfo" } ], "type": "UserFull" }, { "id": "-116274796", "predicate": "contact", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual", "type": "Bool" } ], "type": "Contact" }, { "id": "-805141448", "predicate": "importedContact", "params": [ { "name": "user_id", "type": "int" }, { "name": "client_id", "type": "long" } ], "type": "ImportedContact" }, { "id": "1444661369", "predicate": "contactBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ContactBlocked" }, { "id": "1038193057", "predicate": "contactSuggested", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual_contacts", "type": "int" } ], "type": "ContactSuggested" }, { "id": "-748155807", "predicate": "contactStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "ContactStatus" }, { "id": "986597452", "predicate": "contacts.link", "params": [ { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" }, { "name": "user", "type": "User" } ], "type": "contacts.Link" }, { "id": "-1219778094", "predicate": "contacts.contactsNotModified", "params": [], "type": "contacts.Contacts" }, { "id": "1871416498", "predicate": "contacts.contacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Contacts" }, { "id": "-1387117803", "predicate": "contacts.importedContacts", "params": [ { "name": "imported", "type": "Vector" }, { "name": "retry_contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ImportedContacts" }, { "id": "471043349", "predicate": "contacts.blocked", "params": [ { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "-1878523231", "predicate": "contacts.blockedSlice", "params": [ { "name": "count", "type": "int" }, { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "1447681221", "predicate": "contacts.suggested", "params": [ { "name": "results", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Suggested" }, { "id": "364538944", "predicate": "messages.dialogs", "params": [ { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "1910543603", "predicate": "messages.dialogsSlice", "params": [ { "name": "count", "type": "int" }, { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "-1938715001", "predicate": "messages.messages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "189033187", "predicate": "messages.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "1694474197", "predicate": "messages.chats", "params": [ { "name": "chats", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "-438840932", "predicate": "messages.chatFull", "params": [ { "name": "full_chat", "type": "ChatFull" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.ChatFull" }, { "id": "-1269012015", "predicate": "messages.affectedHistory", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "1474492012", "predicate": "inputMessagesFilterEmpty", "params": [], "type": "MessagesFilter" }, { "id": "-1777752804", "predicate": "inputMessagesFilterPhotos", "params": [], "type": "MessagesFilter" }, { "id": "-1614803355", "predicate": "inputMessagesFilterVideo", "params": [], "type": "MessagesFilter" }, { "id": "1458172132", "predicate": "inputMessagesFilterPhotoVideo", "params": [], "type": "MessagesFilter" }, { "id": "-648121413", "predicate": "inputMessagesFilterPhotoVideoDocuments", "params": [], "type": "MessagesFilter" }, { "id": "-1629621880", "predicate": "inputMessagesFilterDocument", "params": [], "type": "MessagesFilter" }, { "id": "-808946398", "predicate": "inputMessagesFilterAudio", "params": [], "type": "MessagesFilter" }, { "id": "1526462308", "predicate": "inputMessagesFilterAudioDocuments", "params": [], "type": "MessagesFilter" }, { "id": "2129714567", "predicate": "inputMessagesFilterUrl", "params": [], "type": "MessagesFilter" }, { "id": "522914557", "predicate": "updateNewMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1318109142", "predicate": "updateMessageID", "params": [ { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Update" }, { "id": "-1576161051", "predicate": "updateDeleteMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1548249383", "predicate": "updateUserTyping", "params": [ { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "-1704596961", "predicate": "updateChatUserTyping", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "125178264", "predicate": "updateChatParticipants", "params": [ { "name": "participants", "type": "ChatParticipants" } ], "type": "Update" }, { "id": "469489699", "predicate": "updateUserStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "Update" }, { "id": "-1489818765", "predicate": "updateUserName", "params": [ { "name": "user_id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "Update" }, { "id": "-1791935732", "predicate": "updateUserPhoto", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "previous", "type": "Bool" } ], "type": "Update" }, { "id": "628472761", "predicate": "updateContactRegistered", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1657903163", "predicate": "updateContactLink", "params": [ { "name": "user_id", "type": "int" }, { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" } ], "type": "Update" }, { "id": "-1895411046", "predicate": "updateNewAuthorization", "params": [ { "name": "auth_key_id", "type": "long" }, { "name": "date", "type": "int" }, { "name": "device", "type": "string" }, { "name": "location", "type": "string" } ], "type": "Update" }, { "id": "-1519637954", "predicate": "updates.state", "params": [ { "name": "pts", "type": "int" }, { "name": "qts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "unread_count", "type": "int" } ], "type": "updates.State" }, { "id": "1567990072", "predicate": "updates.differenceEmpty", "params": [ { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "updates.Difference" }, { "id": "16030880", "predicate": "updates.difference", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-1459938943", "predicate": "updates.differenceSlice", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "intermediate_state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-484987010", "predicate": "updatesTooLong", "params": [], "type": "Updates" }, { "id": "-136766906", "predicate": "updateShortMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "-892863022", "predicate": "updateShortChatMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "chat_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "2027216577", "predicate": "updateShort", "params": [ { "name": "update", "type": "Update" }, { "name": "date", "type": "int" } ], "type": "Updates" }, { "id": "1918567619", "predicate": "updatesCombined", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq_start", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "1957577280", "predicate": "updates", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "-1916114267", "predicate": "photos.photos", "params": [ { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "352657236", "predicate": "photos.photosSlice", "params": [ { "name": "count", "type": "int" }, { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "539045032", "predicate": "photos.photo", "params": [ { "name": "photo", "type": "Photo" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photo" }, { "id": "157948117", "predicate": "upload.file", "params": [ { "name": "type", "type": "storage.FileType" }, { "name": "mtime", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "upload.File" }, { "id": "98092748", "predicate": "dcOption", "params": [ { "name": "flags", "type": "#" }, { "name": "ipv6", "type": "flags.0?true" }, { "name": "media_only", "type": "flags.1?true" }, { "name": "id", "type": "int" }, { "name": "ip_address", "type": "string" }, { "name": "port", "type": "int" } ], "type": "DcOption" }, { "id": "1823925854", "predicate": "config", "params": [ { "name": "date", "type": "int" }, { "name": "expires", "type": "int" }, { "name": "test_mode", "type": "Bool" }, { "name": "this_dc", "type": "int" }, { "name": "dc_options", "type": "Vector" }, { "name": "chat_size_max", "type": "int" }, { "name": "megagroup_size_max", "type": "int" }, { "name": "forwarded_count_max", "type": "int" }, { "name": "online_update_period_ms", "type": "int" }, { "name": "offline_blur_timeout_ms", "type": "int" }, { "name": "offline_idle_timeout_ms", "type": "int" }, { "name": "online_cloud_timeout_ms", "type": "int" }, { "name": "notify_cloud_delay_ms", "type": "int" }, { "name": "notify_default_delay_ms", "type": "int" }, { "name": "chat_big_size", "type": "int" }, { "name": "push_chat_period_ms", "type": "int" }, { "name": "push_chat_limit", "type": "int" }, { "name": "disabled_features", "type": "Vector" } ], "type": "Config" }, { "id": "-1910892683", "predicate": "nearestDc", "params": [ { "name": "country", "type": "string" }, { "name": "this_dc", "type": "int" }, { "name": "nearest_dc", "type": "int" } ], "type": "NearestDc" }, { "id": "-1987579119", "predicate": "help.appUpdate", "params": [ { "name": "id", "type": "int" }, { "name": "critical", "type": "Bool" }, { "name": "url", "type": "string" }, { "name": "text", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "-1000708810", "predicate": "help.noAppUpdate", "params": [], "type": "help.AppUpdate" }, { "id": "415997816", "predicate": "help.inviteText", "params": [ { "name": "message", "type": "string" } ], "type": "help.InviteText" }, { "id": "1662091044", "predicate": "wallPaperSolid", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "bg_color", "type": "int" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "314359194", "predicate": "updateNewEncryptedMessage", "params": [ { "name": "message", "type": "EncryptedMessage" }, { "name": "qts", "type": "int" } ], "type": "Update" }, { "id": "386986326", "predicate": "updateEncryptedChatTyping", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Update" }, { "id": "-1264392051", "predicate": "updateEncryption", "params": [ { "name": "chat", "type": "EncryptedChat" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "956179895", "predicate": "updateEncryptedMessagesRead", "params": [ { "name": "chat_id", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1417756512", "predicate": "encryptedChatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "1006044124", "predicate": "encryptedChatWaiting", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-931638658", "predicate": "encryptedChatRequested", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "-94974410", "predicate": "encryptedChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a_or_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "332848423", "predicate": "encryptedChatDiscarded", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-247351839", "predicate": "inputEncryptedChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedChat" }, { "id": "-1038136962", "predicate": "encryptedFileEmpty", "params": [], "type": "EncryptedFile" }, { "id": "1248893260", "predicate": "encryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "EncryptedFile" }, { "id": "406307684", "predicate": "inputEncryptedFileEmpty", "params": [], "type": "InputEncryptedFile" }, { "id": "1690108678", "predicate": "inputEncryptedFileUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "md5_checksum", "type": "string" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "1511503333", "predicate": "inputEncryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedFile" }, { "id": "-182231723", "predicate": "inputEncryptedFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-317144808", "predicate": "encryptedMessage", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" }, { "name": "file", "type": "EncryptedFile" } ], "type": "EncryptedMessage" }, { "id": "594758406", "predicate": "encryptedMessageService", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "EncryptedMessage" }, { "id": "-1058912715", "predicate": "messages.dhConfigNotModified", "params": [ { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "740433629", "predicate": "messages.dhConfig", "params": [ { "name": "g", "type": "int" }, { "name": "p", "type": "bytes" }, { "name": "version", "type": "int" }, { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "1443858741", "predicate": "messages.sentEncryptedMessage", "params": [ { "name": "date", "type": "int" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1802240206", "predicate": "messages.sentEncryptedFile", "params": [ { "name": "date", "type": "int" }, { "name": "file", "type": "EncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-95482955", "predicate": "inputFileBig", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" } ], "type": "InputFile" }, { "id": "767652808", "predicate": "inputEncryptedFileBigUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "-364179876", "predicate": "updateChatParticipantAdd", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1851755554", "predicate": "updateChatParticipantDelete", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1906403213", "predicate": "updateDcOptions", "params": [ { "name": "dc_options", "type": "Vector" } ], "type": "Update" }, { "id": "1313442987", "predicate": "inputMediaUploadedAudio", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1986820223", "predicate": "inputMediaAudio", "params": [ { "name": "id", "type": "InputAudio" } ], "type": "InputMedia" }, { "id": "-1610888", "predicate": "inputMediaUploadedDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "1095242886", "predicate": "inputMediaUploadedThumbDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "-779818943", "predicate": "inputMediaDocument", "params": [ { "name": "id", "type": "InputDocument" } ], "type": "InputMedia" }, { "id": "802824708", "predicate": "messageMediaDocument", "params": [ { "name": "document", "type": "Document" } ], "type": "MessageMedia" }, { "id": "-961117440", "predicate": "messageMediaAudio", "params": [ { "name": "audio", "type": "Audio" } ], "type": "MessageMedia" }, { "id": "-648356732", "predicate": "inputAudioEmpty", "params": [], "type": "InputAudio" }, { "id": "2010398975", "predicate": "inputAudio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputAudio" }, { "id": "1928391342", "predicate": "inputDocumentEmpty", "params": [], "type": "InputDocument" }, { "id": "410618194", "predicate": "inputDocument", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputDocument" }, { "id": "1960591437", "predicate": "inputAudioFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1313188841", "predicate": "inputDocumentFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1483311320", "predicate": "audioEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Audio" }, { "id": "-102543275", "predicate": "audio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" } ], "type": "Audio" }, { "id": "922273905", "predicate": "documentEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Document" }, { "id": "-106717361", "predicate": "document", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "attributes", "type": "Vector" } ], "type": "Document" }, { "id": "398898678", "predicate": "help.support", "params": [ { "name": "phone_number", "type": "string" }, { "name": "user", "type": "User" } ], "type": "help.Support" }, { "id": "-1613493288", "predicate": "notifyPeer", "params": [ { "name": "peer", "type": "Peer" } ], "type": "NotifyPeer" }, { "id": "-1261946036", "predicate": "notifyUsers", "params": [], "type": "NotifyPeer" }, { "id": "-1073230141", "predicate": "notifyChats", "params": [], "type": "NotifyPeer" }, { "id": "1959820384", "predicate": "notifyAll", "params": [], "type": "NotifyPeer" }, { "id": "-2131957734", "predicate": "updateUserBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "blocked", "type": "Bool" } ], "type": "Update" }, { "id": "-1094555409", "predicate": "updateNotifySettings", "params": [ { "name": "peer", "type": "NotifyPeer" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Update" }, { "id": "-484053553", "predicate": "auth.sentAppCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "381645902", "predicate": "sendMessageTypingAction", "params": [], "type": "SendMessageAction" }, { "id": "-44119819", "predicate": "sendMessageCancelAction", "params": [], "type": "SendMessageAction" }, { "id": "-1584933265", "predicate": "sendMessageRecordVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-378127636", "predicate": "sendMessageUploadVideoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-718310409", "predicate": "sendMessageRecordAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-212740181", "predicate": "sendMessageUploadAudioAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-774682074", "predicate": "sendMessageUploadPhotoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-1441998364", "predicate": "sendMessageUploadDocumentAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "393186209", "predicate": "sendMessageGeoLocationAction", "params": [], "type": "SendMessageAction" }, { "id": "1653390447", "predicate": "sendMessageChooseContactAction", "params": [], "type": "SendMessageAction" }, { "id": "446822276", "predicate": "contacts.found", "params": [ { "name": "results", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Found" }, { "id": "942527460", "predicate": "updateServiceNotification", "params": [ { "name": "type", "type": "string" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" }, { "name": "popup", "type": "Bool" } ], "type": "Update" }, { "id": "-496024847", "predicate": "userStatusRecently", "params": [], "type": "UserStatus" }, { "id": "129960444", "predicate": "userStatusLastWeek", "params": [], "type": "UserStatus" }, { "id": "2011940674", "predicate": "userStatusLastMonth", "params": [], "type": "UserStatus" }, { "id": "-298113238", "predicate": "updatePrivacy", "params": [ { "name": "key", "type": "PrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "Update" }, { "id": "1335282456", "predicate": "inputPrivacyKeyStatusTimestamp", "params": [], "type": "InputPrivacyKey" }, { "id": "-1137792208", "predicate": "privacyKeyStatusTimestamp", "params": [], "type": "PrivacyKey" }, { "id": "218751099", "predicate": "inputPrivacyValueAllowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "407582158", "predicate": "inputPrivacyValueAllowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "320652927", "predicate": "inputPrivacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "195371015", "predicate": "inputPrivacyValueDisallowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "-697604407", "predicate": "inputPrivacyValueDisallowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "-1877932953", "predicate": "inputPrivacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "-123988", "predicate": "privacyValueAllowContacts", "params": [], "type": "PrivacyRule" }, { "id": "1698855810", "predicate": "privacyValueAllowAll", "params": [], "type": "PrivacyRule" }, { "id": "1297858060", "predicate": "privacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "-125240806", "predicate": "privacyValueDisallowContacts", "params": [], "type": "PrivacyRule" }, { "id": "-1955338397", "predicate": "privacyValueDisallowAll", "params": [], "type": "PrivacyRule" }, { "id": "209668535", "predicate": "privacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "1430961007", "predicate": "account.privacyRules", "params": [ { "name": "rules", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "-1194283041", "predicate": "accountDaysTTL", "params": [ { "name": "days", "type": "int" } ], "type": "AccountDaysTTL" }, { "id": "-1527411636", "predicate": "account.sentChangePhoneCode", "params": [ { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" } ], "type": "account.SentChangePhoneCode" }, { "id": "314130811", "predicate": "updateUserPhone", "params": [ { "name": "user_id", "type": "int" }, { "name": "phone", "type": "string" } ], "type": "Update" }, { "id": "1815593308", "predicate": "documentAttributeImageSize", "params": [ { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "297109817", "predicate": "documentAttributeAnimated", "params": [], "type": "DocumentAttribute" }, { "id": "978674434", "predicate": "documentAttributeSticker", "params": [ { "name": "alt", "type": "string" }, { "name": "stickerset", "type": "InputStickerSet" } ], "type": "DocumentAttribute" }, { "id": "1494273227", "predicate": "documentAttributeVideo", "params": [ { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "-556656416", "predicate": "documentAttributeAudio", "params": [ { "name": "duration", "type": "int" }, { "name": "title", "type": "string" }, { "name": "performer", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "358154344", "predicate": "documentAttributeFilename", "params": [ { "name": "file_name", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "-244016606", "predicate": "messages.stickersNotModified", "params": [], "type": "messages.Stickers" }, { "id": "-1970352846", "predicate": "messages.stickers", "params": [ { "name": "hash", "type": "string" }, { "name": "stickers", "type": "Vector" } ], "type": "messages.Stickers" }, { "id": "313694676", "predicate": "stickerPack", "params": [ { "name": "emoticon", "type": "string" }, { "name": "documents", "type": "Vector" } ], "type": "StickerPack" }, { "id": "-395967805", "predicate": "messages.allStickersNotModified", "params": [], "type": "messages.AllStickers" }, { "id": "-719474725", "predicate": "messages.allStickers", "params": [ { "name": "hash", "type": "string" }, { "name": "sets", "type": "Vector" } ], "type": "messages.AllStickers" }, { "id": "-1369215196", "predicate": "disabledFeature", "params": [ { "name": "feature", "type": "string" }, { "name": "description", "type": "string" } ], "type": "DisabledFeature" }, { "id": "-1721631396", "predicate": "updateReadHistoryInbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "791617983", "predicate": "updateReadHistoryOutbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-2066640507", "predicate": "messages.affectedMessages", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "1599050311", "predicate": "contactLinkUnknown", "params": [], "type": "ContactLink" }, { "id": "-17968211", "predicate": "contactLinkNone", "params": [], "type": "ContactLink" }, { "id": "646922073", "predicate": "contactLinkHasPhone", "params": [], "type": "ContactLink" }, { "id": "-721239344", "predicate": "contactLinkContact", "params": [], "type": "ContactLink" }, { "id": "2139689491", "predicate": "updateWebPage", "params": [ { "name": "webpage", "type": "WebPage" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-350980120", "predicate": "webPageEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "WebPage" }, { "id": "-981018084", "predicate": "webPagePending", "params": [ { "name": "id", "type": "long" }, { "name": "date", "type": "int" } ], "type": "WebPage" }, { "id": "-897446185", "predicate": "webPage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "long" }, { "name": "url", "type": "string" }, { "name": "display_url", "type": "string" }, { "name": "type", "type": "flags.0?string" }, { "name": "site_name", "type": "flags.1?string" }, { "name": "title", "type": "flags.2?string" }, { "name": "description", "type": "flags.3?string" }, { "name": "photo", "type": "flags.4?Photo" }, { "name": "embed_url", "type": "flags.5?string" }, { "name": "embed_type", "type": "flags.5?string" }, { "name": "embed_width", "type": "flags.6?int" }, { "name": "embed_height", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "author", "type": "flags.8?string" }, { "name": "document", "type": "flags.9?Document" } ], "type": "WebPage" }, { "id": "-1557277184", "predicate": "messageMediaWebPage", "params": [ { "name": "webpage", "type": "WebPage" } ], "type": "MessageMedia" }, { "id": "2079516406", "predicate": "authorization", "params": [ { "name": "hash", "type": "long" }, { "name": "flags", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "platform", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "api_id", "type": "int" }, { "name": "app_name", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "date_created", "type": "int" }, { "name": "date_active", "type": "int" }, { "name": "ip", "type": "string" }, { "name": "country", "type": "string" }, { "name": "region", "type": "string" } ], "type": "Authorization" }, { "id": "307276766", "predicate": "account.authorizations", "params": [ { "name": "authorizations", "type": "Vector" } ], "type": "account.Authorizations" }, { "id": "-1764049896", "predicate": "account.noPassword", "params": [ { "name": "new_salt", "type": "bytes" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "2081952796", "predicate": "account.password", "params": [ { "name": "current_salt", "type": "bytes" }, { "name": "new_salt", "type": "bytes" }, { "name": "hint", "type": "string" }, { "name": "has_recovery", "type": "Bool" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "-1212732749", "predicate": "account.passwordSettings", "params": [ { "name": "email", "type": "string" } ], "type": "account.PasswordSettings" }, { "id": "-1124314324", "predicate": "account.passwordInputSettings", "params": [ { "name": "flags", "type": "#" }, { "name": "new_salt", "type": "flags.0?bytes" }, { "name": "new_password_hash", "type": "flags.0?bytes" }, { "name": "hint", "type": "flags.0?string" }, { "name": "email", "type": "flags.1?string" } ], "type": "account.PasswordInputSettings" }, { "id": "326715557", "predicate": "auth.passwordRecovery", "params": [ { "name": "email_pattern", "type": "string" } ], "type": "auth.PasswordRecovery" }, { "id": "673687578", "predicate": "inputMediaVenue", "params": [ { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "InputMedia" }, { "id": "2031269663", "predicate": "messageMediaVenue", "params": [ { "name": "geo", "type": "GeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "MessageMedia" }, { "id": "-1551583367", "predicate": "receivedNotifyMessage", "params": [ { "name": "id", "type": "int" }, { "name": "flags", "type": "int" } ], "type": "ReceivedNotifyMessage" }, { "id": "1776236393", "predicate": "chatInviteEmpty", "params": [], "type": "ExportedChatInvite" }, { "id": "-64092740", "predicate": "chatInviteExported", "params": [ { "name": "link", "type": "string" } ], "type": "ExportedChatInvite" }, { "id": "1516793212", "predicate": "chatInviteAlready", "params": [ { "name": "chat", "type": "Chat" } ], "type": "ChatInvite" }, { "id": "-1813406880", "predicate": "chatInvite", "params": [ { "name": "flags", "type": "#" }, { "name": "channel", "type": "flags.0?true" }, { "name": "broadcast", "type": "flags.1?true" }, { "name": "public", "type": "flags.2?true" }, { "name": "megagroup", "type": "flags.3?true" }, { "name": "title", "type": "string" } ], "type": "ChatInvite" }, { "id": "-123931160", "predicate": "messageActionChatJoinedByLink", "params": [ { "name": "inviter_id", "type": "int" } ], "type": "MessageAction" }, { "id": "1757493555", "predicate": "updateReadMessagesContents", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-4838507", "predicate": "inputStickerSetEmpty", "params": [], "type": "InputStickerSet" }, { "id": "-1645763991", "predicate": "inputStickerSetID", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputStickerSet" }, { "id": "-2044933984", "predicate": "inputStickerSetShortName", "params": [ { "name": "short_name", "type": "string" } ], "type": "InputStickerSet" }, { "id": "-852477119", "predicate": "stickerSet", "params": [ { "name": "flags", "type": "#" }, { "name": "installed", "type": "flags.0?true" }, { "name": "disabled", "type": "flags.1?true" }, { "name": "official", "type": "flags.2?true" }, { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "short_name", "type": "string" }, { "name": "count", "type": "int" }, { "name": "hash", "type": "int" } ], "type": "StickerSet" }, { "id": "-1240849242", "predicate": "messages.stickerSet", "params": [ { "name": "set", "type": "StickerSet" }, { "name": "packs", "type": "Vector" }, { "name": "documents", "type": "Vector" } ], "type": "messages.StickerSet" }, { "id": "585404530", "predicate": "user", "params": [ { "name": "flags", "type": "#" }, { "name": "self", "type": "flags.10?true" }, { "name": "contact", "type": "flags.11?true" }, { "name": "mutual_contact", "type": "flags.12?true" }, { "name": "deleted", "type": "flags.13?true" }, { "name": "bot", "type": "flags.14?true" }, { "name": "bot_chat_history", "type": "flags.15?true" }, { "name": "bot_nochats", "type": "flags.16?true" }, { "name": "verified", "type": "flags.17?true" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "flags.0?long" }, { "name": "first_name", "type": "flags.1?string" }, { "name": "last_name", "type": "flags.2?string" }, { "name": "username", "type": "flags.3?string" }, { "name": "phone", "type": "flags.4?string" }, { "name": "photo", "type": "flags.5?UserProfilePhoto" }, { "name": "status", "type": "flags.6?UserStatus" }, { "name": "bot_info_version", "type": "flags.14?int" } ], "type": "User" }, { "id": "-1032140601", "predicate": "botCommand", "params": [ { "name": "command", "type": "string" }, { "name": "description", "type": "string" } ], "type": "BotCommand" }, { "id": "-1154598962", "predicate": "botInfoEmpty", "params": [], "type": "BotInfo" }, { "id": "164583517", "predicate": "botInfo", "params": [ { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" }, { "name": "share_text", "type": "string" }, { "name": "description", "type": "string" }, { "name": "commands", "type": "Vector" } ], "type": "BotInfo" }, { "id": "-1560655744", "predicate": "keyboardButton", "params": [ { "name": "text", "type": "string" } ], "type": "KeyboardButton" }, { "id": "2002815875", "predicate": "keyboardButtonRow", "params": [ { "name": "buttons", "type": "Vector" } ], "type": "KeyboardButtonRow" }, { "id": "-1606526075", "predicate": "replyKeyboardHide", "params": [ { "name": "flags", "type": "#" }, { "name": "selective", "type": "flags.2?true" } ], "type": "ReplyMarkup" }, { "id": "-200242528", "predicate": "replyKeyboardForceReply", "params": [ { "name": "flags", "type": "#" }, { "name": "single_use", "type": "flags.1?true" }, { "name": "selective", "type": "flags.2?true" } ], "type": "ReplyMarkup" }, { "id": "889353612", "predicate": "replyKeyboardMarkup", "params": [ { "name": "flags", "type": "#" }, { "name": "resize", "type": "flags.0?true" }, { "name": "single_use", "type": "flags.1?true" }, { "name": "selective", "type": "flags.2?true" }, { "name": "rows", "type": "Vector" } ], "type": "ReplyMarkup" }, { "id": "2072935910", "predicate": "inputPeerUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "-668391402", "predicate": "inputUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputUser" }, { "id": "-1350696044", "predicate": "help.appChangelogEmpty", "params": [], "type": "help.AppChangelog" }, { "id": "1181279933", "predicate": "help.appChangelog", "params": [ { "name": "text", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-1148011883", "predicate": "messageEntityUnknown", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-100378723", "predicate": "messageEntityMention", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1868782349", "predicate": "messageEntityHashtag", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1827637959", "predicate": "messageEntityBotCommand", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1859134776", "predicate": "messageEntityUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1692693954", "predicate": "messageEntityEmail", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-1117713463", "predicate": "messageEntityBold", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-2106619040", "predicate": "messageEntityItalic", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "681706865", "predicate": "messageEntityCode", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1938967520", "predicate": "messageEntityPre", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "language", "type": "string" } ], "type": "MessageEntity" }, { "id": "1990644519", "predicate": "messageEntityTextUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "url", "type": "string" } ], "type": "MessageEntity" }, { "id": "301019932", "predicate": "updateShortSentMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "-292807034", "predicate": "inputChannelEmpty", "params": [], "type": "InputChannel" }, { "id": "-1343524562", "predicate": "inputChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputChannel" }, { "id": "-1109531342", "predicate": "peerChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Peer" }, { "id": "548253432", "predicate": "inputPeerChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "1737397639", "predicate": "channel", "params": [ { "name": "flags", "type": "#" }, { "name": "creator", "type": "flags.0?true" }, { "name": "kicked", "type": "flags.1?true" }, { "name": "left", "type": "flags.2?true" }, { "name": "editor", "type": "flags.3?true" }, { "name": "moderator", "type": "flags.4?true" }, { "name": "broadcast", "type": "flags.5?true" }, { "name": "verified", "type": "flags.7?true" }, { "name": "megagroup", "type": "flags.8?true" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "username", "type": "flags.6?string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Chat" }, { "id": "763724588", "predicate": "channelForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" } ], "type": "Chat" }, { "id": "2131196633", "predicate": "contacts.resolvedPeer", "params": [ { "name": "peer", "type": "Peer" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ResolvedPeer" }, { "id": "-1640751649", "predicate": "channelFull", "params": [ { "name": "flags", "type": "#" }, { "name": "can_view_participants", "type": "flags.3?true" }, { "name": "id", "type": "int" }, { "name": "about", "type": "string" }, { "name": "participants_count", "type": "flags.0?int" }, { "name": "admins_count", "type": "flags.1?int" }, { "name": "kicked_count", "type": "flags.2?int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector" }, { "name": "migrated_from_chat_id", "type": "flags.4?int" }, { "name": "migrated_from_max_id", "type": "flags.4?int" } ], "type": "ChatFull" }, { "id": "1535415986", "predicate": "dialogChannel", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "top_important_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "pts", "type": "int" } ], "type": "Dialog" }, { "id": "182649427", "predicate": "messageRange", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "MessageRange" }, { "id": "-399216813", "predicate": "messageGroup", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "count", "type": "int" }, { "name": "date", "type": "int" } ], "type": "MessageGroup" }, { "id": "-1139861572", "predicate": "messages.channelMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "pts", "type": "int" }, { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "collapsed", "type": "flags.0?Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "-1781355374", "predicate": "messageActionChannelCreate", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "1620337698", "predicate": "updateChannelTooLong", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Update" }, { "id": "-1227598250", "predicate": "updateChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Update" }, { "id": "-1016324548", "predicate": "updateChannelGroup", "params": [ { "name": "channel_id", "type": "int" }, { "name": "group", "type": "MessageGroup" } ], "type": "Update" }, { "id": "1656358105", "predicate": "updateNewChannelMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1108669311", "predicate": "updateReadChannelInbox", "params": [ { "name": "channel_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "Update" }, { "id": "-1015733815", "predicate": "updateDeleteChannelMessages", "params": [ { "name": "channel_id", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-1734268085", "predicate": "updateChannelMessageViews", "params": [ { "name": "channel_id", "type": "int" }, { "name": "id", "type": "int" }, { "name": "views", "type": "int" } ], "type": "Update" }, { "id": "1041346555", "predicate": "updates.channelDifferenceEmpty", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" } ], "type": "updates.ChannelDifference" }, { "id": "1578530374", "predicate": "updates.channelDifferenceTooLong", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "top_message", "type": "int" }, { "name": "top_important_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "updates.ChannelDifference" }, { "id": "543450958", "predicate": "updates.channelDifference", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "new_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "updates.ChannelDifference" }, { "id": "-1798033689", "predicate": "channelMessagesFilterEmpty", "params": [], "type": "ChannelMessagesFilter" }, { "id": "-847783593", "predicate": "channelMessagesFilter", "params": [ { "name": "flags", "type": "#" }, { "name": "important_only", "type": "flags.0?true" }, { "name": "ranges", "type": "Vector" } ], "type": "ChannelMessagesFilter" }, { "id": "-100588754", "predicate": "channelMessagesFilterCollapsed", "params": [], "type": "ChannelMessagesFilter" }, { "id": "367766557", "predicate": "channelParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1557620115", "predicate": "channelParticipantSelf", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1861910545", "predicate": "channelParticipantModerator", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1743180447", "predicate": "channelParticipantEditor", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1933187430", "predicate": "channelParticipantKicked", "params": [ { "name": "user_id", "type": "int" }, { "name": "kicked_by", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-471670279", "predicate": "channelParticipantCreator", "params": [ { "name": "user_id", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-566281095", "predicate": "channelParticipantsRecent", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-1268741783", "predicate": "channelParticipantsAdmins", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "1010285434", "predicate": "channelParticipantsKicked", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-1299865402", "predicate": "channelRoleEmpty", "params": [], "type": "ChannelParticipantRole" }, { "id": "-1776756363", "predicate": "channelRoleModerator", "params": [], "type": "ChannelParticipantRole" }, { "id": "-2113143156", "predicate": "channelRoleEditor", "params": [], "type": "ChannelParticipantRole" }, { "id": "-177282392", "predicate": "channels.channelParticipants", "params": [ { "name": "count", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "channels.ChannelParticipants" }, { "id": "-791039645", "predicate": "channels.channelParticipant", "params": [ { "name": "participant", "type": "ChannelParticipant" }, { "name": "users", "type": "Vector" } ], "type": "channels.ChannelParticipant" }, { "id": "-636267638", "predicate": "chatParticipantCreator", "params": [ { "name": "user_id", "type": "int" } ], "type": "ChatParticipant" }, { "id": "-489233354", "predicate": "chatParticipantAdmin", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "1855224129", "predicate": "updateChatAdmins", "params": [ { "name": "chat_id", "type": "int" }, { "name": "enabled", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1232070311", "predicate": "updateChatParticipantAdmin", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "is_admin", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1371385889", "predicate": "messageActionChatMigrateTo", "params": [ { "name": "channel_id", "type": "int" } ], "type": "MessageAction" }, { "id": "1689067688", "predicate": "messageActionChatDeactivate", "params": [], "type": "MessageAction" }, { "id": "1085115570", "predicate": "messageActionChatActivate", "params": [], "type": "MessageAction" }, { "id": "-1336546578", "predicate": "messageActionChannelMigrateFrom", "params": [ { "name": "title", "type": "string" }, { "name": "chat_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1328445861", "predicate": "channelParticipantsBots", "params": [], "type": "ChannelParticipantsFilter" } ], "methods": [ { "id": "-878758099", "method": "invokeAfterMsg", "params": [ { "name": "msg_id", "type": "long" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1036301552", "method": "invokeAfterMsgs", "params": [ { "name": "msg_ids", "type": "Vector" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1877286395", "method": "auth.checkPhone", "params": [ { "name": "phone_number", "type": "string" } ], "type": "auth.CheckedPhone" }, { "id": "1988976461", "method": "auth.sendCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "sms_type", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "auth.SentCode" }, { "id": "63247716", "method": "auth.sendCall", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "453408308", "method": "auth.signUp", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1126886015", "method": "auth.signIn", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "1461180992", "method": "auth.logOut", "params": [], "type": "Bool" }, { "id": "-1616179942", "method": "auth.resetAuthorizations", "params": [], "type": "Bool" }, { "id": "1998331287", "method": "auth.sendInvites", "params": [ { "name": "phone_numbers", "type": "Vector" }, { "name": "message", "type": "string" } ], "type": "Bool" }, { "id": "-440401971", "method": "auth.exportAuthorization", "params": [ { "name": "dc_id", "type": "int" } ], "type": "auth.ExportedAuthorization" }, { "id": "-470837741", "method": "auth.importAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-841733627", "method": "auth.bindTempAuthKey", "params": [ { "name": "perm_auth_key_id", "type": "long" }, { "name": "nonce", "type": "long" }, { "name": "expires_at", "type": "int" }, { "name": "encrypted_message", "type": "bytes" } ], "type": "Bool" }, { "id": "1147957548", "method": "account.registerDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "app_sandbox", "type": "Bool" }, { "name": "lang_code", "type": "string" } ], "type": "Bool" }, { "id": "1707432768", "method": "account.unregisterDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" } ], "type": "Bool" }, { "id": "-2067899501", "method": "account.updateNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" }, { "name": "settings", "type": "InputPeerNotifySettings" } ], "type": "Bool" }, { "id": "313765169", "method": "account.getNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" } ], "type": "PeerNotifySettings" }, { "id": "-612493497", "method": "account.resetNotifySettings", "params": [], "type": "Bool" }, { "id": "-259486360", "method": "account.updateProfile", "params": [ { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "User" }, { "id": "1713919532", "method": "account.updateStatus", "params": [ { "name": "offline", "type": "Bool" } ], "type": "Bool" }, { "id": "-1068696894", "method": "account.getWallPapers", "params": [], "type": "Vector" }, { "id": "227648840", "method": "users.getUsers", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-902781519", "method": "users.getFullUser", "params": [ { "name": "id", "type": "InputUser" } ], "type": "UserFull" }, { "id": "-995929106", "method": "contacts.getStatuses", "params": [], "type": "Vector" }, { "id": "583445000", "method": "contacts.getContacts", "params": [ { "name": "hash", "type": "string" } ], "type": "contacts.Contacts" }, { "id": "-634342611", "method": "contacts.importContacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "replace", "type": "Bool" } ], "type": "contacts.ImportedContacts" }, { "id": "-847825880", "method": "contacts.getSuggested", "params": [ { "name": "limit", "type": "int" } ], "type": "contacts.Suggested" }, { "id": "-1902823612", "method": "contacts.deleteContact", "params": [ { "name": "id", "type": "InputUser" } ], "type": "contacts.Link" }, { "id": "1504393374", "method": "contacts.deleteContacts", "params": [ { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "858475004", "method": "contacts.block", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-448724803", "method": "contacts.unblock", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-176409329", "method": "contacts.getBlocked", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "contacts.Blocked" }, { "id": "-2065352905", "method": "contacts.exportCard", "params": [], "type": "Vector" }, { "id": "1340184318", "method": "contacts.importCard", "params": [ { "name": "export_card", "type": "Vector" } ], "type": "User" }, { "id": "1109588596", "method": "messages.getMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "-2053423812", "method": "messages.getDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-1970355494", "method": "messages.getHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset_id", "type": "int" }, { "name": "add_offset", "type": "int" }, { "name": "limit", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" } ], "type": "messages.Messages" }, { "id": "-732523960", "method": "messages.search", "params": [ { "name": "flags", "type": "#" }, { "name": "important_only", "type": "flags.0?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "238054714", "method": "messages.readHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "-1212072999", "method": "messages.deleteHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-1510897371", "method": "messages.deleteMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "94983360", "method": "messages.receivedMessages", "params": [ { "name": "max_id", "type": "int" } ], "type": "Vector" }, { "id": "-1551737264", "method": "messages.setTyping", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Bool" }, { "id": "-91733382", "method": "messages.sendMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.1?true" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" }, { "name": "entities", "type": "flags.3?Vector" } ], "type": "Updates" }, { "id": "-923703407", "method": "messages.sendMedia", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "Updates" }, { "id": "1888354709", "method": "messages.forwardMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "from_peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "random_id", "type": "Vector" }, { "name": "to_peer", "type": "InputPeer" } ], "type": "Updates" }, { "id": "-820669733", "method": "messages.reportSpam", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "Bool" }, { "id": "1013621127", "method": "messages.getChats", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "998448230", "method": "messages.getFullChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "messages.ChatFull" }, { "id": "-599447467", "method": "messages.editChatTitle", "params": [ { "name": "chat_id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-900957736", "method": "messages.editChatPhoto", "params": [ { "name": "chat_id", "type": "int" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-106911223", "method": "messages.addChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "fwd_limit", "type": "int" } ], "type": "Updates" }, { "id": "-530505962", "method": "messages.deleteChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" } ], "type": "Updates" }, { "id": "164303470", "method": "messages.createChat", "params": [ { "name": "users", "type": "Vector" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-304838614", "method": "updates.getState", "params": [], "type": "updates.State" }, { "id": "168039573", "method": "updates.getDifference", "params": [ { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "qts", "type": "int" } ], "type": "updates.Difference" }, { "id": "-285902432", "method": "photos.updateProfilePhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "UserProfilePhoto" }, { "id": "-720397176", "method": "photos.uploadProfilePhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "photos.Photo" }, { "id": "-2016444625", "method": "photos.deletePhotos", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-1291540959", "method": "upload.saveFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "-475607115", "method": "upload.getFile", "params": [ { "name": "location", "type": "InputFileLocation" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "upload.File" }, { "id": "-990308245", "method": "help.getConfig", "params": [], "type": "Config" }, { "id": "531836966", "method": "help.getNearestDc", "params": [], "type": "NearestDc" }, { "id": "-938300290", "method": "help.getAppUpdate", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "1862465352", "method": "help.saveAppLog", "params": [ { "name": "events", "type": "Vector" } ], "type": "Bool" }, { "id": "-1532407418", "method": "help.getInviteText", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.InviteText" }, { "id": "-1848823128", "method": "photos.getUserPhotos", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "long" }, { "name": "limit", "type": "int" } ], "type": "photos.Photos" }, { "id": "865483769", "method": "messages.forwardMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Updates" }, { "id": "-1082919718", "method": "messages.sendBroadcast", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "random_id", "type": "Vector" }, { "name": "message", "type": "string" }, { "name": "media", "type": "InputMedia" } ], "type": "Updates" }, { "id": "651135312", "method": "messages.getDhConfig", "params": [ { "name": "version", "type": "int" }, { "name": "random_length", "type": "int" } ], "type": "messages.DhConfig" }, { "id": "-162681021", "method": "messages.requestEncryption", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "random_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "1035731989", "method": "messages.acceptEncryption", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "g_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "-304536635", "method": "messages.discardEncryption", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Bool" }, { "id": "2031374829", "method": "messages.setEncryptedTyping", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "2135648522", "method": "messages.readEncryptedHistory", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "max_date", "type": "int" } ], "type": "Bool" }, { "id": "-1451792525", "method": "messages.sendEncrypted", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1701831834", "method": "messages.sendEncryptedFile", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" }, { "name": "file", "type": "InputEncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "852769188", "method": "messages.sendEncryptedService", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "1436924774", "method": "messages.receivedQueue", "params": [ { "name": "max_qts", "type": "int" } ], "type": "Vector" }, { "id": "-562337987", "method": "upload.saveBigFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "file_total_parts", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "1769565673", "method": "initConnection", "params": [ { "name": "api_id", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-1663104819", "method": "help.getSupport", "params": [], "type": "help.Support" }, { "id": "229241832", "method": "auth.sendSms", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "916930423", "method": "messages.readMessageContents", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "655677548", "method": "account.checkUsername", "params": [ { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "1040964988", "method": "account.updateUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "301470424", "method": "contacts.search", "params": [ { "name": "q", "type": "string" }, { "name": "limit", "type": "int" } ], "type": "contacts.Found" }, { "id": "-623130288", "method": "account.getPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" } ], "type": "account.PrivacyRules" }, { "id": "-906486552", "method": "account.setPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "1099779595", "method": "account.deleteAccount", "params": [ { "name": "reason", "type": "string" } ], "type": "Bool" }, { "id": "150761757", "method": "account.getAccountTTL", "params": [], "type": "AccountDaysTTL" }, { "id": "608323678", "method": "account.setAccountTTL", "params": [ { "name": "ttl", "type": "AccountDaysTTL" } ], "type": "Bool" }, { "id": "-627372787", "method": "invokeWithLayer", "params": [ { "name": "layer", "type": "int" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-113456221", "method": "contacts.resolveUsername", "params": [ { "name": "username", "type": "string" } ], "type": "contacts.ResolvedPeer" }, { "id": "-1543001868", "method": "account.sendChangePhoneCode", "params": [ { "name": "phone_number", "type": "string" } ], "type": "account.SentChangePhoneCode" }, { "id": "1891839707", "method": "account.changePhone", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "User" }, { "id": "-1373446075", "method": "messages.getStickers", "params": [ { "name": "emoticon", "type": "string" }, { "name": "hash", "type": "string" } ], "type": "messages.Stickers" }, { "id": "-1438922648", "method": "messages.getAllStickers", "params": [ { "name": "hash", "type": "string" } ], "type": "messages.AllStickers" }, { "id": "954152242", "method": "account.updateDeviceLocked", "params": [ { "name": "period", "type": "int" } ], "type": "Bool" }, { "id": "1738800940", "method": "auth.importBotAuthorization", "params": [ { "name": "flags", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "bot_auth_token", "type": "string" } ], "type": "auth.Authorization" }, { "id": "623001124", "method": "messages.getWebPagePreview", "params": [ { "name": "message", "type": "string" } ], "type": "MessageMedia" }, { "id": "-484392616", "method": "account.getAuthorizations", "params": [], "type": "account.Authorizations" }, { "id": "-545786948", "method": "account.resetAuthorization", "params": [ { "name": "hash", "type": "long" } ], "type": "Bool" }, { "id": "1418342645", "method": "account.getPassword", "params": [], "type": "account.Password" }, { "id": "-1131605573", "method": "account.getPasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" } ], "type": "account.PasswordSettings" }, { "id": "-92517498", "method": "account.updatePasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" }, { "name": "new_settings", "type": "account.PasswordInputSettings" } ], "type": "Bool" }, { "id": "174260510", "method": "auth.checkPassword", "params": [ { "name": "password_hash", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-661144474", "method": "auth.requestPasswordRecovery", "params": [], "type": "auth.PasswordRecovery" }, { "id": "1319464594", "method": "auth.recoverPassword", "params": [ { "name": "code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1080796745", "method": "invokeWithoutUpdates", "params": [ { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "2106086025", "method": "messages.exportChatInvite", "params": [ { "name": "chat_id", "type": "int" } ], "type": "ExportedChatInvite" }, { "id": "1051570619", "method": "messages.checkChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "ChatInvite" }, { "id": "1817183516", "method": "messages.importChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "Updates" }, { "id": "639215886", "method": "messages.getStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "messages.StickerSet" }, { "id": "2066793382", "method": "messages.installStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" }, { "name": "disabled", "type": "Bool" } ], "type": "Bool" }, { "id": "-110209570", "method": "messages.uninstallStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "Bool" }, { "id": "-421563528", "method": "messages.startBot", "params": [ { "name": "bot", "type": "InputUser" }, { "name": "peer", "type": "InputPeer" }, { "name": "random_id", "type": "long" }, { "name": "start_param", "type": "string" } ], "type": "Updates" }, { "id": "1537966002", "method": "help.getAppChangelog", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-993483427", "method": "messages.getMessagesViews", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "increment", "type": "Bool" } ], "type": "Vector" }, { "id": "-1445735863", "method": "channels.getDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-575067701", "method": "channels.getImportantHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "offset_id", "type": "int" }, { "name": "add_offset", "type": "int" }, { "name": "limit", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" } ], "type": "messages.Messages" }, { "id": "-871347913", "method": "channels.readHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "max_id", "type": "int" } ], "type": "Bool" }, { "id": "-2067661490", "method": "channels.deleteMessages", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "-787622117", "method": "channels.deleteUserHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" } ], "type": "messages.AffectedHistory" }, { "id": "-32999408", "method": "channels.reportSpam", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "-1814580409", "method": "channels.getMessages", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "618237842", "method": "channels.getParticipants", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "filter", "type": "ChannelParticipantsFilter" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "channels.ChannelParticipants" }, { "id": "1416484774", "method": "channels.getParticipant", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" } ], "type": "channels.ChannelParticipant" }, { "id": "176122811", "method": "channels.getChannels", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "141781513", "method": "channels.getFullChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "messages.ChatFull" }, { "id": "-192332417", "method": "channels.createChannel", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.0?true" }, { "name": "megagroup", "type": "flags.1?true" }, { "name": "title", "type": "string" }, { "name": "about", "type": "string" } ], "type": "Updates" }, { "id": "333610782", "method": "channels.editAbout", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "about", "type": "string" } ], "type": "Bool" }, { "id": "1387358562", "method": "channels.editAdmin", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "role", "type": "ChannelParticipantRole" } ], "type": "Bool" }, { "id": "1450044624", "method": "channels.editTitle", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-248621111", "method": "channels.editPhoto", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-1432183160", "method": "channels.toggleComments", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "283557164", "method": "channels.checkUsername", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "890549214", "method": "channels.updateUsername", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "615851205", "method": "channels.joinChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "-130635115", "method": "channels.leaveChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "429865580", "method": "channels.inviteToChannel", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "users", "type": "Vector" } ], "type": "Updates" }, { "id": "-1502421484", "method": "channels.kickFromChannel", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "kicked", "type": "Bool" } ], "type": "Updates" }, { "id": "-950663035", "method": "channels.exportInvite", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "ExportedChatInvite" }, { "id": "-1072619549", "method": "channels.deleteChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "-1154295872", "method": "updates.getChannelDifference", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "filter", "type": "ChannelMessagesFilter" }, { "name": "pts", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "updates.ChannelDifference" }, { "id": "-326379039", "method": "messages.toggleChatAdmins", "params": [ { "name": "chat_id", "type": "int" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "-1444503762", "method": "messages.editChatAdmin", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "is_admin", "type": "Bool" } ], "type": "Bool" }, { "id": "1651444545", "method": "messages.deactivateChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "363051235", "method": "messages.migrateChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Updates" }, { "id": "-1640190800", "method": "messages.searchGlobal", "params": [ { "name": "q", "type": "string" }, { "name": "offset_date", "type": "int" }, { "name": "offset_peer", "type": "InputPeer" }, { "name": "offset_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" } ] } = AccessPointRule; help.configSimple#5a592a6c date:int expires:int rules:vector = help.ConfigSimple; boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaPhoto#b3ba0635 flags:# id:InputPhoto ttl_seconds:flags.0?int = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia; inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaDocument#23ab23d2 flags:# id:InputDocument ttl_seconds:flags.0?int = InputMedia; inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = InputMedia; inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia; inputMediaGeoLive#7b1a118f geo_point:InputGeoPoint period:int = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#3bb3b94a id:long access_hash:long file_reference:bytes = InputPhoto; inputFileLocation#dfdaabe1 volume_id:long local_id:int secret:long file_reference:bytes = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#196683d9 id:long access_hash:long file_reference:bytes = InputFileLocation; inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation; inputTakeoutFileLocation#29be5899 = InputFileLocation; inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#91d11eb dc_id:int volume_id:long local_id:int secret:long file_reference:bytes = FileLocation; userEmpty#200250ba id:int = User; user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#c88974ac flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights participants_count:flags.17?int = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; channelFull#76af5481 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#44f9b43d flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#cbf24940 phone_number:string first_name:string last_name:string vcard:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#9cb070d7 flags:# document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia; messageMediaGeoLive#7c3c2609 geo:GeoPoint period:int = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction; messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; messageActionScreenshotTaken#4792929b = MessageAction; messageActionCustomAction#fae69f56 message:string = MessageAction; messageActionBotAllowed#abe9affe domain:string = MessageAction; messageActionSecureValuesSentMe#1b287353 values:Vector credentials:SecureCredentialsEncrypted = MessageAction; messageActionSecureValuesSent#d95c6154 types:Vector = MessageAction; dialog#e4def5db flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9c477dd8 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#38faab5f flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int terms_of_service:flags.3?help.TermsOfService = auth.SentCode; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputPeerNotifySettings#9c3d198e flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = InputPeerNotifySettings; peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = PeerNotifySettings; peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; inputReportReasonCopyright#9b89f93a = ReportReason; userFull#f220f3f flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#eae87e42 contacts:Vector saved_count:int users:Vector = contacts.Contacts; contacts.importedContacts#77d01c3b imported:Vector popular_invites:Vector retry_contacts:Vector users:Vector = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector users:Vector = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector users:Vector = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#99262e37 flags:# pts:int count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesNotModified#74535f21 count:int = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; messages.chatsSlice#9cd81144 count:int chats:Vector = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector users:Vector = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter; inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter; inputMessagesFilterGeo#e7026d0d = MessagesFilter; inputMessagesFilterContacts#e062db83 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updateDialogPinned#19d27f3c flags:# pinned:flags.0?true peer:DialogPeer = Update; updatePinnedDialogs#ea4cb65b flags:# order:flags.0?Vector = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updateLangPackTooLong#10c2404b = Update; updateLangPack#56022f4d difference:LangPackDifference = Update; updateFavedStickers#e511996d = Update; updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector = Update; updateContactsReset#7084a7be = Update; updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update; updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector intermediate_state:updates.State = updates.Difference; updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector = upload.File; dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption; config#3213dbba flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#1da7158f flags:# popup:flags.0?true id:int version:string text:string entities:Vector document:flags.1?Document url:flags.2?string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument; documentEmpty#36f8c871 id:long = Document; document#59534e4c id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumb:PhotoSize dc_id:int attributes:Vector = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; sendMessageRecordRoundAction#88f27fbc = SendMessageAction; sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; contacts.found#b3134d9d my_results:Vector results:Vector chats:Vector users:Vector = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector = PrivacyRule; account.privacyRules#554abb6f rules:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true supports_streaming:flags.1?true duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#e4599bbd hash:int stickers:Vector = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector = messages.AllStickers; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector = account.Authorizations; account.password#ad2641f8 flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes = account.Password; account.passwordSettings#9a5c33e5 flags:# email:flags.0?string secure_settings:flags.1?SecureSecretSettings = account.PasswordSettings; account.passwordInputSettings#c23727c9 flags:# new_algo:flags.0?PasswordKdfAlgo new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string new_secure_settings:flags.2?SecureSecretSettings = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#5585a139 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#98e81d3a user_id:int description:string commands:Vector = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector = ReplyMarkup; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; messageEntityPhone#9b69e34b offset:int length:int = MessageEntity; messageEntityCashtag#4c4e743f offset:int length:int = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector users:Vector = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#6a9d7b35 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int messages:Vector chats:Vector users:Vector = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector other_updates:Vector chats:Vector users:Vector = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantAdmin#a82fa898 flags:# can_edit:flags.0?true user_id:int inviter_id:int promoted_by:int date:int admin_rights:ChannelAdminRights = ChannelParticipant; channelParticipantBanned#222c1886 flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChannelBannedRights = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter; channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter; channels.channelParticipants#f56ee2a8 count:int participants:Vector users:Vector = channels.ChannelParticipants; channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector = channels.ChannelParticipant; help.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector min_age_confirm:flags.1?int = help.TermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector = messages.SavedGifs; inputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#c1b15d65 flags:# geo_point:InputGeoPoint period:int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#b722de65 flags:# geo:GeoPoint period:int reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector cache_time:int users:Vector = messages.BotResults; exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink; messageFwdHeader#559ebe6d flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; messages.peerDialogs#3371c354 dialogs:Vector messages:Vector chats:Vector users:Vector state:updates.State = messages.PeerDialogs; topPeer#edcdc05b peer:Peer rating:double = TopPeer; topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; topPeerCategoryBotsInline#148677e2 = TopPeerCategory; topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector chats:Vector users:Vector = contacts.TopPeers; contacts.topPeersDisabled#b52c939d = contacts.TopPeers; draftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; messages.featuredStickers#f89d88e5 hash:int sets:Vector unread:Vector = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#22f3afb3 hash:int packs:Vector stickers:Vector dates:Vector = messages.RecentStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector = messages.ArchivedStickers; messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector = messages.StickerSetInstallResult; stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector users:Vector = messages.HighScores; textEmpty#dc3d824f = RichText; textPlain#744694e0 text:string = RichText; textBold#6724abc4 text:RichText = RichText; textItalic#d912a59c text:RichText = RichText; textUnderline#c12622c4 text:RichText = RichText; textStrike#9bf8bb95 text:RichText = RichText; textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; pageBlockHeader#bfd064ec text:RichText = PageBlock; pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; pageBlockParagraph#467a0766 text:RichText = PageBlock; pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; pageBlockList#3a58c7f4 ordered:Bool items:Vector = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; pageBlockVideo#d9d71866 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:RichText = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; pageBlockEmbed#cde200d1 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:int h:int caption:RichText = PageBlock; pageBlockEmbedPost#292c7be9 url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:RichText = PageBlock; pageBlockCollage#8b31c4f items:Vector caption:RichText = PageBlock; pageBlockSlideshow#130c8963 items:Vector caption:RichText = PageBlock; pageBlockChannel#ef1751b5 channel:Chat = PageBlock; pageBlockAudio#31b81a7f audio_id:long caption:RichText = PageBlock; pagePart#8e3f9ebe blocks:Vector photos:Vector documents:Vector = Page; pageFull#556ec7aa blocks:Vector photos:Vector documents:Vector = Page; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; webDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector = WebDocument; webDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector = payments.PaymentReceipt; payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsAndroidPay#ca05d50e payment_token:DataJSON google_transaction_id:string = InputPaymentCredentials; account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; shippingOption#b6213cdf id:string title:string prices:Vector = ShippingOption; inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCall#ffe6ab67 id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector = phone.PhoneCall; upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey; cdnConfig#5725e40a public_keys:Vector = CdnConfig; langPackString#cad181f6 key:string value:string = LangPackString; langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString; langPackStringDeleted#2979eeb2 key:string = LangPackString; langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector = LangPackDifference; langPackLanguage#117698f1 name:string native_name:string lang_code:string = LangPackLanguage; channelAdminRights#5d7ceba5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true invite_link:flags.6?true pin_messages:flags.7?true add_admins:flags.9?true manage_call:flags.10?true = ChannelAdminRights; channelBannedRights#58cf4249 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true until_date:int = ChannelBannedRights; channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangePhoto#b82f55c3 prev_photo:ChatPhoto new_photo:ChatPhoto = ChannelAdminLogEventAction; channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers; messages.favedStickers#f37f2f16 hash:int packs:Vector stickers:Vector = messages.FavedStickers; recentMeUrlUnknown#46e1d13d url:string = RecentMeUrl; recentMeUrlUser#8dbc3336 url:string user_id:int = RecentMeUrl; recentMeUrlChat#a01b22f9 url:string chat_id:int = RecentMeUrl; recentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl; recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl; help.recentMeUrls#e0310d7 urls:Vector chats:Vector users:Vector = help.RecentMeUrls; inputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector = InputSingleMedia; webAuthorization#cac943f2 hash:long bot_id:int domain:string browser:string platform:string date_created:int date_active:int ip:string region:string = WebAuthorization; account.webAuthorizations#ed56c9fc authorizations:Vector users:Vector = account.WebAuthorizations; inputMessageID#a676a322 id:int = InputMessage; inputMessageReplyTo#bad88395 id:int = InputMessage; inputMessagePinned#86872538 = InputMessage; inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer; dialogPeer#e56dbf05 peer:Peer = DialogPeer; messages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets; messages.foundStickerSets#5108d648 hash:int sets:Vector = messages.FoundStickerSets; fileHash#6242c773 offset:int limit:int hash:bytes = FileHash; inputClientProxy#75588b3f address:string port:int = InputClientProxy; help.proxyDataEmpty#e09e1fb8 expires:int = help.ProxyData; help.proxyDataPromo#2bf7ee23 expires:int peer:Peer chats:Vector users:Vector = help.ProxyData; help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate; help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate; inputSecureFileUploaded#3334b0f0 id:long parts:int md5_checksum:string file_hash:bytes secret:bytes = InputSecureFile; inputSecureFile#5367e5be id:long access_hash:long = InputSecureFile; secureFileEmpty#64199744 = SecureFile; secureFile#e0277a62 id:long access_hash:long size:int dc_id:int date:int file_hash:bytes secret:bytes = SecureFile; secureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData; securePlainPhone#7d6099dd phone:string = SecurePlainData; securePlainEmail#21ec5a5f email:string = SecurePlainData; secureValueTypePersonalDetails#9d2a81e3 = SecureValueType; secureValueTypePassport#3dac6a00 = SecureValueType; secureValueTypeDriverLicense#6e425c4 = SecureValueType; secureValueTypeIdentityCard#a0d0744b = SecureValueType; secureValueTypeInternalPassport#99a48f23 = SecureValueType; secureValueTypeAddress#cbe31e26 = SecureValueType; secureValueTypeUtilityBill#fc36954e = SecureValueType; secureValueTypeBankStatement#89137c0d = SecureValueType; secureValueTypeRentalAgreement#8b883488 = SecureValueType; secureValueTypePassportRegistration#99e3806a = SecureValueType; secureValueTypeTemporaryRegistration#ea02ec33 = SecureValueType; secureValueTypePhone#b320aadb = SecureValueType; secureValueTypeEmail#8e3ca7ee = SecureValueType; secureValue#187fa0ca flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile translation:flags.6?Vector files:flags.4?Vector plain_data:flags.5?SecurePlainData hash:bytes = SecureValue; inputSecureValue#db21d0a7 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?InputSecureFile reverse_side:flags.2?InputSecureFile selfie:flags.3?InputSecureFile translation:flags.6?Vector files:flags.4?Vector plain_data:flags.5?SecurePlainData = InputSecureValue; secureValueHash#ed1ecdb0 type:SecureValueType hash:bytes = SecureValueHash; secureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError; secureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector text:string = SecureValueError; secureValueError#869d758f type:SecureValueType hash:bytes text:string = SecureValueError; secureValueErrorTranslationFile#a1144770 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorTranslationFiles#34636dd8 type:SecureValueType file_hash:Vector text:string = SecureValueError; secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted; account.authorizationForm#ad2e1cd8 flags:# required_types:Vector values:Vector errors:Vector users:Vector privacy_policy_url:flags.0?string = account.AuthorizationForm; account.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode; help.deepLinkInfoEmpty#66afa166 = help.DeepLinkInfo; help.deepLinkInfo#6a4ee832 flags:# update_app:flags.0?true message:string entities:flags.1?Vector = help.DeepLinkInfo; savedPhoneContact#1142bd56 phone:string first_name:string last_name:string date:int = SavedContact; account.takeout#4dba4501 id:long = account.Takeout; passwordKdfAlgoUnknown#d45ab096 = PasswordKdfAlgo; passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow#3a912d4a salt1:bytes salt2:bytes g:int p:bytes = PasswordKdfAlgo; securePasswordKdfAlgoUnknown#4a8537 = SecurePasswordKdfAlgo; securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 salt:bytes = SecurePasswordKdfAlgo; securePasswordKdfAlgoSHA512#86471d92 salt:bytes = SecurePasswordKdfAlgo; secureSecretSettings#1527bcac secure_algo:SecurePasswordKdfAlgo secure_secret:bytes secure_secret_id:long = SecureSecretSettings; inputCheckPasswordEmpty#9880f658 = InputCheckPasswordSRP; inputCheckPasswordSRP#d27ff082 srp_id:long A:bytes M1:bytes = InputCheckPasswordSRP; secureRequiredType#829d99da flags:# native_names:flags.0?true selfie_required:flags.1?true translation_required:flags.2?true type:SecureValueType = SecureRequiredType; secureRequiredTypeOneOf#27477b4 types:Vector = SecureRequiredType; help.passportConfigNotModified#bfb9f457 = help.PassportConfig; help.passportConfig#a098d6af hash:int countries_langs:DataJSON = help.PassportConfig; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X; initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X; invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X; auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#d18b4d16 password:InputCheckPasswordSRP = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector = Bool; account.registerDevice#5cbea590 token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector = Bool; account.unregisterDevice#3076c4bf token_type:int token:string other_uids:Vector = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#9cd4eaf9 password:InputCheckPasswordSRP = account.PasswordSettings; account.updatePasswordSettings#a59b102f password:InputCheckPasswordSRP new_settings:account.PasswordInputSettings = Bool; account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; account.getTmpPassword#449e0b51 password:InputCheckPasswordSRP period:int = account.TmpPassword; account.getWebAuthorizations#182e6d6f = account.WebAuthorizations; account.resetWebAuthorization#2d01b9ef hash:long = Bool; account.resetWebAuthorizations#682d2594 = Bool; account.getAllSecureValues#b288bc7d = Vector; account.getSecureValue#73665bc2 types:Vector = Vector; account.saveSecureValue#899fe31d value:InputSecureValue secure_secret_id:long = SecureValue; account.deleteSecureValue#b880bc4b types:Vector = Bool; account.getAuthorizationForm#b86ba8e1 bot_id:int scope:string public_key:string = account.AuthorizationForm; account.acceptAuthorization#e7027c94 bot_id:int scope:string public_key:string value_hashes:Vector credentials:SecureCredentialsEncrypted = Bool; account.sendVerifyPhoneCode#823380b4 flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool; account.sendVerifyEmailCode#7011509f email:string = account.SentEmailCode; account.verifyEmail#ecba39db email:string code:string = Bool; account.initTakeoutSession#f05b4804 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?int = account.Takeout; account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector = Bool; contacts.getStatuses#c4a353ee = Vector; contacts.getContacts#c023849f hash:int = contacts.Contacts; contacts.importContacts#2c800be5 contacts:Vector = contacts.ImportedContacts; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector; contacts.importCard#4fe196fe export_card:Vector = User; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; contacts.resetSaved#879537f1 = Bool; contacts.getSaved#82f1e39f = Vector; contacts.toggleTopPeers#8514bdda enabled:Bool = Bool; messages.getMessages#63c66506 id:Vector = messages.Messages; messages.getDialogs#b098aee6 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:int = messages.Dialogs; messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.search#8614ef68 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.sendMedia#b8d1262b flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true grouped:flags.9?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.report#bd82b658 peer:InputPeer id:Vector reason:ReportReason = Bool; messages.getChats#3c6aa187 id:Vector = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector title:string = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; messages.getStickers#43d4f2c emoticon:string hash:int = messages.Stickers; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#8b68b0cc flags:# message:string entities:flags.3?Vector = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#c000e4c8 flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector geo_point:flags.13?InputGeoPoint = Updates; messages.editInlineBotMessage#adc3e828 flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector geo_point:flags.13?InputGeoPoint = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#e470bcfd peers:Vector = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector = Bool; messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; messages.reorderPinnedDialogs#5b51d63f flags:# force:flags.0?true order:Vector = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia; messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates; messages.getFavedStickers#21ce0b0e hash:int = messages.FavedStickers; messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool; messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory; messages.getRecentLocations#bbc45b09 peer:InputPeer limit:int hash:int = messages.Messages; messages.sendMultiMedia#2095512f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; messages.searchStickerSets#c2b7d08b flags:# exclude_featured:flags.0?true q:string hash:int = messages.FoundStickerSets; messages.getSplitRanges#1cff7e08 = Vector; messages.markDialogUnread#c286d98f flags:# unread:flags.0?true peer:InputDialogPeer = Bool; messages.getDialogUnreadMarks#22e24e22 = Vector; messages.clearAllDrafts#7e58ee9c = Bool; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector = Vector; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; upload.reuploadCdnFile#9b2754a8 file_token:bytes request_token:bytes = Vector; upload.getCdnFileHashes#4da54231 file_token:bytes offset:int = Vector; upload.getFileHashes#c7025931 location:InputFileLocation offset:int = Vector; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#522d5a7d source:string = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector = Bool; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#9010ef6f prev_app_version:string = Updates; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls; help.getProxyData#3d7758e1 = help.ProxyData; help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate; help.acceptTermsOfService#ee72f79a id:DataJSON = Bool; help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo; help.getPassportConfig#c661ad08 hash:int = help.PassportConfig; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector = Bool; channels.getMessages#ad8c9a23 channel:InputChannel id:Vector = messages.Messages; channels.getParticipants#123e05e9 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#20b88214 channel:InputChannel user_id:InputUser admin_rights:ChannelAdminRights = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; channels.exportMessageLink#ceb77163 channel:InputChannel id:int grouped:Bool = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; channels.editBanned#bfd915cd channel:InputChannel user_id:InputUser banned_rights:ChannelBannedRights = Updates; channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector max_id:long min_id:long limit:int = channels.AdminLogResults; channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool; channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector = Bool; channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool; channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates; channels.getLeftChannels#8341ecc0 offset:int = messages.Chats; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm; payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt; payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult; payments.getSavedInfo#227d824b = payments.SavedInfo; payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet; stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; phone.getCallConfig#55451fa9 = DataJSON; phone.requestCall#5b95b3d4 user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = Updates; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference; langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector = Vector; langpack.getDifference#b2e4d7d from_version:int = LangPackDifference; langpack.getLanguages#42c6978f lang_pack:string = Vector; // LAYER 86 dataJSON#7d748d04 data:string = DataJSON; socketMessageRequest request_id:int method:vector args:vector<%DataJSON> = SocketMessage; socketMessageResponse request_id:int data:%DataJSON = SocketMessage; socketMessageException request_id:int exception:SocketException = SocketMessage; socketMessageUpdate data:%DataJSON = SocketMessage; socketMessageLog flags:# thread:flags.0?true process:flags.1?true file:string level:int data:%DataJSON = SocketMessage; socketMessageRawData stream_id:string data:bytes = SocketMessage; socketException message:string code:int trace:%SocketTLTrace = SocketException; socketRPCErrorException flags:# rpc_message:flags.0?string message:flags.1?string code:int trace:%SocketTLTrace = SocketException; socketTLException message:string code:int trace:%SocketTLTrace = SocketException; socketDOMException message:string code:int trace:%SocketTLTrace = SocketException; socketTLTrace frames:vector<%SocketTLFrame> = SocketTLTrace; socketTLFrame flags:# file:flags.0?string line:flags.1?int function:flags.2?string args:flags.3?string tl_param:flags.4?string = SocketTLFrame; {"constructors":[{"id":"-1132882121","predicate":"boolFalse","params":[],"type":"Bool"},{"id":"-1720552011","predicate":"boolTrue","params":[],"type":"Bool"},{"id":"1072550713","predicate":"true","params":[],"type":"True"},{"id":"481674261","predicate":"vector","params":[],"type":"Vector t"},{"id":"-994444869","predicate":"error","params":[{"name":"code","type":"int"},{"name":"text","type":"string"}],"type":"Error"},{"id":"1450380236","predicate":"null","params":[],"type":"Null"},{"id":"2134579434","predicate":"inputPeerEmpty","params":[],"type":"InputPeer"},{"id":"2107670217","predicate":"inputPeerSelf","params":[],"type":"InputPeer"},{"id":"396093539","predicate":"inputPeerChat","params":[{"name":"chat_id","type":"int"}],"type":"InputPeer"},{"id":"-1182234929","predicate":"inputUserEmpty","params":[],"type":"InputUser"},{"id":"-138301121","predicate":"inputUserSelf","params":[],"type":"InputUser"},{"id":"-208488460","predicate":"inputPhoneContact","params":[{"name":"client_id","type":"long"},{"name":"phone","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"}],"type":"InputContact"},{"id":"-181407105","predicate":"inputFile","params":[{"name":"id","type":"long"},{"name":"parts","type":"int"},{"name":"name","type":"string"},{"name":"md5_checksum","type":"string"}],"type":"InputFile"},{"id":"-1771768449","predicate":"inputMediaEmpty","params":[],"type":"InputMedia"},{"id":"-139464256","predicate":"inputMediaUploadedPhoto","params":[{"name":"file","type":"InputFile"},{"name":"caption","type":"string"}],"type":"InputMedia"},{"id":"-373312269","predicate":"inputMediaPhoto","params":[{"name":"id","type":"InputPhoto"},{"name":"caption","type":"string"}],"type":"InputMedia"},{"id":"-104578748","predicate":"inputMediaGeoPoint","params":[{"name":"geo_point","type":"InputGeoPoint"}],"type":"InputMedia"},{"id":"-1494984313","predicate":"inputMediaContact","params":[{"name":"phone_number","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"}],"type":"InputMedia"},{"id":"480546647","predicate":"inputChatPhotoEmpty","params":[],"type":"InputChatPhoto"},{"id":"-1809496270","predicate":"inputChatUploadedPhoto","params":[{"name":"file","type":"InputFile"},{"name":"crop","type":"InputPhotoCrop"}],"type":"InputChatPhoto"},{"id":"-1293828344","predicate":"inputChatPhoto","params":[{"name":"id","type":"InputPhoto"},{"name":"crop","type":"InputPhotoCrop"}],"type":"InputChatPhoto"},{"id":"-457104426","predicate":"inputGeoPointEmpty","params":[],"type":"InputGeoPoint"},{"id":"-206066487","predicate":"inputGeoPoint","params":[{"name":"lat","type":"double"},{"name":"long","type":"double"}],"type":"InputGeoPoint"},{"id":"483901197","predicate":"inputPhotoEmpty","params":[],"type":"InputPhoto"},{"id":"-74070332","predicate":"inputPhoto","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputPhoto"},{"id":"342061462","predicate":"inputFileLocation","params":[{"name":"volume_id","type":"long"},{"name":"local_id","type":"int"},{"name":"secret","type":"long"}],"type":"InputFileLocation"},{"id":"-1377390588","predicate":"inputPhotoCropAuto","params":[],"type":"InputPhotoCrop"},{"id":"-644787419","predicate":"inputPhotoCrop","params":[{"name":"crop_left","type":"double"},{"name":"crop_top","type":"double"},{"name":"crop_width","type":"double"}],"type":"InputPhotoCrop"},{"id":"1996904104","predicate":"inputAppEvent","params":[{"name":"time","type":"double"},{"name":"type","type":"string"},{"name":"peer","type":"long"},{"name":"data","type":"string"}],"type":"InputAppEvent"},{"id":"-1649296275","predicate":"peerUser","params":[{"name":"user_id","type":"int"}],"type":"Peer"},{"id":"-1160714821","predicate":"peerChat","params":[{"name":"chat_id","type":"int"}],"type":"Peer"},{"id":"-1432995067","predicate":"storage.fileUnknown","params":[],"type":"storage.FileType"},{"id":"8322574","predicate":"storage.fileJpeg","params":[],"type":"storage.FileType"},{"id":"-891180321","predicate":"storage.fileGif","params":[],"type":"storage.FileType"},{"id":"172975040","predicate":"storage.filePng","params":[],"type":"storage.FileType"},{"id":"-1373745011","predicate":"storage.filePdf","params":[],"type":"storage.FileType"},{"id":"1384777335","predicate":"storage.fileMp3","params":[],"type":"storage.FileType"},{"id":"1258941372","predicate":"storage.fileMov","params":[],"type":"storage.FileType"},{"id":"1086091090","predicate":"storage.filePartial","params":[],"type":"storage.FileType"},{"id":"-1278304028","predicate":"storage.fileMp4","params":[],"type":"storage.FileType"},{"id":"276907596","predicate":"storage.fileWebp","params":[],"type":"storage.FileType"},{"id":"2086234950","predicate":"fileLocationUnavailable","params":[{"name":"volume_id","type":"long"},{"name":"local_id","type":"int"},{"name":"secret","type":"long"}],"type":"FileLocation"},{"id":"1406570614","predicate":"fileLocation","params":[{"name":"dc_id","type":"int"},{"name":"volume_id","type":"long"},{"name":"local_id","type":"int"},{"name":"secret","type":"long"}],"type":"FileLocation"},{"id":"537022650","predicate":"userEmpty","params":[{"name":"id","type":"int"}],"type":"User"},{"id":"1326562017","predicate":"userProfilePhotoEmpty","params":[],"type":"UserProfilePhoto"},{"id":"-715532088","predicate":"userProfilePhoto","params":[{"name":"photo_id","type":"long"},{"name":"photo_small","type":"FileLocation"},{"name":"photo_big","type":"FileLocation"}],"type":"UserProfilePhoto"},{"id":"164646985","predicate":"userStatusEmpty","params":[],"type":"UserStatus"},{"id":"-306628279","predicate":"userStatusOnline","params":[{"name":"expires","type":"int"}],"type":"UserStatus"},{"id":"9203775","predicate":"userStatusOffline","params":[{"name":"was_online","type":"int"}],"type":"UserStatus"},{"id":"-1683826688","predicate":"chatEmpty","params":[{"name":"id","type":"int"}],"type":"Chat"},{"id":"-652419756","predicate":"chat","params":[{"name":"flags","type":"#"},{"name":"creator","type":"flags.0?true"},{"name":"kicked","type":"flags.1?true"},{"name":"left","type":"flags.2?true"},{"name":"admins_enabled","type":"flags.3?true"},{"name":"admin","type":"flags.4?true"},{"name":"deactivated","type":"flags.5?true"},{"name":"id","type":"int"},{"name":"title","type":"string"},{"name":"photo","type":"ChatPhoto"},{"name":"participants_count","type":"int"},{"name":"date","type":"int"},{"name":"version","type":"int"},{"name":"migrated_to","type":"flags.6?InputChannel"}],"type":"Chat"},{"id":"120753115","predicate":"chatForbidden","params":[{"name":"id","type":"int"},{"name":"title","type":"string"}],"type":"Chat"},{"id":"771925524","predicate":"chatFull","params":[{"name":"id","type":"int"},{"name":"participants","type":"ChatParticipants"},{"name":"chat_photo","type":"Photo"},{"name":"notify_settings","type":"PeerNotifySettings"},{"name":"exported_invite","type":"ExportedChatInvite"},{"name":"bot_info","type":"Vector"}],"type":"ChatFull"},{"id":"-925415106","predicate":"chatParticipant","params":[{"name":"user_id","type":"int"},{"name":"inviter_id","type":"int"},{"name":"date","type":"int"}],"type":"ChatParticipant"},{"id":"-57668565","predicate":"chatParticipantsForbidden","params":[{"name":"flags","type":"#"},{"name":"chat_id","type":"int"},{"name":"self_participant","type":"flags.0?ChatParticipant"}],"type":"ChatParticipants"},{"id":"1061556205","predicate":"chatParticipants","params":[{"name":"chat_id","type":"int"},{"name":"participants","type":"Vector"},{"name":"version","type":"int"}],"type":"ChatParticipants"},{"id":"935395612","predicate":"chatPhotoEmpty","params":[],"type":"ChatPhoto"},{"id":"1632839530","predicate":"chatPhoto","params":[{"name":"photo_small","type":"FileLocation"},{"name":"photo_big","type":"FileLocation"}],"type":"ChatPhoto"},{"id":"-2082087340","predicate":"messageEmpty","params":[{"name":"id","type":"int"}],"type":"Message"},{"id":"-1063525281","predicate":"message","params":[{"name":"flags","type":"#"},{"name":"out","type":"flags.1?true"},{"name":"mentioned","type":"flags.4?true"},{"name":"media_unread","type":"flags.5?true"},{"name":"silent","type":"flags.13?true"},{"name":"post","type":"flags.14?true"},{"name":"id","type":"int"},{"name":"from_id","type":"flags.8?int"},{"name":"to_id","type":"Peer"},{"name":"fwd_from","type":"flags.2?MessageFwdHeader"},{"name":"via_bot_id","type":"flags.11?int"},{"name":"reply_to_msg_id","type":"flags.3?int"},{"name":"date","type":"int"},{"name":"message","type":"string"},{"name":"media","type":"flags.9?MessageMedia"},{"name":"reply_markup","type":"flags.6?ReplyMarkup"},{"name":"entities","type":"flags.7?Vector"},{"name":"views","type":"flags.10?int"},{"name":"edit_date","type":"flags.15?int"}],"type":"Message"},{"id":"-1642487306","predicate":"messageService","params":[{"name":"flags","type":"#"},{"name":"out","type":"flags.1?true"},{"name":"mentioned","type":"flags.4?true"},{"name":"media_unread","type":"flags.5?true"},{"name":"silent","type":"flags.13?true"},{"name":"post","type":"flags.14?true"},{"name":"id","type":"int"},{"name":"from_id","type":"flags.8?int"},{"name":"to_id","type":"Peer"},{"name":"reply_to_msg_id","type":"flags.3?int"},{"name":"date","type":"int"},{"name":"action","type":"MessageAction"}],"type":"Message"},{"id":"1038967584","predicate":"messageMediaEmpty","params":[],"type":"MessageMedia"},{"id":"1032643901","predicate":"messageMediaPhoto","params":[{"name":"photo","type":"Photo"},{"name":"caption","type":"string"}],"type":"MessageMedia"},{"id":"1457575028","predicate":"messageMediaGeo","params":[{"name":"geo","type":"GeoPoint"}],"type":"MessageMedia"},{"id":"1585262393","predicate":"messageMediaContact","params":[{"name":"phone_number","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"},{"name":"user_id","type":"int"}],"type":"MessageMedia"},{"id":"-1618676578","predicate":"messageMediaUnsupported","params":[],"type":"MessageMedia"},{"id":"-1230047312","predicate":"messageActionEmpty","params":[],"type":"MessageAction"},{"id":"-1503425638","predicate":"messageActionChatCreate","params":[{"name":"title","type":"string"},{"name":"users","type":"Vector"}],"type":"MessageAction"},{"id":"-1247687078","predicate":"messageActionChatEditTitle","params":[{"name":"title","type":"string"}],"type":"MessageAction"},{"id":"2144015272","predicate":"messageActionChatEditPhoto","params":[{"name":"photo","type":"Photo"}],"type":"MessageAction"},{"id":"-1780220945","predicate":"messageActionChatDeletePhoto","params":[],"type":"MessageAction"},{"id":"1217033015","predicate":"messageActionChatAddUser","params":[{"name":"users","type":"Vector"}],"type":"MessageAction"},{"id":"-1297179892","predicate":"messageActionChatDeleteUser","params":[{"name":"user_id","type":"int"}],"type":"MessageAction"},{"id":"1728035348","predicate":"dialog","params":[{"name":"flags","type":"#"},{"name":"peer","type":"Peer"},{"name":"top_message","type":"int"},{"name":"read_inbox_max_id","type":"int"},{"name":"read_outbox_max_id","type":"int"},{"name":"unread_count","type":"int"},{"name":"notify_settings","type":"PeerNotifySettings"},{"name":"pts","type":"flags.0?int"},{"name":"draft","type":"flags.1?DraftMessage"}],"type":"Dialog"},{"id":"590459437","predicate":"photoEmpty","params":[{"name":"id","type":"long"}],"type":"Photo"},{"id":"-840088834","predicate":"photo","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"},{"name":"date","type":"int"},{"name":"sizes","type":"Vector"}],"type":"Photo"},{"id":"236446268","predicate":"photoSizeEmpty","params":[{"name":"type","type":"string"}],"type":"PhotoSize"},{"id":"2009052699","predicate":"photoSize","params":[{"name":"type","type":"string"},{"name":"location","type":"FileLocation"},{"name":"w","type":"int"},{"name":"h","type":"int"},{"name":"size","type":"int"}],"type":"PhotoSize"},{"id":"-374917894","predicate":"photoCachedSize","params":[{"name":"type","type":"string"},{"name":"location","type":"FileLocation"},{"name":"w","type":"int"},{"name":"h","type":"int"},{"name":"bytes","type":"bytes"}],"type":"PhotoSize"},{"id":"286776671","predicate":"geoPointEmpty","params":[],"type":"GeoPoint"},{"id":"541710092","predicate":"geoPoint","params":[{"name":"long","type":"double"},{"name":"lat","type":"double"}],"type":"GeoPoint"},{"id":"-2128698738","predicate":"auth.checkedPhone","params":[{"name":"phone_registered","type":"Bool"}],"type":"auth.CheckedPhone"},{"id":"1577067778","predicate":"auth.sentCode","params":[{"name":"flags","type":"#"},{"name":"phone_registered","type":"flags.0?true"},{"name":"type","type":"auth.SentCodeType"},{"name":"phone_code_hash","type":"string"},{"name":"next_type","type":"flags.1?auth.CodeType"},{"name":"timeout","type":"flags.2?int"}],"type":"auth.SentCode"},{"id":"-855308010","predicate":"auth.authorization","params":[{"name":"flags","type":"#"},{"name":"tmp_sessions","type":"flags.0?int"},{"name":"user","type":"User"}],"type":"auth.Authorization"},{"id":"-543777747","predicate":"auth.exportedAuthorization","params":[{"name":"id","type":"int"},{"name":"bytes","type":"bytes"}],"type":"auth.ExportedAuthorization"},{"id":"-1195615476","predicate":"inputNotifyPeer","params":[{"name":"peer","type":"InputPeer"}],"type":"InputNotifyPeer"},{"id":"423314455","predicate":"inputNotifyUsers","params":[],"type":"InputNotifyPeer"},{"id":"1251338318","predicate":"inputNotifyChats","params":[],"type":"InputNotifyPeer"},{"id":"-1540769658","predicate":"inputNotifyAll","params":[],"type":"InputNotifyPeer"},{"id":"-265263912","predicate":"inputPeerNotifyEventsEmpty","params":[],"type":"InputPeerNotifyEvents"},{"id":"-395694988","predicate":"inputPeerNotifyEventsAll","params":[],"type":"InputPeerNotifyEvents"},{"id":"949182130","predicate":"inputPeerNotifySettings","params":[{"name":"flags","type":"#"},{"name":"show_previews","type":"flags.0?true"},{"name":"silent","type":"flags.1?true"},{"name":"mute_until","type":"int"},{"name":"sound","type":"string"}],"type":"InputPeerNotifySettings"},{"id":"-1378534221","predicate":"peerNotifyEventsEmpty","params":[],"type":"PeerNotifyEvents"},{"id":"1830677896","predicate":"peerNotifyEventsAll","params":[],"type":"PeerNotifyEvents"},{"id":"1889961234","predicate":"peerNotifySettingsEmpty","params":[],"type":"PeerNotifySettings"},{"id":"-1697798976","predicate":"peerNotifySettings","params":[{"name":"flags","type":"#"},{"name":"show_previews","type":"flags.0?true"},{"name":"silent","type":"flags.1?true"},{"name":"mute_until","type":"int"},{"name":"sound","type":"string"}],"type":"PeerNotifySettings"},{"id":"-2122045747","predicate":"peerSettings","params":[{"name":"flags","type":"#"},{"name":"report_spam","type":"flags.0?true"}],"type":"PeerSettings"},{"id":"-860866985","predicate":"wallPaper","params":[{"name":"id","type":"int"},{"name":"title","type":"string"},{"name":"sizes","type":"Vector"},{"name":"color","type":"int"}],"type":"WallPaper"},{"id":"1490799288","predicate":"inputReportReasonSpam","params":[],"type":"ReportReason"},{"id":"505595789","predicate":"inputReportReasonViolence","params":[],"type":"ReportReason"},{"id":"777640226","predicate":"inputReportReasonPornography","params":[],"type":"ReportReason"},{"id":"-512463606","predicate":"inputReportReasonOther","params":[{"name":"text","type":"string"}],"type":"ReportReason"},{"id":"1496513539","predicate":"userFull","params":[{"name":"flags","type":"#"},{"name":"blocked","type":"flags.0?true"},{"name":"user","type":"User"},{"name":"about","type":"flags.1?string"},{"name":"link","type":"contacts.Link"},{"name":"profile_photo","type":"flags.2?Photo"},{"name":"notify_settings","type":"PeerNotifySettings"},{"name":"bot_info","type":"flags.3?BotInfo"}],"type":"UserFull"},{"id":"-116274796","predicate":"contact","params":[{"name":"user_id","type":"int"},{"name":"mutual","type":"Bool"}],"type":"Contact"},{"id":"-805141448","predicate":"importedContact","params":[{"name":"user_id","type":"int"},{"name":"client_id","type":"long"}],"type":"ImportedContact"},{"id":"1444661369","predicate":"contactBlocked","params":[{"name":"user_id","type":"int"},{"name":"date","type":"int"}],"type":"ContactBlocked"},{"id":"-748155807","predicate":"contactStatus","params":[{"name":"user_id","type":"int"},{"name":"status","type":"UserStatus"}],"type":"ContactStatus"},{"id":"986597452","predicate":"contacts.link","params":[{"name":"my_link","type":"ContactLink"},{"name":"foreign_link","type":"ContactLink"},{"name":"user","type":"User"}],"type":"contacts.Link"},{"id":"-1219778094","predicate":"contacts.contactsNotModified","params":[],"type":"contacts.Contacts"},{"id":"1871416498","predicate":"contacts.contacts","params":[{"name":"contacts","type":"Vector"},{"name":"users","type":"Vector"}],"type":"contacts.Contacts"},{"id":"-1387117803","predicate":"contacts.importedContacts","params":[{"name":"imported","type":"Vector"},{"name":"retry_contacts","type":"Vector"},{"name":"users","type":"Vector"}],"type":"contacts.ImportedContacts"},{"id":"471043349","predicate":"contacts.blocked","params":[{"name":"blocked","type":"Vector"},{"name":"users","type":"Vector"}],"type":"contacts.Blocked"},{"id":"-1878523231","predicate":"contacts.blockedSlice","params":[{"name":"count","type":"int"},{"name":"blocked","type":"Vector"},{"name":"users","type":"Vector"}],"type":"contacts.Blocked"},{"id":"364538944","predicate":"messages.dialogs","params":[{"name":"dialogs","type":"Vector"},{"name":"messages","type":"Vector"},{"name":"chats","type":"Vector"},{"name":"users","type":"Vector"}],"type":"messages.Dialogs"},{"id":"1910543603","predicate":"messages.dialogsSlice","params":[{"name":"count","type":"int"},{"name":"dialogs","type":"Vector"},{"name":"messages","type":"Vector"},{"name":"chats","type":"Vector"},{"name":"users","type":"Vector"}],"type":"messages.Dialogs"},{"id":"-1938715001","predicate":"messages.messages","params":[{"name":"messages","type":"Vector"},{"name":"chats","type":"Vector"},{"name":"users","type":"Vector"}],"type":"messages.Messages"},{"id":"189033187","predicate":"messages.messagesSlice","params":[{"name":"count","type":"int"},{"name":"messages","type":"Vector"},{"name":"chats","type":"Vector"},{"name":"users","type":"Vector"}],"type":"messages.Messages"},{"id":"1694474197","predicate":"messages.chats","params":[{"name":"chats","type":"Vector"}],"type":"messages.Chats"},{"id":"-438840932","predicate":"messages.chatFull","params":[{"name":"full_chat","type":"ChatFull"},{"name":"chats","type":"Vector"},{"name":"users","type":"Vector"}],"type":"messages.ChatFull"},{"id":"-1269012015","predicate":"messages.affectedHistory","params":[{"name":"pts","type":"int"},{"name":"pts_count","type":"int"},{"name":"offset","type":"int"}],"type":"messages.AffectedHistory"},{"id":"1474492012","predicate":"inputMessagesFilterEmpty","params":[],"type":"MessagesFilter"},{"id":"-1777752804","predicate":"inputMessagesFilterPhotos","params":[],"type":"MessagesFilter"},{"id":"-1614803355","predicate":"inputMessagesFilterVideo","params":[],"type":"MessagesFilter"},{"id":"1458172132","predicate":"inputMessagesFilterPhotoVideo","params":[],"type":"MessagesFilter"},{"id":"-648121413","predicate":"inputMessagesFilterPhotoVideoDocuments","params":[],"type":"MessagesFilter"},{"id":"-1629621880","predicate":"inputMessagesFilterDocument","params":[],"type":"MessagesFilter"},{"id":"2129714567","predicate":"inputMessagesFilterUrl","params":[],"type":"MessagesFilter"},{"id":"-3644025","predicate":"inputMessagesFilterGif","params":[],"type":"MessagesFilter"},{"id":"522914557","predicate":"updateNewMessage","params":[{"name":"message","type":"Message"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"1318109142","predicate":"updateMessageID","params":[{"name":"id","type":"int"},{"name":"random_id","type":"long"}],"type":"Update"},{"id":"-1576161051","predicate":"updateDeleteMessages","params":[{"name":"messages","type":"Vector"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"1548249383","predicate":"updateUserTyping","params":[{"name":"user_id","type":"int"},{"name":"action","type":"SendMessageAction"}],"type":"Update"},{"id":"-1704596961","predicate":"updateChatUserTyping","params":[{"name":"chat_id","type":"int"},{"name":"user_id","type":"int"},{"name":"action","type":"SendMessageAction"}],"type":"Update"},{"id":"125178264","predicate":"updateChatParticipants","params":[{"name":"participants","type":"ChatParticipants"}],"type":"Update"},{"id":"469489699","predicate":"updateUserStatus","params":[{"name":"user_id","type":"int"},{"name":"status","type":"UserStatus"}],"type":"Update"},{"id":"-1489818765","predicate":"updateUserName","params":[{"name":"user_id","type":"int"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"},{"name":"username","type":"string"}],"type":"Update"},{"id":"-1791935732","predicate":"updateUserPhoto","params":[{"name":"user_id","type":"int"},{"name":"date","type":"int"},{"name":"photo","type":"UserProfilePhoto"},{"name":"previous","type":"Bool"}],"type":"Update"},{"id":"628472761","predicate":"updateContactRegistered","params":[{"name":"user_id","type":"int"},{"name":"date","type":"int"}],"type":"Update"},{"id":"-1657903163","predicate":"updateContactLink","params":[{"name":"user_id","type":"int"},{"name":"my_link","type":"ContactLink"},{"name":"foreign_link","type":"ContactLink"}],"type":"Update"},{"id":"-1895411046","predicate":"updateNewAuthorization","params":[{"name":"auth_key_id","type":"long"},{"name":"date","type":"int"},{"name":"device","type":"string"},{"name":"location","type":"string"}],"type":"Update"},{"id":"-1519637954","predicate":"updates.state","params":[{"name":"pts","type":"int"},{"name":"qts","type":"int"},{"name":"date","type":"int"},{"name":"seq","type":"int"},{"name":"unread_count","type":"int"}],"type":"updates.State"},{"id":"1567990072","predicate":"updates.differenceEmpty","params":[{"name":"date","type":"int"},{"name":"seq","type":"int"}],"type":"updates.Difference"},{"id":"16030880","predicate":"updates.difference","params":[{"name":"new_messages","type":"Vector"},{"name":"new_encrypted_messages","type":"Vector"},{"name":"other_updates","type":"Vector"},{"name":"chats","type":"Vector"},{"name":"users","type":"Vector"},{"name":"state","type":"updates.State"}],"type":"updates.Difference"},{"id":"-1459938943","predicate":"updates.differenceSlice","params":[{"name":"new_messages","type":"Vector"},{"name":"new_encrypted_messages","type":"Vector"},{"name":"other_updates","type":"Vector"},{"name":"chats","type":"Vector"},{"name":"users","type":"Vector"},{"name":"intermediate_state","type":"updates.State"}],"type":"updates.Difference"},{"id":"-484987010","predicate":"updatesTooLong","params":[],"type":"Updates"},{"id":"-1857044719","predicate":"updateShortMessage","params":[{"name":"flags","type":"#"},{"name":"out","type":"flags.1?true"},{"name":"mentioned","type":"flags.4?true"},{"name":"media_unread","type":"flags.5?true"},{"name":"silent","type":"flags.13?true"},{"name":"id","type":"int"},{"name":"user_id","type":"int"},{"name":"message","type":"string"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"},{"name":"date","type":"int"},{"name":"fwd_from","type":"flags.2?MessageFwdHeader"},{"name":"via_bot_id","type":"flags.11?int"},{"name":"reply_to_msg_id","type":"flags.3?int"},{"name":"entities","type":"flags.7?Vector"}],"type":"Updates"},{"id":"377562760","predicate":"updateShortChatMessage","params":[{"name":"flags","type":"#"},{"name":"out","type":"flags.1?true"},{"name":"mentioned","type":"flags.4?true"},{"name":"media_unread","type":"flags.5?true"},{"name":"silent","type":"flags.13?true"},{"name":"id","type":"int"},{"name":"from_id","type":"int"},{"name":"chat_id","type":"int"},{"name":"message","type":"string"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"},{"name":"date","type":"int"},{"name":"fwd_from","type":"flags.2?MessageFwdHeader"},{"name":"via_bot_id","type":"flags.11?int"},{"name":"reply_to_msg_id","type":"flags.3?int"},{"name":"entities","type":"flags.7?Vector"}],"type":"Updates"},{"id":"2027216577","predicate":"updateShort","params":[{"name":"update","type":"Update"},{"name":"date","type":"int"}],"type":"Updates"},{"id":"1918567619","predicate":"updatesCombined","params":[{"name":"updates","type":"Vector"},{"name":"users","type":"Vector"},{"name":"chats","type":"Vector"},{"name":"date","type":"int"},{"name":"seq_start","type":"int"},{"name":"seq","type":"int"}],"type":"Updates"},{"id":"1957577280","predicate":"updates","params":[{"name":"updates","type":"Vector"},{"name":"users","type":"Vector"},{"name":"chats","type":"Vector"},{"name":"date","type":"int"},{"name":"seq","type":"int"}],"type":"Updates"},{"id":"-1916114267","predicate":"photos.photos","params":[{"name":"photos","type":"Vector"},{"name":"users","type":"Vector"}],"type":"photos.Photos"},{"id":"352657236","predicate":"photos.photosSlice","params":[{"name":"count","type":"int"},{"name":"photos","type":"Vector"},{"name":"users","type":"Vector"}],"type":"photos.Photos"},{"id":"539045032","predicate":"photos.photo","params":[{"name":"photo","type":"Photo"},{"name":"users","type":"Vector"}],"type":"photos.Photo"},{"id":"157948117","predicate":"upload.file","params":[{"name":"type","type":"storage.FileType"},{"name":"mtime","type":"int"},{"name":"bytes","type":"bytes"}],"type":"upload.File"},{"id":"98092748","predicate":"dcOption","params":[{"name":"flags","type":"#"},{"name":"ipv6","type":"flags.0?true"},{"name":"media_only","type":"flags.1?true"},{"name":"tcpo_only","type":"flags.2?true"},{"name":"id","type":"int"},{"name":"ip_address","type":"string"},{"name":"port","type":"int"}],"type":"DcOption"},{"id":"-1704251862","predicate":"config","params":[{"name":"flags","type":"#"},{"name":"date","type":"int"},{"name":"expires","type":"int"},{"name":"test_mode","type":"Bool"},{"name":"this_dc","type":"int"},{"name":"dc_options","type":"Vector"},{"name":"chat_size_max","type":"int"},{"name":"megagroup_size_max","type":"int"},{"name":"forwarded_count_max","type":"int"},{"name":"online_update_period_ms","type":"int"},{"name":"offline_blur_timeout_ms","type":"int"},{"name":"offline_idle_timeout_ms","type":"int"},{"name":"online_cloud_timeout_ms","type":"int"},{"name":"notify_cloud_delay_ms","type":"int"},{"name":"notify_default_delay_ms","type":"int"},{"name":"chat_big_size","type":"int"},{"name":"push_chat_period_ms","type":"int"},{"name":"push_chat_limit","type":"int"},{"name":"saved_gifs_limit","type":"int"},{"name":"edit_time_limit","type":"int"},{"name":"rating_e_decay","type":"int"},{"name":"stickers_recent_limit","type":"int"},{"name":"tmp_sessions","type":"flags.0?int"},{"name":"disabled_features","type":"Vector"}],"type":"Config"},{"id":"-1910892683","predicate":"nearestDc","params":[{"name":"country","type":"string"},{"name":"this_dc","type":"int"},{"name":"nearest_dc","type":"int"}],"type":"NearestDc"},{"id":"-1987579119","predicate":"help.appUpdate","params":[{"name":"id","type":"int"},{"name":"critical","type":"Bool"},{"name":"url","type":"string"},{"name":"text","type":"string"}],"type":"help.AppUpdate"},{"id":"-1000708810","predicate":"help.noAppUpdate","params":[],"type":"help.AppUpdate"},{"id":"415997816","predicate":"help.inviteText","params":[{"name":"message","type":"string"}],"type":"help.InviteText"},{"id":"1662091044","predicate":"wallPaperSolid","params":[{"name":"id","type":"int"},{"name":"title","type":"string"},{"name":"bg_color","type":"int"},{"name":"color","type":"int"}],"type":"WallPaper"},{"id":"314359194","predicate":"updateNewEncryptedMessage","params":[{"name":"message","type":"EncryptedMessage"},{"name":"qts","type":"int"}],"type":"Update"},{"id":"386986326","predicate":"updateEncryptedChatTyping","params":[{"name":"chat_id","type":"int"}],"type":"Update"},{"id":"-1264392051","predicate":"updateEncryption","params":[{"name":"chat","type":"EncryptedChat"},{"name":"date","type":"int"}],"type":"Update"},{"id":"956179895","predicate":"updateEncryptedMessagesRead","params":[{"name":"chat_id","type":"int"},{"name":"max_date","type":"int"},{"name":"date","type":"int"}],"type":"Update"},{"id":"-1417756512","predicate":"encryptedChatEmpty","params":[{"name":"id","type":"int"}],"type":"EncryptedChat"},{"id":"1006044124","predicate":"encryptedChatWaiting","params":[{"name":"id","type":"int"},{"name":"access_hash","type":"long"},{"name":"date","type":"int"},{"name":"admin_id","type":"int"},{"name":"participant_id","type":"int"}],"type":"EncryptedChat"},{"id":"-931638658","predicate":"encryptedChatRequested","params":[{"name":"id","type":"int"},{"name":"access_hash","type":"long"},{"name":"date","type":"int"},{"name":"admin_id","type":"int"},{"name":"participant_id","type":"int"},{"name":"g_a","type":"bytes"}],"type":"EncryptedChat"},{"id":"-94974410","predicate":"encryptedChat","params":[{"name":"id","type":"int"},{"name":"access_hash","type":"long"},{"name":"date","type":"int"},{"name":"admin_id","type":"int"},{"name":"participant_id","type":"int"},{"name":"g_a_or_b","type":"bytes"},{"name":"key_fingerprint","type":"long"}],"type":"EncryptedChat"},{"id":"332848423","predicate":"encryptedChatDiscarded","params":[{"name":"id","type":"int"}],"type":"EncryptedChat"},{"id":"-247351839","predicate":"inputEncryptedChat","params":[{"name":"chat_id","type":"int"},{"name":"access_hash","type":"long"}],"type":"InputEncryptedChat"},{"id":"-1038136962","predicate":"encryptedFileEmpty","params":[],"type":"EncryptedFile"},{"id":"1248893260","predicate":"encryptedFile","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"},{"name":"size","type":"int"},{"name":"dc_id","type":"int"},{"name":"key_fingerprint","type":"int"}],"type":"EncryptedFile"},{"id":"406307684","predicate":"inputEncryptedFileEmpty","params":[],"type":"InputEncryptedFile"},{"id":"1690108678","predicate":"inputEncryptedFileUploaded","params":[{"name":"id","type":"long"},{"name":"parts","type":"int"},{"name":"md5_checksum","type":"string"},{"name":"key_fingerprint","type":"int"}],"type":"InputEncryptedFile"},{"id":"1511503333","predicate":"inputEncryptedFile","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputEncryptedFile"},{"id":"-182231723","predicate":"inputEncryptedFileLocation","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputFileLocation"},{"id":"-317144808","predicate":"encryptedMessage","params":[{"name":"random_id","type":"long"},{"name":"chat_id","type":"int"},{"name":"date","type":"int"},{"name":"bytes","type":"bytes"},{"name":"file","type":"EncryptedFile"}],"type":"EncryptedMessage"},{"id":"594758406","predicate":"encryptedMessageService","params":[{"name":"random_id","type":"long"},{"name":"chat_id","type":"int"},{"name":"date","type":"int"},{"name":"bytes","type":"bytes"}],"type":"EncryptedMessage"},{"id":"-1058912715","predicate":"messages.dhConfigNotModified","params":[{"name":"random","type":"bytes"}],"type":"messages.DhConfig"},{"id":"740433629","predicate":"messages.dhConfig","params":[{"name":"g","type":"int"},{"name":"p","type":"bytes"},{"name":"version","type":"int"},{"name":"random","type":"bytes"}],"type":"messages.DhConfig"},{"id":"1443858741","predicate":"messages.sentEncryptedMessage","params":[{"name":"date","type":"int"}],"type":"messages.SentEncryptedMessage"},{"id":"-1802240206","predicate":"messages.sentEncryptedFile","params":[{"name":"date","type":"int"},{"name":"file","type":"EncryptedFile"}],"type":"messages.SentEncryptedMessage"},{"id":"-95482955","predicate":"inputFileBig","params":[{"name":"id","type":"long"},{"name":"parts","type":"int"},{"name":"name","type":"string"}],"type":"InputFile"},{"id":"767652808","predicate":"inputEncryptedFileBigUploaded","params":[{"name":"id","type":"long"},{"name":"parts","type":"int"},{"name":"key_fingerprint","type":"int"}],"type":"InputEncryptedFile"},{"id":"-364179876","predicate":"updateChatParticipantAdd","params":[{"name":"chat_id","type":"int"},{"name":"user_id","type":"int"},{"name":"inviter_id","type":"int"},{"name":"date","type":"int"},{"name":"version","type":"int"}],"type":"Update"},{"id":"1851755554","predicate":"updateChatParticipantDelete","params":[{"name":"chat_id","type":"int"},{"name":"user_id","type":"int"},{"name":"version","type":"int"}],"type":"Update"},{"id":"-1906403213","predicate":"updateDcOptions","params":[{"name":"dc_options","type":"Vector"}],"type":"Update"},{"id":"495530093","predicate":"inputMediaUploadedDocument","params":[{"name":"file","type":"InputFile"},{"name":"mime_type","type":"string"},{"name":"attributes","type":"Vector"},{"name":"caption","type":"string"}],"type":"InputMedia"},{"id":"-1386138479","predicate":"inputMediaUploadedThumbDocument","params":[{"name":"file","type":"InputFile"},{"name":"thumb","type":"InputFile"},{"name":"mime_type","type":"string"},{"name":"attributes","type":"Vector"},{"name":"caption","type":"string"}],"type":"InputMedia"},{"id":"444068508","predicate":"inputMediaDocument","params":[{"name":"id","type":"InputDocument"},{"name":"caption","type":"string"}],"type":"InputMedia"},{"id":"-203411800","predicate":"messageMediaDocument","params":[{"name":"document","type":"Document"},{"name":"caption","type":"string"}],"type":"MessageMedia"},{"id":"1928391342","predicate":"inputDocumentEmpty","params":[],"type":"InputDocument"},{"id":"410618194","predicate":"inputDocument","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputDocument"},{"id":"1125058340","predicate":"inputDocumentFileLocation","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"},{"name":"version","type":"int"}],"type":"InputFileLocation"},{"id":"922273905","predicate":"documentEmpty","params":[{"name":"id","type":"long"}],"type":"Document"},{"id":"-2027738169","predicate":"document","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"},{"name":"date","type":"int"},{"name":"mime_type","type":"string"},{"name":"size","type":"int"},{"name":"thumb","type":"PhotoSize"},{"name":"dc_id","type":"int"},{"name":"version","type":"int"},{"name":"attributes","type":"Vector"}],"type":"Document"},{"id":"398898678","predicate":"help.support","params":[{"name":"phone_number","type":"string"},{"name":"user","type":"User"}],"type":"help.Support"},{"id":"-1613493288","predicate":"notifyPeer","params":[{"name":"peer","type":"Peer"}],"type":"NotifyPeer"},{"id":"-1261946036","predicate":"notifyUsers","params":[],"type":"NotifyPeer"},{"id":"-1073230141","predicate":"notifyChats","params":[],"type":"NotifyPeer"},{"id":"1959820384","predicate":"notifyAll","params":[],"type":"NotifyPeer"},{"id":"-2131957734","predicate":"updateUserBlocked","params":[{"name":"user_id","type":"int"},{"name":"blocked","type":"Bool"}],"type":"Update"},{"id":"-1094555409","predicate":"updateNotifySettings","params":[{"name":"peer","type":"NotifyPeer"},{"name":"notify_settings","type":"PeerNotifySettings"}],"type":"Update"},{"id":"381645902","predicate":"sendMessageTypingAction","params":[],"type":"SendMessageAction"},{"id":"-44119819","predicate":"sendMessageCancelAction","params":[],"type":"SendMessageAction"},{"id":"-1584933265","predicate":"sendMessageRecordVideoAction","params":[],"type":"SendMessageAction"},{"id":"-378127636","predicate":"sendMessageUploadVideoAction","params":[{"name":"progress","type":"int"}],"type":"SendMessageAction"},{"id":"-718310409","predicate":"sendMessageRecordAudioAction","params":[],"type":"SendMessageAction"},{"id":"-212740181","predicate":"sendMessageUploadAudioAction","params":[{"name":"progress","type":"int"}],"type":"SendMessageAction"},{"id":"-774682074","predicate":"sendMessageUploadPhotoAction","params":[{"name":"progress","type":"int"}],"type":"SendMessageAction"},{"id":"-1441998364","predicate":"sendMessageUploadDocumentAction","params":[{"name":"progress","type":"int"}],"type":"SendMessageAction"},{"id":"393186209","predicate":"sendMessageGeoLocationAction","params":[],"type":"SendMessageAction"},{"id":"1653390447","predicate":"sendMessageChooseContactAction","params":[],"type":"SendMessageAction"},{"id":"446822276","predicate":"contacts.found","params":[{"name":"results","type":"Vector"},{"name":"chats","type":"Vector"},{"name":"users","type":"Vector"}],"type":"contacts.Found"},{"id":"942527460","predicate":"updateServiceNotification","params":[{"name":"type","type":"string"},{"name":"message","type":"string"},{"name":"media","type":"MessageMedia"},{"name":"popup","type":"Bool"}],"type":"Update"},{"id":"-496024847","predicate":"userStatusRecently","params":[],"type":"UserStatus"},{"id":"129960444","predicate":"userStatusLastWeek","params":[],"type":"UserStatus"},{"id":"2011940674","predicate":"userStatusLastMonth","params":[],"type":"UserStatus"},{"id":"-298113238","predicate":"updatePrivacy","params":[{"name":"key","type":"PrivacyKey"},{"name":"rules","type":"Vector"}],"type":"Update"},{"id":"1335282456","predicate":"inputPrivacyKeyStatusTimestamp","params":[],"type":"InputPrivacyKey"},{"id":"-1137792208","predicate":"privacyKeyStatusTimestamp","params":[],"type":"PrivacyKey"},{"id":"218751099","predicate":"inputPrivacyValueAllowContacts","params":[],"type":"InputPrivacyRule"},{"id":"407582158","predicate":"inputPrivacyValueAllowAll","params":[],"type":"InputPrivacyRule"},{"id":"320652927","predicate":"inputPrivacyValueAllowUsers","params":[{"name":"users","type":"Vector"}],"type":"InputPrivacyRule"},{"id":"195371015","predicate":"inputPrivacyValueDisallowContacts","params":[],"type":"InputPrivacyRule"},{"id":"-697604407","predicate":"inputPrivacyValueDisallowAll","params":[],"type":"InputPrivacyRule"},{"id":"-1877932953","predicate":"inputPrivacyValueDisallowUsers","params":[{"name":"users","type":"Vector"}],"type":"InputPrivacyRule"},{"id":"-123988","predicate":"privacyValueAllowContacts","params":[],"type":"PrivacyRule"},{"id":"1698855810","predicate":"privacyValueAllowAll","params":[],"type":"PrivacyRule"},{"id":"1297858060","predicate":"privacyValueAllowUsers","params":[{"name":"users","type":"Vector"}],"type":"PrivacyRule"},{"id":"-125240806","predicate":"privacyValueDisallowContacts","params":[],"type":"PrivacyRule"},{"id":"-1955338397","predicate":"privacyValueDisallowAll","params":[],"type":"PrivacyRule"},{"id":"209668535","predicate":"privacyValueDisallowUsers","params":[{"name":"users","type":"Vector"}],"type":"PrivacyRule"},{"id":"1430961007","predicate":"account.privacyRules","params":[{"name":"rules","type":"Vector"},{"name":"users","type":"Vector"}],"type":"account.PrivacyRules"},{"id":"-1194283041","predicate":"accountDaysTTL","params":[{"name":"days","type":"int"}],"type":"AccountDaysTTL"},{"id":"314130811","predicate":"updateUserPhone","params":[{"name":"user_id","type":"int"},{"name":"phone","type":"string"}],"type":"Update"},{"id":"1815593308","predicate":"documentAttributeImageSize","params":[{"name":"w","type":"int"},{"name":"h","type":"int"}],"type":"DocumentAttribute"},{"id":"297109817","predicate":"documentAttributeAnimated","params":[],"type":"DocumentAttribute"},{"id":"978674434","predicate":"documentAttributeSticker","params":[{"name":"alt","type":"string"},{"name":"stickerset","type":"InputStickerSet"}],"type":"DocumentAttribute"},{"id":"1494273227","predicate":"documentAttributeVideo","params":[{"name":"duration","type":"int"},{"name":"w","type":"int"},{"name":"h","type":"int"}],"type":"DocumentAttribute"},{"id":"-1739392570","predicate":"documentAttributeAudio","params":[{"name":"flags","type":"#"},{"name":"voice","type":"flags.10?true"},{"name":"duration","type":"int"},{"name":"title","type":"flags.0?string"},{"name":"performer","type":"flags.1?string"},{"name":"waveform","type":"flags.2?bytes"}],"type":"DocumentAttribute"},{"id":"358154344","predicate":"documentAttributeFilename","params":[{"name":"file_name","type":"string"}],"type":"DocumentAttribute"},{"id":"-244016606","predicate":"messages.stickersNotModified","params":[],"type":"messages.Stickers"},{"id":"-1970352846","predicate":"messages.stickers","params":[{"name":"hash","type":"string"},{"name":"stickers","type":"Vector"}],"type":"messages.Stickers"},{"id":"313694676","predicate":"stickerPack","params":[{"name":"emoticon","type":"string"},{"name":"documents","type":"Vector"}],"type":"StickerPack"},{"id":"-395967805","predicate":"messages.allStickersNotModified","params":[],"type":"messages.AllStickers"},{"id":"-302170017","predicate":"messages.allStickers","params":[{"name":"hash","type":"int"},{"name":"sets","type":"Vector"}],"type":"messages.AllStickers"},{"id":"-1369215196","predicate":"disabledFeature","params":[{"name":"feature","type":"string"},{"name":"description","type":"string"}],"type":"DisabledFeature"},{"id":"-1721631396","predicate":"updateReadHistoryInbox","params":[{"name":"peer","type":"Peer"},{"name":"max_id","type":"int"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"791617983","predicate":"updateReadHistoryOutbox","params":[{"name":"peer","type":"Peer"},{"name":"max_id","type":"int"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"-2066640507","predicate":"messages.affectedMessages","params":[{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"messages.AffectedMessages"},{"id":"1599050311","predicate":"contactLinkUnknown","params":[],"type":"ContactLink"},{"id":"-17968211","predicate":"contactLinkNone","params":[],"type":"ContactLink"},{"id":"646922073","predicate":"contactLinkHasPhone","params":[],"type":"ContactLink"},{"id":"-721239344","predicate":"contactLinkContact","params":[],"type":"ContactLink"},{"id":"2139689491","predicate":"updateWebPage","params":[{"name":"webpage","type":"WebPage"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"-350980120","predicate":"webPageEmpty","params":[{"name":"id","type":"long"}],"type":"WebPage"},{"id":"-981018084","predicate":"webPagePending","params":[{"name":"id","type":"long"},{"name":"date","type":"int"}],"type":"WebPage"},{"id":"-897446185","predicate":"webPage","params":[{"name":"flags","type":"#"},{"name":"id","type":"long"},{"name":"url","type":"string"},{"name":"display_url","type":"string"},{"name":"type","type":"flags.0?string"},{"name":"site_name","type":"flags.1?string"},{"name":"title","type":"flags.2?string"},{"name":"description","type":"flags.3?string"},{"name":"photo","type":"flags.4?Photo"},{"name":"embed_url","type":"flags.5?string"},{"name":"embed_type","type":"flags.5?string"},{"name":"embed_width","type":"flags.6?int"},{"name":"embed_height","type":"flags.6?int"},{"name":"duration","type":"flags.7?int"},{"name":"author","type":"flags.8?string"},{"name":"document","type":"flags.9?Document"}],"type":"WebPage"},{"id":"-1557277184","predicate":"messageMediaWebPage","params":[{"name":"webpage","type":"WebPage"}],"type":"MessageMedia"},{"id":"2079516406","predicate":"authorization","params":[{"name":"hash","type":"long"},{"name":"flags","type":"int"},{"name":"device_model","type":"string"},{"name":"platform","type":"string"},{"name":"system_version","type":"string"},{"name":"api_id","type":"int"},{"name":"app_name","type":"string"},{"name":"app_version","type":"string"},{"name":"date_created","type":"int"},{"name":"date_active","type":"int"},{"name":"ip","type":"string"},{"name":"country","type":"string"},{"name":"region","type":"string"}],"type":"Authorization"},{"id":"307276766","predicate":"account.authorizations","params":[{"name":"authorizations","type":"Vector"}],"type":"account.Authorizations"},{"id":"-1764049896","predicate":"account.noPassword","params":[{"name":"new_salt","type":"bytes"},{"name":"email_unconfirmed_pattern","type":"string"}],"type":"account.Password"},{"id":"2081952796","predicate":"account.password","params":[{"name":"current_salt","type":"bytes"},{"name":"new_salt","type":"bytes"},{"name":"hint","type":"string"},{"name":"has_recovery","type":"Bool"},{"name":"email_unconfirmed_pattern","type":"string"}],"type":"account.Password"},{"id":"-1212732749","predicate":"account.passwordSettings","params":[{"name":"email","type":"string"}],"type":"account.PasswordSettings"},{"id":"-2037289493","predicate":"account.passwordInputSettings","params":[{"name":"flags","type":"#"},{"name":"new_salt","type":"flags.0?bytes"},{"name":"new_password_hash","type":"flags.0?bytes"},{"name":"hint","type":"flags.0?string"},{"name":"email","type":"flags.1?string"}],"type":"account.PasswordInputSettings"},{"id":"326715557","predicate":"auth.passwordRecovery","params":[{"name":"email_pattern","type":"string"}],"type":"auth.PasswordRecovery"},{"id":"673687578","predicate":"inputMediaVenue","params":[{"name":"geo_point","type":"InputGeoPoint"},{"name":"title","type":"string"},{"name":"address","type":"string"},{"name":"provider","type":"string"},{"name":"venue_id","type":"string"}],"type":"InputMedia"},{"id":"2031269663","predicate":"messageMediaVenue","params":[{"name":"geo","type":"GeoPoint"},{"name":"title","type":"string"},{"name":"address","type":"string"},{"name":"provider","type":"string"},{"name":"venue_id","type":"string"}],"type":"MessageMedia"},{"id":"-1551583367","predicate":"receivedNotifyMessage","params":[{"name":"id","type":"int"},{"name":"flags","type":"int"}],"type":"ReceivedNotifyMessage"},{"id":"1776236393","predicate":"chatInviteEmpty","params":[],"type":"ExportedChatInvite"},{"id":"-64092740","predicate":"chatInviteExported","params":[{"name":"link","type":"string"}],"type":"ExportedChatInvite"},{"id":"1516793212","predicate":"chatInviteAlready","params":[{"name":"chat","type":"Chat"}],"type":"ChatInvite"},{"id":"-613092008","predicate":"chatInvite","params":[{"name":"flags","type":"#"},{"name":"channel","type":"flags.0?true"},{"name":"broadcast","type":"flags.1?true"},{"name":"public","type":"flags.2?true"},{"name":"megagroup","type":"flags.3?true"},{"name":"title","type":"string"},{"name":"photo","type":"ChatPhoto"},{"name":"participants_count","type":"int"},{"name":"participants","type":"flags.4?Vector"}],"type":"ChatInvite"},{"id":"-123931160","predicate":"messageActionChatJoinedByLink","params":[{"name":"inviter_id","type":"int"}],"type":"MessageAction"},{"id":"1757493555","predicate":"updateReadMessagesContents","params":[{"name":"messages","type":"Vector"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"-4838507","predicate":"inputStickerSetEmpty","params":[],"type":"InputStickerSet"},{"id":"-1645763991","predicate":"inputStickerSetID","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputStickerSet"},{"id":"-2044933984","predicate":"inputStickerSetShortName","params":[{"name":"short_name","type":"string"}],"type":"InputStickerSet"},{"id":"-852477119","predicate":"stickerSet","params":[{"name":"flags","type":"#"},{"name":"installed","type":"flags.0?true"},{"name":"archived","type":"flags.1?true"},{"name":"official","type":"flags.2?true"},{"name":"id","type":"long"},{"name":"access_hash","type":"long"},{"name":"title","type":"string"},{"name":"short_name","type":"string"},{"name":"count","type":"int"},{"name":"hash","type":"int"}],"type":"StickerSet"},{"id":"-1240849242","predicate":"messages.stickerSet","params":[{"name":"set","type":"StickerSet"},{"name":"packs","type":"Vector"},{"name":"documents","type":"Vector"}],"type":"messages.StickerSet"},{"id":"-787638374","predicate":"user","params":[{"name":"flags","type":"#"},{"name":"self","type":"flags.10?true"},{"name":"contact","type":"flags.11?true"},{"name":"mutual_contact","type":"flags.12?true"},{"name":"deleted","type":"flags.13?true"},{"name":"bot","type":"flags.14?true"},{"name":"bot_chat_history","type":"flags.15?true"},{"name":"bot_nochats","type":"flags.16?true"},{"name":"verified","type":"flags.17?true"},{"name":"restricted","type":"flags.18?true"},{"name":"min","type":"flags.20?true"},{"name":"bot_inline_geo","type":"flags.21?true"},{"name":"id","type":"int"},{"name":"access_hash","type":"flags.0?long"},{"name":"first_name","type":"flags.1?string"},{"name":"last_name","type":"flags.2?string"},{"name":"username","type":"flags.3?string"},{"name":"phone","type":"flags.4?string"},{"name":"photo","type":"flags.5?UserProfilePhoto"},{"name":"status","type":"flags.6?UserStatus"},{"name":"bot_info_version","type":"flags.14?int"},{"name":"restriction_reason","type":"flags.18?string"},{"name":"bot_inline_placeholder","type":"flags.19?string"}],"type":"User"},{"id":"-1032140601","predicate":"botCommand","params":[{"name":"command","type":"string"},{"name":"description","type":"string"}],"type":"BotCommand"},{"id":"-1729618630","predicate":"botInfo","params":[{"name":"user_id","type":"int"},{"name":"description","type":"string"},{"name":"commands","type":"Vector"}],"type":"BotInfo"},{"id":"-1560655744","predicate":"keyboardButton","params":[{"name":"text","type":"string"}],"type":"KeyboardButton"},{"id":"2002815875","predicate":"keyboardButtonRow","params":[{"name":"buttons","type":"Vector"}],"type":"KeyboardButtonRow"},{"id":"-1606526075","predicate":"replyKeyboardHide","params":[{"name":"flags","type":"#"},{"name":"selective","type":"flags.2?true"}],"type":"ReplyMarkup"},{"id":"-200242528","predicate":"replyKeyboardForceReply","params":[{"name":"flags","type":"#"},{"name":"single_use","type":"flags.1?true"},{"name":"selective","type":"flags.2?true"}],"type":"ReplyMarkup"},{"id":"889353612","predicate":"replyKeyboardMarkup","params":[{"name":"flags","type":"#"},{"name":"resize","type":"flags.0?true"},{"name":"single_use","type":"flags.1?true"},{"name":"selective","type":"flags.2?true"},{"name":"rows","type":"Vector"}],"type":"ReplyMarkup"},{"id":"2072935910","predicate":"inputPeerUser","params":[{"name":"user_id","type":"int"},{"name":"access_hash","type":"long"}],"type":"InputPeer"},{"id":"-668391402","predicate":"inputUser","params":[{"name":"user_id","type":"int"},{"name":"access_hash","type":"long"}],"type":"InputUser"},{"id":"-1350696044","predicate":"help.appChangelogEmpty","params":[],"type":"help.AppChangelog"},{"id":"1181279933","predicate":"help.appChangelog","params":[{"name":"text","type":"string"}],"type":"help.AppChangelog"},{"id":"-1148011883","predicate":"messageEntityUnknown","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"-100378723","predicate":"messageEntityMention","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"1868782349","predicate":"messageEntityHashtag","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"1827637959","predicate":"messageEntityBotCommand","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"1859134776","predicate":"messageEntityUrl","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"1692693954","predicate":"messageEntityEmail","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"-1117713463","predicate":"messageEntityBold","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"-2106619040","predicate":"messageEntityItalic","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"681706865","predicate":"messageEntityCode","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"1938967520","predicate":"messageEntityPre","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"},{"name":"language","type":"string"}],"type":"MessageEntity"},{"id":"1990644519","predicate":"messageEntityTextUrl","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"},{"name":"url","type":"string"}],"type":"MessageEntity"},{"id":"301019932","predicate":"updateShortSentMessage","params":[{"name":"flags","type":"#"},{"name":"out","type":"flags.1?true"},{"name":"id","type":"int"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"},{"name":"date","type":"int"},{"name":"media","type":"flags.9?MessageMedia"},{"name":"entities","type":"flags.7?Vector"}],"type":"Updates"},{"id":"-292807034","predicate":"inputChannelEmpty","params":[],"type":"InputChannel"},{"id":"-1343524562","predicate":"inputChannel","params":[{"name":"channel_id","type":"int"},{"name":"access_hash","type":"long"}],"type":"InputChannel"},{"id":"-1109531342","predicate":"peerChannel","params":[{"name":"channel_id","type":"int"}],"type":"Peer"},{"id":"548253432","predicate":"inputPeerChannel","params":[{"name":"channel_id","type":"int"},{"name":"access_hash","type":"long"}],"type":"InputPeer"},{"id":"-1588737454","predicate":"channel","params":[{"name":"flags","type":"#"},{"name":"creator","type":"flags.0?true"},{"name":"kicked","type":"flags.1?true"},{"name":"left","type":"flags.2?true"},{"name":"editor","type":"flags.3?true"},{"name":"moderator","type":"flags.4?true"},{"name":"broadcast","type":"flags.5?true"},{"name":"verified","type":"flags.7?true"},{"name":"megagroup","type":"flags.8?true"},{"name":"restricted","type":"flags.9?true"},{"name":"democracy","type":"flags.10?true"},{"name":"signatures","type":"flags.11?true"},{"name":"min","type":"flags.12?true"},{"name":"id","type":"int"},{"name":"access_hash","type":"flags.13?long"},{"name":"title","type":"string"},{"name":"username","type":"flags.6?string"},{"name":"photo","type":"ChatPhoto"},{"name":"date","type":"int"},{"name":"version","type":"int"},{"name":"restriction_reason","type":"flags.9?string"}],"type":"Chat"},{"id":"-2059962289","predicate":"channelForbidden","params":[{"name":"flags","type":"#"},{"name":"broadcast","type":"flags.5?true"},{"name":"megagroup","type":"flags.8?true"},{"name":"id","type":"int"},{"name":"access_hash","type":"long"},{"name":"title","type":"string"}],"type":"Chat"},{"id":"2131196633","predicate":"contacts.resolvedPeer","params":[{"name":"peer","type":"Peer"},{"name":"chats","type":"Vector"},{"name":"users","type":"Vector"}],"type":"contacts.ResolvedPeer"},{"id":"-1009430225","predicate":"channelFull","params":[{"name":"flags","type":"#"},{"name":"can_view_participants","type":"flags.3?true"},{"name":"can_set_username","type":"flags.6?true"},{"name":"id","type":"int"},{"name":"about","type":"string"},{"name":"participants_count","type":"flags.0?int"},{"name":"admins_count","type":"flags.1?int"},{"name":"kicked_count","type":"flags.2?int"},{"name":"read_inbox_max_id","type":"int"},{"name":"read_outbox_max_id","type":"int"},{"name":"unread_count","type":"int"},{"name":"chat_photo","type":"Photo"},{"name":"notify_settings","type":"PeerNotifySettings"},{"name":"exported_invite","type":"ExportedChatInvite"},{"name":"bot_info","type":"Vector"},{"name":"migrated_from_chat_id","type":"flags.4?int"},{"name":"migrated_from_max_id","type":"flags.4?int"},{"name":"pinned_msg_id","type":"flags.5?int"}],"type":"ChatFull"},{"id":"182649427","predicate":"messageRange","params":[{"name":"min_id","type":"int"},{"name":"max_id","type":"int"}],"type":"MessageRange"},{"id":"-1725551049","predicate":"messages.channelMessages","params":[{"name":"flags","type":"#"},{"name":"pts","type":"int"},{"name":"count","type":"int"},{"name":"messages","type":"Vector"},{"name":"chats","type":"Vector"},{"name":"users","type":"Vector"}],"type":"messages.Messages"},{"id":"-1781355374","predicate":"messageActionChannelCreate","params":[{"name":"title","type":"string"}],"type":"MessageAction"},{"id":"-352032773","predicate":"updateChannelTooLong","params":[{"name":"flags","type":"#"},{"name":"channel_id","type":"int"},{"name":"pts","type":"flags.0?int"}],"type":"Update"},{"id":"-1227598250","predicate":"updateChannel","params":[{"name":"channel_id","type":"int"}],"type":"Update"},{"id":"1656358105","predicate":"updateNewChannelMessage","params":[{"name":"message","type":"Message"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"1108669311","predicate":"updateReadChannelInbox","params":[{"name":"channel_id","type":"int"},{"name":"max_id","type":"int"}],"type":"Update"},{"id":"-1015733815","predicate":"updateDeleteChannelMessages","params":[{"name":"channel_id","type":"int"},{"name":"messages","type":"Vector"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"-1734268085","predicate":"updateChannelMessageViews","params":[{"name":"channel_id","type":"int"},{"name":"id","type":"int"},{"name":"views","type":"int"}],"type":"Update"},{"id":"1041346555","predicate":"updates.channelDifferenceEmpty","params":[{"name":"flags","type":"#"},{"name":"final","type":"flags.0?true"},{"name":"pts","type":"int"},{"name":"timeout","type":"flags.1?int"}],"type":"updates.ChannelDifference"},{"id":"1091431943","predicate":"updates.channelDifferenceTooLong","params":[{"name":"flags","type":"#"},{"name":"final","type":"flags.0?true"},{"name":"pts","type":"int"},{"name":"timeout","type":"flags.1?int"},{"name":"top_message","type":"int"},{"name":"read_inbox_max_id","type":"int"},{"name":"read_outbox_max_id","type":"int"},{"name":"unread_count","type":"int"},{"name":"messages","type":"Vector"},{"name":"chats","type":"Vector"},{"name":"users","type":"Vector"}],"type":"updates.ChannelDifference"},{"id":"543450958","predicate":"updates.channelDifference","params":[{"name":"flags","type":"#"},{"name":"final","type":"flags.0?true"},{"name":"pts","type":"int"},{"name":"timeout","type":"flags.1?int"},{"name":"new_messages","type":"Vector"},{"name":"other_updates","type":"Vector"},{"name":"chats","type":"Vector"},{"name":"users","type":"Vector"}],"type":"updates.ChannelDifference"},{"id":"-1798033689","predicate":"channelMessagesFilterEmpty","params":[],"type":"ChannelMessagesFilter"},{"id":"-847783593","predicate":"channelMessagesFilter","params":[{"name":"flags","type":"#"},{"name":"exclude_new_messages","type":"flags.1?true"},{"name":"ranges","type":"Vector"}],"type":"ChannelMessagesFilter"},{"id":"367766557","predicate":"channelParticipant","params":[{"name":"user_id","type":"int"},{"name":"date","type":"int"}],"type":"ChannelParticipant"},{"id":"-1557620115","predicate":"channelParticipantSelf","params":[{"name":"user_id","type":"int"},{"name":"inviter_id","type":"int"},{"name":"date","type":"int"}],"type":"ChannelParticipant"},{"id":"-1861910545","predicate":"channelParticipantModerator","params":[{"name":"user_id","type":"int"},{"name":"inviter_id","type":"int"},{"name":"date","type":"int"}],"type":"ChannelParticipant"},{"id":"-1743180447","predicate":"channelParticipantEditor","params":[{"name":"user_id","type":"int"},{"name":"inviter_id","type":"int"},{"name":"date","type":"int"}],"type":"ChannelParticipant"},{"id":"-1933187430","predicate":"channelParticipantKicked","params":[{"name":"user_id","type":"int"},{"name":"kicked_by","type":"int"},{"name":"date","type":"int"}],"type":"ChannelParticipant"},{"id":"-471670279","predicate":"channelParticipantCreator","params":[{"name":"user_id","type":"int"}],"type":"ChannelParticipant"},{"id":"-566281095","predicate":"channelParticipantsRecent","params":[],"type":"ChannelParticipantsFilter"},{"id":"-1268741783","predicate":"channelParticipantsAdmins","params":[],"type":"ChannelParticipantsFilter"},{"id":"1010285434","predicate":"channelParticipantsKicked","params":[],"type":"ChannelParticipantsFilter"},{"id":"-1299865402","predicate":"channelRoleEmpty","params":[],"type":"ChannelParticipantRole"},{"id":"-1776756363","predicate":"channelRoleModerator","params":[],"type":"ChannelParticipantRole"},{"id":"-2113143156","predicate":"channelRoleEditor","params":[],"type":"ChannelParticipantRole"},{"id":"-177282392","predicate":"channels.channelParticipants","params":[{"name":"count","type":"int"},{"name":"participants","type":"Vector"},{"name":"users","type":"Vector"}],"type":"channels.ChannelParticipants"},{"id":"-791039645","predicate":"channels.channelParticipant","params":[{"name":"participant","type":"ChannelParticipant"},{"name":"users","type":"Vector"}],"type":"channels.ChannelParticipant"},{"id":"-636267638","predicate":"chatParticipantCreator","params":[{"name":"user_id","type":"int"}],"type":"ChatParticipant"},{"id":"-489233354","predicate":"chatParticipantAdmin","params":[{"name":"user_id","type":"int"},{"name":"inviter_id","type":"int"},{"name":"date","type":"int"}],"type":"ChatParticipant"},{"id":"1855224129","predicate":"updateChatAdmins","params":[{"name":"chat_id","type":"int"},{"name":"enabled","type":"Bool"},{"name":"version","type":"int"}],"type":"Update"},{"id":"-1232070311","predicate":"updateChatParticipantAdmin","params":[{"name":"chat_id","type":"int"},{"name":"user_id","type":"int"},{"name":"is_admin","type":"Bool"},{"name":"version","type":"int"}],"type":"Update"},{"id":"1371385889","predicate":"messageActionChatMigrateTo","params":[{"name":"channel_id","type":"int"}],"type":"MessageAction"},{"id":"-1336546578","predicate":"messageActionChannelMigrateFrom","params":[{"name":"title","type":"string"},{"name":"chat_id","type":"int"}],"type":"MessageAction"},{"id":"-1328445861","predicate":"channelParticipantsBots","params":[],"type":"ChannelParticipantsFilter"},{"id":"-236044656","predicate":"help.termsOfService","params":[{"name":"text","type":"string"}],"type":"help.TermsOfService"},{"id":"1753886890","predicate":"updateNewStickerSet","params":[{"name":"stickerset","type":"messages.StickerSet"}],"type":"Update"},{"id":"-253774767","predicate":"updateStickerSetsOrder","params":[{"name":"order","type":"Vector"}],"type":"Update"},{"id":"1135492588","predicate":"updateStickerSets","params":[],"type":"Update"},{"id":"372165663","predicate":"foundGif","params":[{"name":"url","type":"string"},{"name":"thumb_url","type":"string"},{"name":"content_url","type":"string"},{"name":"content_type","type":"string"},{"name":"w","type":"int"},{"name":"h","type":"int"}],"type":"FoundGif"},{"id":"-1670052855","predicate":"foundGifCached","params":[{"name":"url","type":"string"},{"name":"photo","type":"Photo"},{"name":"document","type":"Document"}],"type":"FoundGif"},{"id":"1212395773","predicate":"inputMediaGifExternal","params":[{"name":"url","type":"string"},{"name":"q","type":"string"}],"type":"InputMedia"},{"id":"1158290442","predicate":"messages.foundGifs","params":[{"name":"next_offset","type":"int"},{"name":"results","type":"Vector"}],"type":"messages.FoundGifs"},{"id":"-402498398","predicate":"messages.savedGifsNotModified","params":[],"type":"messages.SavedGifs"},{"id":"772213157","predicate":"messages.savedGifs","params":[{"name":"hash","type":"int"},{"name":"gifs","type":"Vector"}],"type":"messages.SavedGifs"},{"id":"-1821035490","predicate":"updateSavedGifs","params":[],"type":"Update"},{"id":"691006739","predicate":"inputBotInlineMessageMediaAuto","params":[{"name":"flags","type":"#"},{"name":"caption","type":"string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"InputBotInlineMessage"},{"id":"1036876423","predicate":"inputBotInlineMessageText","params":[{"name":"flags","type":"#"},{"name":"no_webpage","type":"flags.0?true"},{"name":"message","type":"string"},{"name":"entities","type":"flags.1?Vector"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"InputBotInlineMessage"},{"id":"750510426","predicate":"inputBotInlineResult","params":[{"name":"flags","type":"#"},{"name":"id","type":"string"},{"name":"type","type":"string"},{"name":"title","type":"flags.1?string"},{"name":"description","type":"flags.2?string"},{"name":"url","type":"flags.3?string"},{"name":"thumb_url","type":"flags.4?string"},{"name":"content_url","type":"flags.5?string"},{"name":"content_type","type":"flags.5?string"},{"name":"w","type":"flags.6?int"},{"name":"h","type":"flags.6?int"},{"name":"duration","type":"flags.7?int"},{"name":"send_message","type":"InputBotInlineMessage"}],"type":"InputBotInlineResult"},{"id":"175419739","predicate":"botInlineMessageMediaAuto","params":[{"name":"flags","type":"#"},{"name":"caption","type":"string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"BotInlineMessage"},{"id":"-1937807902","predicate":"botInlineMessageText","params":[{"name":"flags","type":"#"},{"name":"no_webpage","type":"flags.0?true"},{"name":"message","type":"string"},{"name":"entities","type":"flags.1?Vector"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"BotInlineMessage"},{"id":"-1679053127","predicate":"botInlineResult","params":[{"name":"flags","type":"#"},{"name":"id","type":"string"},{"name":"type","type":"string"},{"name":"title","type":"flags.1?string"},{"name":"description","type":"flags.2?string"},{"name":"url","type":"flags.3?string"},{"name":"thumb_url","type":"flags.4?string"},{"name":"content_url","type":"flags.5?string"},{"name":"content_type","type":"flags.5?string"},{"name":"w","type":"flags.6?int"},{"name":"h","type":"flags.6?int"},{"name":"duration","type":"flags.7?int"},{"name":"send_message","type":"BotInlineMessage"}],"type":"BotInlineResult"},{"id":"627509670","predicate":"messages.botResults","params":[{"name":"flags","type":"#"},{"name":"gallery","type":"flags.0?true"},{"name":"query_id","type":"long"},{"name":"next_offset","type":"flags.1?string"},{"name":"switch_pm","type":"flags.2?InlineBotSwitchPM"},{"name":"results","type":"Vector"}],"type":"messages.BotResults"},{"id":"1417832080","predicate":"updateBotInlineQuery","params":[{"name":"flags","type":"#"},{"name":"query_id","type":"long"},{"name":"user_id","type":"int"},{"name":"query","type":"string"},{"name":"geo","type":"flags.0?GeoPoint"},{"name":"offset","type":"string"}],"type":"Update"},{"id":"239663460","predicate":"updateBotInlineSend","params":[{"name":"flags","type":"#"},{"name":"user_id","type":"int"},{"name":"query","type":"string"},{"name":"geo","type":"flags.0?GeoPoint"},{"name":"id","type":"string"},{"name":"msg_id","type":"flags.1?InputBotInlineMessageID"}],"type":"Update"},{"id":"1358283666","predicate":"inputMessagesFilterVoice","params":[],"type":"MessagesFilter"},{"id":"928101534","predicate":"inputMessagesFilterMusic","params":[],"type":"MessagesFilter"},{"id":"-1107622874","predicate":"inputPrivacyKeyChatInvite","params":[],"type":"InputPrivacyKey"},{"id":"1343122938","predicate":"privacyKeyChatInvite","params":[],"type":"PrivacyKey"},{"id":"524838915","predicate":"exportedMessageLink","params":[{"name":"link","type":"string"}],"type":"ExportedMessageLink"},{"id":"-947462709","predicate":"messageFwdHeader","params":[{"name":"flags","type":"#"},{"name":"from_id","type":"flags.0?int"},{"name":"date","type":"int"},{"name":"channel_id","type":"flags.1?int"},{"name":"channel_post","type":"flags.2?int"}],"type":"MessageFwdHeader"},{"id":"457133559","predicate":"updateEditChannelMessage","params":[{"name":"message","type":"Message"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"-1738988427","predicate":"updateChannelPinnedMessage","params":[{"name":"channel_id","type":"int"},{"name":"id","type":"int"}],"type":"Update"},{"id":"-1799538451","predicate":"messageActionPinMessage","params":[],"type":"MessageAction"},{"id":"1923290508","predicate":"auth.codeTypeSms","params":[],"type":"auth.CodeType"},{"id":"1948046307","predicate":"auth.codeTypeCall","params":[],"type":"auth.CodeType"},{"id":"577556219","predicate":"auth.codeTypeFlashCall","params":[],"type":"auth.CodeType"},{"id":"1035688326","predicate":"auth.sentCodeTypeApp","params":[{"name":"length","type":"int"}],"type":"auth.SentCodeType"},{"id":"-1073693790","predicate":"auth.sentCodeTypeSms","params":[{"name":"length","type":"int"}],"type":"auth.SentCodeType"},{"id":"1398007207","predicate":"auth.sentCodeTypeCall","params":[{"name":"length","type":"int"}],"type":"auth.SentCodeType"},{"id":"-1425815847","predicate":"auth.sentCodeTypeFlashCall","params":[{"name":"pattern","type":"string"}],"type":"auth.SentCodeType"},{"id":"629866245","predicate":"keyboardButtonUrl","params":[{"name":"text","type":"string"},{"name":"url","type":"string"}],"type":"KeyboardButton"},{"id":"1748655686","predicate":"keyboardButtonCallback","params":[{"name":"text","type":"string"},{"name":"data","type":"bytes"}],"type":"KeyboardButton"},{"id":"-1318425559","predicate":"keyboardButtonRequestPhone","params":[{"name":"text","type":"string"}],"type":"KeyboardButton"},{"id":"-59151553","predicate":"keyboardButtonRequestGeoLocation","params":[{"name":"text","type":"string"}],"type":"KeyboardButton"},{"id":"-367298028","predicate":"keyboardButtonSwitchInline","params":[{"name":"text","type":"string"},{"name":"query","type":"string"}],"type":"KeyboardButton"},{"id":"1218642516","predicate":"replyInlineMarkup","params":[{"name":"rows","type":"Vector"}],"type":"ReplyMarkup"},{"id":"-1324486149","predicate":"messages.botCallbackAnswer","params":[{"name":"flags","type":"#"},{"name":"alert","type":"flags.1?true"},{"name":"message","type":"flags.0?string"},{"name":"url","type":"flags.2?string"}],"type":"messages.BotCallbackAnswer"},{"id":"-1500747636","predicate":"updateBotCallbackQuery","params":[{"name":"query_id","type":"long"},{"name":"user_id","type":"int"},{"name":"peer","type":"Peer"},{"name":"msg_id","type":"int"},{"name":"data","type":"bytes"}],"type":"Update"},{"id":"649453030","predicate":"messages.messageEditData","params":[{"name":"flags","type":"#"},{"name":"caption","type":"flags.0?true"}],"type":"messages.MessageEditData"},{"id":"-469536605","predicate":"updateEditMessage","params":[{"name":"message","type":"Message"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"-190472735","predicate":"inputBotInlineMessageMediaGeo","params":[{"name":"flags","type":"#"},{"name":"geo_point","type":"InputGeoPoint"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"InputBotInlineMessage"},{"id":"-1431327288","predicate":"inputBotInlineMessageMediaVenue","params":[{"name":"flags","type":"#"},{"name":"geo_point","type":"InputGeoPoint"},{"name":"title","type":"string"},{"name":"address","type":"string"},{"name":"provider","type":"string"},{"name":"venue_id","type":"string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"InputBotInlineMessage"},{"id":"766443943","predicate":"inputBotInlineMessageMediaContact","params":[{"name":"flags","type":"#"},{"name":"phone_number","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"InputBotInlineMessage"},{"id":"982505656","predicate":"botInlineMessageMediaGeo","params":[{"name":"flags","type":"#"},{"name":"geo","type":"GeoPoint"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"BotInlineMessage"},{"id":"1130767150","predicate":"botInlineMessageMediaVenue","params":[{"name":"flags","type":"#"},{"name":"geo","type":"GeoPoint"},{"name":"title","type":"string"},{"name":"address","type":"string"},{"name":"provider","type":"string"},{"name":"venue_id","type":"string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"BotInlineMessage"},{"id":"904770772","predicate":"botInlineMessageMediaContact","params":[{"name":"flags","type":"#"},{"name":"phone_number","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"BotInlineMessage"},{"id":"-1462213465","predicate":"inputBotInlineResultPhoto","params":[{"name":"id","type":"string"},{"name":"type","type":"string"},{"name":"photo","type":"InputPhoto"},{"name":"send_message","type":"InputBotInlineMessage"}],"type":"InputBotInlineResult"},{"id":"-459324","predicate":"inputBotInlineResultDocument","params":[{"name":"flags","type":"#"},{"name":"id","type":"string"},{"name":"type","type":"string"},{"name":"title","type":"flags.1?string"},{"name":"description","type":"flags.2?string"},{"name":"document","type":"InputDocument"},{"name":"send_message","type":"InputBotInlineMessage"}],"type":"InputBotInlineResult"},{"id":"400266251","predicate":"botInlineMediaResult","params":[{"name":"flags","type":"#"},{"name":"id","type":"string"},{"name":"type","type":"string"},{"name":"photo","type":"flags.0?Photo"},{"name":"document","type":"flags.1?Document"},{"name":"title","type":"flags.2?string"},{"name":"description","type":"flags.3?string"},{"name":"send_message","type":"BotInlineMessage"}],"type":"BotInlineResult"},{"id":"-1995686519","predicate":"inputBotInlineMessageID","params":[{"name":"dc_id","type":"int"},{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputBotInlineMessageID"},{"id":"750622127","predicate":"updateInlineBotCallbackQuery","params":[{"name":"query_id","type":"long"},{"name":"user_id","type":"int"},{"name":"msg_id","type":"InputBotInlineMessageID"},{"name":"data","type":"bytes"}],"type":"Update"},{"id":"1008755359","predicate":"inlineBotSwitchPM","params":[{"name":"text","type":"string"},{"name":"start_param","type":"string"}],"type":"InlineBotSwitchPM"},{"id":"863093588","predicate":"messages.peerDialogs","params":[{"name":"dialogs","type":"Vector"},{"name":"messages","type":"Vector"},{"name":"chats","type":"Vector"},{"name":"users","type":"Vector"},{"name":"state","type":"updates.State"}],"type":"messages.PeerDialogs"},{"id":"-305282981","predicate":"topPeer","params":[{"name":"peer","type":"Peer"},{"name":"rating","type":"double"}],"type":"TopPeer"},{"id":"-1419371685","predicate":"topPeerCategoryBotsPM","params":[],"type":"TopPeerCategory"},{"id":"344356834","predicate":"topPeerCategoryBotsInline","params":[],"type":"TopPeerCategory"},{"id":"104314861","predicate":"topPeerCategoryCorrespondents","params":[],"type":"TopPeerCategory"},{"id":"-1122524854","predicate":"topPeerCategoryGroups","params":[],"type":"TopPeerCategory"},{"id":"371037736","predicate":"topPeerCategoryChannels","params":[],"type":"TopPeerCategory"},{"id":"-75283823","predicate":"topPeerCategoryPeers","params":[{"name":"category","type":"TopPeerCategory"},{"name":"count","type":"int"},{"name":"peers","type":"Vector"}],"type":"TopPeerCategoryPeers"},{"id":"-567906571","predicate":"contacts.topPeersNotModified","params":[],"type":"contacts.TopPeers"},{"id":"1891070632","predicate":"contacts.topPeers","params":[{"name":"categories","type":"Vector"},{"name":"chats","type":"Vector"},{"name":"users","type":"Vector"}],"type":"contacts.TopPeers"},{"id":"892193368","predicate":"messageEntityMentionName","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"},{"name":"user_id","type":"int"}],"type":"MessageEntity"},{"id":"546203849","predicate":"inputMessageEntityMentionName","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"},{"name":"user_id","type":"InputUser"}],"type":"MessageEntity"},{"id":"975236280","predicate":"inputMessagesFilterChatPhotos","params":[],"type":"MessagesFilter"},{"id":"634833351","predicate":"updateReadChannelOutbox","params":[{"name":"channel_id","type":"int"},{"name":"max_id","type":"int"}],"type":"Update"},{"id":"-299124375","predicate":"updateDraftMessage","params":[{"name":"peer","type":"Peer"},{"name":"draft","type":"DraftMessage"}],"type":"Update"},{"id":"-1169445179","predicate":"draftMessageEmpty","params":[],"type":"DraftMessage"},{"id":"-40996577","predicate":"draftMessage","params":[{"name":"flags","type":"#"},{"name":"no_webpage","type":"flags.1?true"},{"name":"reply_to_msg_id","type":"flags.0?int"},{"name":"message","type":"string"},{"name":"entities","type":"flags.3?Vector"},{"name":"date","type":"int"}],"type":"DraftMessage"},{"id":"-1615153660","predicate":"messageActionHistoryClear","params":[],"type":"MessageAction"},{"id":"82699215","predicate":"messages.featuredStickersNotModified","params":[],"type":"messages.FeaturedStickers"},{"id":"-123893531","predicate":"messages.featuredStickers","params":[{"name":"hash","type":"int"},{"name":"sets","type":"Vector"},{"name":"unread","type":"Vector"}],"type":"messages.FeaturedStickers"},{"id":"1461528386","predicate":"updateReadFeaturedStickers","params":[],"type":"Update"},{"id":"186120336","predicate":"messages.recentStickersNotModified","params":[],"type":"messages.RecentStickers"},{"id":"1558317424","predicate":"messages.recentStickers","params":[{"name":"hash","type":"int"},{"name":"stickers","type":"Vector"}],"type":"messages.RecentStickers"},{"id":"-1706939360","predicate":"updateRecentStickers","params":[],"type":"Update"},{"id":"1338747336","predicate":"messages.archivedStickers","params":[{"name":"count","type":"int"},{"name":"sets","type":"Vector"}],"type":"messages.ArchivedStickers"},{"id":"946083368","predicate":"messages.stickerSetInstallResultSuccess","params":[],"type":"messages.StickerSetInstallResult"},{"id":"904138920","predicate":"messages.stickerSetInstallResultArchive","params":[{"name":"sets","type":"Vector"}],"type":"messages.StickerSetInstallResult"},{"id":"1678812626","predicate":"stickerSetCovered","params":[{"name":"set","type":"StickerSet"},{"name":"cover","type":"Document"}],"type":"StickerSetCovered"}],"methods":[{"id":"-878758099","method":"invokeAfterMsg","params":[{"name":"msg_id","type":"long"},{"name":"query","type":"!X"}],"type":"X"},{"id":"1036301552","method":"invokeAfterMsgs","params":[{"name":"msg_ids","type":"Vector"},{"name":"query","type":"!X"}],"type":"X"},{"id":"1877286395","method":"auth.checkPhone","params":[{"name":"phone_number","type":"string"}],"type":"auth.CheckedPhone"},{"id":"-2035355412","method":"auth.sendCode","params":[{"name":"flags","type":"#"},{"name":"allow_flashcall","type":"flags.0?true"},{"name":"phone_number","type":"string"},{"name":"current_number","type":"flags.0?Bool"},{"name":"api_id","type":"int"},{"name":"api_hash","type":"string"}],"type":"auth.SentCode"},{"id":"453408308","method":"auth.signUp","params":[{"name":"phone_number","type":"string"},{"name":"phone_code_hash","type":"string"},{"name":"phone_code","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"}],"type":"auth.Authorization"},{"id":"-1126886015","method":"auth.signIn","params":[{"name":"phone_number","type":"string"},{"name":"phone_code_hash","type":"string"},{"name":"phone_code","type":"string"}],"type":"auth.Authorization"},{"id":"1461180992","method":"auth.logOut","params":[],"type":"Bool"},{"id":"-1616179942","method":"auth.resetAuthorizations","params":[],"type":"Bool"},{"id":"1998331287","method":"auth.sendInvites","params":[{"name":"phone_numbers","type":"Vector"},{"name":"message","type":"string"}],"type":"Bool"},{"id":"-440401971","method":"auth.exportAuthorization","params":[{"name":"dc_id","type":"int"}],"type":"auth.ExportedAuthorization"},{"id":"-470837741","method":"auth.importAuthorization","params":[{"name":"id","type":"int"},{"name":"bytes","type":"bytes"}],"type":"auth.Authorization"},{"id":"-841733627","method":"auth.bindTempAuthKey","params":[{"name":"perm_auth_key_id","type":"long"},{"name":"nonce","type":"long"},{"name":"expires_at","type":"int"},{"name":"encrypted_message","type":"bytes"}],"type":"Bool"},{"id":"1669245048","method":"account.registerDevice","params":[{"name":"token_type","type":"int"},{"name":"token","type":"string"}],"type":"Bool"},{"id":"1707432768","method":"account.unregisterDevice","params":[{"name":"token_type","type":"int"},{"name":"token","type":"string"}],"type":"Bool"},{"id":"-2067899501","method":"account.updateNotifySettings","params":[{"name":"peer","type":"InputNotifyPeer"},{"name":"settings","type":"InputPeerNotifySettings"}],"type":"Bool"},{"id":"313765169","method":"account.getNotifySettings","params":[{"name":"peer","type":"InputNotifyPeer"}],"type":"PeerNotifySettings"},{"id":"-612493497","method":"account.resetNotifySettings","params":[],"type":"Bool"},{"id":"2018596725","method":"account.updateProfile","params":[{"name":"flags","type":"#"},{"name":"first_name","type":"flags.0?string"},{"name":"last_name","type":"flags.1?string"},{"name":"about","type":"flags.2?string"}],"type":"User"},{"id":"1713919532","method":"account.updateStatus","params":[{"name":"offline","type":"Bool"}],"type":"Bool"},{"id":"-1068696894","method":"account.getWallPapers","params":[],"type":"Vector"},{"id":"-1374118561","method":"account.reportPeer","params":[{"name":"peer","type":"InputPeer"},{"name":"reason","type":"ReportReason"}],"type":"Bool"},{"id":"227648840","method":"users.getUsers","params":[{"name":"id","type":"Vector"}],"type":"Vector"},{"id":"-902781519","method":"users.getFullUser","params":[{"name":"id","type":"InputUser"}],"type":"UserFull"},{"id":"-995929106","method":"contacts.getStatuses","params":[],"type":"Vector"},{"id":"583445000","method":"contacts.getContacts","params":[{"name":"hash","type":"string"}],"type":"contacts.Contacts"},{"id":"-634342611","method":"contacts.importContacts","params":[{"name":"contacts","type":"Vector"},{"name":"replace","type":"Bool"}],"type":"contacts.ImportedContacts"},{"id":"-1902823612","method":"contacts.deleteContact","params":[{"name":"id","type":"InputUser"}],"type":"contacts.Link"},{"id":"1504393374","method":"contacts.deleteContacts","params":[{"name":"id","type":"Vector"}],"type":"Bool"},{"id":"858475004","method":"contacts.block","params":[{"name":"id","type":"InputUser"}],"type":"Bool"},{"id":"-448724803","method":"contacts.unblock","params":[{"name":"id","type":"InputUser"}],"type":"Bool"},{"id":"-176409329","method":"contacts.getBlocked","params":[{"name":"offset","type":"int"},{"name":"limit","type":"int"}],"type":"contacts.Blocked"},{"id":"-2065352905","method":"contacts.exportCard","params":[],"type":"Vector"},{"id":"1340184318","method":"contacts.importCard","params":[{"name":"export_card","type":"Vector"}],"type":"User"},{"id":"1109588596","method":"messages.getMessages","params":[{"name":"id","type":"Vector"}],"type":"messages.Messages"},{"id":"1799878989","method":"messages.getDialogs","params":[{"name":"offset_date","type":"int"},{"name":"offset_id","type":"int"},{"name":"offset_peer","type":"InputPeer"},{"name":"limit","type":"int"}],"type":"messages.Dialogs"},{"id":"-1347868602","method":"messages.getHistory","params":[{"name":"peer","type":"InputPeer"},{"name":"offset_id","type":"int"},{"name":"offset_date","type":"int"},{"name":"add_offset","type":"int"},{"name":"limit","type":"int"},{"name":"max_id","type":"int"},{"name":"min_id","type":"int"}],"type":"messages.Messages"},{"id":"-732523960","method":"messages.search","params":[{"name":"flags","type":"#"},{"name":"peer","type":"InputPeer"},{"name":"q","type":"string"},{"name":"filter","type":"MessagesFilter"},{"name":"min_date","type":"int"},{"name":"max_date","type":"int"},{"name":"offset","type":"int"},{"name":"max_id","type":"int"},{"name":"limit","type":"int"}],"type":"messages.Messages"},{"id":"238054714","method":"messages.readHistory","params":[{"name":"peer","type":"InputPeer"},{"name":"max_id","type":"int"}],"type":"messages.AffectedMessages"},{"id":"469850889","method":"messages.deleteHistory","params":[{"name":"flags","type":"#"},{"name":"just_clear","type":"flags.0?true"},{"name":"peer","type":"InputPeer"},{"name":"max_id","type":"int"}],"type":"messages.AffectedHistory"},{"id":"-1510897371","method":"messages.deleteMessages","params":[{"name":"id","type":"Vector"}],"type":"messages.AffectedMessages"},{"id":"94983360","method":"messages.receivedMessages","params":[{"name":"max_id","type":"int"}],"type":"Vector"},{"id":"-1551737264","method":"messages.setTyping","params":[{"name":"peer","type":"InputPeer"},{"name":"action","type":"SendMessageAction"}],"type":"Bool"},{"id":"-91733382","method":"messages.sendMessage","params":[{"name":"flags","type":"#"},{"name":"no_webpage","type":"flags.1?true"},{"name":"silent","type":"flags.5?true"},{"name":"background","type":"flags.6?true"},{"name":"clear_draft","type":"flags.7?true"},{"name":"peer","type":"InputPeer"},{"name":"reply_to_msg_id","type":"flags.0?int"},{"name":"message","type":"string"},{"name":"random_id","type":"long"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"},{"name":"entities","type":"flags.3?Vector"}],"type":"Updates"},{"id":"-923703407","method":"messages.sendMedia","params":[{"name":"flags","type":"#"},{"name":"silent","type":"flags.5?true"},{"name":"background","type":"flags.6?true"},{"name":"clear_draft","type":"flags.7?true"},{"name":"peer","type":"InputPeer"},{"name":"reply_to_msg_id","type":"flags.0?int"},{"name":"media","type":"InputMedia"},{"name":"random_id","type":"long"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"Updates"},{"id":"1888354709","method":"messages.forwardMessages","params":[{"name":"flags","type":"#"},{"name":"silent","type":"flags.5?true"},{"name":"background","type":"flags.6?true"},{"name":"from_peer","type":"InputPeer"},{"name":"id","type":"Vector"},{"name":"random_id","type":"Vector"},{"name":"to_peer","type":"InputPeer"}],"type":"Updates"},{"id":"-820669733","method":"messages.reportSpam","params":[{"name":"peer","type":"InputPeer"}],"type":"Bool"},{"id":"-1460572005","method":"messages.hideReportSpam","params":[{"name":"peer","type":"InputPeer"}],"type":"Bool"},{"id":"913498268","method":"messages.getPeerSettings","params":[{"name":"peer","type":"InputPeer"}],"type":"PeerSettings"},{"id":"1013621127","method":"messages.getChats","params":[{"name":"id","type":"Vector"}],"type":"messages.Chats"},{"id":"998448230","method":"messages.getFullChat","params":[{"name":"chat_id","type":"int"}],"type":"messages.ChatFull"},{"id":"-599447467","method":"messages.editChatTitle","params":[{"name":"chat_id","type":"int"},{"name":"title","type":"string"}],"type":"Updates"},{"id":"-900957736","method":"messages.editChatPhoto","params":[{"name":"chat_id","type":"int"},{"name":"photo","type":"InputChatPhoto"}],"type":"Updates"},{"id":"-106911223","method":"messages.addChatUser","params":[{"name":"chat_id","type":"int"},{"name":"user_id","type":"InputUser"},{"name":"fwd_limit","type":"int"}],"type":"Updates"},{"id":"-530505962","method":"messages.deleteChatUser","params":[{"name":"chat_id","type":"int"},{"name":"user_id","type":"InputUser"}],"type":"Updates"},{"id":"164303470","method":"messages.createChat","params":[{"name":"users","type":"Vector"},{"name":"title","type":"string"}],"type":"Updates"},{"id":"-304838614","method":"updates.getState","params":[],"type":"updates.State"},{"id":"168039573","method":"updates.getDifference","params":[{"name":"pts","type":"int"},{"name":"date","type":"int"},{"name":"qts","type":"int"}],"type":"updates.Difference"},{"id":"-285902432","method":"photos.updateProfilePhoto","params":[{"name":"id","type":"InputPhoto"},{"name":"crop","type":"InputPhotoCrop"}],"type":"UserProfilePhoto"},{"id":"-720397176","method":"photos.uploadProfilePhoto","params":[{"name":"file","type":"InputFile"},{"name":"caption","type":"string"},{"name":"geo_point","type":"InputGeoPoint"},{"name":"crop","type":"InputPhotoCrop"}],"type":"photos.Photo"},{"id":"-2016444625","method":"photos.deletePhotos","params":[{"name":"id","type":"Vector"}],"type":"Vector"},{"id":"-1291540959","method":"upload.saveFilePart","params":[{"name":"file_id","type":"long"},{"name":"file_part","type":"int"},{"name":"bytes","type":"bytes"}],"type":"Bool"},{"id":"-475607115","method":"upload.getFile","params":[{"name":"location","type":"InputFileLocation"},{"name":"offset","type":"int"},{"name":"limit","type":"int"}],"type":"upload.File"},{"id":"-990308245","method":"help.getConfig","params":[],"type":"Config"},{"id":"531836966","method":"help.getNearestDc","params":[],"type":"NearestDc"},{"id":"-1372724842","method":"help.getAppUpdate","params":[],"type":"help.AppUpdate"},{"id":"1862465352","method":"help.saveAppLog","params":[{"name":"events","type":"Vector"}],"type":"Bool"},{"id":"1295590211","method":"help.getInviteText","params":[],"type":"help.InviteText"},{"id":"-1848823128","method":"photos.getUserPhotos","params":[{"name":"user_id","type":"InputUser"},{"name":"offset","type":"int"},{"name":"max_id","type":"long"},{"name":"limit","type":"int"}],"type":"photos.Photos"},{"id":"865483769","method":"messages.forwardMessage","params":[{"name":"peer","type":"InputPeer"},{"name":"id","type":"int"},{"name":"random_id","type":"long"}],"type":"Updates"},{"id":"-1082919718","method":"messages.sendBroadcast","params":[{"name":"contacts","type":"Vector"},{"name":"random_id","type":"Vector"},{"name":"message","type":"string"},{"name":"media","type":"InputMedia"}],"type":"Updates"},{"id":"651135312","method":"messages.getDhConfig","params":[{"name":"version","type":"int"},{"name":"random_length","type":"int"}],"type":"messages.DhConfig"},{"id":"-162681021","method":"messages.requestEncryption","params":[{"name":"user_id","type":"InputUser"},{"name":"random_id","type":"int"},{"name":"g_a","type":"bytes"}],"type":"EncryptedChat"},{"id":"1035731989","method":"messages.acceptEncryption","params":[{"name":"peer","type":"InputEncryptedChat"},{"name":"g_b","type":"bytes"},{"name":"key_fingerprint","type":"long"}],"type":"EncryptedChat"},{"id":"-304536635","method":"messages.discardEncryption","params":[{"name":"chat_id","type":"int"}],"type":"Bool"},{"id":"2031374829","method":"messages.setEncryptedTyping","params":[{"name":"peer","type":"InputEncryptedChat"},{"name":"typing","type":"Bool"}],"type":"Bool"},{"id":"2135648522","method":"messages.readEncryptedHistory","params":[{"name":"peer","type":"InputEncryptedChat"},{"name":"max_date","type":"int"}],"type":"Bool"},{"id":"-1451792525","method":"messages.sendEncrypted","params":[{"name":"peer","type":"InputEncryptedChat"},{"name":"random_id","type":"long"},{"name":"data","type":"bytes"}],"type":"messages.SentEncryptedMessage"},{"id":"-1701831834","method":"messages.sendEncryptedFile","params":[{"name":"peer","type":"InputEncryptedChat"},{"name":"random_id","type":"long"},{"name":"data","type":"bytes"},{"name":"file","type":"InputEncryptedFile"}],"type":"messages.SentEncryptedMessage"},{"id":"852769188","method":"messages.sendEncryptedService","params":[{"name":"peer","type":"InputEncryptedChat"},{"name":"random_id","type":"long"},{"name":"data","type":"bytes"}],"type":"messages.SentEncryptedMessage"},{"id":"1436924774","method":"messages.receivedQueue","params":[{"name":"max_qts","type":"int"}],"type":"Vector"},{"id":"-562337987","method":"upload.saveBigFilePart","params":[{"name":"file_id","type":"long"},{"name":"file_part","type":"int"},{"name":"file_total_parts","type":"int"},{"name":"bytes","type":"bytes"}],"type":"Bool"},{"id":"1769565673","method":"initConnection","params":[{"name":"api_id","type":"int"},{"name":"device_model","type":"string"},{"name":"system_version","type":"string"},{"name":"app_version","type":"string"},{"name":"lang_code","type":"string"},{"name":"query","type":"!X"}],"type":"X"},{"id":"-1663104819","method":"help.getSupport","params":[],"type":"help.Support"},{"id":"916930423","method":"messages.readMessageContents","params":[{"name":"id","type":"Vector"}],"type":"messages.AffectedMessages"},{"id":"655677548","method":"account.checkUsername","params":[{"name":"username","type":"string"}],"type":"Bool"},{"id":"1040964988","method":"account.updateUsername","params":[{"name":"username","type":"string"}],"type":"User"},{"id":"301470424","method":"contacts.search","params":[{"name":"q","type":"string"},{"name":"limit","type":"int"}],"type":"contacts.Found"},{"id":"-623130288","method":"account.getPrivacy","params":[{"name":"key","type":"InputPrivacyKey"}],"type":"account.PrivacyRules"},{"id":"-906486552","method":"account.setPrivacy","params":[{"name":"key","type":"InputPrivacyKey"},{"name":"rules","type":"Vector"}],"type":"account.PrivacyRules"},{"id":"1099779595","method":"account.deleteAccount","params":[{"name":"reason","type":"string"}],"type":"Bool"},{"id":"150761757","method":"account.getAccountTTL","params":[],"type":"AccountDaysTTL"},{"id":"608323678","method":"account.setAccountTTL","params":[{"name":"ttl","type":"AccountDaysTTL"}],"type":"Bool"},{"id":"-627372787","method":"invokeWithLayer","params":[{"name":"layer","type":"int"},{"name":"query","type":"!X"}],"type":"X"},{"id":"-113456221","method":"contacts.resolveUsername","params":[{"name":"username","type":"string"}],"type":"contacts.ResolvedPeer"},{"id":"149257707","method":"account.sendChangePhoneCode","params":[{"name":"flags","type":"#"},{"name":"allow_flashcall","type":"flags.0?true"},{"name":"phone_number","type":"string"},{"name":"current_number","type":"flags.0?Bool"}],"type":"auth.SentCode"},{"id":"1891839707","method":"account.changePhone","params":[{"name":"phone_number","type":"string"},{"name":"phone_code_hash","type":"string"},{"name":"phone_code","type":"string"}],"type":"User"},{"id":"-1373446075","method":"messages.getStickers","params":[{"name":"emoticon","type":"string"},{"name":"hash","type":"string"}],"type":"messages.Stickers"},{"id":"479598769","method":"messages.getAllStickers","params":[{"name":"hash","type":"int"}],"type":"messages.AllStickers"},{"id":"954152242","method":"account.updateDeviceLocked","params":[{"name":"period","type":"int"}],"type":"Bool"},{"id":"1738800940","method":"auth.importBotAuthorization","params":[{"name":"flags","type":"int"},{"name":"api_id","type":"int"},{"name":"api_hash","type":"string"},{"name":"bot_auth_token","type":"string"}],"type":"auth.Authorization"},{"id":"623001124","method":"messages.getWebPagePreview","params":[{"name":"message","type":"string"}],"type":"MessageMedia"},{"id":"-484392616","method":"account.getAuthorizations","params":[],"type":"account.Authorizations"},{"id":"-545786948","method":"account.resetAuthorization","params":[{"name":"hash","type":"long"}],"type":"Bool"},{"id":"1418342645","method":"account.getPassword","params":[],"type":"account.Password"},{"id":"-1131605573","method":"account.getPasswordSettings","params":[{"name":"current_password_hash","type":"bytes"}],"type":"account.PasswordSettings"},{"id":"-92517498","method":"account.updatePasswordSettings","params":[{"name":"current_password_hash","type":"bytes"},{"name":"new_settings","type":"account.PasswordInputSettings"}],"type":"Bool"},{"id":"174260510","method":"auth.checkPassword","params":[{"name":"password_hash","type":"bytes"}],"type":"auth.Authorization"},{"id":"-661144474","method":"auth.requestPasswordRecovery","params":[],"type":"auth.PasswordRecovery"},{"id":"1319464594","method":"auth.recoverPassword","params":[{"name":"code","type":"string"}],"type":"auth.Authorization"},{"id":"-1080796745","method":"invokeWithoutUpdates","params":[{"name":"query","type":"!X"}],"type":"X"},{"id":"2106086025","method":"messages.exportChatInvite","params":[{"name":"chat_id","type":"int"}],"type":"ExportedChatInvite"},{"id":"1051570619","method":"messages.checkChatInvite","params":[{"name":"hash","type":"string"}],"type":"ChatInvite"},{"id":"1817183516","method":"messages.importChatInvite","params":[{"name":"hash","type":"string"}],"type":"Updates"},{"id":"639215886","method":"messages.getStickerSet","params":[{"name":"stickerset","type":"InputStickerSet"}],"type":"messages.StickerSet"},{"id":"-946871200","method":"messages.installStickerSet","params":[{"name":"stickerset","type":"InputStickerSet"},{"name":"archived","type":"Bool"}],"type":"messages.StickerSetInstallResult"},{"id":"-110209570","method":"messages.uninstallStickerSet","params":[{"name":"stickerset","type":"InputStickerSet"}],"type":"Bool"},{"id":"-421563528","method":"messages.startBot","params":[{"name":"bot","type":"InputUser"},{"name":"peer","type":"InputPeer"},{"name":"random_id","type":"long"},{"name":"start_param","type":"string"}],"type":"Updates"},{"id":"-1189013126","method":"help.getAppChangelog","params":[],"type":"help.AppChangelog"},{"id":"-993483427","method":"messages.getMessagesViews","params":[{"name":"peer","type":"InputPeer"},{"name":"id","type":"Vector"},{"name":"increment","type":"Bool"}],"type":"Vector"},{"id":"-871347913","method":"channels.readHistory","params":[{"name":"channel","type":"InputChannel"},{"name":"max_id","type":"int"}],"type":"Bool"},{"id":"-2067661490","method":"channels.deleteMessages","params":[{"name":"channel","type":"InputChannel"},{"name":"id","type":"Vector"}],"type":"messages.AffectedMessages"},{"id":"-787622117","method":"channels.deleteUserHistory","params":[{"name":"channel","type":"InputChannel"},{"name":"user_id","type":"InputUser"}],"type":"messages.AffectedHistory"},{"id":"-32999408","method":"channels.reportSpam","params":[{"name":"channel","type":"InputChannel"},{"name":"user_id","type":"InputUser"},{"name":"id","type":"Vector"}],"type":"Bool"},{"id":"-1814580409","method":"channels.getMessages","params":[{"name":"channel","type":"InputChannel"},{"name":"id","type":"Vector"}],"type":"messages.Messages"},{"id":"618237842","method":"channels.getParticipants","params":[{"name":"channel","type":"InputChannel"},{"name":"filter","type":"ChannelParticipantsFilter"},{"name":"offset","type":"int"},{"name":"limit","type":"int"}],"type":"channels.ChannelParticipants"},{"id":"1416484774","method":"channels.getParticipant","params":[{"name":"channel","type":"InputChannel"},{"name":"user_id","type":"InputUser"}],"type":"channels.ChannelParticipant"},{"id":"176122811","method":"channels.getChannels","params":[{"name":"id","type":"Vector"}],"type":"messages.Chats"},{"id":"141781513","method":"channels.getFullChannel","params":[{"name":"channel","type":"InputChannel"}],"type":"messages.ChatFull"},{"id":"-192332417","method":"channels.createChannel","params":[{"name":"flags","type":"#"},{"name":"broadcast","type":"flags.0?true"},{"name":"megagroup","type":"flags.1?true"},{"name":"title","type":"string"},{"name":"about","type":"string"}],"type":"Updates"},{"id":"333610782","method":"channels.editAbout","params":[{"name":"channel","type":"InputChannel"},{"name":"about","type":"string"}],"type":"Bool"},{"id":"-344583728","method":"channels.editAdmin","params":[{"name":"channel","type":"InputChannel"},{"name":"user_id","type":"InputUser"},{"name":"role","type":"ChannelParticipantRole"}],"type":"Updates"},{"id":"1450044624","method":"channels.editTitle","params":[{"name":"channel","type":"InputChannel"},{"name":"title","type":"string"}],"type":"Updates"},{"id":"-248621111","method":"channels.editPhoto","params":[{"name":"channel","type":"InputChannel"},{"name":"photo","type":"InputChatPhoto"}],"type":"Updates"},{"id":"283557164","method":"channels.checkUsername","params":[{"name":"channel","type":"InputChannel"},{"name":"username","type":"string"}],"type":"Bool"},{"id":"890549214","method":"channels.updateUsername","params":[{"name":"channel","type":"InputChannel"},{"name":"username","type":"string"}],"type":"Bool"},{"id":"615851205","method":"channels.joinChannel","params":[{"name":"channel","type":"InputChannel"}],"type":"Updates"},{"id":"-130635115","method":"channels.leaveChannel","params":[{"name":"channel","type":"InputChannel"}],"type":"Updates"},{"id":"429865580","method":"channels.inviteToChannel","params":[{"name":"channel","type":"InputChannel"},{"name":"users","type":"Vector"}],"type":"Updates"},{"id":"-1502421484","method":"channels.kickFromChannel","params":[{"name":"channel","type":"InputChannel"},{"name":"user_id","type":"InputUser"},{"name":"kicked","type":"Bool"}],"type":"Updates"},{"id":"-950663035","method":"channels.exportInvite","params":[{"name":"channel","type":"InputChannel"}],"type":"ExportedChatInvite"},{"id":"-1072619549","method":"channels.deleteChannel","params":[{"name":"channel","type":"InputChannel"}],"type":"Updates"},{"id":"-1154295872","method":"updates.getChannelDifference","params":[{"name":"channel","type":"InputChannel"},{"name":"filter","type":"ChannelMessagesFilter"},{"name":"pts","type":"int"},{"name":"limit","type":"int"}],"type":"updates.ChannelDifference"},{"id":"-326379039","method":"messages.toggleChatAdmins","params":[{"name":"chat_id","type":"int"},{"name":"enabled","type":"Bool"}],"type":"Updates"},{"id":"-1444503762","method":"messages.editChatAdmin","params":[{"name":"chat_id","type":"int"},{"name":"user_id","type":"InputUser"},{"name":"is_admin","type":"Bool"}],"type":"Bool"},{"id":"363051235","method":"messages.migrateChat","params":[{"name":"chat_id","type":"int"}],"type":"Updates"},{"id":"-1640190800","method":"messages.searchGlobal","params":[{"name":"q","type":"string"},{"name":"offset_date","type":"int"},{"name":"offset_peer","type":"InputPeer"},{"name":"offset_id","type":"int"},{"name":"limit","type":"int"}],"type":"messages.Messages"},{"id":"889286899","method":"help.getTermsOfService","params":[],"type":"help.TermsOfService"},{"id":"-1613775824","method":"messages.reorderStickerSets","params":[{"name":"order","type":"Vector"}],"type":"Bool"},{"id":"864953444","method":"messages.getDocumentByHash","params":[{"name":"sha256","type":"bytes"},{"name":"size","type":"int"},{"name":"mime_type","type":"string"}],"type":"Document"},{"id":"-1080395925","method":"messages.searchGifs","params":[{"name":"q","type":"string"},{"name":"offset","type":"int"}],"type":"messages.FoundGifs"},{"id":"-2084618926","method":"messages.getSavedGifs","params":[{"name":"hash","type":"int"}],"type":"messages.SavedGifs"},{"id":"846868683","method":"messages.saveGif","params":[{"name":"id","type":"InputDocument"},{"name":"unsave","type":"Bool"}],"type":"Bool"},{"id":"1364105629","method":"messages.getInlineBotResults","params":[{"name":"flags","type":"#"},{"name":"bot","type":"InputUser"},{"name":"peer","type":"InputPeer"},{"name":"geo_point","type":"flags.0?InputGeoPoint"},{"name":"query","type":"string"},{"name":"offset","type":"string"}],"type":"messages.BotResults"},{"id":"-346119674","method":"messages.setInlineBotResults","params":[{"name":"flags","type":"#"},{"name":"gallery","type":"flags.0?true"},{"name":"private","type":"flags.1?true"},{"name":"query_id","type":"long"},{"name":"results","type":"Vector"},{"name":"cache_time","type":"int"},{"name":"next_offset","type":"flags.2?string"},{"name":"switch_pm","type":"flags.3?InlineBotSwitchPM"}],"type":"Bool"},{"id":"-1318189314","method":"messages.sendInlineBotResult","params":[{"name":"flags","type":"#"},{"name":"silent","type":"flags.5?true"},{"name":"background","type":"flags.6?true"},{"name":"clear_draft","type":"flags.7?true"},{"name":"peer","type":"InputPeer"},{"name":"reply_to_msg_id","type":"flags.0?int"},{"name":"random_id","type":"long"},{"name":"query_id","type":"long"},{"name":"id","type":"string"}],"type":"Updates"},{"id":"1231065863","method":"channels.toggleInvites","params":[{"name":"channel","type":"InputChannel"},{"name":"enabled","type":"Bool"}],"type":"Updates"},{"id":"-934882771","method":"channels.exportMessageLink","params":[{"name":"channel","type":"InputChannel"},{"name":"id","type":"int"}],"type":"ExportedMessageLink"},{"id":"527021574","method":"channels.toggleSignatures","params":[{"name":"channel","type":"InputChannel"},{"name":"enabled","type":"Bool"}],"type":"Updates"},{"id":"-1490162350","method":"channels.updatePinnedMessage","params":[{"name":"flags","type":"#"},{"name":"silent","type":"flags.0?true"},{"name":"channel","type":"InputChannel"},{"name":"id","type":"int"}],"type":"Updates"},{"id":"1056025023","method":"auth.resendCode","params":[{"name":"phone_number","type":"string"},{"name":"phone_code_hash","type":"string"}],"type":"auth.SentCode"},{"id":"520357240","method":"auth.cancelCode","params":[{"name":"phone_number","type":"string"},{"name":"phone_code_hash","type":"string"}],"type":"Bool"},{"id":"-39416522","method":"messages.getMessageEditData","params":[{"name":"peer","type":"InputPeer"},{"name":"id","type":"int"}],"type":"messages.MessageEditData"},{"id":"-829299510","method":"messages.editMessage","params":[{"name":"flags","type":"#"},{"name":"no_webpage","type":"flags.1?true"},{"name":"peer","type":"InputPeer"},{"name":"id","type":"int"},{"name":"message","type":"flags.11?string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"},{"name":"entities","type":"flags.3?Vector"}],"type":"Updates"},{"id":"319564933","method":"messages.editInlineBotMessage","params":[{"name":"flags","type":"#"},{"name":"no_webpage","type":"flags.1?true"},{"name":"id","type":"InputBotInlineMessageID"},{"name":"message","type":"flags.11?string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"},{"name":"entities","type":"flags.3?Vector"}],"type":"Bool"},{"id":"-1494659324","method":"messages.getBotCallbackAnswer","params":[{"name":"peer","type":"InputPeer"},{"name":"msg_id","type":"int"},{"name":"data","type":"bytes"}],"type":"messages.BotCallbackAnswer"},{"id":"-920136629","method":"messages.setBotCallbackAnswer","params":[{"name":"flags","type":"#"},{"name":"alert","type":"flags.1?true"},{"name":"query_id","type":"long"},{"name":"message","type":"flags.0?string"},{"name":"url","type":"flags.2?string"}],"type":"Bool"},{"id":"-728224331","method":"contacts.getTopPeers","params":[{"name":"flags","type":"#"},{"name":"correspondents","type":"flags.0?true"},{"name":"bots_pm","type":"flags.1?true"},{"name":"bots_inline","type":"flags.2?true"},{"name":"groups","type":"flags.10?true"},{"name":"channels","type":"flags.15?true"},{"name":"offset","type":"int"},{"name":"limit","type":"int"},{"name":"hash","type":"int"}],"type":"contacts.TopPeers"},{"id":"451113900","method":"contacts.resetTopPeerRating","params":[{"name":"category","type":"TopPeerCategory"},{"name":"peer","type":"InputPeer"}],"type":"Bool"},{"id":"764901049","method":"messages.getPeerDialogs","params":[{"name":"peers","type":"Vector"}],"type":"messages.PeerDialogs"},{"id":"-1137057461","method":"messages.saveDraft","params":[{"name":"flags","type":"#"},{"name":"no_webpage","type":"flags.1?true"},{"name":"reply_to_msg_id","type":"flags.0?int"},{"name":"peer","type":"InputPeer"},{"name":"message","type":"string"},{"name":"entities","type":"flags.3?Vector"}],"type":"Bool"},{"id":"1782549861","method":"messages.getAllDrafts","params":[],"type":"Updates"},{"id":"766298703","method":"messages.getFeaturedStickers","params":[{"name":"hash","type":"int"}],"type":"messages.FeaturedStickers"},{"id":"14818491","method":"messages.readFeaturedStickers","params":[],"type":"Bool"},{"id":"-1726383060","method":"messages.getRecentStickers","params":[{"name":"hash","type":"int"}],"type":"messages.RecentStickers"},{"id":"881736127","method":"messages.saveRecentSticker","params":[{"name":"id","type":"InputDocument"},{"name":"unsave","type":"Bool"}],"type":"Bool"},{"id":"-1425873454","method":"messages.clearRecentStickers","params":[],"type":"Bool"},{"id":"1124718171","method":"messages.getUnusedStickers","params":[{"name":"limit","type":"int"}],"type":"Vector"},{"id":"-1871829985","method":"messages.getArchivedStickers","params":[{"name":"offset_id","type":"long"},{"name":"limit","type":"int"}],"type":"messages.ArchivedStickers"},{"id":"353818557","method":"account.sendConfirmPhoneCode","params":[{"name":"flags","type":"#"},{"name":"allow_flashcall","type":"flags.0?true"},{"name":"hash","type":"string"},{"name":"current_number","type":"flags.0?Bool"}],"type":"auth.SentCode"},{"id":"1596029123","method":"account.confirmPhone","params":[{"name":"phone_code_hash","type":"string"},{"name":"phone_code","type":"string"}],"type":"Bool"}]}. * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class Conversion { public static function random($length) { return $length === 0 ? '' : \phpseclib\Crypt\Random::string($length); } public static function unpack_signed_int($value) { if (strlen($value) !== 4) { throw new TL\Exception(\danog\MadelineProto\Lang::$current_lang['length_not_4']); } return unpack('l', !\danog\MadelineProto\Magic::$BIG_ENDIAN ? strrev($value) : $value)[1]; } public static function pack_signed_int($value) { if ($value > 2147483647) { throw new TL\Exception(sprintf(\danog\MadelineProto\Lang::$current_lang['value_bigger_than_2147483647'], $value)); } if ($value < -2147483648) { throw new TL\Exception(sprintf(\danog\MadelineProto\Lang::$current_lang['value_smaller_than_2147483648'], $value)); } $res = pack('l', $value); return !\danog\MadelineProto\Magic::$BIG_ENDIAN ? strrev($res) : $res; } public static function old_aes_calculate($msg_key, $auth_key, $to_server = true) { $x = $to_server ? 0 : 8; $sha1_a = sha1($msg_key.substr($auth_key, $x, 32), true); $sha1_b = sha1(substr($auth_key, 32 + $x, 16).$msg_key.substr($auth_key, 48 + $x, 16), true); $sha1_c = sha1(substr($auth_key, 64 + $x, 32).$msg_key, true); $sha1_d = sha1($msg_key.substr($auth_key, 96 + $x, 32), true); $aes_key = substr($sha1_a, 0, 8).substr($sha1_b, 8, 12).substr($sha1_c, 4, 12); $aes_iv = substr($sha1_a, 8, 12).substr($sha1_b, 0, 8).substr($sha1_c, 16, 4).substr($sha1_d, 0, 8); return [$aes_key, $aes_iv]; } public static function ige_decrypt($message, $key, $iv) { $cipher = new \phpseclib\Crypt\AES('ige'); $cipher->setKey($key); $cipher->setIV($iv); return @$cipher->decrypt($message); } public static function telethon($session, $new_session, $settings = []) { set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']); if (!extension_loaded('sqlite3')) { throw new Exception(['extension', 'sqlite3']); } if (!isset(pathinfo($session)['extension'])) { $session .= '.session'; } $session = Absolute::absolute($session); $sqlite = new \PDO("sqlite:$session"); $sqlite->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING); $sessions = $sqlite->query('SELECT * FROM sessions')->fetchAll(); $MadelineProto = new \danog\MadelineProto\API($new_session, $settings); foreach ($sessions as $dc) { $MadelineProto->API->datacenter->sockets[$dc['dc_id']]->auth_key = ['server_salt' => '', 'connection_inited' => true, 'id' => substr(sha1($dc['auth_key'], true), -8), 'auth_key' => $dc['auth_key']]; $MadelineProto->API->datacenter->sockets[$dc['dc_id']]->temp_auth_key = null; $MadelineProto->API->datacenter->sockets[$dc['dc_id']]->ip = $dc['server_address']; $MadelineProto->API->datacenter->sockets[$dc['dc_id']]->port = $dc['port']; $MadelineProto->API->datacenter->sockets[$dc['dc_id']]->authorized = true; $MadelineProto->API->datacenter->sockets[$dc['dc_id']]->session_id = $MadelineProto->random(8); $MadelineProto->API->datacenter->sockets[$dc['dc_id']]->session_in_seq_no = 0; $MadelineProto->API->datacenter->sockets[$dc['dc_id']]->session_out_seq_no = 0; $MadelineProto->API->datacenter->sockets[$dc['dc_id']]->incoming_messages = []; $MadelineProto->API->datacenter->sockets[$dc['dc_id']]->outgoing_messages = []; $MadelineProto->API->datacenter->sockets[$dc['dc_id']]->new_outgoing = []; $MadelineProto->API->datacenter->sockets[$dc['dc_id']]->incoming = []; } $MadelineProto->API->authorized = MTProto::LOGGED_IN; $MadelineProto->API->init_authorization(); return $MadelineProto; } public static function pyrogram($session, $new_session, $settings = []) { set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']); if (!isset(pathinfo($session)['extension'])) { $session .= '.session'; } $session = Absolute::absolute($session); $session = json_decode(file_get_contents($session), true); $session['auth_key'] = base64_decode(implode('', $session['auth_key'])); $settings['connection_settings']['all']['test_mode'] = $session['test_mode']; $MadelineProto = new \danog\MadelineProto\API($new_session, $settings); $MadelineProto->API->datacenter->sockets[$session['dc_id']]->auth_key = ['server_salt' => '', 'connection_inited' => true, 'id' => substr(sha1($session['auth_key'], true), -8), 'auth_key' => $session['auth_key']]; $MadelineProto->API->datacenter->sockets[$session['dc_id']]->temp_auth_key = null; $MadelineProto->API->datacenter->sockets[$session['dc_id']]->authorized = true; $MadelineProto->API->datacenter->sockets[$session['dc_id']]->session_id = $MadelineProto->random(8); $MadelineProto->API->datacenter->sockets[$session['dc_id']]->session_in_seq_no = 0; $MadelineProto->API->datacenter->sockets[$session['dc_id']]->session_out_seq_no = 0; $MadelineProto->API->datacenter->sockets[$session['dc_id']]->incoming_messages = []; $MadelineProto->API->datacenter->sockets[$session['dc_id']]->outgoing_messages = []; $MadelineProto->API->datacenter->sockets[$session['dc_id']]->new_outgoing = []; $MadelineProto->API->datacenter->sockets[$session['dc_id']]->incoming = []; $MadelineProto->API->authorized = MTProto::LOGGED_IN; $MadelineProto->API->init_authorization(); return $MadelineProto; } public static function zerobias($session, $new_session, $settings = []) { set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']); if (is_string($session)) { $session = json_decode($session, true); } $dc = $session['dc']; $session['auth_key'] = hex2bin($session["dc$dc".'_auth_key']); $MadelineProto = new \danog\MadelineProto\API($new_session, $settings); $MadelineProto->API->datacenter->sockets[$dc]->auth_key = ['server_salt' => '', 'connection_inited' => true, 'id' => substr(sha1($session['auth_key'], true), -8), 'auth_key' => $session['auth_key']]; $MadelineProto->API->datacenter->sockets[$dc]->temp_auth_key = null; $MadelineProto->API->datacenter->sockets[$dc]->authorized = true; $MadelineProto->API->datacenter->sockets[$dc]->session_id = $MadelineProto->random(8); $MadelineProto->API->datacenter->sockets[$dc]->session_in_seq_no = 0; $MadelineProto->API->datacenter->sockets[$dc]->session_out_seq_no = 0; $MadelineProto->API->datacenter->sockets[$dc]->incoming_messages = []; $MadelineProto->API->datacenter->sockets[$dc]->outgoing_messages = []; $MadelineProto->API->datacenter->sockets[$dc]->new_outgoing = []; $MadelineProto->API->datacenter->sockets[$dc]->incoming = []; $MadelineProto->API->authorized = MTProto::LOGGED_IN; $MadelineProto->API->init_authorization(); return $MadelineProto; } public static function tdesktop_md5($data) { $result = ''; foreach (str_split(md5($data), 2) as $byte) { $result .= strrev($byte); } return strtoupper($result); } const FILEOPTION_SAFE = 1; const FILEOPTION_USER = 2; public static $tdesktop_base_path; public static $tdesktop_user_base_path; public static $tdesktop_key; public static function tdesktop_fopen($fileName, $options = 3) { $name = ($options & self::FILEOPTION_USER ? self::$tdesktop_user_base_path : self::$tdesktop_base_path).$fileName; $totry = []; for ($x = 0; $x <= 1; $x++) { if (file_exists($name.$x)) { $totry[] = fopen($name.$x, 'rb'); } } foreach ($totry as $fp) { if (stream_get_contents($fp, 4) !== 'TDF$') { \danog\MadelineProto\Logger::log('Wrong magic', Logger::ERROR); continue; } $versionBytes = stream_get_contents($fp, 4); $version = self::unpack_signed_int($versionBytes); \danog\MadelineProto\Logger::log("TDesktop version: $version"); $data = stream_get_contents($fp); $md5 = substr($data, -16); $data = substr($data, 0, -16); $length = pack('l', strlen($data)); $length = \danog\MadelineProto\Magic::$BIG_ENDIAN ? strrev($length) : $length; if (md5($data.$length.$versionBytes.'TDF$', true) !== $md5) { \danog\MadelineProto\Logger::log('Wrong MD5', Logger::ERROR); } $res = fopen('php://memory', 'rw+b'); fwrite($res, $data); fseek($res, 0); return $res; } throw new Exception("Could not open $fileName"); } public static function tdesktop_fopen_encrypted($fileName, $options = 3) { $f = self::tdesktop_fopen($fileName, $options); $data = self::tdesktop_read_bytearray($f); $res = self::tdesktop_decrypt($data, self::$tdesktop_key); $length = unpack('V', stream_get_contents($res, 4))[1]; if ($length > fstat($res)['size'] || $length < 4) { throw new \danog\MadelineProto\Exception('Wrong length'); } return $res; } public static function tdesktop_read_bytearray($fp) { $length = self::unpack_signed_int(stream_get_contents($fp, 4)); $data = $length ? stream_get_contents($fp, $length) : ''; $res = fopen('php://memory', 'rw+b'); fwrite($res, $data); fseek($res, 0); return $res; } public static function tdesktop_decrypt($data, $auth_key) { $message_key = stream_get_contents($data, 16); $encrypted_data = stream_get_contents($data); list($aes_key, $aes_iv) = self::old_aes_calculate($message_key, $auth_key, false); $decrypted_data = self::ige_decrypt($encrypted_data, $aes_key, $aes_iv); if ($message_key != substr(sha1($decrypted_data, true), 0, 16)) { throw new \danog\MadelineProto\SecurityException('msg_key mismatch'); } $res = fopen('php://memory', 'rw+b'); fwrite($res, $decrypted_data); fseek($res, 0); return $res; } const dbiKey = 0x00; const dbiUser = 0x01; const dbiDcOptionOldOld = 0x02; const dbiChatSizeMax = 0x03; const dbiMutePeer = 0x04; const dbiSendKey = 0x05; const dbiAutoStart = 0x06; const dbiStartMinimized = 0x07; const dbiSoundNotify = 0x08; const dbiWorkMode = 0x09; const dbiSeenTrayTooltip = 0x0a; const dbiDesktopNotify = 0x0b; const dbiAutoUpdate = 0x0c; const dbiLastUpdateCheck = 0x0d; const dbiWindowPosition = 0x0e; const dbiConnectionTypeOld = 0x0f; // 0x10 reserved const dbiDefaultAttach = 0x11; const dbiCatsAndDogs = 0x12; const dbiReplaceEmojis = 0x13; const dbiAskDownloadPath = 0x14; const dbiDownloadPathOld = 0x15; const dbiScale = 0x16; const dbiEmojiTabOld = 0x17; const dbiRecentEmojiOldOld = 0x18; const dbiLoggedPhoneNumber = 0x19; const dbiMutedPeers = 0x1a; // 0x1b reserved const dbiNotifyView = 0x1c; const dbiSendToMenu = 0x1d; const dbiCompressPastedImage = 0x1e; const dbiLangOld = 0x1f; const dbiLangFileOld = 0x20; const dbiTileBackground = 0x21; const dbiAutoLock = 0x22; const dbiDialogLastPath = 0x23; const dbiRecentEmojiOld = 0x24; const dbiEmojiVariantsOld = 0x25; const dbiRecentStickers = 0x26; const dbiDcOptionOld = 0x27; const dbiTryIPv6 = 0x28; const dbiSongVolume = 0x29; const dbiWindowsNotificationsOld = 0x30; const dbiIncludeMuted = 0x31; const dbiMegagroupSizeMax = 0x32; const dbiDownloadPath = 0x33; const dbiAutoDownload = 0x34; const dbiSavedGifsLimit = 0x35; const dbiShowingSavedGifsOld = 0x36; const dbiAutoPlay = 0x37; const dbiAdaptiveForWide = 0x38; const dbiHiddenPinnedMessages = 0x39; const dbiRecentEmoji = 0x3a; const dbiEmojiVariants = 0x3b; const dbiDialogsMode = 0x40; const dbiModerateMode = 0x41; const dbiVideoVolume = 0x42; const dbiStickersRecentLimit = 0x43; const dbiNativeNotifications = 0x44; const dbiNotificationsCount = 0x45; const dbiNotificationsCorner = 0x46; const dbiThemeKey = 0x47; const dbiDialogsWidthRatioOld = 0x48; const dbiUseExternalVideoPlayer = 0x49; const dbiDcOptions = 0x4a; const dbiMtpAuthorization = 0x4b; const dbiLastSeenWarningSeenOld = 0x4c; const dbiAuthSessionSettings = 0x4d; const dbiLangPackKey = 0x4e; const dbiConnectionType = 0x4f; const dbiStickersFavedLimit = 0x50; const dbiSuggestStickersByEmoji = 0x51; const dbiEncryptedWithSalt = 333; const dbiEncrypted = 444; // 500-600 reserved const dbiVersion = 666; public static function tdesktop($session, $new_session, $settings = []) { set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']); if (!isset($settings['old_session_key'])) { $settings['old_session_key'] = 'data'; } if (!isset($settings['old_session_passcode'])) { $settings['old_session_passcode'] = ''; } if (basename($session) !== 'tdata') { $session .= '/tdata'; } list($part_one_md5, $part_two_md5) = str_split(self::tdesktop_md5($settings['old_session_key']), 16); self::$tdesktop_base_path = $session.'/'; self::$tdesktop_user_base_path = self::$tdesktop_base_path.$part_one_md5.'/'; $data = self::tdesktop_fopen('map'); $salt = self::tdesktop_read_bytearray($data); $salt = fstat($salt)['size'] ? $salt : self::random(32); $encryptedKey = self::tdesktop_read_bytearray($data); $keyIterCount = strlen($settings['old_session_passcode']) ? 4000 : 4; $passKey = openssl_pbkdf2($settings['old_session_passcode'], stream_get_contents($salt), 256, $keyIterCount); self::$tdesktop_key = stream_get_contents(self::tdesktop_read_bytearray(self::tdesktop_decrypt($encryptedKey, $passKey))); $main = self::tdesktop_fopen_encrypted($part_one_md5, self::FILEOPTION_SAFE); $auth_keys = []; while (true) { $magic = self::unpack_signed_int(stream_get_contents($main, 4)); switch ($magic) { case self::dbiDcOptionOldOld: stream_get_contents($main, 4); self::tdesktop_read_bytearray($main); self::tdesktop_read_bytearray($main); stream_get_contents($main, 4); break; case self::dbiDcOptionOld: stream_get_contents($main, 8); self::tdesktop_read_bytearray($main); stream_get_contents($main, 4); break; case self::dbiDcOptions: self::tdesktop_read_bytearray($main); break; case self::dbiUser: stream_get_contents($main, 4); $main_dc_id = self::unpack_signed_int(stream_get_contents($main, 4)); break; case self::dbiKey: $auth_keys[self::unpack_signed_int(stream_get_contents($main, 4))] = stream_get_contents($main, 256); break; case self::dbiMtpAuthorization: $main = self::tdesktop_read_bytearray($main); //stream_get_contents($main, 4); $user_id = self::unpack_signed_int(stream_get_contents($main, 4)); $main_dc_id = self::unpack_signed_int(stream_get_contents($main, 4)); $length = self::unpack_signed_int(stream_get_contents($main, 4)); for ($x = 0; $x < $length; $x++) { $auth_keys[self::unpack_signed_int(stream_get_contents($main, 4))] = stream_get_contents($main, 256); } break 2; case self::dbiAutoDownload: stream_get_contents($main, 12); break; case self::dbiDialogsMode: stream_get_contents($main, 8); break; case self::dbiAuthSessionSettings: self::tdesktop_read_bytearray($main); break; case self::dbiConnectionTypeOld: switch (self::unpack_signed_int(stream_get_contents($main, 4))) { case 2: case 3: self::tdesktop_read_bytearray($main); stream_get_contents($main, 4); self::tdesktop_read_bytearray($main); self::tdesktop_read_bytearray($main); break; } break; case self::dbiConnectionType: stream_get_contents($main, 8); self::tdesktop_read_bytearray($main); stream_get_contents($main, 4); self::tdesktop_read_bytearray($main); self::tdesktop_read_bytearray($main); break; case self::dbiThemeKey: case self::dbiLangPackKey: case self::dbiMutePeer: stream_get_contents($main, 8); break; case self::dbiWindowPosition: stream_get_contents($main, 24); break; case self::dbiLoggedPhoneNumber: self::tdesktop_read_bytearray($main); break; case self::dbiMutedPeers: $length = self::unpack_signed_int(stream_get_contents($main, 4)); for ($x = 0; $x < $length; $x++) { stream_get_contents($main, 8); } case self::dbiDownloadPathOld: self::tdesktop_read_bytearray($main); break; case self::dbiDialogLastPath: self::tdesktop_read_bytearray($main); break; case self::dbiDownloadPath: self::tdesktop_read_bytearray($main); self::tdesktop_read_bytearray($main); break; default: stream_get_contents($main, 4); break; } } $MadelineProto = new \danog\MadelineProto\API($new_session, $settings); foreach ($auth_keys as $dc => $auth_key) { $MadelineProto->API->datacenter->sockets[$dc]->auth_key = ['server_salt' => '', 'connection_inited' => true, 'id' => substr(sha1($auth_key, true), -8), 'auth_key' => $auth_key]; $MadelineProto->API->datacenter->sockets[$dc]->temp_auth_key = null; $MadelineProto->API->datacenter->sockets[$dc]->authorized = true; $MadelineProto->API->datacenter->sockets[$dc]->session_id = $MadelineProto->random(8); $MadelineProto->API->datacenter->sockets[$dc]->session_in_seq_no = 0; $MadelineProto->API->datacenter->sockets[$dc]->session_out_seq_no = 0; $MadelineProto->API->datacenter->sockets[$dc]->incoming_messages = []; $MadelineProto->API->datacenter->sockets[$dc]->outgoing_messages = []; $MadelineProto->API->datacenter->sockets[$dc]->new_outgoing = []; $MadelineProto->API->datacenter->sockets[$dc]->incoming = []; } $MadelineProto->API->authorized = MTProto::LOGGED_IN; $MadelineProto->API->authorized_dc = $main_dc_id; $MadelineProto->API->init_authorization(); return $MadelineProto; } } ---types--- ipPort#d433ad73 ipv4:int port:int = IpPort; ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort; accessPointRule#4679b65f phone_prefix_rules:string dc_id:int ips:vector = AccessPointRule; help.configSimple#5a592a6c date:int expires:int rules:vector = help.ConfigSimple; boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaPhoto#b3ba0635 flags:# id:InputPhoto ttl_seconds:flags.0?int = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia; inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaDocument#23ab23d2 flags:# id:InputDocument ttl_seconds:flags.0?int = InputMedia; inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = InputMedia; inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia; inputMediaGeoLive#7b1a118f geo_point:InputGeoPoint period:int = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#3bb3b94a id:long access_hash:long file_reference:bytes = InputPhoto; inputFileLocation#dfdaabe1 volume_id:long local_id:int secret:long file_reference:bytes = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#196683d9 id:long access_hash:long file_reference:bytes = InputFileLocation; inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation; inputTakeoutFileLocation#29be5899 = InputFileLocation; inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#91d11eb dc_id:int volume_id:long local_id:int secret:long file_reference:bytes = FileLocation; userEmpty#200250ba id:int = User; user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#c88974ac flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights participants_count:flags.17?int = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; chatFull#edd2a791 flags:# id:int participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int = ChatFull; channelFull#76af5481 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#44f9b43d flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#cbf24940 phone_number:string first_name:string last_name:string vcard:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#9cb070d7 flags:# document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia; messageMediaGeoLive#7c3c2609 geo:GeoPoint period:int = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction; messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; messageActionScreenshotTaken#4792929b = MessageAction; messageActionCustomAction#fae69f56 message:string = MessageAction; messageActionBotAllowed#abe9affe domain:string = MessageAction; messageActionSecureValuesSentMe#1b287353 values:Vector credentials:SecureCredentialsEncrypted = MessageAction; messageActionSecureValuesSent#d95c6154 types:Vector = MessageAction; dialog#e4def5db flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9c477dd8 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#38faab5f flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int terms_of_service:flags.3?help.TermsOfService = auth.SentCode; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyBroadcasts#b1db7c7e = InputNotifyPeer; inputPeerNotifySettings#9c3d198e flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = InputPeerNotifySettings; peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = PeerNotifySettings; peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; inputReportReasonCopyright#9b89f93a = ReportReason; userFull#8ea4a881 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#eae87e42 contacts:Vector saved_count:int users:Vector = contacts.Contacts; contacts.importedContacts#77d01c3b imported:Vector popular_invites:Vector retry_contacts:Vector users:Vector = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector users:Vector = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector users:Vector = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#99262e37 flags:# pts:int count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesNotModified#74535f21 count:int = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; messages.chatsSlice#9cd81144 count:int chats:Vector = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector users:Vector = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter; inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter; inputMessagesFilterGeo#e7026d0d = MessagesFilter; inputMessagesFilterContacts#e062db83 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updateDialogPinned#19d27f3c flags:# pinned:flags.0?true peer:DialogPeer = Update; updatePinnedDialogs#ea4cb65b flags:# order:flags.0?Vector = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updateLangPackTooLong#46560264 lang_code:string = Update; updateLangPack#56022f4d difference:LangPackDifference = Update; updateFavedStickers#e511996d = Update; updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector = Update; updateContactsReset#7084a7be = Update; updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update; updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update; updateUserPinnedMessage#4c43da18 user_id:int id:int = Update; updateChatPinnedMessage#22893b26 chat_id:int id:int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector intermediate_state:updates.State = updates.Difference; updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector = upload.File; dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption; config#e6ca25f6 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#1da7158f flags:# popup:flags.0?true id:int version:string text:string entities:Vector document:flags.1?Document url:flags.2?string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument; documentEmpty#36f8c871 id:long = Document; document#59534e4c id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumb:PhotoSize dc_id:int attributes:Vector = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyBroadcasts#d612e8ef = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; sendMessageRecordRoundAction#88f27fbc = SendMessageAction; sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; contacts.found#b3134d9d my_results:Vector results:Vector chats:Vector users:Vector = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; inputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; privacyKeyPhoneP2P#39491cc8 = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector = PrivacyRule; account.privacyRules#554abb6f rules:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true supports_streaming:flags.1?true duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#e4599bbd hash:int stickers:Vector = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector = messages.AllStickers; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; authorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true password_pending:flags.2?true hash:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector = account.Authorizations; account.password#ad2641f8 flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes = account.Password; account.passwordSettings#9a5c33e5 flags:# email:flags.0?string secure_settings:flags.1?SecureSecretSettings = account.PasswordSettings; account.passwordInputSettings#c23727c9 flags:# new_algo:flags.0?PasswordKdfAlgo new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string new_secure_settings:flags.2?SecureSecretSettings = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#5585a139 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#98e81d3a user_id:int description:string commands:Vector = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector = ReplyMarkup; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; messageEntityPhone#9b69e34b offset:int length:int = MessageEntity; messageEntityCashtag#4c4e743f offset:int length:int = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector users:Vector = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#6a9d7b35 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int messages:Vector chats:Vector users:Vector = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector other_updates:Vector chats:Vector users:Vector = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantAdmin#a82fa898 flags:# can_edit:flags.0?true user_id:int inviter_id:int promoted_by:int date:int admin_rights:ChannelAdminRights = ChannelParticipant; channelParticipantBanned#222c1886 flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChannelBannedRights = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter; channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter; channels.channelParticipants#f56ee2a8 count:int participants:Vector users:Vector = channels.ChannelParticipants; channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector = channels.ChannelParticipant; help.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector min_age_confirm:flags.1?int = help.TermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector = messages.SavedGifs; inputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#c1b15d65 flags:# geo_point:InputGeoPoint period:int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#b722de65 flags:# geo:GeoPoint period:int reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector cache_time:int users:Vector = messages.BotResults; exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink; messageFwdHeader#559ebe6d flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; messages.peerDialogs#3371c354 dialogs:Vector messages:Vector chats:Vector users:Vector state:updates.State = messages.PeerDialogs; topPeer#edcdc05b peer:Peer rating:double = TopPeer; topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; topPeerCategoryBotsInline#148677e2 = TopPeerCategory; topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector chats:Vector users:Vector = contacts.TopPeers; contacts.topPeersDisabled#b52c939d = contacts.TopPeers; draftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; messages.featuredStickers#f89d88e5 hash:int sets:Vector unread:Vector = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#22f3afb3 hash:int packs:Vector stickers:Vector dates:Vector = messages.RecentStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector = messages.ArchivedStickers; messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector = messages.StickerSetInstallResult; stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector users:Vector = messages.HighScores; textEmpty#dc3d824f = RichText; textPlain#744694e0 text:string = RichText; textBold#6724abc4 text:RichText = RichText; textItalic#d912a59c text:RichText = RichText; textUnderline#c12622c4 text:RichText = RichText; textStrike#9bf8bb95 text:RichText = RichText; textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector = RichText; textSubscript#ed6a8504 text:RichText = RichText; textSuperscript#c7fb5e01 text:RichText = RichText; textMarked#34b8621 text:RichText = RichText; textPhone#1ccb966a text:RichText phone:string = RichText; textImage#81ccf4f document_id:long w:int h:int = RichText; textAnchor#35553762 text:RichText name:string = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; pageBlockHeader#bfd064ec text:RichText = PageBlock; pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; pageBlockParagraph#467a0766 text:RichText = PageBlock; pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; pageBlockList#e4e88011 items:Vector = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; pageBlockPhoto#1759c560 flags:# photo_id:long caption:PageCaption url:flags.0?string webpage_id:flags.0?long = PageBlock; pageBlockVideo#7c8fe7b6 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:PageCaption = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; pageBlockEmbed#a8718dc5 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:flags.5?int h:flags.5?int caption:PageCaption = PageBlock; pageBlockEmbedPost#f259a80b url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:PageCaption = PageBlock; pageBlockCollage#65a0fa4d items:Vector caption:PageCaption = PageBlock; pageBlockSlideshow#31f9590 items:Vector caption:PageCaption = PageBlock; pageBlockChannel#ef1751b5 channel:Chat = PageBlock; pageBlockAudio#804361ea audio_id:long caption:PageCaption = PageBlock; pageBlockKicker#1e148390 text:RichText = PageBlock; pageBlockTable#bf4dea82 flags:# bordered:flags.0?true striped:flags.1?true title:RichText rows:Vector = PageBlock; pageBlockOrderedList#9a8ae1e1 items:Vector = PageBlock; pageBlockDetails#76768bed flags:# open:flags.0?true blocks:Vector title:RichText = PageBlock; pageBlockRelatedArticles#16115a96 title:RichText articles:Vector = PageBlock; pageBlockMap#a44f3ef6 geo:GeoPoint zoom:int w:int h:int caption:PageCaption = PageBlock; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; webDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector = WebDocument; webDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector = payments.PaymentReceipt; payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsAndroidPay#ca05d50e payment_token:DataJSON google_transaction_id:string = InputPaymentCredentials; account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; shippingOption#b6213cdf id:string title:string prices:Vector = ShippingOption; inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCall#e6f9ddf3 flags:# p2p_allowed:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector = phone.PhoneCall; upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey; cdnConfig#5725e40a public_keys:Vector = CdnConfig; langPackString#cad181f6 key:string value:string = LangPackString; langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString; langPackStringDeleted#2979eeb2 key:string = LangPackString; langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector = LangPackDifference; langPackLanguage#eeca5ce3 flags:# official:flags.0?true rtl:flags.2?true name:string native_name:string lang_code:string base_lang_code:flags.1?string plural_code:string strings_count:int translated_count:int translations_url:string = LangPackLanguage; channelAdminRights#5d7ceba5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true invite_link:flags.6?true pin_messages:flags.7?true add_admins:flags.9?true manage_call:flags.10?true = ChannelAdminRights; channelBannedRights#58cf4249 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true until_date:int = ChannelBannedRights; channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangePhoto#b82f55c3 prev_photo:ChatPhoto new_photo:ChatPhoto = ChannelAdminLogEventAction; channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers; messages.favedStickers#f37f2f16 hash:int packs:Vector stickers:Vector = messages.FavedStickers; recentMeUrlUnknown#46e1d13d url:string = RecentMeUrl; recentMeUrlUser#8dbc3336 url:string user_id:int = RecentMeUrl; recentMeUrlChat#a01b22f9 url:string chat_id:int = RecentMeUrl; recentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl; recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl; help.recentMeUrls#e0310d7 urls:Vector chats:Vector users:Vector = help.RecentMeUrls; inputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector = InputSingleMedia; webAuthorization#cac943f2 hash:long bot_id:int domain:string browser:string platform:string date_created:int date_active:int ip:string region:string = WebAuthorization; account.webAuthorizations#ed56c9fc authorizations:Vector users:Vector = account.WebAuthorizations; inputMessageID#a676a322 id:int = InputMessage; inputMessageReplyTo#bad88395 id:int = InputMessage; inputMessagePinned#86872538 = InputMessage; inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer; dialogPeer#e56dbf05 peer:Peer = DialogPeer; messages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets; messages.foundStickerSets#5108d648 hash:int sets:Vector = messages.FoundStickerSets; fileHash#6242c773 offset:int limit:int hash:bytes = FileHash; inputClientProxy#75588b3f address:string port:int = InputClientProxy; help.proxyDataEmpty#e09e1fb8 expires:int = help.ProxyData; help.proxyDataPromo#2bf7ee23 expires:int peer:Peer chats:Vector users:Vector = help.ProxyData; help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate; help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate; inputSecureFileUploaded#3334b0f0 id:long parts:int md5_checksum:string file_hash:bytes secret:bytes = InputSecureFile; inputSecureFile#5367e5be id:long access_hash:long = InputSecureFile; secureFileEmpty#64199744 = SecureFile; secureFile#e0277a62 id:long access_hash:long size:int dc_id:int date:int file_hash:bytes secret:bytes = SecureFile; secureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData; securePlainPhone#7d6099dd phone:string = SecurePlainData; securePlainEmail#21ec5a5f email:string = SecurePlainData; secureValueTypePersonalDetails#9d2a81e3 = SecureValueType; secureValueTypePassport#3dac6a00 = SecureValueType; secureValueTypeDriverLicense#6e425c4 = SecureValueType; secureValueTypeIdentityCard#a0d0744b = SecureValueType; secureValueTypeInternalPassport#99a48f23 = SecureValueType; secureValueTypeAddress#cbe31e26 = SecureValueType; secureValueTypeUtilityBill#fc36954e = SecureValueType; secureValueTypeBankStatement#89137c0d = SecureValueType; secureValueTypeRentalAgreement#8b883488 = SecureValueType; secureValueTypePassportRegistration#99e3806a = SecureValueType; secureValueTypeTemporaryRegistration#ea02ec33 = SecureValueType; secureValueTypePhone#b320aadb = SecureValueType; secureValueTypeEmail#8e3ca7ee = SecureValueType; secureValue#187fa0ca flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile translation:flags.6?Vector files:flags.4?Vector plain_data:flags.5?SecurePlainData hash:bytes = SecureValue; inputSecureValue#db21d0a7 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?InputSecureFile reverse_side:flags.2?InputSecureFile selfie:flags.3?InputSecureFile translation:flags.6?Vector files:flags.4?Vector plain_data:flags.5?SecurePlainData = InputSecureValue; secureValueHash#ed1ecdb0 type:SecureValueType hash:bytes = SecureValueHash; secureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError; secureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector text:string = SecureValueError; secureValueError#869d758f type:SecureValueType hash:bytes text:string = SecureValueError; secureValueErrorTranslationFile#a1144770 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorTranslationFiles#34636dd8 type:SecureValueType file_hash:Vector text:string = SecureValueError; secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted; account.authorizationForm#ad2e1cd8 flags:# required_types:Vector values:Vector errors:Vector users:Vector privacy_policy_url:flags.0?string = account.AuthorizationForm; account.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode; help.deepLinkInfoEmpty#66afa166 = help.DeepLinkInfo; help.deepLinkInfo#6a4ee832 flags:# update_app:flags.0?true message:string entities:flags.1?Vector = help.DeepLinkInfo; savedPhoneContact#1142bd56 phone:string first_name:string last_name:string date:int = SavedContact; account.takeout#4dba4501 id:long = account.Takeout; passwordKdfAlgoUnknown#d45ab096 = PasswordKdfAlgo; passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow#3a912d4a salt1:bytes salt2:bytes g:int p:bytes = PasswordKdfAlgo; securePasswordKdfAlgoUnknown#4a8537 = SecurePasswordKdfAlgo; securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 salt:bytes = SecurePasswordKdfAlgo; securePasswordKdfAlgoSHA512#86471d92 salt:bytes = SecurePasswordKdfAlgo; secureSecretSettings#1527bcac secure_algo:SecurePasswordKdfAlgo secure_secret:bytes secure_secret_id:long = SecureSecretSettings; inputCheckPasswordEmpty#9880f658 = InputCheckPasswordSRP; inputCheckPasswordSRP#d27ff082 srp_id:long A:bytes M1:bytes = InputCheckPasswordSRP; secureRequiredType#829d99da flags:# native_names:flags.0?true selfie_required:flags.1?true translation_required:flags.2?true type:SecureValueType = SecureRequiredType; secureRequiredTypeOneOf#27477b4 types:Vector = SecureRequiredType; help.passportConfigNotModified#bfb9f457 = help.PassportConfig; help.passportConfig#a098d6af hash:int countries_langs:DataJSON = help.PassportConfig; pageTableCell#34566b6a flags:# header:flags.0?true align_center:flags.3?true align_right:flags.4?true valign_middle:flags.5?true valign_bottom:flags.6?true text:flags.7?RichText colspan:flags.1?int rowspan:flags.2?int = PageTableCell; pageTableRow#e0c0c5e5 cells:Vector = PageTableRow; pageCaption#6f747657 text:RichText credit:RichText = PageCaption; pageListItemText#b92fb6cd text:RichText = PageListItem; pageListItemBlocks#25e073fc blocks:Vector = PageListItem; pageListOrderedItemText#5e068047 num:string text:RichText = PageListOrderedItem; pageListOrderedItemBlocks#98dd8936 num:string blocks:Vector = PageListOrderedItem; pageRelatedArticle#b390dc08 flags:# url:string webpage_id:long title:flags.0?string description:flags.1?string photo_id:flags.2?long author:flags.3?string published_date:flags.4?int = PageRelatedArticle; page#ae891bec flags:# part:flags.0?true rtl:flags.1?true url:string blocks:Vector photos:Vector documents:Vector = Page; help.supportName#8c05f1c9 name:string = help.SupportName; help.userInfoEmpty#f3ae2eed = help.UserInfo; help.userInfo#1eb3758 message:string entities:Vector author:string date:int = help.UserInfo; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X; initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X; invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X; auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#d18b4d16 password:InputCheckPasswordSRP = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector = Bool; account.registerDevice#5cbea590 token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector = Bool; account.unregisterDevice#3076c4bf token_type:int token:string other_uids:Vector = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#9cd4eaf9 password:InputCheckPasswordSRP = account.PasswordSettings; account.updatePasswordSettings#a59b102f password:InputCheckPasswordSRP new_settings:account.PasswordInputSettings = Bool; account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; account.getTmpPassword#449e0b51 password:InputCheckPasswordSRP period:int = account.TmpPassword; account.getWebAuthorizations#182e6d6f = account.WebAuthorizations; account.resetWebAuthorization#2d01b9ef hash:long = Bool; account.resetWebAuthorizations#682d2594 = Bool; account.getAllSecureValues#b288bc7d = Vector; account.getSecureValue#73665bc2 types:Vector = Vector; account.saveSecureValue#899fe31d value:InputSecureValue secure_secret_id:long = SecureValue; account.deleteSecureValue#b880bc4b types:Vector = Bool; account.getAuthorizationForm#b86ba8e1 bot_id:int scope:string public_key:string = account.AuthorizationForm; account.acceptAuthorization#e7027c94 bot_id:int scope:string public_key:string value_hashes:Vector credentials:SecureCredentialsEncrypted = Bool; account.sendVerifyPhoneCode#823380b4 flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool; account.sendVerifyEmailCode#7011509f email:string = account.SentEmailCode; account.verifyEmail#ecba39db email:string code:string = Bool; account.initTakeoutSession#f05b4804 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?int = account.Takeout; account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool; account.confirmPasswordEmail#8fdf1920 code:string = Bool; account.resendPasswordEmail#7a7f2a15 = Bool; account.cancelPasswordEmail#c1cbd5b6 = Bool; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector = Bool; contacts.getContactIDs#2caa4a42 hash:int = Vector; contacts.getStatuses#c4a353ee = Vector; contacts.getContacts#c023849f hash:int = contacts.Contacts; contacts.importContacts#2c800be5 contacts:Vector = contacts.ImportedContacts; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector; contacts.importCard#4fe196fe export_card:Vector = User; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; contacts.resetSaved#879537f1 = Bool; contacts.getSaved#82f1e39f = Vector; contacts.toggleTopPeers#8514bdda enabled:Bool = Bool; messages.getMessages#63c66506 id:Vector = messages.Messages; messages.getDialogs#b098aee6 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:int = messages.Dialogs; messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.search#8614ef68 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.sendMedia#b8d1262b flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true grouped:flags.9?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.report#bd82b658 peer:InputPeer id:Vector reason:ReportReason = Bool; messages.getChats#3c6aa187 id:Vector = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector title:string = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; messages.getStickers#43d4f2c emoticon:string hash:int = messages.Stickers; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#8b68b0cc flags:# message:string entities:flags.3?Vector = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#c000e4c8 flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector geo_point:flags.13?InputGeoPoint = Updates; messages.editInlineBotMessage#adc3e828 flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector geo_point:flags.13?InputGeoPoint = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#e470bcfd peers:Vector = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector = Bool; messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; messages.reorderPinnedDialogs#5b51d63f flags:# force:flags.0?true order:Vector = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia; messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates; messages.getFavedStickers#21ce0b0e hash:int = messages.FavedStickers; messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool; messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory; messages.getRecentLocations#bbc45b09 peer:InputPeer limit:int hash:int = messages.Messages; messages.sendMultiMedia#2095512f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; messages.searchStickerSets#c2b7d08b flags:# exclude_featured:flags.0?true q:string hash:int = messages.FoundStickerSets; messages.getSplitRanges#1cff7e08 = Vector; messages.markDialogUnread#c286d98f flags:# unread:flags.0?true peer:InputDialogPeer = Bool; messages.getDialogUnreadMarks#22e24e22 = Vector; messages.clearAllDrafts#7e58ee9c = Bool; messages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true peer:InputPeer id:int = Updates; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector = Vector; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; upload.reuploadCdnFile#9b2754a8 file_token:bytes request_token:bytes = Vector; upload.getCdnFileHashes#4da54231 file_token:bytes offset:int = Vector; upload.getFileHashes#c7025931 location:InputFileLocation offset:int = Vector; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#522d5a7d source:string = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector = Bool; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#9010ef6f prev_app_version:string = Updates; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls; help.getProxyData#3d7758e1 = help.ProxyData; help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate; help.acceptTermsOfService#ee72f79a id:DataJSON = Bool; help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo; help.getPassportConfig#c661ad08 hash:int = help.PassportConfig; help.getSupportName#d360e72c = help.SupportName; help.getUserInfo#38a08d3 user_id:InputUser = help.UserInfo; help.editUserInfo#66b91b70 user_id:InputUser message:string entities:Vector = help.UserInfo; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector = Bool; channels.getMessages#ad8c9a23 channel:InputChannel id:Vector = messages.Messages; channels.getParticipants#123e05e9 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#20b88214 channel:InputChannel user_id:InputUser admin_rights:ChannelAdminRights = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; channels.exportMessageLink#ceb77163 channel:InputChannel id:int grouped:Bool = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; channels.editBanned#bfd915cd channel:InputChannel user_id:InputUser banned_rights:ChannelBannedRights = Updates; channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector max_id:long min_id:long limit:int = channels.AdminLogResults; channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool; channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector = Bool; channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool; channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates; channels.getLeftChannels#8341ecc0 offset:int = messages.Chats; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm; payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt; payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult; payments.getSavedInfo#227d824b = payments.SavedInfo; payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet; stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; phone.getCallConfig#55451fa9 = DataJSON; phone.requestCall#5b95b3d4 user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = Updates; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference; langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector = Vector; langpack.getDifference#9d51e814 lang_code:string from_version:int = LangPackDifference; langpack.getLanguages#42c6978f lang_pack:string = Vector; langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage; // LAYER 89 // Core types (no need to gen) //vector#1cb5c415 {t:Type} # [ t ] = Vector t; /////////////////////////////// /////////////////// Layer cons /////////////////////////////// //invokeAfterMsg#cb9f372d msg_id:long query:!X = X; //invokeAfterMsgs#3dc4b4f0 msg_ids:Vector query:!X = X; //invokeWithLayer1#53835315 query:!X = X; //invokeWithLayer2#289dd1f6 query:!X = X; //invokeWithLayer3#b7475268 query:!X = X; //invokeWithLayer4#dea0d430 query:!X = X; //invokeWithLayer5#417a57ae query:!X = X; //invokeWithLayer6#3a64d54d query:!X = X; //invokeWithLayer7#a5be56d3 query:!X = X; //invokeWithLayer8#e9abd9fd query:!X = X; //invokeWithLayer9#76715a63 query:!X = X; //invokeWithLayer10#39620c41 query:!X = X; //invokeWithLayer11#a6b88fdf query:!X = X; //invokeWithLayer12#dda60d3c query:!X = X; //invokeWithLayer13#427c8ea2 query:!X = X; //invokeWithLayer14#2b9b08fa query:!X = X; //invokeWithLayer15#b4418b64 query:!X = X; //invokeWithLayer16#cf5f0987 query:!X = X; //invokeWithLayer17#50858a19 query:!X = X; //invokeWithLayer18#1c900537 query:!X = X; //invokeWithLayer#da9b0d0d layer:int query:!X = X; // after 18 layer /////////////////////////////// /// Authorization key creation /////////////////////////////// resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector = ResPQ; p_q_inner_data#83c95aec pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data; server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params; server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params; server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data; client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data; dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer; dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer; dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer; destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes; destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes; destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes; ---functions--- req_pq#60469778 nonce:int128 = ResPQ; req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params; set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer; destroy_auth_key#d1435160 = DestroyAuthKeyRes; /////////////////////////////// ////////////// System messages /////////////////////////////// ---types--- msgs_ack#62d6b459 msg_ids:Vector = MsgsAck; bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification; bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification; msgs_state_req#da69fb52 msg_ids:Vector = MsgsStateReq; msgs_state_info#04deb57d req_msg_id:long info:string = MsgsStateInfo; msgs_all_info#8cc0d131 msg_ids:Vector info:string = MsgsAllInfo; msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo; msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo; msg_resend_req#7d861a08 msg_ids:Vector = MsgResendReq; //rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult; // parsed manually rpc_error#2144ca19 error_code:int error_message:string = RpcError; rpc_answer_unknown#5e2ad36e = RpcDropAnswer; rpc_answer_dropped_running#cd78e586 = RpcDropAnswer; rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer; future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt; future_salts#ae500895 req_msg_id:long now:int salts:vector = FutureSalts; pong#347773c5 msg_id:long ping_id:long = Pong; destroy_session_ok#e22045fc session_id:long = DestroySessionRes; destroy_session_none#62d350c9 session_id:long = DestroySessionRes; new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession; //message msg_id:long seqno:int bytes:int body:Object = Message; // parsed manually //msg_container#73f1f8dc messages:vector = MessageContainer; // parsed manually //msg_copy#e06046b2 orig_message:Message = MessageCopy; // parsed manually, not used - use msg_container //gzip_packed#3072cfa1 packed_data:string = Object; // parsed manually http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait; ipPort ipv4:int port:int = IpPort; help.configSimple#d997c3c5 date:int expires:int dc_id:int ip_port_list:Vector = help.ConfigSimple; ---functions--- rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer; get_future_salts#b921bd04 num:int = FutureSalts; ping#7abe77ec ping_id:long = Pong; ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong; destroy_session#e7512126 session_id:long = DestroySessionRes; contest.saveDeveloperInfo#9a5f6e95 vk_id:int name:string phone_number:string age:int city:string = Bool; /////////////////////////////// ///////// Main application API /////////////////////////////// ---types--- boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#630c9af1 flags:# file:InputFile caption:string stickers:flags.0?Vector = InputMedia; inputMediaPhoto#e9bfb4f3 id:InputPhoto caption:string = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; inputMediaUploadedDocument#d070f1e9 flags:# file:InputFile mime_type:string attributes:Vector caption:string stickers:flags.0?Vector = InputMedia; inputMediaUploadedThumbDocument#50d88cae flags:# file:InputFile thumb:InputFile mime_type:string attributes:Vector caption:string stickers:flags.0?Vector = InputMedia; inputMediaDocument#1a77f29c id:InputDocument caption:string = InputMedia; inputMediaVenue#2827a81a geo_point:InputGeoPoint title:string address:string provider:string venue_id:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#b55f4f18 url:string caption:string = InputMedia; inputMediaDocumentExternal#e5e9607c url:string caption:string = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputMediaInvoice#92153685 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string start_param:string = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#fb95c6c4 id:long access_hash:long = InputPhoto; inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#430f0724 id:long access_hash:long version:int = InputFileLocation; inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation; userEmpty#200250ba id:int = User; user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#cb44b1c flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; channelFull#95cb5f57 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#c09be45f flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#3d8ce53d photo:Photo caption:string = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#f3e02ea8 document:Document caption:string = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#7912b71f geo:GeoPoint title:string address:string provider:string venue_id:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction; messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; dialog#66ffba14 flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#2049d70c long:double lat:double = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#5e002502 flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyAll#a429b886 = InputNotifyPeer; inputPeerNotifyEventsEmpty#f03064d8 = InputPeerNotifyEvents; inputPeerNotifyEventsAll#e86a2c74 = InputPeerNotifyEvents; inputPeerNotifySettings#38935eb2 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = InputPeerNotifySettings; peerNotifyEventsEmpty#add53cb3 = PeerNotifyEvents; peerNotifyEventsAll#6d1ded88 = PeerNotifyEvents; peerNotifySettingsEmpty#70a68512 = PeerNotifySettings; peerNotifySettings#9acda4c0 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = PeerNotifySettings; peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; userFull#f220f3f flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#6f8b8cb2 contacts:Vector users:Vector = contacts.Contacts; contacts.importedContacts#ad524315 imported:Vector retry_contacts:Vector users:Vector = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector users:Vector = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector users:Vector = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#99262e37 flags:# pts:int count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; messages.chatsSlice#9cd81144 count:int chats:Vector = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector users:Vector = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterPhotoVideoDocuments#d95e73bb = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter; inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updateDialogPinned#d711a2cc flags:# pinned:flags.0?true peer:Peer = Update; updatePinnedDialogs#d8caf68d flags:# order:flags.0?Vector = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updateLangPackTooLong#10c2404b = Update; updateLangPack#56022f4d difference:LangPackDifference = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector intermediate_state:updates.State = updates.Difference; updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; upload.fileCdnRedirect#1508485a dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes = upload.File; dcOption#5d8c6cc flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int = DcOption; config#7feec888 flags:# phonecalls_enabled:flags.1?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int rating_e_decay:int stickers_recent_limit:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string suggested_lang_code:flags.2?string lang_pack_version:flags.2?int disabled_features:Vector = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#8987f311 id:int critical:Bool url:string text:string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#18798952 id:long access_hash:long = InputDocument; documentEmpty#36f8c871 id:long = Document; document#87232bc7 id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int version:int attributes:Vector = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyAll#74d07c60 = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; sendMessageRecordRoundAction#88f27fbc = SendMessageAction; sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; contacts.found#1aa1f784 results:Vector chats:Vector users:Vector = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector = PrivacyRule; account.privacyRules#554abb6f rules:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#8a8ecd32 hash:string stickers:Vector = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector = messages.AllStickers; disabledFeature#ae636f24 feature:string description:string = DisabledFeature; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector = account.Authorizations; account.noPassword#96dabc18 new_salt:bytes email_unconfirmed_pattern:string = account.Password; account.password#7c18141c current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = account.Password; account.passwordSettings#b7b72ab3 email:string = account.PasswordSettings; account.passwordInputSettings#86916deb flags:# new_salt:flags.0?bytes new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#cd303b41 flags:# installed:flags.0?true archived:flags.1?true official:flags.2?true masks:flags.3?true id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#98e81d3a user_id:int description:string commands:Vector = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector = ReplyMarkup; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector users:Vector = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#410dee07 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int messages:Vector chats:Vector users:Vector = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector other_updates:Vector chats:Vector users:Vector = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantAdmin#a82fa898 flags:# can_edit:flags.0?true user_id:int inviter_id:int promoted_by:int date:int admin_rights:ChannelAdminRights = ChannelParticipant; channelParticipantBanned#222c1886 flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChannelBannedRights = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter; channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter; channels.channelParticipants#f56ee2a8 count:int participants:Vector users:Vector = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector = channels.ChannelParticipant; help.termsOfService#f1ee3e90 text:string = help.TermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector = messages.SavedGifs; inputBotInlineMessageMediaAuto#292fed13 flags:# caption:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#f4a59de1 flags:# geo_point:InputGeoPoint reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#aaafadc8 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#2daf01a7 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#2cbbe15a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#a74b15b flags:# caption:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#3a8fd8b8 flags:# geo:GeoPoint reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#4366232e flags:# geo:GeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#9bebaeb9 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; messages.botResults#ccd3563d flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector cache_time:int = messages.BotResults; exportedMessageLink#1f486803 link:string = ExportedMessageLink; messageFwdHeader#c786ddcb flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; messages.peerDialogs#3371c354 dialogs:Vector messages:Vector chats:Vector users:Vector state:updates.State = messages.PeerDialogs; topPeer#edcdc05b peer:Peer rating:double = TopPeer; topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; topPeerCategoryBotsInline#148677e2 = TopPeerCategory; topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector chats:Vector users:Vector = contacts.TopPeers; draftMessageEmpty#ba4baec5 = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; messages.featuredStickers#f89d88e5 hash:int sets:Vector unread:Vector = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#5ce20970 hash:int stickers:Vector = messages.RecentStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector = messages.ArchivedStickers; messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector = messages.StickerSetInstallResult; stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector users:Vector = messages.HighScores; textEmpty#dc3d824f = RichText; textPlain#744694e0 text:string = RichText; textBold#6724abc4 text:RichText = RichText; textItalic#d912a59c text:RichText = RichText; textUnderline#c12622c4 text:RichText = RichText; textStrike#9bf8bb95 text:RichText = RichText; textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; pageBlockHeader#bfd064ec text:RichText = PageBlock; pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; pageBlockParagraph#467a0766 text:RichText = PageBlock; pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; pageBlockList#3a58c7f4 ordered:Bool items:Vector = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; pageBlockVideo#d9d71866 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:RichText = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; pageBlockEmbed#cde200d1 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:int h:int caption:RichText = PageBlock; pageBlockEmbedPost#292c7be9 url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:RichText = PageBlock; pageBlockCollage#8b31c4f items:Vector caption:RichText = PageBlock; pageBlockSlideshow#130c8963 items:Vector caption:RichText = PageBlock; pageBlockChannel#ef1751b5 channel:Chat = PageBlock; pageBlockAudio#31b81a7f audio_id:long caption:RichText = PageBlock; pagePart#8e3f9ebe blocks:Vector photos:Vector documents:Vector = Page; pageFull#556ec7aa blocks:Vector photos:Vector documents:Vector = Page; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true currency:string prices:Vector = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; webDocument#c61acbd8 url:string access_hash:long size:int mime_type:string attributes:Vector dc_id:int = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector = payments.PaymentReceipt; payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; shippingOption#b6213cdf id:string title:string prices:Vector = ShippingOption; inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCall#ffe6ab67 id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector = phone.PhoneCall; upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey; cdnConfig#5725e40a public_keys:Vector = CdnConfig; langPackString#cad181f6 key:string value:string = LangPackString; langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString; langPackStringDeleted#2979eeb2 key:string = LangPackString; langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector = LangPackDifference; langPackLanguage#117698f1 name:string native_name:string lang_code:string = LangPackLanguage; channelAdminRights#5d7ceba5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true invite_link:flags.6?true pin_messages:flags.7?true add_admins:flags.9?true = ChannelAdminRights; channelBannedRights#58cf4249 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true until_date:int = ChannelBannedRights; channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangePhoto#b82f55c3 prev_photo:ChatPhoto new_photo:ChatPhoto = ChannelAdminLogEventAction; channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true = ChannelAdminLogEventsFilter; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X; initConnection#c7481da6 {X:Type} api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone; auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.sendInvites#771c1d97 phone_numbers:Vector message:string = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector = Bool; account.registerDevice#637ea878 token_type:int token:string = Bool; account.unregisterDevice#65c55b40 token_type:int token:string = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; account.getTmpPassword#4a82327e password_hash:bytes period:int = account.TmpPassword; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; contacts.getStatuses#c4a353ee = Vector; contacts.getContacts#22c6aa08 hash:string = contacts.Contacts; contacts.importContacts#da30b32d contacts:Vector replace:Bool = contacts.ImportedContacts; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector; contacts.importCard#4fe196fe export_card:Vector = User; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; messages.getMessages#4222fa74 id:Vector = messages.Messages; messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs; messages.getHistory#afa92846 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.search#f288a275 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.sendMedia#c8f16791 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.getChats#3c6aa187 id:Vector = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector title:string = Updates; messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#25223e24 message:string = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#ce91e4ca flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.editInlineBotMessage#130c2c85 flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#2d9776b9 peers:Vector = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector = Bool; messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#3289be6a flags:# pinned:flags.0?true peer:InputPeer = Bool; messages.reorderPinnedDialogs#959ff644 flags:# force:flags.0?true order:Vector = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector = Vector; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; upload.reuploadCdnFile#2e7a2020 file_token:bytes request_token:bytes = Bool; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#ae2de196 = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector = Bool; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#9010ef6f prev_app_version:string = Updates; help.getTermsOfService#350170f3 = help.TermsOfService; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector = Bool; channels.getMessages#93d7b347 channel:InputChannel id:Vector = messages.Messages; channels.getParticipants#24d98f92 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#20b88214 channel:InputChannel user_id:InputUser admin_rights:ChannelAdminRights = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; channels.exportMessageLink#c846d22d channel:InputChannel id:int = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; channels.editBanned#bfd915cd channel:InputChannel user_id:InputUser banned_rights:ChannelBannedRights = Updates; channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector max_id:long min_id:long limit:int = channels.AdminLogResults; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm; payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt; payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult; payments.getSavedInfo#227d824b = payments.SavedInfo; payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector = messages.StickerSet; stickers.removeStickerFromSet#4255934 sticker:InputDocument = Bool; stickers.changeStickerPosition#4ed705ca sticker:InputDocument position:int = Bool; stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; phone.getCallConfig#55451fa9 = DataJSON; phone.requestCall#5b95b3d4 user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = Updates; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; langpack.getLangPack#9ab5c58e lang_code:string = LangPackDifference; langpack.getStrings#2e1ee318 lang_code:string keys:Vector = Vector; langpack.getDifference#b2e4d7d from_version:int = LangPackDifference; langpack.getLanguages#800fd57d = Vector; // LAYER 68 { "constructors": [ { "id": "-1132882121", "predicate": "boolFalse", "params": [], "type": "Bool" }, { "id": "-1720552011", "predicate": "boolTrue", "params": [], "type": "Bool" }, { "id": "1072550713", "predicate": "true", "params": [], "type": "True" }, { "id": "481674261", "predicate": "vector", "params": [], "type": "Vector t" }, { "id": "-994444869", "predicate": "error", "params": [ { "name": "code", "type": "int" }, { "name": "text", "type": "string" } ], "type": "Error" }, { "id": "1450380236", "predicate": "null", "params": [], "type": "Null" }, { "id": "2134579434", "predicate": "inputPeerEmpty", "params": [], "type": "InputPeer" }, { "id": "2107670217", "predicate": "inputPeerSelf", "params": [], "type": "InputPeer" }, { "id": "396093539", "predicate": "inputPeerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1182234929", "predicate": "inputUserEmpty", "params": [], "type": "InputUser" }, { "id": "-138301121", "predicate": "inputUserSelf", "params": [], "type": "InputUser" }, { "id": "-208488460", "predicate": "inputPhoneContact", "params": [ { "name": "client_id", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputContact" }, { "id": "-181407105", "predicate": "inputFile", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" }, { "name": "md5_checksum", "type": "string" } ], "type": "InputFile" }, { "id": "-1771768449", "predicate": "inputMediaEmpty", "params": [], "type": "InputMedia" }, { "id": "-139464256", "predicate": "inputMediaUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-373312269", "predicate": "inputMediaPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-104578748", "predicate": "inputMediaGeoPoint", "params": [ { "name": "geo_point", "type": "InputGeoPoint" } ], "type": "InputMedia" }, { "id": "-1494984313", "predicate": "inputMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputMedia" }, { "id": "480546647", "predicate": "inputChatPhotoEmpty", "params": [], "type": "InputChatPhoto" }, { "id": "-1809496270", "predicate": "inputChatUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-1293828344", "predicate": "inputChatPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-457104426", "predicate": "inputGeoPointEmpty", "params": [], "type": "InputGeoPoint" }, { "id": "-206066487", "predicate": "inputGeoPoint", "params": [ { "name": "lat", "type": "double" }, { "name": "long", "type": "double" } ], "type": "InputGeoPoint" }, { "id": "483901197", "predicate": "inputPhotoEmpty", "params": [], "type": "InputPhoto" }, { "id": "-74070332", "predicate": "inputPhoto", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputPhoto" }, { "id": "342061462", "predicate": "inputFileLocation", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-1377390588", "predicate": "inputPhotoCropAuto", "params": [], "type": "InputPhotoCrop" }, { "id": "-644787419", "predicate": "inputPhotoCrop", "params": [ { "name": "crop_left", "type": "double" }, { "name": "crop_top", "type": "double" }, { "name": "crop_width", "type": "double" } ], "type": "InputPhotoCrop" }, { "id": "1996904104", "predicate": "inputAppEvent", "params": [ { "name": "time", "type": "double" }, { "name": "type", "type": "string" }, { "name": "peer", "type": "long" }, { "name": "data", "type": "string" } ], "type": "InputAppEvent" }, { "id": "-1649296275", "predicate": "peerUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "Peer" }, { "id": "-1160714821", "predicate": "peerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Peer" }, { "id": "-1432995067", "predicate": "storage.fileUnknown", "params": [], "type": "storage.FileType" }, { "id": "8322574", "predicate": "storage.fileJpeg", "params": [], "type": "storage.FileType" }, { "id": "-891180321", "predicate": "storage.fileGif", "params": [], "type": "storage.FileType" }, { "id": "172975040", "predicate": "storage.filePng", "params": [], "type": "storage.FileType" }, { "id": "-1373745011", "predicate": "storage.filePdf", "params": [], "type": "storage.FileType" }, { "id": "1384777335", "predicate": "storage.fileMp3", "params": [], "type": "storage.FileType" }, { "id": "1258941372", "predicate": "storage.fileMov", "params": [], "type": "storage.FileType" }, { "id": "1086091090", "predicate": "storage.filePartial", "params": [], "type": "storage.FileType" }, { "id": "-1278304028", "predicate": "storage.fileMp4", "params": [], "type": "storage.FileType" }, { "id": "276907596", "predicate": "storage.fileWebp", "params": [], "type": "storage.FileType" }, { "id": "2086234950", "predicate": "fileLocationUnavailable", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "1406570614", "predicate": "fileLocation", "params": [ { "name": "dc_id", "type": "int" }, { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "537022650", "predicate": "userEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "User" }, { "id": "1326562017", "predicate": "userProfilePhotoEmpty", "params": [], "type": "UserProfilePhoto" }, { "id": "-715532088", "predicate": "userProfilePhoto", "params": [ { "name": "photo_id", "type": "long" }, { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "UserProfilePhoto" }, { "id": "164646985", "predicate": "userStatusEmpty", "params": [], "type": "UserStatus" }, { "id": "-306628279", "predicate": "userStatusOnline", "params": [ { "name": "expires", "type": "int" } ], "type": "UserStatus" }, { "id": "9203775", "predicate": "userStatusOffline", "params": [ { "name": "was_online", "type": "int" } ], "type": "UserStatus" }, { "id": "-1683826688", "predicate": "chatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Chat" }, { "id": "-652419756", "predicate": "chat", "params": [ { "name": "flags", "type": "#" }, { "name": "creator", "type": "flags.0?true" }, { "name": "kicked", "type": "flags.1?true" }, { "name": "left", "type": "flags.2?true" }, { "name": "admins_enabled", "type": "flags.3?true" }, { "name": "admin", "type": "flags.4?true" }, { "name": "deactivated", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" }, { "name": "migrated_to", "type": "flags.6?InputChannel" } ], "type": "Chat" }, { "id": "120753115", "predicate": "chatForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Chat" }, { "id": "771925524", "predicate": "chatFull", "params": [ { "name": "id", "type": "int" }, { "name": "participants", "type": "ChatParticipants" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector" } ], "type": "ChatFull" }, { "id": "-925415106", "predicate": "chatParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "-57668565", "predicate": "chatParticipantsForbidden", "params": [ { "name": "flags", "type": "#" }, { "name": "chat_id", "type": "int" }, { "name": "self_participant", "type": "flags.0?ChatParticipant" } ], "type": "ChatParticipants" }, { "id": "1061556205", "predicate": "chatParticipants", "params": [ { "name": "chat_id", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "version", "type": "int" } ], "type": "ChatParticipants" }, { "id": "935395612", "predicate": "chatPhotoEmpty", "params": [], "type": "ChatPhoto" }, { "id": "1632839530", "predicate": "chatPhoto", "params": [ { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "ChatPhoto" }, { "id": "-2082087340", "predicate": "messageEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Message" }, { "id": "-1063525281", "predicate": "message", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "silent", "type": "flags.13?true" }, { "name": "post", "type": "flags.14?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "fwd_from", "type": "flags.2?MessageFwdHeader" }, { "name": "via_bot_id", "type": "flags.11?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "reply_markup", "type": "flags.6?ReplyMarkup" }, { "name": "entities", "type": "flags.7?Vector" }, { "name": "views", "type": "flags.10?int" }, { "name": "edit_date", "type": "flags.15?int" } ], "type": "Message" }, { "id": "-1642487306", "predicate": "messageService", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "silent", "type": "flags.13?true" }, { "name": "post", "type": "flags.14?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "Message" }, { "id": "1038967584", "predicate": "messageMediaEmpty", "params": [], "type": "MessageMedia" }, { "id": "1032643901", "predicate": "messageMediaPhoto", "params": [ { "name": "photo", "type": "Photo" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1457575028", "predicate": "messageMediaGeo", "params": [ { "name": "geo", "type": "GeoPoint" } ], "type": "MessageMedia" }, { "id": "1585262393", "predicate": "messageMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "user_id", "type": "int" } ], "type": "MessageMedia" }, { "id": "-1618676578", "predicate": "messageMediaUnsupported", "params": [], "type": "MessageMedia" }, { "id": "-1230047312", "predicate": "messageActionEmpty", "params": [], "type": "MessageAction" }, { "id": "-1503425638", "predicate": "messageActionChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "users", "type": "Vector" } ], "type": "MessageAction" }, { "id": "-1247687078", "predicate": "messageActionChatEditTitle", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "2144015272", "predicate": "messageActionChatEditPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageAction" }, { "id": "-1780220945", "predicate": "messageActionChatDeletePhoto", "params": [], "type": "MessageAction" }, { "id": "1217033015", "predicate": "messageActionChatAddUser", "params": [ { "name": "users", "type": "Vector" } ], "type": "MessageAction" }, { "id": "-1297179892", "predicate": "messageActionChatDeleteUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1042448310", "predicate": "dialog", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Dialog" }, { "id": "590459437", "predicate": "photoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Photo" }, { "id": "-840088834", "predicate": "photo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "sizes", "type": "Vector" } ], "type": "Photo" }, { "id": "236446268", "predicate": "photoSizeEmpty", "params": [ { "name": "type", "type": "string" } ], "type": "PhotoSize" }, { "id": "2009052699", "predicate": "photoSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "size", "type": "int" } ], "type": "PhotoSize" }, { "id": "-374917894", "predicate": "photoCachedSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "PhotoSize" }, { "id": "286776671", "predicate": "geoPointEmpty", "params": [], "type": "GeoPoint" }, { "id": "541710092", "predicate": "geoPoint", "params": [ { "name": "long", "type": "double" }, { "name": "lat", "type": "double" } ], "type": "GeoPoint" }, { "id": "-2128698738", "predicate": "auth.checkedPhone", "params": [ { "name": "phone_registered", "type": "Bool" } ], "type": "auth.CheckedPhone" }, { "id": "-16553231", "predicate": "auth.authorization", "params": [ { "name": "user", "type": "User" } ], "type": "auth.Authorization" }, { "id": "-543777747", "predicate": "auth.exportedAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.ExportedAuthorization" }, { "id": "-1195615476", "predicate": "inputNotifyPeer", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "InputNotifyPeer" }, { "id": "423314455", "predicate": "inputNotifyUsers", "params": [], "type": "InputNotifyPeer" }, { "id": "1251338318", "predicate": "inputNotifyChats", "params": [], "type": "InputNotifyPeer" }, { "id": "-1540769658", "predicate": "inputNotifyAll", "params": [], "type": "InputNotifyPeer" }, { "id": "-265263912", "predicate": "inputPeerNotifyEventsEmpty", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "-395694988", "predicate": "inputPeerNotifyEventsAll", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "949182130", "predicate": "inputPeerNotifySettings", "params": [ { "name": "flags", "type": "#" }, { "name": "show_previews", "type": "flags.0?true" }, { "name": "silent", "type": "flags.1?true" }, { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" } ], "type": "InputPeerNotifySettings" }, { "id": "-1378534221", "predicate": "peerNotifyEventsEmpty", "params": [], "type": "PeerNotifyEvents" }, { "id": "1830677896", "predicate": "peerNotifyEventsAll", "params": [], "type": "PeerNotifyEvents" }, { "id": "1889961234", "predicate": "peerNotifySettingsEmpty", "params": [], "type": "PeerNotifySettings" }, { "id": "-1697798976", "predicate": "peerNotifySettings", "params": [ { "name": "flags", "type": "#" }, { "name": "show_previews", "type": "flags.0?true" }, { "name": "silent", "type": "flags.1?true" }, { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" } ], "type": "PeerNotifySettings" }, { "id": "-2122045747", "predicate": "peerSettings", "params": [ { "name": "flags", "type": "#" }, { "name": "report_spam", "type": "flags.0?true" } ], "type": "PeerSettings" }, { "id": "-860866985", "predicate": "wallPaper", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "sizes", "type": "Vector" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "1490799288", "predicate": "inputReportReasonSpam", "params": [], "type": "ReportReason" }, { "id": "505595789", "predicate": "inputReportReasonViolence", "params": [], "type": "ReportReason" }, { "id": "777640226", "predicate": "inputReportReasonPornography", "params": [], "type": "ReportReason" }, { "id": "-512463606", "predicate": "inputReportReasonOther", "params": [ { "name": "text", "type": "string" } ], "type": "ReportReason" }, { "id": "1496513539", "predicate": "userFull", "params": [ { "name": "flags", "type": "#" }, { "name": "blocked", "type": "flags.0?true" }, { "name": "user", "type": "User" }, { "name": "about", "type": "flags.1?string" }, { "name": "link", "type": "contacts.Link" }, { "name": "profile_photo", "type": "flags.2?Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "bot_info", "type": "flags.3?BotInfo" } ], "type": "UserFull" }, { "id": "-116274796", "predicate": "contact", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual", "type": "Bool" } ], "type": "Contact" }, { "id": "-805141448", "predicate": "importedContact", "params": [ { "name": "user_id", "type": "int" }, { "name": "client_id", "type": "long" } ], "type": "ImportedContact" }, { "id": "1444661369", "predicate": "contactBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ContactBlocked" }, { "id": "-748155807", "predicate": "contactStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "ContactStatus" }, { "id": "986597452", "predicate": "contacts.link", "params": [ { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" }, { "name": "user", "type": "User" } ], "type": "contacts.Link" }, { "id": "-1219778094", "predicate": "contacts.contactsNotModified", "params": [], "type": "contacts.Contacts" }, { "id": "1871416498", "predicate": "contacts.contacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Contacts" }, { "id": "-1387117803", "predicate": "contacts.importedContacts", "params": [ { "name": "imported", "type": "Vector" }, { "name": "retry_contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ImportedContacts" }, { "id": "471043349", "predicate": "contacts.blocked", "params": [ { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "-1878523231", "predicate": "contacts.blockedSlice", "params": [ { "name": "count", "type": "int" }, { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "364538944", "predicate": "messages.dialogs", "params": [ { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "1910543603", "predicate": "messages.dialogsSlice", "params": [ { "name": "count", "type": "int" }, { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "-1938715001", "predicate": "messages.messages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "189033187", "predicate": "messages.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "1694474197", "predicate": "messages.chats", "params": [ { "name": "chats", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "-438840932", "predicate": "messages.chatFull", "params": [ { "name": "full_chat", "type": "ChatFull" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.ChatFull" }, { "id": "-1269012015", "predicate": "messages.affectedHistory", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "1474492012", "predicate": "inputMessagesFilterEmpty", "params": [], "type": "MessagesFilter" }, { "id": "-1777752804", "predicate": "inputMessagesFilterPhotos", "params": [], "type": "MessagesFilter" }, { "id": "-1614803355", "predicate": "inputMessagesFilterVideo", "params": [], "type": "MessagesFilter" }, { "id": "1458172132", "predicate": "inputMessagesFilterPhotoVideo", "params": [], "type": "MessagesFilter" }, { "id": "-648121413", "predicate": "inputMessagesFilterPhotoVideoDocuments", "params": [], "type": "MessagesFilter" }, { "id": "-1629621880", "predicate": "inputMessagesFilterDocument", "params": [], "type": "MessagesFilter" }, { "id": "2129714567", "predicate": "inputMessagesFilterUrl", "params": [], "type": "MessagesFilter" }, { "id": "-3644025", "predicate": "inputMessagesFilterGif", "params": [], "type": "MessagesFilter" }, { "id": "522914557", "predicate": "updateNewMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1318109142", "predicate": "updateMessageID", "params": [ { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Update" }, { "id": "-1576161051", "predicate": "updateDeleteMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1548249383", "predicate": "updateUserTyping", "params": [ { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "-1704596961", "predicate": "updateChatUserTyping", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "125178264", "predicate": "updateChatParticipants", "params": [ { "name": "participants", "type": "ChatParticipants" } ], "type": "Update" }, { "id": "469489699", "predicate": "updateUserStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "Update" }, { "id": "-1489818765", "predicate": "updateUserName", "params": [ { "name": "user_id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "Update" }, { "id": "-1791935732", "predicate": "updateUserPhoto", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "previous", "type": "Bool" } ], "type": "Update" }, { "id": "628472761", "predicate": "updateContactRegistered", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1657903163", "predicate": "updateContactLink", "params": [ { "name": "user_id", "type": "int" }, { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" } ], "type": "Update" }, { "id": "-1895411046", "predicate": "updateNewAuthorization", "params": [ { "name": "auth_key_id", "type": "long" }, { "name": "date", "type": "int" }, { "name": "device", "type": "string" }, { "name": "location", "type": "string" } ], "type": "Update" }, { "id": "-1519637954", "predicate": "updates.state", "params": [ { "name": "pts", "type": "int" }, { "name": "qts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "unread_count", "type": "int" } ], "type": "updates.State" }, { "id": "1567990072", "predicate": "updates.differenceEmpty", "params": [ { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "updates.Difference" }, { "id": "16030880", "predicate": "updates.difference", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-1459938943", "predicate": "updates.differenceSlice", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "intermediate_state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-484987010", "predicate": "updatesTooLong", "params": [], "type": "Updates" }, { "id": "-1857044719", "predicate": "updateShortMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "silent", "type": "flags.13?true" }, { "name": "id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from", "type": "flags.2?MessageFwdHeader" }, { "name": "via_bot_id", "type": "flags.11?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "377562760", "predicate": "updateShortChatMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "silent", "type": "flags.13?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "chat_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from", "type": "flags.2?MessageFwdHeader" }, { "name": "via_bot_id", "type": "flags.11?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "2027216577", "predicate": "updateShort", "params": [ { "name": "update", "type": "Update" }, { "name": "date", "type": "int" } ], "type": "Updates" }, { "id": "1918567619", "predicate": "updatesCombined", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq_start", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "1957577280", "predicate": "updates", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "-1916114267", "predicate": "photos.photos", "params": [ { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "352657236", "predicate": "photos.photosSlice", "params": [ { "name": "count", "type": "int" }, { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "539045032", "predicate": "photos.photo", "params": [ { "name": "photo", "type": "Photo" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photo" }, { "id": "157948117", "predicate": "upload.file", "params": [ { "name": "type", "type": "storage.FileType" }, { "name": "mtime", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "upload.File" }, { "id": "98092748", "predicate": "dcOption", "params": [ { "name": "flags", "type": "#" }, { "name": "ipv6", "type": "flags.0?true" }, { "name": "media_only", "type": "flags.1?true" }, { "name": "tcpo_only", "type": "flags.2?true" }, { "name": "id", "type": "int" }, { "name": "ip_address", "type": "string" }, { "name": "port", "type": "int" } ], "type": "DcOption" }, { "id": "830271220", "predicate": "config", "params": [ { "name": "date", "type": "int" }, { "name": "expires", "type": "int" }, { "name": "test_mode", "type": "Bool" }, { "name": "this_dc", "type": "int" }, { "name": "dc_options", "type": "Vector" }, { "name": "chat_size_max", "type": "int" }, { "name": "megagroup_size_max", "type": "int" }, { "name": "forwarded_count_max", "type": "int" }, { "name": "online_update_period_ms", "type": "int" }, { "name": "offline_blur_timeout_ms", "type": "int" }, { "name": "offline_idle_timeout_ms", "type": "int" }, { "name": "online_cloud_timeout_ms", "type": "int" }, { "name": "notify_cloud_delay_ms", "type": "int" }, { "name": "notify_default_delay_ms", "type": "int" }, { "name": "chat_big_size", "type": "int" }, { "name": "push_chat_period_ms", "type": "int" }, { "name": "push_chat_limit", "type": "int" }, { "name": "saved_gifs_limit", "type": "int" }, { "name": "edit_time_limit", "type": "int" }, { "name": "disabled_features", "type": "Vector" } ], "type": "Config" }, { "id": "-1910892683", "predicate": "nearestDc", "params": [ { "name": "country", "type": "string" }, { "name": "this_dc", "type": "int" }, { "name": "nearest_dc", "type": "int" } ], "type": "NearestDc" }, { "id": "-1987579119", "predicate": "help.appUpdate", "params": [ { "name": "id", "type": "int" }, { "name": "critical", "type": "Bool" }, { "name": "url", "type": "string" }, { "name": "text", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "-1000708810", "predicate": "help.noAppUpdate", "params": [], "type": "help.AppUpdate" }, { "id": "415997816", "predicate": "help.inviteText", "params": [ { "name": "message", "type": "string" } ], "type": "help.InviteText" }, { "id": "1662091044", "predicate": "wallPaperSolid", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "bg_color", "type": "int" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "314359194", "predicate": "updateNewEncryptedMessage", "params": [ { "name": "message", "type": "EncryptedMessage" }, { "name": "qts", "type": "int" } ], "type": "Update" }, { "id": "386986326", "predicate": "updateEncryptedChatTyping", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Update" }, { "id": "-1264392051", "predicate": "updateEncryption", "params": [ { "name": "chat", "type": "EncryptedChat" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "956179895", "predicate": "updateEncryptedMessagesRead", "params": [ { "name": "chat_id", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1417756512", "predicate": "encryptedChatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "1006044124", "predicate": "encryptedChatWaiting", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-931638658", "predicate": "encryptedChatRequested", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "-94974410", "predicate": "encryptedChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a_or_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "332848423", "predicate": "encryptedChatDiscarded", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-247351839", "predicate": "inputEncryptedChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedChat" }, { "id": "-1038136962", "predicate": "encryptedFileEmpty", "params": [], "type": "EncryptedFile" }, { "id": "1248893260", "predicate": "encryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "EncryptedFile" }, { "id": "406307684", "predicate": "inputEncryptedFileEmpty", "params": [], "type": "InputEncryptedFile" }, { "id": "1690108678", "predicate": "inputEncryptedFileUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "md5_checksum", "type": "string" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "1511503333", "predicate": "inputEncryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedFile" }, { "id": "-182231723", "predicate": "inputEncryptedFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-317144808", "predicate": "encryptedMessage", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" }, { "name": "file", "type": "EncryptedFile" } ], "type": "EncryptedMessage" }, { "id": "594758406", "predicate": "encryptedMessageService", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "EncryptedMessage" }, { "id": "-1058912715", "predicate": "messages.dhConfigNotModified", "params": [ { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "740433629", "predicate": "messages.dhConfig", "params": [ { "name": "g", "type": "int" }, { "name": "p", "type": "bytes" }, { "name": "version", "type": "int" }, { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "1443858741", "predicate": "messages.sentEncryptedMessage", "params": [ { "name": "date", "type": "int" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1802240206", "predicate": "messages.sentEncryptedFile", "params": [ { "name": "date", "type": "int" }, { "name": "file", "type": "EncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-95482955", "predicate": "inputFileBig", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" } ], "type": "InputFile" }, { "id": "767652808", "predicate": "inputEncryptedFileBigUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "-364179876", "predicate": "updateChatParticipantAdd", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1851755554", "predicate": "updateChatParticipantDelete", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1906403213", "predicate": "updateDcOptions", "params": [ { "name": "dc_options", "type": "Vector" } ], "type": "Update" }, { "id": "495530093", "predicate": "inputMediaUploadedDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-1386138479", "predicate": "inputMediaUploadedThumbDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "444068508", "predicate": "inputMediaDocument", "params": [ { "name": "id", "type": "InputDocument" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-203411800", "predicate": "messageMediaDocument", "params": [ { "name": "document", "type": "Document" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1928391342", "predicate": "inputDocumentEmpty", "params": [], "type": "InputDocument" }, { "id": "410618194", "predicate": "inputDocument", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputDocument" }, { "id": "1313188841", "predicate": "inputDocumentFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "922273905", "predicate": "documentEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Document" }, { "id": "-106717361", "predicate": "document", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "attributes", "type": "Vector" } ], "type": "Document" }, { "id": "398898678", "predicate": "help.support", "params": [ { "name": "phone_number", "type": "string" }, { "name": "user", "type": "User" } ], "type": "help.Support" }, { "id": "-1613493288", "predicate": "notifyPeer", "params": [ { "name": "peer", "type": "Peer" } ], "type": "NotifyPeer" }, { "id": "-1261946036", "predicate": "notifyUsers", "params": [], "type": "NotifyPeer" }, { "id": "-1073230141", "predicate": "notifyChats", "params": [], "type": "NotifyPeer" }, { "id": "1959820384", "predicate": "notifyAll", "params": [], "type": "NotifyPeer" }, { "id": "-2131957734", "predicate": "updateUserBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "blocked", "type": "Bool" } ], "type": "Update" }, { "id": "-1094555409", "predicate": "updateNotifySettings", "params": [ { "name": "peer", "type": "NotifyPeer" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Update" }, { "id": "381645902", "predicate": "sendMessageTypingAction", "params": [], "type": "SendMessageAction" }, { "id": "-44119819", "predicate": "sendMessageCancelAction", "params": [], "type": "SendMessageAction" }, { "id": "-1584933265", "predicate": "sendMessageRecordVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-378127636", "predicate": "sendMessageUploadVideoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-718310409", "predicate": "sendMessageRecordAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-212740181", "predicate": "sendMessageUploadAudioAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-774682074", "predicate": "sendMessageUploadPhotoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-1441998364", "predicate": "sendMessageUploadDocumentAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "393186209", "predicate": "sendMessageGeoLocationAction", "params": [], "type": "SendMessageAction" }, { "id": "1653390447", "predicate": "sendMessageChooseContactAction", "params": [], "type": "SendMessageAction" }, { "id": "446822276", "predicate": "contacts.found", "params": [ { "name": "results", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Found" }, { "id": "942527460", "predicate": "updateServiceNotification", "params": [ { "name": "type", "type": "string" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" }, { "name": "popup", "type": "Bool" } ], "type": "Update" }, { "id": "-496024847", "predicate": "userStatusRecently", "params": [], "type": "UserStatus" }, { "id": "129960444", "predicate": "userStatusLastWeek", "params": [], "type": "UserStatus" }, { "id": "2011940674", "predicate": "userStatusLastMonth", "params": [], "type": "UserStatus" }, { "id": "-298113238", "predicate": "updatePrivacy", "params": [ { "name": "key", "type": "PrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "Update" }, { "id": "1335282456", "predicate": "inputPrivacyKeyStatusTimestamp", "params": [], "type": "InputPrivacyKey" }, { "id": "-1137792208", "predicate": "privacyKeyStatusTimestamp", "params": [], "type": "PrivacyKey" }, { "id": "218751099", "predicate": "inputPrivacyValueAllowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "407582158", "predicate": "inputPrivacyValueAllowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "320652927", "predicate": "inputPrivacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "195371015", "predicate": "inputPrivacyValueDisallowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "-697604407", "predicate": "inputPrivacyValueDisallowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "-1877932953", "predicate": "inputPrivacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "-123988", "predicate": "privacyValueAllowContacts", "params": [], "type": "PrivacyRule" }, { "id": "1698855810", "predicate": "privacyValueAllowAll", "params": [], "type": "PrivacyRule" }, { "id": "1297858060", "predicate": "privacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "-125240806", "predicate": "privacyValueDisallowContacts", "params": [], "type": "PrivacyRule" }, { "id": "-1955338397", "predicate": "privacyValueDisallowAll", "params": [], "type": "PrivacyRule" }, { "id": "209668535", "predicate": "privacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "1430961007", "predicate": "account.privacyRules", "params": [ { "name": "rules", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "-1194283041", "predicate": "accountDaysTTL", "params": [ { "name": "days", "type": "int" } ], "type": "AccountDaysTTL" }, { "id": "314130811", "predicate": "updateUserPhone", "params": [ { "name": "user_id", "type": "int" }, { "name": "phone", "type": "string" } ], "type": "Update" }, { "id": "1815593308", "predicate": "documentAttributeImageSize", "params": [ { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "297109817", "predicate": "documentAttributeAnimated", "params": [], "type": "DocumentAttribute" }, { "id": "978674434", "predicate": "documentAttributeSticker", "params": [ { "name": "alt", "type": "string" }, { "name": "stickerset", "type": "InputStickerSet" } ], "type": "DocumentAttribute" }, { "id": "1494273227", "predicate": "documentAttributeVideo", "params": [ { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "-1739392570", "predicate": "documentAttributeAudio", "params": [ { "name": "flags", "type": "#" }, { "name": "voice", "type": "flags.10?true" }, { "name": "duration", "type": "int" }, { "name": "title", "type": "flags.0?string" }, { "name": "performer", "type": "flags.1?string" }, { "name": "waveform", "type": "flags.2?bytes" } ], "type": "DocumentAttribute" }, { "id": "358154344", "predicate": "documentAttributeFilename", "params": [ { "name": "file_name", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "-244016606", "predicate": "messages.stickersNotModified", "params": [], "type": "messages.Stickers" }, { "id": "-1970352846", "predicate": "messages.stickers", "params": [ { "name": "hash", "type": "string" }, { "name": "stickers", "type": "Vector" } ], "type": "messages.Stickers" }, { "id": "313694676", "predicate": "stickerPack", "params": [ { "name": "emoticon", "type": "string" }, { "name": "documents", "type": "Vector" } ], "type": "StickerPack" }, { "id": "-395967805", "predicate": "messages.allStickersNotModified", "params": [], "type": "messages.AllStickers" }, { "id": "-302170017", "predicate": "messages.allStickers", "params": [ { "name": "hash", "type": "int" }, { "name": "sets", "type": "Vector" } ], "type": "messages.AllStickers" }, { "id": "-1369215196", "predicate": "disabledFeature", "params": [ { "name": "feature", "type": "string" }, { "name": "description", "type": "string" } ], "type": "DisabledFeature" }, { "id": "-1721631396", "predicate": "updateReadHistoryInbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "791617983", "predicate": "updateReadHistoryOutbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-2066640507", "predicate": "messages.affectedMessages", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "1599050311", "predicate": "contactLinkUnknown", "params": [], "type": "ContactLink" }, { "id": "-17968211", "predicate": "contactLinkNone", "params": [], "type": "ContactLink" }, { "id": "646922073", "predicate": "contactLinkHasPhone", "params": [], "type": "ContactLink" }, { "id": "-721239344", "predicate": "contactLinkContact", "params": [], "type": "ContactLink" }, { "id": "2139689491", "predicate": "updateWebPage", "params": [ { "name": "webpage", "type": "WebPage" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-350980120", "predicate": "webPageEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "WebPage" }, { "id": "-981018084", "predicate": "webPagePending", "params": [ { "name": "id", "type": "long" }, { "name": "date", "type": "int" } ], "type": "WebPage" }, { "id": "-897446185", "predicate": "webPage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "long" }, { "name": "url", "type": "string" }, { "name": "display_url", "type": "string" }, { "name": "type", "type": "flags.0?string" }, { "name": "site_name", "type": "flags.1?string" }, { "name": "title", "type": "flags.2?string" }, { "name": "description", "type": "flags.3?string" }, { "name": "photo", "type": "flags.4?Photo" }, { "name": "embed_url", "type": "flags.5?string" }, { "name": "embed_type", "type": "flags.5?string" }, { "name": "embed_width", "type": "flags.6?int" }, { "name": "embed_height", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "author", "type": "flags.8?string" }, { "name": "document", "type": "flags.9?Document" } ], "type": "WebPage" }, { "id": "-1557277184", "predicate": "messageMediaWebPage", "params": [ { "name": "webpage", "type": "WebPage" } ], "type": "MessageMedia" }, { "id": "2079516406", "predicate": "authorization", "params": [ { "name": "hash", "type": "long" }, { "name": "flags", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "platform", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "api_id", "type": "int" }, { "name": "app_name", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "date_created", "type": "int" }, { "name": "date_active", "type": "int" }, { "name": "ip", "type": "string" }, { "name": "country", "type": "string" }, { "name": "region", "type": "string" } ], "type": "Authorization" }, { "id": "307276766", "predicate": "account.authorizations", "params": [ { "name": "authorizations", "type": "Vector" } ], "type": "account.Authorizations" }, { "id": "-1764049896", "predicate": "account.noPassword", "params": [ { "name": "new_salt", "type": "bytes" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "2081952796", "predicate": "account.password", "params": [ { "name": "current_salt", "type": "bytes" }, { "name": "new_salt", "type": "bytes" }, { "name": "hint", "type": "string" }, { "name": "has_recovery", "type": "Bool" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "-1212732749", "predicate": "account.passwordSettings", "params": [ { "name": "email", "type": "string" } ], "type": "account.PasswordSettings" }, { "id": "-2037289493", "predicate": "account.passwordInputSettings", "params": [ { "name": "flags", "type": "#" }, { "name": "new_salt", "type": "flags.0?bytes" }, { "name": "new_password_hash", "type": "flags.0?bytes" }, { "name": "hint", "type": "flags.0?string" }, { "name": "email", "type": "flags.1?string" } ], "type": "account.PasswordInputSettings" }, { "id": "326715557", "predicate": "auth.passwordRecovery", "params": [ { "name": "email_pattern", "type": "string" } ], "type": "auth.PasswordRecovery" }, { "id": "673687578", "predicate": "inputMediaVenue", "params": [ { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "InputMedia" }, { "id": "2031269663", "predicate": "messageMediaVenue", "params": [ { "name": "geo", "type": "GeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "MessageMedia" }, { "id": "-1551583367", "predicate": "receivedNotifyMessage", "params": [ { "name": "id", "type": "int" }, { "name": "flags", "type": "int" } ], "type": "ReceivedNotifyMessage" }, { "id": "1776236393", "predicate": "chatInviteEmpty", "params": [], "type": "ExportedChatInvite" }, { "id": "-64092740", "predicate": "chatInviteExported", "params": [ { "name": "link", "type": "string" } ], "type": "ExportedChatInvite" }, { "id": "1516793212", "predicate": "chatInviteAlready", "params": [ { "name": "chat", "type": "Chat" } ], "type": "ChatInvite" }, { "id": "-1813406880", "predicate": "chatInvite", "params": [ { "name": "flags", "type": "#" }, { "name": "channel", "type": "flags.0?true" }, { "name": "broadcast", "type": "flags.1?true" }, { "name": "public", "type": "flags.2?true" }, { "name": "megagroup", "type": "flags.3?true" }, { "name": "title", "type": "string" } ], "type": "ChatInvite" }, { "id": "-123931160", "predicate": "messageActionChatJoinedByLink", "params": [ { "name": "inviter_id", "type": "int" } ], "type": "MessageAction" }, { "id": "1757493555", "predicate": "updateReadMessagesContents", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-4838507", "predicate": "inputStickerSetEmpty", "params": [], "type": "InputStickerSet" }, { "id": "-1645763991", "predicate": "inputStickerSetID", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputStickerSet" }, { "id": "-2044933984", "predicate": "inputStickerSetShortName", "params": [ { "name": "short_name", "type": "string" } ], "type": "InputStickerSet" }, { "id": "-852477119", "predicate": "stickerSet", "params": [ { "name": "flags", "type": "#" }, { "name": "installed", "type": "flags.0?true" }, { "name": "disabled", "type": "flags.1?true" }, { "name": "official", "type": "flags.2?true" }, { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "short_name", "type": "string" }, { "name": "count", "type": "int" }, { "name": "hash", "type": "int" } ], "type": "StickerSet" }, { "id": "-1240849242", "predicate": "messages.stickerSet", "params": [ { "name": "set", "type": "StickerSet" }, { "name": "packs", "type": "Vector" }, { "name": "documents", "type": "Vector" } ], "type": "messages.StickerSet" }, { "id": "-787638374", "predicate": "user", "params": [ { "name": "flags", "type": "#" }, { "name": "self", "type": "flags.10?true" }, { "name": "contact", "type": "flags.11?true" }, { "name": "mutual_contact", "type": "flags.12?true" }, { "name": "deleted", "type": "flags.13?true" }, { "name": "bot", "type": "flags.14?true" }, { "name": "bot_chat_history", "type": "flags.15?true" }, { "name": "bot_nochats", "type": "flags.16?true" }, { "name": "verified", "type": "flags.17?true" }, { "name": "restricted", "type": "flags.18?true" }, { "name": "min", "type": "flags.20?true" }, { "name": "bot_inline_geo", "type": "flags.21?true" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "flags.0?long" }, { "name": "first_name", "type": "flags.1?string" }, { "name": "last_name", "type": "flags.2?string" }, { "name": "username", "type": "flags.3?string" }, { "name": "phone", "type": "flags.4?string" }, { "name": "photo", "type": "flags.5?UserProfilePhoto" }, { "name": "status", "type": "flags.6?UserStatus" }, { "name": "bot_info_version", "type": "flags.14?int" }, { "name": "restriction_reason", "type": "flags.18?string" }, { "name": "bot_inline_placeholder", "type": "flags.19?string" } ], "type": "User" }, { "id": "-1032140601", "predicate": "botCommand", "params": [ { "name": "command", "type": "string" }, { "name": "description", "type": "string" } ], "type": "BotCommand" }, { "id": "-1729618630", "predicate": "botInfo", "params": [ { "name": "user_id", "type": "int" }, { "name": "description", "type": "string" }, { "name": "commands", "type": "Vector" } ], "type": "BotInfo" }, { "id": "-1560655744", "predicate": "keyboardButton", "params": [ { "name": "text", "type": "string" } ], "type": "KeyboardButton" }, { "id": "2002815875", "predicate": "keyboardButtonRow", "params": [ { "name": "buttons", "type": "Vector" } ], "type": "KeyboardButtonRow" }, { "id": "-1606526075", "predicate": "replyKeyboardHide", "params": [ { "name": "flags", "type": "#" }, { "name": "selective", "type": "flags.2?true" } ], "type": "ReplyMarkup" }, { "id": "-200242528", "predicate": "replyKeyboardForceReply", "params": [ { "name": "flags", "type": "#" }, { "name": "single_use", "type": "flags.1?true" }, { "name": "selective", "type": "flags.2?true" } ], "type": "ReplyMarkup" }, { "id": "889353612", "predicate": "replyKeyboardMarkup", "params": [ { "name": "flags", "type": "#" }, { "name": "resize", "type": "flags.0?true" }, { "name": "single_use", "type": "flags.1?true" }, { "name": "selective", "type": "flags.2?true" }, { "name": "rows", "type": "Vector" } ], "type": "ReplyMarkup" }, { "id": "2072935910", "predicate": "inputPeerUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "-668391402", "predicate": "inputUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputUser" }, { "id": "-1350696044", "predicate": "help.appChangelogEmpty", "params": [], "type": "help.AppChangelog" }, { "id": "1181279933", "predicate": "help.appChangelog", "params": [ { "name": "text", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-1148011883", "predicate": "messageEntityUnknown", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-100378723", "predicate": "messageEntityMention", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1868782349", "predicate": "messageEntityHashtag", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1827637959", "predicate": "messageEntityBotCommand", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1859134776", "predicate": "messageEntityUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1692693954", "predicate": "messageEntityEmail", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-1117713463", "predicate": "messageEntityBold", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-2106619040", "predicate": "messageEntityItalic", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "681706865", "predicate": "messageEntityCode", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1938967520", "predicate": "messageEntityPre", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "language", "type": "string" } ], "type": "MessageEntity" }, { "id": "1990644519", "predicate": "messageEntityTextUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "url", "type": "string" } ], "type": "MessageEntity" }, { "id": "301019932", "predicate": "updateShortSentMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "-292807034", "predicate": "inputChannelEmpty", "params": [], "type": "InputChannel" }, { "id": "-1343524562", "predicate": "inputChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputChannel" }, { "id": "-1109531342", "predicate": "peerChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Peer" }, { "id": "548253432", "predicate": "inputPeerChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "-1588737454", "predicate": "channel", "params": [ { "name": "flags", "type": "#" }, { "name": "creator", "type": "flags.0?true" }, { "name": "kicked", "type": "flags.1?true" }, { "name": "left", "type": "flags.2?true" }, { "name": "editor", "type": "flags.3?true" }, { "name": "moderator", "type": "flags.4?true" }, { "name": "broadcast", "type": "flags.5?true" }, { "name": "verified", "type": "flags.7?true" }, { "name": "megagroup", "type": "flags.8?true" }, { "name": "restricted", "type": "flags.9?true" }, { "name": "democracy", "type": "flags.10?true" }, { "name": "signatures", "type": "flags.11?true" }, { "name": "min", "type": "flags.12?true" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "flags.13?long" }, { "name": "title", "type": "string" }, { "name": "username", "type": "flags.6?string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" }, { "name": "restriction_reason", "type": "flags.9?string" } ], "type": "Chat" }, { "id": "763724588", "predicate": "channelForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" } ], "type": "Chat" }, { "id": "2131196633", "predicate": "contacts.resolvedPeer", "params": [ { "name": "peer", "type": "Peer" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ResolvedPeer" }, { "id": "-1749097118", "predicate": "channelFull", "params": [ { "name": "flags", "type": "#" }, { "name": "can_view_participants", "type": "flags.3?true" }, { "name": "can_set_username", "type": "flags.6?true" }, { "name": "id", "type": "int" }, { "name": "about", "type": "string" }, { "name": "participants_count", "type": "flags.0?int" }, { "name": "admins_count", "type": "flags.1?int" }, { "name": "kicked_count", "type": "flags.2?int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector" }, { "name": "migrated_from_chat_id", "type": "flags.4?int" }, { "name": "migrated_from_max_id", "type": "flags.4?int" }, { "name": "pinned_msg_id", "type": "flags.5?int" } ], "type": "ChatFull" }, { "id": "1535415986", "predicate": "dialogChannel", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "top_important_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "pts", "type": "int" } ], "type": "Dialog" }, { "id": "182649427", "predicate": "messageRange", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "MessageRange" }, { "id": "-399216813", "predicate": "messageGroup", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "count", "type": "int" }, { "name": "date", "type": "int" } ], "type": "MessageGroup" }, { "id": "-1139861572", "predicate": "messages.channelMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "pts", "type": "int" }, { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "collapsed", "type": "flags.0?Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "-1781355374", "predicate": "messageActionChannelCreate", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "-352032773", "predicate": "updateChannelTooLong", "params": [ { "name": "flags", "type": "#" }, { "name": "channel_id", "type": "int" }, { "name": "pts", "type": "flags.0?int" } ], "type": "Update" }, { "id": "-1227598250", "predicate": "updateChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Update" }, { "id": "-1016324548", "predicate": "updateChannelGroup", "params": [ { "name": "channel_id", "type": "int" }, { "name": "group", "type": "MessageGroup" } ], "type": "Update" }, { "id": "1656358105", "predicate": "updateNewChannelMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1108669311", "predicate": "updateReadChannelInbox", "params": [ { "name": "channel_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "Update" }, { "id": "-1015733815", "predicate": "updateDeleteChannelMessages", "params": [ { "name": "channel_id", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-1734268085", "predicate": "updateChannelMessageViews", "params": [ { "name": "channel_id", "type": "int" }, { "name": "id", "type": "int" }, { "name": "views", "type": "int" } ], "type": "Update" }, { "id": "1041346555", "predicate": "updates.channelDifferenceEmpty", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" } ], "type": "updates.ChannelDifference" }, { "id": "1578530374", "predicate": "updates.channelDifferenceTooLong", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "top_message", "type": "int" }, { "name": "top_important_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "updates.ChannelDifference" }, { "id": "543450958", "predicate": "updates.channelDifference", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "new_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "updates.ChannelDifference" }, { "id": "-1798033689", "predicate": "channelMessagesFilterEmpty", "params": [], "type": "ChannelMessagesFilter" }, { "id": "-847783593", "predicate": "channelMessagesFilter", "params": [ { "name": "flags", "type": "#" }, { "name": "important_only", "type": "flags.0?true" }, { "name": "exclude_new_messages", "type": "flags.1?true" }, { "name": "ranges", "type": "Vector" } ], "type": "ChannelMessagesFilter" }, { "id": "-100588754", "predicate": "channelMessagesFilterCollapsed", "params": [], "type": "ChannelMessagesFilter" }, { "id": "367766557", "predicate": "channelParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1557620115", "predicate": "channelParticipantSelf", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1861910545", "predicate": "channelParticipantModerator", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1743180447", "predicate": "channelParticipantEditor", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1933187430", "predicate": "channelParticipantKicked", "params": [ { "name": "user_id", "type": "int" }, { "name": "kicked_by", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-471670279", "predicate": "channelParticipantCreator", "params": [ { "name": "user_id", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-566281095", "predicate": "channelParticipantsRecent", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-1268741783", "predicate": "channelParticipantsAdmins", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "1010285434", "predicate": "channelParticipantsKicked", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-1299865402", "predicate": "channelRoleEmpty", "params": [], "type": "ChannelParticipantRole" }, { "id": "-1776756363", "predicate": "channelRoleModerator", "params": [], "type": "ChannelParticipantRole" }, { "id": "-2113143156", "predicate": "channelRoleEditor", "params": [], "type": "ChannelParticipantRole" }, { "id": "-177282392", "predicate": "channels.channelParticipants", "params": [ { "name": "count", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "channels.ChannelParticipants" }, { "id": "-791039645", "predicate": "channels.channelParticipant", "params": [ { "name": "participant", "type": "ChannelParticipant" }, { "name": "users", "type": "Vector" } ], "type": "channels.ChannelParticipant" }, { "id": "-636267638", "predicate": "chatParticipantCreator", "params": [ { "name": "user_id", "type": "int" } ], "type": "ChatParticipant" }, { "id": "-489233354", "predicate": "chatParticipantAdmin", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "1855224129", "predicate": "updateChatAdmins", "params": [ { "name": "chat_id", "type": "int" }, { "name": "enabled", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1232070311", "predicate": "updateChatParticipantAdmin", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "is_admin", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1371385889", "predicate": "messageActionChatMigrateTo", "params": [ { "name": "channel_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1336546578", "predicate": "messageActionChannelMigrateFrom", "params": [ { "name": "title", "type": "string" }, { "name": "chat_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1328445861", "predicate": "channelParticipantsBots", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-236044656", "predicate": "help.termsOfService", "params": [ { "name": "text", "type": "string" } ], "type": "help.TermsOfService" }, { "id": "1753886890", "predicate": "updateNewStickerSet", "params": [ { "name": "stickerset", "type": "messages.StickerSet" } ], "type": "Update" }, { "id": "-253774767", "predicate": "updateStickerSetsOrder", "params": [ { "name": "order", "type": "Vector" } ], "type": "Update" }, { "id": "1135492588", "predicate": "updateStickerSets", "params": [], "type": "Update" }, { "id": "372165663", "predicate": "foundGif", "params": [ { "name": "url", "type": "string" }, { "name": "thumb_url", "type": "string" }, { "name": "content_url", "type": "string" }, { "name": "content_type", "type": "string" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "FoundGif" }, { "id": "-1670052855", "predicate": "foundGifCached", "params": [ { "name": "url", "type": "string" }, { "name": "photo", "type": "Photo" }, { "name": "document", "type": "Document" } ], "type": "FoundGif" }, { "id": "1212395773", "predicate": "inputMediaGifExternal", "params": [ { "name": "url", "type": "string" }, { "name": "q", "type": "string" } ], "type": "InputMedia" }, { "id": "1158290442", "predicate": "messages.foundGifs", "params": [ { "name": "next_offset", "type": "int" }, { "name": "results", "type": "Vector" } ], "type": "messages.FoundGifs" }, { "id": "-402498398", "predicate": "messages.savedGifsNotModified", "params": [], "type": "messages.SavedGifs" }, { "id": "772213157", "predicate": "messages.savedGifs", "params": [ { "name": "hash", "type": "int" }, { "name": "gifs", "type": "Vector" } ], "type": "messages.SavedGifs" }, { "id": "-1821035490", "predicate": "updateSavedGifs", "params": [], "type": "Update" }, { "id": "691006739", "predicate": "inputBotInlineMessageMediaAuto", "params": [ { "name": "flags", "type": "#" }, { "name": "caption", "type": "string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "InputBotInlineMessage" }, { "id": "1036876423", "predicate": "inputBotInlineMessageText", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.0?true" }, { "name": "message", "type": "string" }, { "name": "entities", "type": "flags.1?Vector" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "InputBotInlineMessage" }, { "id": "750510426", "predicate": "inputBotInlineResult", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "string" }, { "name": "type", "type": "string" }, { "name": "title", "type": "flags.1?string" }, { "name": "description", "type": "flags.2?string" }, { "name": "url", "type": "flags.3?string" }, { "name": "thumb_url", "type": "flags.4?string" }, { "name": "content_url", "type": "flags.5?string" }, { "name": "content_type", "type": "flags.5?string" }, { "name": "w", "type": "flags.6?int" }, { "name": "h", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "send_message", "type": "InputBotInlineMessage" } ], "type": "InputBotInlineResult" }, { "id": "175419739", "predicate": "botInlineMessageMediaAuto", "params": [ { "name": "flags", "type": "#" }, { "name": "caption", "type": "string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "BotInlineMessage" }, { "id": "-1937807902", "predicate": "botInlineMessageText", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.0?true" }, { "name": "message", "type": "string" }, { "name": "entities", "type": "flags.1?Vector" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "BotInlineMessage" }, { "id": "-1679053127", "predicate": "botInlineResult", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "string" }, { "name": "type", "type": "string" }, { "name": "title", "type": "flags.1?string" }, { "name": "description", "type": "flags.2?string" }, { "name": "url", "type": "flags.3?string" }, { "name": "thumb_url", "type": "flags.4?string" }, { "name": "content_url", "type": "flags.5?string" }, { "name": "content_type", "type": "flags.5?string" }, { "name": "w", "type": "flags.6?int" }, { "name": "h", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "send_message", "type": "BotInlineMessage" } ], "type": "BotInlineResult" }, { "id": "627509670", "predicate": "messages.botResults", "params": [ { "name": "flags", "type": "#" }, { "name": "gallery", "type": "flags.0?true" }, { "name": "query_id", "type": "long" }, { "name": "next_offset", "type": "flags.1?string" }, { "name": "switch_pm", "type": "flags.2?InlineBotSwitchPM" }, { "name": "results", "type": "Vector" } ], "type": "messages.BotResults" }, { "id": "1417832080", "predicate": "updateBotInlineQuery", "params": [ { "name": "flags", "type": "#" }, { "name": "query_id", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "query", "type": "string" }, { "name": "geo", "type": "flags.0?GeoPoint" }, { "name": "offset", "type": "string" } ], "type": "Update" }, { "id": "239663460", "predicate": "updateBotInlineSend", "params": [ { "name": "flags", "type": "#" }, { "name": "user_id", "type": "int" }, { "name": "query", "type": "string" }, { "name": "geo", "type": "flags.0?GeoPoint" }, { "name": "id", "type": "string" }, { "name": "msg_id", "type": "flags.1?InputBotInlineMessageID" } ], "type": "Update" }, { "id": "1358283666", "predicate": "inputMessagesFilterVoice", "params": [], "type": "MessagesFilter" }, { "id": "928101534", "predicate": "inputMessagesFilterMusic", "params": [], "type": "MessagesFilter" }, { "id": "-1107622874", "predicate": "inputPrivacyKeyChatInvite", "params": [], "type": "InputPrivacyKey" }, { "id": "1343122938", "predicate": "privacyKeyChatInvite", "params": [], "type": "PrivacyKey" }, { "id": "524838915", "predicate": "exportedMessageLink", "params": [ { "name": "link", "type": "string" } ], "type": "ExportedMessageLink" }, { "id": "-947462709", "predicate": "messageFwdHeader", "params": [ { "name": "flags", "type": "#" }, { "name": "from_id", "type": "flags.0?int" }, { "name": "date", "type": "int" }, { "name": "channel_id", "type": "flags.1?int" }, { "name": "channel_post", "type": "flags.2?int" } ], "type": "MessageFwdHeader" }, { "id": "457133559", "predicate": "updateEditChannelMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-1738988427", "predicate": "updateChannelPinnedMessage", "params": [ { "name": "channel_id", "type": "int" }, { "name": "id", "type": "int" } ], "type": "Update" }, { "id": "-1799538451", "predicate": "messageActionPinMessage", "params": [], "type": "MessageAction" }, { "id": "1923290508", "predicate": "auth.codeTypeSms", "params": [], "type": "auth.CodeType" }, { "id": "1948046307", "predicate": "auth.codeTypeCall", "params": [], "type": "auth.CodeType" }, { "id": "577556219", "predicate": "auth.codeTypeFlashCall", "params": [], "type": "auth.CodeType" }, { "id": "1035688326", "predicate": "auth.sentCodeTypeApp", "params": [ { "name": "length", "type": "int" } ], "type": "auth.SentCodeType" }, { "id": "-1073693790", "predicate": "auth.sentCodeTypeSms", "params": [ { "name": "length", "type": "int" } ], "type": "auth.SentCodeType" }, { "id": "1398007207", "predicate": "auth.sentCodeTypeCall", "params": [ { "name": "length", "type": "int" } ], "type": "auth.SentCodeType" }, { "id": "-1425815847", "predicate": "auth.sentCodeTypeFlashCall", "params": [ { "name": "pattern", "type": "string" } ], "type": "auth.SentCodeType" }, { "id": "1577067778", "predicate": "auth.sentCode", "params": [ { "name": "flags", "type": "#" }, { "name": "phone_registered", "type": "flags.0?true" }, { "name": "type", "type": "auth.SentCodeType" }, { "name": "phone_code_hash", "type": "string" }, { "name": "next_type", "type": "flags.1?auth.CodeType" }, { "name": "timeout", "type": "flags.2?int" } ], "type": "auth.SentCode" }, { "id": "629866245", "predicate": "keyboardButtonUrl", "params": [ { "name": "text", "type": "string" }, { "name": "url", "type": "string" } ], "type": "KeyboardButton" }, { "id": "1748655686", "predicate": "keyboardButtonCallback", "params": [ { "name": "text", "type": "string" }, { "name": "data", "type": "bytes" } ], "type": "KeyboardButton" }, { "id": "-1318425559", "predicate": "keyboardButtonRequestPhone", "params": [ { "name": "text", "type": "string" } ], "type": "KeyboardButton" }, { "id": "-59151553", "predicate": "keyboardButtonRequestGeoLocation", "params": [ { "name": "text", "type": "string" } ], "type": "KeyboardButton" }, { "id": "-367298028", "predicate": "keyboardButtonSwitchInline", "params": [ { "name": "text", "type": "string" }, { "name": "query", "type": "string" } ], "type": "KeyboardButton" }, { "id": "1218642516", "predicate": "replyInlineMarkup", "params": [ { "name": "rows", "type": "Vector" } ], "type": "ReplyMarkup" }, { "id": "308605382", "predicate": "messages.botCallbackAnswer", "params": [ { "name": "flags", "type": "#" }, { "name": "alert", "type": "flags.1?true" }, { "name": "message", "type": "flags.0?string" } ], "type": "messages.BotCallbackAnswer" }, { "id": "-1500747636", "predicate": "updateBotCallbackQuery", "params": [ { "name": "query_id", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "peer", "type": "Peer" }, { "name": "msg_id", "type": "int" }, { "name": "data", "type": "bytes" } ], "type": "Update" }, { "id": "649453030", "predicate": "messages.messageEditData", "params": [ { "name": "flags", "type": "#" }, { "name": "caption", "type": "flags.0?true" } ], "type": "messages.MessageEditData" }, { "id": "-469536605", "predicate": "updateEditMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-190472735", "predicate": "inputBotInlineMessageMediaGeo", "params": [ { "name": "flags", "type": "#" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "InputBotInlineMessage" }, { "id": "-1431327288", "predicate": "inputBotInlineMessageMediaVenue", "params": [ { "name": "flags", "type": "#" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "InputBotInlineMessage" }, { "id": "766443943", "predicate": "inputBotInlineMessageMediaContact", "params": [ { "name": "flags", "type": "#" }, { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "InputBotInlineMessage" }, { "id": "982505656", "predicate": "botInlineMessageMediaGeo", "params": [ { "name": "flags", "type": "#" }, { "name": "geo", "type": "GeoPoint" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "BotInlineMessage" }, { "id": "1130767150", "predicate": "botInlineMessageMediaVenue", "params": [ { "name": "flags", "type": "#" }, { "name": "geo", "type": "GeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "BotInlineMessage" }, { "id": "904770772", "predicate": "botInlineMessageMediaContact", "params": [ { "name": "flags", "type": "#" }, { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "BotInlineMessage" }, { "id": "-1462213465", "predicate": "inputBotInlineResultPhoto", "params": [ { "name": "id", "type": "string" }, { "name": "type", "type": "string" }, { "name": "photo", "type": "InputPhoto" }, { "name": "send_message", "type": "InputBotInlineMessage" } ], "type": "InputBotInlineResult" }, { "id": "-459324", "predicate": "inputBotInlineResultDocument", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "string" }, { "name": "type", "type": "string" }, { "name": "title", "type": "flags.1?string" }, { "name": "description", "type": "flags.2?string" }, { "name": "document", "type": "InputDocument" }, { "name": "send_message", "type": "InputBotInlineMessage" } ], "type": "InputBotInlineResult" }, { "id": "400266251", "predicate": "botInlineMediaResult", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "string" }, { "name": "type", "type": "string" }, { "name": "photo", "type": "flags.0?Photo" }, { "name": "document", "type": "flags.1?Document" }, { "name": "title", "type": "flags.2?string" }, { "name": "description", "type": "flags.3?string" }, { "name": "send_message", "type": "BotInlineMessage" } ], "type": "BotInlineResult" }, { "id": "-1995686519", "predicate": "inputBotInlineMessageID", "params": [ { "name": "dc_id", "type": "int" }, { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputBotInlineMessageID" }, { "id": "750622127", "predicate": "updateInlineBotCallbackQuery", "params": [ { "name": "query_id", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "msg_id", "type": "InputBotInlineMessageID" }, { "name": "data", "type": "bytes" } ], "type": "Update" }, { "id": "1008755359", "predicate": "inlineBotSwitchPM", "params": [ { "name": "text", "type": "string" }, { "name": "start_param", "type": "string" } ], "type": "InlineBotSwitchPM" } ], "methods": [ { "id": "-878758099", "method": "invokeAfterMsg", "params": [ { "name": "msg_id", "type": "long" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1036301552", "method": "invokeAfterMsgs", "params": [ { "name": "msg_ids", "type": "Vector" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1877286395", "method": "auth.checkPhone", "params": [ { "name": "phone_number", "type": "string" } ], "type": "auth.CheckedPhone" }, { "id": "-855805745", "method": "auth.sendCode", "params": [ { "name": "flags", "type": "#" }, { "name": "allow_flashcall", "type": "flags.0?true" }, { "name": "phone_number", "type": "string" }, { "name": "current_number", "type": "flags.0?Bool" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "auth.SentCode" }, { "id": "453408308", "method": "auth.signUp", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1126886015", "method": "auth.signIn", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "1461180992", "method": "auth.logOut", "params": [], "type": "Bool" }, { "id": "-1616179942", "method": "auth.resetAuthorizations", "params": [], "type": "Bool" }, { "id": "1998331287", "method": "auth.sendInvites", "params": [ { "name": "phone_numbers", "type": "Vector" }, { "name": "message", "type": "string" } ], "type": "Bool" }, { "id": "-440401971", "method": "auth.exportAuthorization", "params": [ { "name": "dc_id", "type": "int" } ], "type": "auth.ExportedAuthorization" }, { "id": "-470837741", "method": "auth.importAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-841733627", "method": "auth.bindTempAuthKey", "params": [ { "name": "perm_auth_key_id", "type": "long" }, { "name": "nonce", "type": "long" }, { "name": "expires_at", "type": "int" }, { "name": "encrypted_message", "type": "bytes" } ], "type": "Bool" }, { "id": "1147957548", "method": "account.registerDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "app_sandbox", "type": "Bool" }, { "name": "lang_code", "type": "string" } ], "type": "Bool" }, { "id": "1707432768", "method": "account.unregisterDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" } ], "type": "Bool" }, { "id": "-2067899501", "method": "account.updateNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" }, { "name": "settings", "type": "InputPeerNotifySettings" } ], "type": "Bool" }, { "id": "313765169", "method": "account.getNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" } ], "type": "PeerNotifySettings" }, { "id": "-612493497", "method": "account.resetNotifySettings", "params": [], "type": "Bool" }, { "id": "2018596725", "method": "account.updateProfile", "params": [ { "name": "flags", "type": "#" }, { "name": "first_name", "type": "flags.0?string" }, { "name": "last_name", "type": "flags.1?string" }, { "name": "about", "type": "flags.2?string" } ], "type": "User" }, { "id": "1713919532", "method": "account.updateStatus", "params": [ { "name": "offline", "type": "Bool" } ], "type": "Bool" }, { "id": "-1068696894", "method": "account.getWallPapers", "params": [], "type": "Vector" }, { "id": "-1374118561", "method": "account.reportPeer", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "reason", "type": "ReportReason" } ], "type": "Bool" }, { "id": "227648840", "method": "users.getUsers", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-902781519", "method": "users.getFullUser", "params": [ { "name": "id", "type": "InputUser" } ], "type": "UserFull" }, { "id": "-995929106", "method": "contacts.getStatuses", "params": [], "type": "Vector" }, { "id": "583445000", "method": "contacts.getContacts", "params": [ { "name": "hash", "type": "string" } ], "type": "contacts.Contacts" }, { "id": "-634342611", "method": "contacts.importContacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "replace", "type": "Bool" } ], "type": "contacts.ImportedContacts" }, { "id": "-1902823612", "method": "contacts.deleteContact", "params": [ { "name": "id", "type": "InputUser" } ], "type": "contacts.Link" }, { "id": "1504393374", "method": "contacts.deleteContacts", "params": [ { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "858475004", "method": "contacts.block", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-448724803", "method": "contacts.unblock", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-176409329", "method": "contacts.getBlocked", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "contacts.Blocked" }, { "id": "-2065352905", "method": "contacts.exportCard", "params": [], "type": "Vector" }, { "id": "1340184318", "method": "contacts.importCard", "params": [ { "name": "export_card", "type": "Vector" } ], "type": "User" }, { "id": "1109588596", "method": "messages.getMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "1799878989", "method": "messages.getDialogs", "params": [ { "name": "offset_date", "type": "int" }, { "name": "offset_id", "type": "int" }, { "name": "offset_peer", "type": "InputPeer" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-1347868602", "method": "messages.getHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset_id", "type": "int" }, { "name": "offset_date", "type": "int" }, { "name": "add_offset", "type": "int" }, { "name": "limit", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" } ], "type": "messages.Messages" }, { "id": "-732523960", "method": "messages.search", "params": [ { "name": "flags", "type": "#" }, { "name": "important_only", "type": "flags.0?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "238054714", "method": "messages.readHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "-1212072999", "method": "messages.deleteHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-1510897371", "method": "messages.deleteMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "94983360", "method": "messages.receivedMessages", "params": [ { "name": "max_id", "type": "int" } ], "type": "Vector" }, { "id": "-1551737264", "method": "messages.setTyping", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Bool" }, { "id": "-91733382", "method": "messages.sendMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.1?true" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "silent", "type": "flags.5?true" }, { "name": "background", "type": "flags.6?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" }, { "name": "entities", "type": "flags.3?Vector" } ], "type": "Updates" }, { "id": "-923703407", "method": "messages.sendMedia", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "silent", "type": "flags.5?true" }, { "name": "background", "type": "flags.6?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "Updates" }, { "id": "1888354709", "method": "messages.forwardMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "silent", "type": "flags.5?true" }, { "name": "background", "type": "flags.6?true" }, { "name": "from_peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "random_id", "type": "Vector" }, { "name": "to_peer", "type": "InputPeer" } ], "type": "Updates" }, { "id": "-820669733", "method": "messages.reportSpam", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "Bool" }, { "id": "-1460572005", "method": "messages.hideReportSpam", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "Bool" }, { "id": "913498268", "method": "messages.getPeerSettings", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "PeerSettings" }, { "id": "1013621127", "method": "messages.getChats", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "998448230", "method": "messages.getFullChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "messages.ChatFull" }, { "id": "-599447467", "method": "messages.editChatTitle", "params": [ { "name": "chat_id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-900957736", "method": "messages.editChatPhoto", "params": [ { "name": "chat_id", "type": "int" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-106911223", "method": "messages.addChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "fwd_limit", "type": "int" } ], "type": "Updates" }, { "id": "-530505962", "method": "messages.deleteChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" } ], "type": "Updates" }, { "id": "164303470", "method": "messages.createChat", "params": [ { "name": "users", "type": "Vector" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-304838614", "method": "updates.getState", "params": [], "type": "updates.State" }, { "id": "168039573", "method": "updates.getDifference", "params": [ { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "qts", "type": "int" } ], "type": "updates.Difference" }, { "id": "-285902432", "method": "photos.updateProfilePhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "UserProfilePhoto" }, { "id": "-720397176", "method": "photos.uploadProfilePhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "photos.Photo" }, { "id": "-2016444625", "method": "photos.deletePhotos", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-1291540959", "method": "upload.saveFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "-475607115", "method": "upload.getFile", "params": [ { "name": "location", "type": "InputFileLocation" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "upload.File" }, { "id": "-990308245", "method": "help.getConfig", "params": [], "type": "Config" }, { "id": "531836966", "method": "help.getNearestDc", "params": [], "type": "NearestDc" }, { "id": "-938300290", "method": "help.getAppUpdate", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "1862465352", "method": "help.saveAppLog", "params": [ { "name": "events", "type": "Vector" } ], "type": "Bool" }, { "id": "-1532407418", "method": "help.getInviteText", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.InviteText" }, { "id": "-1848823128", "method": "photos.getUserPhotos", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "long" }, { "name": "limit", "type": "int" } ], "type": "photos.Photos" }, { "id": "865483769", "method": "messages.forwardMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Updates" }, { "id": "-1082919718", "method": "messages.sendBroadcast", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "random_id", "type": "Vector" }, { "name": "message", "type": "string" }, { "name": "media", "type": "InputMedia" } ], "type": "Updates" }, { "id": "651135312", "method": "messages.getDhConfig", "params": [ { "name": "version", "type": "int" }, { "name": "random_length", "type": "int" } ], "type": "messages.DhConfig" }, { "id": "-162681021", "method": "messages.requestEncryption", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "random_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "1035731989", "method": "messages.acceptEncryption", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "g_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "-304536635", "method": "messages.discardEncryption", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Bool" }, { "id": "2031374829", "method": "messages.setEncryptedTyping", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "2135648522", "method": "messages.readEncryptedHistory", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "max_date", "type": "int" } ], "type": "Bool" }, { "id": "-1451792525", "method": "messages.sendEncrypted", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1701831834", "method": "messages.sendEncryptedFile", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" }, { "name": "file", "type": "InputEncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "852769188", "method": "messages.sendEncryptedService", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "1436924774", "method": "messages.receivedQueue", "params": [ { "name": "max_qts", "type": "int" } ], "type": "Vector" }, { "id": "-562337987", "method": "upload.saveBigFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "file_total_parts", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "1769565673", "method": "initConnection", "params": [ { "name": "api_id", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-1663104819", "method": "help.getSupport", "params": [], "type": "help.Support" }, { "id": "916930423", "method": "messages.readMessageContents", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "655677548", "method": "account.checkUsername", "params": [ { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "1040964988", "method": "account.updateUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "301470424", "method": "contacts.search", "params": [ { "name": "q", "type": "string" }, { "name": "limit", "type": "int" } ], "type": "contacts.Found" }, { "id": "-623130288", "method": "account.getPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" } ], "type": "account.PrivacyRules" }, { "id": "-906486552", "method": "account.setPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "1099779595", "method": "account.deleteAccount", "params": [ { "name": "reason", "type": "string" } ], "type": "Bool" }, { "id": "150761757", "method": "account.getAccountTTL", "params": [], "type": "AccountDaysTTL" }, { "id": "608323678", "method": "account.setAccountTTL", "params": [ { "name": "ttl", "type": "AccountDaysTTL" } ], "type": "Bool" }, { "id": "-627372787", "method": "invokeWithLayer", "params": [ { "name": "layer", "type": "int" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-113456221", "method": "contacts.resolveUsername", "params": [ { "name": "username", "type": "string" } ], "type": "contacts.ResolvedPeer" }, { "id": "149257707", "method": "account.sendChangePhoneCode", "params": [ { "name": "flags", "type": "#" }, { "name": "allow_flashcall", "type": "flags.0?true" }, { "name": "phone_number", "type": "string" }, { "name": "current_number", "type": "flags.0?Bool" } ], "type": "auth.SentCode" }, { "id": "1891839707", "method": "account.changePhone", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "User" }, { "id": "-1373446075", "method": "messages.getStickers", "params": [ { "name": "emoticon", "type": "string" }, { "name": "hash", "type": "string" } ], "type": "messages.Stickers" }, { "id": "479598769", "method": "messages.getAllStickers", "params": [ { "name": "hash", "type": "int" } ], "type": "messages.AllStickers" }, { "id": "954152242", "method": "account.updateDeviceLocked", "params": [ { "name": "period", "type": "int" } ], "type": "Bool" }, { "id": "1738800940", "method": "auth.importBotAuthorization", "params": [ { "name": "flags", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "bot_auth_token", "type": "string" } ], "type": "auth.Authorization" }, { "id": "623001124", "method": "messages.getWebPagePreview", "params": [ { "name": "message", "type": "string" } ], "type": "MessageMedia" }, { "id": "-484392616", "method": "account.getAuthorizations", "params": [], "type": "account.Authorizations" }, { "id": "-545786948", "method": "account.resetAuthorization", "params": [ { "name": "hash", "type": "long" } ], "type": "Bool" }, { "id": "1418342645", "method": "account.getPassword", "params": [], "type": "account.Password" }, { "id": "-1131605573", "method": "account.getPasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" } ], "type": "account.PasswordSettings" }, { "id": "-92517498", "method": "account.updatePasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" }, { "name": "new_settings", "type": "account.PasswordInputSettings" } ], "type": "Bool" }, { "id": "174260510", "method": "auth.checkPassword", "params": [ { "name": "password_hash", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-661144474", "method": "auth.requestPasswordRecovery", "params": [], "type": "auth.PasswordRecovery" }, { "id": "1319464594", "method": "auth.recoverPassword", "params": [ { "name": "code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1080796745", "method": "invokeWithoutUpdates", "params": [ { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "2106086025", "method": "messages.exportChatInvite", "params": [ { "name": "chat_id", "type": "int" } ], "type": "ExportedChatInvite" }, { "id": "1051570619", "method": "messages.checkChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "ChatInvite" }, { "id": "1817183516", "method": "messages.importChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "Updates" }, { "id": "639215886", "method": "messages.getStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "messages.StickerSet" }, { "id": "2066793382", "method": "messages.installStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" }, { "name": "disabled", "type": "Bool" } ], "type": "Bool" }, { "id": "-110209570", "method": "messages.uninstallStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "Bool" }, { "id": "-421563528", "method": "messages.startBot", "params": [ { "name": "bot", "type": "InputUser" }, { "name": "peer", "type": "InputPeer" }, { "name": "random_id", "type": "long" }, { "name": "start_param", "type": "string" } ], "type": "Updates" }, { "id": "1537966002", "method": "help.getAppChangelog", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-993483427", "method": "messages.getMessagesViews", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "increment", "type": "Bool" } ], "type": "Vector" }, { "id": "-1445735863", "method": "channels.getDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-1891021902", "method": "channels.getImportantHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "offset_id", "type": "int" }, { "name": "offset_date", "type": "int" }, { "name": "add_offset", "type": "int" }, { "name": "limit", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" } ], "type": "messages.Messages" }, { "id": "-871347913", "method": "channels.readHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "max_id", "type": "int" } ], "type": "Bool" }, { "id": "-2067661490", "method": "channels.deleteMessages", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "-787622117", "method": "channels.deleteUserHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" } ], "type": "messages.AffectedHistory" }, { "id": "-32999408", "method": "channels.reportSpam", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "-1814580409", "method": "channels.getMessages", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "618237842", "method": "channels.getParticipants", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "filter", "type": "ChannelParticipantsFilter" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "channels.ChannelParticipants" }, { "id": "1416484774", "method": "channels.getParticipant", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" } ], "type": "channels.ChannelParticipant" }, { "id": "176122811", "method": "channels.getChannels", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "141781513", "method": "channels.getFullChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "messages.ChatFull" }, { "id": "-192332417", "method": "channels.createChannel", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.0?true" }, { "name": "megagroup", "type": "flags.1?true" }, { "name": "title", "type": "string" }, { "name": "about", "type": "string" } ], "type": "Updates" }, { "id": "333610782", "method": "channels.editAbout", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "about", "type": "string" } ], "type": "Bool" }, { "id": "-344583728", "method": "channels.editAdmin", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "role", "type": "ChannelParticipantRole" } ], "type": "Updates" }, { "id": "1450044624", "method": "channels.editTitle", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-248621111", "method": "channels.editPhoto", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-1432183160", "method": "channels.toggleComments", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "283557164", "method": "channels.checkUsername", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "890549214", "method": "channels.updateUsername", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "615851205", "method": "channels.joinChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "-130635115", "method": "channels.leaveChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "429865580", "method": "channels.inviteToChannel", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "users", "type": "Vector" } ], "type": "Updates" }, { "id": "-1502421484", "method": "channels.kickFromChannel", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "kicked", "type": "Bool" } ], "type": "Updates" }, { "id": "-950663035", "method": "channels.exportInvite", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "ExportedChatInvite" }, { "id": "-1072619549", "method": "channels.deleteChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "-1154295872", "method": "updates.getChannelDifference", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "filter", "type": "ChannelMessagesFilter" }, { "name": "pts", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "updates.ChannelDifference" }, { "id": "-326379039", "method": "messages.toggleChatAdmins", "params": [ { "name": "chat_id", "type": "int" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "-1444503762", "method": "messages.editChatAdmin", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "is_admin", "type": "Bool" } ], "type": "Bool" }, { "id": "363051235", "method": "messages.migrateChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Updates" }, { "id": "-1640190800", "method": "messages.searchGlobal", "params": [ { "name": "q", "type": "string" }, { "name": "offset_date", "type": "int" }, { "name": "offset_peer", "type": "InputPeer" }, { "name": "offset_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "936873859", "method": "help.getTermsOfService", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.TermsOfService" }, { "id": "-1613775824", "method": "messages.reorderStickerSets", "params": [ { "name": "order", "type": "Vector" } ], "type": "Bool" }, { "id": "864953444", "method": "messages.getDocumentByHash", "params": [ { "name": "sha256", "type": "bytes" }, { "name": "size", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "Document" }, { "id": "-1080395925", "method": "messages.searchGifs", "params": [ { "name": "q", "type": "string" }, { "name": "offset", "type": "int" } ], "type": "messages.FoundGifs" }, { "id": "-2084618926", "method": "messages.getSavedGifs", "params": [ { "name": "hash", "type": "int" } ], "type": "messages.SavedGifs" }, { "id": "846868683", "method": "messages.saveGif", "params": [ { "name": "id", "type": "InputDocument" }, { "name": "unsave", "type": "Bool" } ], "type": "Bool" }, { "id": "1364105629", "method": "messages.getInlineBotResults", "params": [ { "name": "flags", "type": "#" }, { "name": "bot", "type": "InputUser" }, { "name": "peer", "type": "InputPeer" }, { "name": "geo_point", "type": "flags.0?InputGeoPoint" }, { "name": "query", "type": "string" }, { "name": "offset", "type": "string" } ], "type": "messages.BotResults" }, { "id": "-346119674", "method": "messages.setInlineBotResults", "params": [ { "name": "flags", "type": "#" }, { "name": "gallery", "type": "flags.0?true" }, { "name": "private", "type": "flags.1?true" }, { "name": "query_id", "type": "long" }, { "name": "results", "type": "Vector" }, { "name": "cache_time", "type": "int" }, { "name": "next_offset", "type": "flags.2?string" }, { "name": "switch_pm", "type": "flags.3?InlineBotSwitchPM" } ], "type": "Bool" }, { "id": "-1318189314", "method": "messages.sendInlineBotResult", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "silent", "type": "flags.5?true" }, { "name": "background", "type": "flags.6?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "random_id", "type": "long" }, { "name": "query_id", "type": "long" }, { "name": "id", "type": "string" } ], "type": "Updates" }, { "id": "1231065863", "method": "channels.toggleInvites", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "-934882771", "method": "channels.exportMessageLink", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "int" } ], "type": "ExportedMessageLink" }, { "id": "527021574", "method": "channels.toggleSignatures", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "-1490162350", "method": "channels.updatePinnedMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "silent", "type": "flags.0?true" }, { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "int" } ], "type": "Updates" }, { "id": "1056025023", "method": "auth.resendCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "auth.SentCode" }, { "id": "520357240", "method": "auth.cancelCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "-39416522", "method": "messages.getMessageEditData", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" } ], "type": "messages.MessageEditData" }, { "id": "-829299510", "method": "messages.editMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.1?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "message", "type": "flags.11?string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" }, { "name": "entities", "type": "flags.3?Vector" } ], "type": "Updates" }, { "id": "319564933", "method": "messages.editInlineBotMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.1?true" }, { "name": "id", "type": "InputBotInlineMessageID" }, { "name": "message", "type": "flags.11?string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" }, { "name": "entities", "type": "flags.3?Vector" } ], "type": "Bool" }, { "id": "-1494659324", "method": "messages.getBotCallbackAnswer", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "msg_id", "type": "int" }, { "name": "data", "type": "bytes" } ], "type": "messages.BotCallbackAnswer" }, { "id": "1209817370", "method": "messages.setBotCallbackAnswer", "params": [ { "name": "flags", "type": "#" }, { "name": "alert", "type": "flags.1?true" }, { "name": "query_id", "type": "long" }, { "name": "message", "type": "flags.0?string" } ], "type": "Bool" } ] }. * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Loop\Connection; use Amp\Success; use danog\MadelineProto\Logger; use danog\MadelineProto\Loop\Impl\ResumableSignalLoop; /** * Update loop. * * @author Daniil Gentili */ class UpdateLoop extends ResumableSignalLoop { public function loop(): \Generator { $API = $this->API; $datacenter = $this->datacenter; $connection = $this->connection; if (!$this->API->settings['updates']['handle_updates']) { yield new Success(0); return false; } $this->startedLoop(); $API->logger->logger("Entered updates loop in DC {$datacenter}", Logger::ULTRA_VERBOSE); $timeout = $API->settings['updates']['getdifference_interval']; while (true) { while (!$this->API->settings['updates']['handle_updates'] || !$this->has_all_auth()) { if (yield $this->waitSignal($this->pause())) { $API->logger->logger('Exiting update loop'); $this->exitedLoop(); return; } } if (time() - $API->last_getdifference > $timeout) { if (!$API->get_updates_difference()) { return false; } } if (yield $this->waitSignal($this->pause(($API->last_getdifference + $timeout) - time()))) { $API->logger->logger('Exiting update loop'); $this->exitedLoop(); return; } } } public function has_all_auth() { if ($this->API->isInitingAuthorization()) { return false; } foreach ($this->API->datacenter->sockets as $dc) { if (!$dc->authorized || $dc->temp_auth_key === null) { return false; } } return true; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Loop\Connection; use Amp\Coroutine; use Amp\Success; use danog\MadelineProto\Connection; use danog\MadelineProto\Logger; use danog\MadelineProto\Loop\Impl\ResumableSignalLoop; use danog\MadelineProto\MTProtoTools\Crypt; use danog\MadelineProto\Tools; /** * Socket write loop. * * @author Daniil Gentili */ class WriteLoop extends ResumableSignalLoop { use Crypt; use Tools; public function loop(): \Generator { $API = $this->API; $datacenter = $this->datacenter; $connection = $this->connection; $this->startedLoop(); $API->logger->logger("Entered write loop in DC {$datacenter}", Logger::ULTRA_VERBOSE); while (true) { if (empty($connection->pending_outgoing)) { if (yield $this->waitSignal($this->pause())) { $API->logger->logger('Exiting write loop'); $this->exitedLoop(); yield new Success(0); return; } } try { if ($connection->temp_auth_key === null) { $res = $this->unencryptedWriteLoopAsync(); } else { $res = $this->encryptedWriteLoopAsync(); } if ($res instanceof \Generator) { yield new Coroutine($res); } } finally { $this->exitedLoop(); } $this->startedLoop(); //$connection->waiter->resume(); } } public function unencryptedWriteLoopAsync(): \Generator { $API = $this->API; $datacenter = $this->datacenter; $connection = $this->connection; while ($connection->pending_outgoing) { $skipped_all = true; foreach ($connection->pending_outgoing as $k => $message) { if ($connection->temp_auth_key !== null) { return; } if (!$message['unencrypted']) { continue; } $skipped_all = false; $body = $message['serialized_body']; $API->logger->logger("Sending {$message['_']} as unencrypted message to DC {$datacenter}", \danog\MadelineProto\Logger::ULTRA_VERBOSE); $message_id = isset($message['msg_id']) ? $message['msg_id'] : $connection->generate_message_id(); $length = strlen($body); $pad_length = -$length & 15; $pad_length += 16 * $this->random_int($modulus = 16); $pad = $this->random($pad_length); $buffer = yield $connection->stream->getWriteBuffer(8 + 8 + 4 + $pad_length + $length); yield $buffer->bufferWrite("\0\0\0\0\0\0\0\0".$message_id.$this->pack_unsigned_int($length).$body.$pad); //var_dump("plain ".bin2hex($message_id)); $connection->http_req_count++; $connection->outgoing_messages[$message_id] = $message; $connection->outgoing_messages[$message_id]['sent'] = time(); $connection->outgoing_messages[$message_id]['tries'] = 0; $connection->outgoing_messages[$message_id]['unencrypted'] = true; $connection->new_outgoing[$message_id] = $message_id; unset($connection->pending_outgoing[$k]); $API->logger->logger("Sent {$message['_']} as unencrypted message to DC {$datacenter}!", \danog\MadelineProto\Logger::ULTRA_VERBOSE); $message['send_promise']->resolve(isset($message['promise']) ? $message['promise'] : true); } if ($skipped_all) { break; } } } public function encryptedWriteLoopAsync(): \Generator { $API = $this->API; $datacenter = $this->datacenter; $connection = $this->connection; do { if ($connection->temp_auth_key === null) { return; } if ($this->API->is_http($datacenter) && empty($connection->pending_outgoing)) { return; } if (count($to_ack = $connection->ack_queue)) { $connection->pending_outgoing[$connection->pending_outgoing_key++] = ['_' => 'msgs_ack', 'serialized_body' => $this->API->serialize_object(['type' => 'msgs_ack'], ['msg_ids' => $connection->ack_queue], 'msgs_ack'), 'content_related' => false, 'unencrypted' => false, 'method' => false]; $connection->pending_outgoing_key %= Connection::PENDING_MAX; } $has_http_wait = false; $messages = []; $keys = []; foreach ($connection->pending_outgoing as $message) { if ($message['_'] === 'http_wait') { $has_http_wait = true; break; } } if ($API->is_http($datacenter) && !$has_http_wait) { $dc_config_number = isset($API->settings['connection_settings'][$datacenter]) ? $datacenter : 'all'; //$connection->pending_outgoing[$connection->pending_outgoing_key++] = ['_' => 'http_wait', 'serialized_body' => $this->API->serialize_object(['type' => ''], ['_' => 'http_wait', 'max_wait' => $API->settings['connection_settings'][$dc_config_number]['timeout'] * 1000 - 100, 'wait_after' => 0, 'max_delay' => 0], 'http_wait'), 'content_related' => true, 'unencrypted' => false, 'method' => true]; $connection->pending_outgoing[$connection->pending_outgoing_key++] = ['_' => 'http_wait', 'serialized_body' => $this->API->serialize_object(['type' => ''], ['_' => 'http_wait', 'max_wait' => 30000, 'wait_after' => 0, 'max_delay' => 1], 'http_wait'), 'content_related' => true, 'unencrypted' => false, 'method' => true]; $connection->pending_outgoing_key %= Connection::PENDING_MAX; $has_http_wait = true; } $total_length = 0; $count = 0; ksort($connection->pending_outgoing); foreach ($connection->pending_outgoing as $k => $message) { if ($message['unencrypted']) { continue; } if (isset($message['container'])) { unset($connection->pending_outgoing[$k]); continue; } $body = $message['serialized_body']; $message_id = isset($message['msg_id']) ? $message['msg_id'] : $connection->generate_message_id($datacenter); $API->logger->logger("Sending {$message['_']} as encrypted message to DC {$datacenter}", \danog\MadelineProto\Logger::ULTRA_VERBOSE); $MTmessage = ['_' => 'MTmessage', 'msg_id' => $message_id, 'body' => $body, 'seqno' => $connection->generate_out_seq_no($message['content_related'])]; if (isset($message['method']) && $message['method'] && $message['_'] !== 'http_wait') { if ((!isset($connection->temp_auth_key['connection_inited']) || $connection->temp_auth_key['connection_inited'] === false) && $message['_'] !== 'auth.bindTempAuthKey') { $API->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['write_client_info'], $message['_']), \danog\MadelineProto\Logger::NOTICE); $MTmessage['body'] = $API->serialize_method( 'invokeWithLayer', [ 'layer' => $API->settings['tl_schema']['layer'], 'query' => $API->serialize_method( 'initConnection', [ 'api_id' => $API->settings['app_info']['api_id'], 'api_hash' => $API->settings['app_info']['api_hash'], 'device_model' => strpos($datacenter, 'cdn') === false ? $API->settings['app_info']['device_model'] : 'n/a', 'system_version' => strpos($datacenter, 'cdn') === false ? $API->settings['app_info']['system_version'] : 'n/a', 'app_version' => $API->settings['app_info']['app_version'], 'system_lang_code' => $API->settings['app_info']['lang_code'], 'lang_code' => $API->settings['app_info']['lang_code'], 'lang_pack' => $API->settings['app_info']['lang_pack'], 'query' => $MTmessage['body'], ] ), ] ); } else { if (isset($message['queue'])) { if (!isset($connection->call_queue[$message['queue']])) { $connection->call_queue[$message['queue']] = []; } $MTmessage['body'] = $API->serialize_method('invokeAfterMsgs', ['msg_ids' => $connection->call_queue[$message['queue']], 'query' => $MTmessage['body']]); $connection->call_queue[$message['queue']][$message_id] = $message_id; if (count($connection->call_queue[$message['queue']]) > $API->settings['msg_array_limit']['call_queue']) { reset($connection->call_queue[$message['queue']]); $key = key($connection->call_queue[$message['queue']]); unset($connection->call_queue[$message['queue']][$key]); } } /* if ($API->settings['requests']['gzip_encode_if_gt'] !== -1 && ($l = strlen($MTmessage['body'])) > $API->settings['requests']['gzip_encode_if_gt']) { if (($g = strlen($gzipped = gzencode($MTmessage['body']))) < $l) { $MTmessage['body'] = $API->serialize_object(['type' => 'gzip_packed'], ['packed_data' => $gzipped], 'gzipped data'); $API->logger->logger('Using GZIP compression for ' . $message['_'] . ', saved ' . ($l - $g) . ' bytes of data, reduced call size by ' . $g * 100 / $l . '%', \danog\MadelineProto\Logger::ULTRA_VERBOSE); } unset($gzipped); }*/ } } $body_length = strlen($MTmessage['body']); if ($total_length && $total_length + $body_length + 32 > 655360) { $API->logger->logger('Length overflow, postponing part of payload', \danog\MadelineProto\Logger::NOTICE); break; } $count++; $total_length += $body_length + 32; $MTmessage['bytes'] = $body_length; $messages[] = $MTmessage; $keys[$k] = $message_id; if ($total_length && $total_length + 32 > 655360) { $API->logger->logger('Length overflow, postponing part of payload', \danog\MadelineProto\Logger::NOTICE); break; } } if (count($messages) > 1) { $API->logger->logger("Wrapping in msg_container as encrypted message for DC {$datacenter}", \danog\MadelineProto\Logger::ULTRA_VERBOSE); $message_id = $connection->generate_message_id($datacenter); $connection->pending_outgoing[$connection->pending_outgoing_key] = ['_' => 'msg_container', 'container' => array_values($keys), 'content_related' => false, 'method' => false]; //var_dumP("container ".bin2hex($message_id)); $keys[$connection->pending_outgoing_key++] = $message_id; $connection->pending_outgoing_key %= Connection::PENDING_MAX; $message_data = $API->serialize_object(['type' => ''], ['_' => 'msg_container', 'messages' => $messages], 'container'); $message_data_length = strlen($message_data); $seq_no = $connection->generate_out_seq_no(false); } elseif (count($messages)) { $message = $messages[0]; $message_data = $message['body']; $message_data_length = $message['bytes']; $message_id = $message['msg_id']; $seq_no = $message['seqno']; } else { $API->logger->logger('NO MESSAGE SENT', \danog\MadelineProto\Logger::WARNING); return; } unset($messages); $plaintext = $connection->temp_auth_key['server_salt'].$connection->session_id.$message_id.pack('VV', $seq_no, $message_data_length).$message_data; $padding = $this->posmod(-strlen($plaintext), 16); if ($padding < 12) { $padding += 16; } $padding = $this->random($padding); $message_key = substr(hash('sha256', substr($connection->temp_auth_key['auth_key'], 88, 32).$plaintext.$padding, true), 8, 16); list($aes_key, $aes_iv) = $this->aes_calculate($message_key, $connection->temp_auth_key['auth_key']); $message = $connection->temp_auth_key['id'].$message_key.$this->ige_encrypt($plaintext.$padding, $aes_key, $aes_iv); $buffer = yield $connection->stream->getWriteBuffer($len = strlen($message)); $t = microtime(true); yield $buffer->bufferWrite($message); $connection->http_req_count++; $API->logger->logger("Sent encrypted payload to DC {$datacenter}, speed ".((($len * 8) / (microtime(true) - $t)) / 1000000).' mbps!', \danog\MadelineProto\Logger::ULTRA_VERBOSE); $sent = time(); if ($to_ack) { $connection->ack_queue = []; } if ($has_http_wait) { $connection->last_http_wait = $sent; } elseif ($API->isAltervista()) { $connection->last_http_wait = PHP_INT_MAX; } foreach ($keys as $key => $message_id) { $connection->outgoing_messages[$message_id] = &$connection->pending_outgoing[$key]; if (isset($connection->outgoing_messages[$message_id]['promise'])) { $connection->new_outgoing[$message_id] = $message_id; $connection->outgoing_messages[$message_id]['sent'] = $sent; $connection->outgoing_messages[$message_id]['tries'] = 0; } if (isset($connection->outgoing_messages[$message_id]['send_promise'])) { $connection->outgoing_messages[$message_id]['send_promise']->resolve(isset($connection->outgoing_messages[$message_id]['promise']) ? $connection->outgoing_messages[$message_id]['promise'] : true); } //var_dumP("encrypted ".bin2hex($message_id)." ".$connection->outgoing_messages[$message_id]['_']); unset($connection->pending_outgoing[$key]); } //if (!empty($connection->pending_outgoing)) $connection->select(); } while (!empty($connection->pending_outgoing)); $connection->pending_outgoing_key = 0; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Loop\Connection; use Amp\Deferred; use danog\MadelineProto\Logger; use danog\MadelineProto\Loop\Impl\ResumableSignalLoop; use function Amp\call; /** * RPC call status check loop. * * @author Daniil Gentili */ class CheckLoop extends ResumableSignalLoop { public function loop(): \Generator { $API = $this->API; $datacenter = $this->datacenter; $connection = $this->connection; $this->startedLoop(); $API->logger->logger("Entered check loop in DC {$datacenter}", Logger::ULTRA_VERBOSE); $try_count = 0; $timeout = $API->settings['connection_settings'][isset($API->settings['connection_settings'][$datacenter]) ? $datacenter : 'all']['timeout']; while (true) { while (empty($connection->new_outgoing)) { if (yield $this->waitSignal($this->pause())) { $API->logger->logger('Exiting check loop'); $this->exitedLoop(); return; } $try_count = 0; } if ($connection->hasPendingCalls()) { $last_recv = $connection->last_recv; if ($connection->temp_auth_key !== null) { $message_ids = array_values($connection->new_outgoing); $deferred = new Deferred(); $deferred->promise()->onResolve( function ($e, $result) use ($message_ids, $API, $connection, $datacenter) { if ($e) { throw $e; } $reply = []; foreach (str_split($result['info']) as $key => $chr) { $message_id = $message_ids[$key]; if (!isset($connection->outgoing_messages[$message_id])) { $API->logger->logger('Already got response for and forgot about message ID '.($message_id)); continue; } if (!isset($connection->new_outgoing[$message_id])) { $API->logger->logger('Already got response for '.$connection->outgoing_messages[$message_id]['_'].' with message ID '.($message_id)); continue; } $chr = ord($chr); switch ($chr & 7) { case 0: $API->logger->logger('Wrong message status 0 for '.$connection->outgoing_messages[$message_id]['_'], \danog\MadelineProto\Logger::FATAL_ERROR); break; case 1: case 2: case 3: if ($connection->outgoing_messages[$message_id]['_'] === 'msgs_state_req') { break; } $API->logger->logger('Message '.$connection->outgoing_messages[$message_id]['_'].' with message ID '.($message_id).' not received by server, resending...', \danog\MadelineProto\Logger::ERROR); $API->method_recall('', ['message_id' => $message_id, 'datacenter' => $datacenter, 'postpone' => true]); break; case 4: if ($chr & 32) { $API->logger->logger('Message '.$connection->outgoing_messages[$message_id]['_'].' with message ID '.($message_id).' received by server and is being processed, waiting...', \danog\MadelineProto\Logger::ERROR); } elseif ($chr & 64) { $API->logger->logger('Message '.$connection->outgoing_messages[$message_id]['_'].' with message ID '.($message_id).' received by server and was already processed, requesting reply...', \danog\MadelineProto\Logger::ERROR); $reply[] = $message_id; } elseif ($chr & 128) { $API->logger->logger('Message '.$connection->outgoing_messages[$message_id]['_'].' with message ID '.($message_id).' received by server and was already sent, requesting reply...', \danog\MadelineProto\Logger::ERROR); $reply[] = $message_id; } else { $API->logger->logger('Message '.$connection->outgoing_messages[$message_id]['_'].' with message ID '.($message_id).' received by server, requesting reply...', \danog\MadelineProto\Logger::ERROR); $reply[] = $message_id; } } } if ($reply) { $API->object_call('msg_resend_ans_req', ['msg_ids' => $reply], ['datacenter' => $datacenter, 'postpone' => true]); } $connection->writer->resume(); } ); $list = ''; foreach ($message_ids as $message_id) { $list .= $connection->outgoing_messages[$message_id]['_'].', '; } $API->logger->logger("Still missing $list on DC $datacenter, sending state request", \danog\MadelineProto\Logger::ERROR); yield $API->object_call_async('msgs_state_req', ['msg_ids' => $message_ids], ['datacenter' => $datacenter, 'promise' => $deferred]); } else { foreach ($connection->new_outgoing as $message_id) { if (isset($connection->outgoing_messages[$message_id]['sent']) && $connection->outgoing_messages[$message_id]['sent'] + $timeout < time() && $connection->outgoing_messages[$message_id]['unencrypted'] ) { $API->logger->logger('Still missing '.$connection->outgoing_messages[$message_id]['_'].' with message id '.($message_id)." on DC $datacenter, resending", \danog\MadelineProto\Logger::ERROR); $API->method_recall('', ['message_id' => $message_id, 'datacenter' => $datacenter, 'postpone' => true]); } } $connection->writer->resume(); } //$t = time(); if (yield $this->waitSignal($this->pause($timeout))) { $API->logger->logger('Exiting check loop'); $this->exitedLoop(); return; } //var_dumP("after ".(time() - $t).", with timeout ".$timeout); $try_count++; if ($connection->last_recv === $last_recv) { $API->logger->logger("Reconnecting and exiting check loop on DC $datacenter"); $this->exitedLoop(); yield $connection->reconnect(); return; } } else { if (yield $this->waitSignal($this->pause($timeout))) { $API->logger->logger('Exiting check loop'); $this->exitedLoop(); return; } $try_count = 0; } } } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Loop\Connection; use Amp\Success; use danog\MadelineProto\Logger; use danog\MadelineProto\Loop\Impl\ResumableSignalLoop; use danog\MadelineProto\Stream\MTProtoTransport\HttpsStream; use danog\MadelineProto\Stream\MTProtoTransport\HttpStream; /** * HttpWait loop. * * @author Daniil Gentili */ class HttpWaitLoop extends ResumableSignalLoop { public function loop(): \Generator { $API = $this->API; $datacenter = $this->datacenter; $connection = $this->connection; if (!in_array($connection->getCtx()->getStreamName(), [HttpStream::getName(), HttpsStream::getName()])) { yield new Success(0); return; } $this->startedLoop(); $API->logger->logger("Entered HTTP wait loop in DC {$datacenter}", Logger::ULTRA_VERBOSE); $timeout = $API->settings['connection_settings'][isset($API->settings['connection_settings'][$datacenter]) ? $datacenter : 'all']['timeout']; while (true) { //var_dump("http loop DC $datacenter"); if ($a = yield $this->waitSignal($this->pause())) { $API->logger->logger('Exiting HTTP wait loop'); $this->exitedLoop(); return; } if (!in_array($connection->getCtx()->getStreamName(), [HttpStream::getName(), HttpsStream::getName()])) { $this->exitedLoop(); yield new Success(0); return; } while ($connection->temp_auth_key === null) { if (yield $this->waitSignal($this->pause())) { $API->logger->logger('Exiting HTTP wait loop'); $this->exitedLoop(); return; } } //if (time() - $connection->last_http_wait >= $timeout) { $API->logger->logger("DC $datacenter: request {$connection->http_req_count}, response {$connection->http_res_count}"); if ($connection->http_req_count === $connection->http_res_count && (!empty($connection->pending_outgoing) || (!empty($connection->new_outgoing) && !$connection->hasPendingCalls()))) { yield $connection->sendMessage(['_' => 'http_wait', 'body' => ['max_wait' => 30000, 'wait_after' => 0, 'max_delay' => 0], 'content_related' => true, 'unencrypted' => false, 'method' => false]); //var_dump('sent wait'); } $API->logger->logger("DC $datacenter: request {$connection->http_req_count}, response {$connection->http_res_count}"); //($connection->last_http_wait + $timeout) - time() } } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Loop\Connection; use Amp\Loop; use Amp\Promise; use Amp\Websocket\ClosedException; use danog\MadelineProto\Logger; use danog\MadelineProto\Loop\Impl\SignalLoop; use danog\MadelineProto\MTProtoTools\Crypt; use danog\MadelineProto\NothingInTheSocketException; use danog\MadelineProto\Tools; use function Amp\call; /** * Socket read loop. * * @author Daniil Gentili */ class ReadLoop extends SignalLoop { use Tools; use Crypt; public function loop(): \Generator { $API = $this->API; $datacenter = $this->datacenter; $connection = $this->connection; $this->startedLoop(); $API->logger->logger("Entered read loop in DC {$datacenter}", Logger::ULTRA_VERBOSE); $timeout = $API->settings['connection_settings'][isset($API->settings['connection_settings'][$datacenter]) ? $datacenter : 'all']['timeout']; while (true) { try { $error = yield $this->waitSignal($this->readMessage()); } catch (NothingInTheSocketException $e) { if (isset($connection->old)) { $this->exitedLoop(); $API->logger->logger("Exiting read loop in DC $datacenter"); return; } $API->logger->logger("Got nothing in the socket in DC {$datacenter}, reconnecting...", Logger::ERROR); yield $connection->reconnect(); continue; } catch (ClosedException $e) { $API->logger->logger($e->getMessage(), Logger::FATAL_ERROR); throw $e; } if (is_int($error)) { $this->exitedLoop(); yield $connection->reconnect(); if ($error === -404) { if ($connection->temp_auth_key !== null) { $API->logger->logger("WARNING: Resetting auth key in DC {$datacenter}...", \danog\MadelineProto\Logger::WARNING); $connection->temp_auth_key = null; $connection->session_id = null; foreach ($connection->new_outgoing as $message_id) { $connection->outgoing_messages[$message_id]['sent'] = 0; } $API->init_authorization(); } else { //throw new \danog\MadelineProto\RPCErrorException($error, $error); } } elseif ($error === -1) { $API->logger->logger("WARNING: Got quick ack from DC {$datacenter}", \danog\MadelineProto\Logger::WARNING); } elseif ($error === 0) { $API->logger->logger("Got NOOP from DC {$datacenter}", \danog\MadelineProto\Logger::WARNING); } else { throw new \danog\MadelineProto\RPCErrorException($error, $error); } return; } $connection->http_res_count++; try { $API->handle_messages($datacenter); } finally { $this->exitedLoop(); } $this->startedLoop(); // Loop::defer(function () use ($datacenter) { if ($this->API->is_http($datacenter)) { $this->API->datacenter->sockets[$datacenter]->waiter->resume(); } // }); } } public function readMessage(): Promise { return call([$this, 'readMessageAsync']); } public function readMessageAsync(): \Generator { $API = $this->API; $datacenter = $this->datacenter; $connection = $this->connection; try { $buffer = yield $connection->stream->getReadBuffer($payload_length); } catch (ClosedException $e) { $API->logger->logger($e->getReason()); if (strpos($e->getReason(), ' ') === 0) { $payload = -substr($e->getReason(), 7); $API->logger->logger("Received $payload from DC ".$datacenter, \danog\MadelineProto\Logger::ULTRA_VERBOSE); return $payload; } throw $e; } if ($payload_length === 4) { $payload = $this->unpack_signed_int(yield $buffer->bufferRead(4)); $API->logger->logger("Received $payload from DC ".$datacenter, \danog\MadelineProto\Logger::ULTRA_VERBOSE); return $payload; } $auth_key_id = yield $buffer->bufferRead(8); if ($auth_key_id === "\0\0\0\0\0\0\0\0") { $message_id = yield $buffer->bufferRead(8); if (!in_array($message_id, [1, 0])) { $connection->check_message_id($message_id, ['outgoing' => false, 'container' => false]); } $message_length = unpack('V', yield $buffer->bufferRead(4))[1]; $message_data = yield $buffer->bufferRead($message_length); $left = $payload_length - $message_length - 4 - 8 - 8; if ($left) { $API->logger->logger('Padded unencrypted message', \danog\MadelineProto\Logger::ULTRA_VERBOSE); if ($left < (-$message_length & 15)) { throw new \danog\MadelineProto\SecurityException('padding is too small'); } yield $buffer->bufferRead($left); } $connection->incoming_messages[$message_id] = []; } elseif ($auth_key_id === $connection->temp_auth_key['id']) { $message_key = yield $buffer->bufferRead(16); list($aes_key, $aes_iv) = $this->aes_calculate($message_key, $connection->temp_auth_key['auth_key'], false); $encrypted_data = yield $buffer->bufferRead($payload_length - 24); $protocol_padding = strlen($encrypted_data) % 16; if ($protocol_padding) { $encrypted_data = substr($encrypted_data, 0, -$protocol_padding); } $decrypted_data = $this->ige_decrypt($encrypted_data, $aes_key, $aes_iv); /* $server_salt = substr($decrypted_data, 0, 8); if ($server_salt != $connection->temp_auth_key['server_salt']) { $API->logger->logger('WARNING: Server salt mismatch (my server salt '.$connection->temp_auth_key['server_salt'].' is not equal to server server salt '.$server_salt.').', \danog\MadelineProto\Logger::WARNING); } */ $session_id = substr($decrypted_data, 8, 8); if ($session_id != $connection->session_id) { throw new \danog\MadelineProto\Exception('Session id mismatch.'); } $message_id = substr($decrypted_data, 16, 8); $connection->check_message_id($message_id, ['outgoing' => false, 'container' => false]); $seq_no = unpack('V', substr($decrypted_data, 24, 4))[1]; $message_data_length = unpack('V', substr($decrypted_data, 28, 4))[1]; if ($message_data_length > strlen($decrypted_data)) { throw new \danog\MadelineProto\SecurityException('message_data_length is too big'); } if (strlen($decrypted_data) - 32 - $message_data_length < 12) { throw new \danog\MadelineProto\SecurityException('padding is too small'); } if (strlen($decrypted_data) - 32 - $message_data_length > 1024) { throw new \danog\MadelineProto\SecurityException('padding is too big'); } if ($message_data_length < 0) { throw new \danog\MadelineProto\SecurityException('message_data_length not positive'); } if ($message_data_length % 4 != 0) { throw new \danog\MadelineProto\SecurityException('message_data_length not divisible by 4'); } $message_data = substr($decrypted_data, 32, $message_data_length); if ($message_key != substr(hash('sha256', substr($connection->temp_auth_key['auth_key'], 96, 32).$decrypted_data, true), 8, 16)) { throw new \danog\MadelineProto\SecurityException('msg_key mismatch'); } $connection->incoming_messages[$message_id] = ['seq_no' => $seq_no]; } else { throw new \danog\MadelineProto\Exception('Got unknown auth_key id'); } $deserialized = $API->deserialize($message_data, ['type' => '', 'datacenter' => $datacenter]); $API->referenceDatabase->reset(); $connection->incoming_messages[$message_id]['content'] = $deserialized; $connection->incoming_messages[$message_id]['response'] = -1; $connection->new_incoming[$message_id] = $message_id; $connection->last_recv = time(); $connection->last_http_wait = 0; $API->logger->logger('Received payload from DC '.$datacenter, \danog\MadelineProto\Logger::ULTRA_VERBOSE); return true; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Loop; use Amp\Promise; /** * Signal loop interface. * * @author Daniil Gentili */ interface SignalLoopInterface extends LoopInterface { /** * Resolve the promise or return|throw the signal. * * @param Promise $promise The origin promise * * @return Promise */ public function waitSignal(Promise $promise): Promise; /** * Send a signal to the the loop. * * @param Exception|any $data Signal to send * * @return void */ public function signal($data); } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Loop; /** * Loop interface. * * @author Daniil Gentili */ interface LoopInterface { /** * Start the loop. * * @return void */ public function start(); /** * The actual loop. * * @return void */ public function loop(): \Generator; } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Loop; use Amp\Promise; /** * Resumable loop interface. * * @author Daniil Gentili */ interface ResumableLoopInterface extends LoopInterface { /** * Pause the loop. * * @param int $time For how long to pause the loop * * @return Promise */ public function pause($time = null): Promise; /** * Resume the loop. * * @return void */ public function resume(); } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Loop\Impl; use Amp\Promise; use danog\MadelineProto\Logger; use danog\MadelineProto\Loop\LoopInterface; /** * Loop helper trait. * * Wraps the asynchronous generator methods with asynchronous promise-based methods * * @author Daniil Gentili */ abstract class Loop implements LoopInterface { use \danog\MadelineProto\Tools; private $count = 0; protected $API; protected $connection; protected $datacenter; public function __construct($API, $datacenter) { $this->API = $API; $this->datacenter = $datacenter; $this->connection = $API->datacenter->sockets[$datacenter]; } public function start() { if ($this->count) { $this->API->logger->logger("NOT entering check loop in DC {$this->datacenter} with running count {$this->count}", Logger::ERROR); return false; } Promise\rethrow($this->call($this->loop())); return true; } public function exitedLoop() { $this->count--; } public function startedLoop() { $this->count++; } public function isRunning() { return $this->count; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Loop\Impl; use Amp\Deferred; use Amp\Loop; use Amp\Promise; use Amp\Success; use danog\MadelineProto\Loop\ResumableLoopInterface; /** * Resumable signal loop helper trait. * * @author Daniil Gentili */ abstract class ResumableSignalLoop extends SignalLoop implements ResumableLoopInterface { private $resume; private $resumeWatcher; public function pause($time = null): Promise { if (!is_null($time)) { if ($time <= 0) { return new Success(0); } else { $resume = microtime(true) + $time; if ($this->resumeWatcher) { Loop::cancel($this->resumeWatcher); $this->resumeWatcher = null; } $this->resumeWatcher = Loop::delay($time * 1000, [$this, 'resume'], $resume); //var_dump("resume {$this->resumeWatcher} ".get_class($this)." DC {$this->datacenter} after ", ($time * 1000), $resume); } } $this->resume = new Deferred(); return $this->resume->promise(); } public function resume($watcherId = null, $expected = 0) { if ($this->resumeWatcher) { $storedWatcherId = $this->resumeWatcher; Loop::cancel($storedWatcherId); $this->resumeWatcher = null; if ($watcherId && $storedWatcherId !== $watcherId) { return; } } if ($expected) { //var_dump("=======", "resume $watcherId ".get_class($this)." DC {$this->datacenter} diff ".(microtime(true) - $expected).": expected $expected, actual ".microtime(true)); } if ($this->resume) { $resume = $this->resume; $this->resume = null; $resume->resolve(); } } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Loop\Impl; use Amp\Deferred; use Amp\Promise; use danog\MadelineProto\Loop\SignalLoopInterface; /** * Signal loop helper trait. * * @author Daniil Gentili */ abstract class SignalLoop extends Loop implements SignalLoopInterface { private $signalDeferred; public function signal($what) { if ($this->signalDeferred) { $deferred = $this->signalDeferred; $this->signalDeferred = null; if ($what instanceof \Exception || $what instanceof \Throwable) { $deferred->fail($what); } else { $deferred->resolve($what); } } } public function waitSignal(Promise $promise): Promise { $this->signalDeferred = new Deferred(); $dpromise = $this->signalDeferred->promise(); $promise->onResolve(function () use ($promise) { if ($this->signalDeferred !== null) { $deferred = $this->signalDeferred; $this->signalDeferred = null; $deferred->resolve($promise); } }); return $dpromise; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; use Amp\Deferred; use Amp\Loop; use Amp\Promise; use Amp\Success; use function Amp\Promise\wait; /** * Some tools. */ trait Tools { public function gen_vector_hash($ints) { //sort($ints, SORT_NUMERIC); if (\danog\MadelineProto\Magic::$bigint) { $hash = new \phpseclib\Math\BigInteger(0); foreach ($ints as $int) { $hash = $hash->multiply(\danog\MadelineProto\Magic::$twozerotwosixone)->add(\danog\MadelineProto\Magic::$zeroeight)->add(new \phpseclib\Math\BigInteger($int))->divide(\danog\MadelineProto\Magic::$zeroeight)[1]; } $hash = $this->unpack_signed_int(strrev(str_pad($hash->toBytes(), 4, "\0", STR_PAD_LEFT))); } else { $hash = 0; foreach ($ints as $int) { $hash = ((($hash * 20261) & 0x7FFFFFFF) + $int) & 0x7FFFFFFF; } } return $hash; } public function random_int($modulus = false) { if ($modulus === false) { $modulus = PHP_INT_MAX; } try { return \random_int(0, PHP_INT_MAX) % $modulus; } catch (\Exception $e) { // random_compat will throw an Exception, which in PHP 5 does not implement Throwable } catch (\Throwable $e) { // If a sufficient source of randomness is unavailable, random_bytes() will throw an // object that implements the Throwable interface (Exception, TypeError, Error). // We don't actually need to do anything here. The string() method should just continue // as normal. Note, however, that if we don't have a sufficient source of randomness for // random_bytes(), most of the other calls here will fail too, so we'll end up using // the PHP implementation. } if (Magic::$bigint) { $number = $this->unpack_signed_int($this->random(4)); } else { $number = $this->unpack_signed_long($this->random(8)); } return ($number & PHP_INT_MAX) % $modulus; } public function random($length) { return $length === 0 ? '' : \phpseclib\Crypt\Random::string($length); } /** * posmod(numeric,numeric) : numeric * Works just like the % (modulus) operator, only returns always a postive number. */ public function posmod($a, $b) { $resto = $a % $b; return $resto < 0 ? $resto + abs($b) : $resto; } public function array_cast_recursive($array, $force = false) { if (!\danog\MadelineProto\Magic::$has_thread && !$force) { return $array; } if (is_array($array)) { if (!is_array($array)) { $array = (array) $array; } foreach ($array as $key => $value) { $array[$key] = $this->array_cast_recursive($value, $force); } } return $array; } public function unpack_signed_int($value) { if (strlen($value) !== 4) { throw new TL\Exception(\danog\MadelineProto\Lang::$current_lang['length_not_4']); } return unpack('l', \danog\MadelineProto\Magic::$BIG_ENDIAN ? strrev($value) : $value)[1]; } public function unpack_signed_long($value) { if (strlen($value) !== 8) { throw new TL\Exception(\danog\MadelineProto\Lang::$current_lang['length_not_8']); } return unpack('q', \danog\MadelineProto\Magic::$BIG_ENDIAN ? strrev($value) : $value)[1]; } public function pack_signed_int($value) { if ($value > 2147483647) { throw new TL\Exception(sprintf(\danog\MadelineProto\Lang::$current_lang['value_bigger_than_2147483647'], $value)); } if ($value < -2147483648) { throw new TL\Exception(sprintf(\danog\MadelineProto\Lang::$current_lang['value_smaller_than_2147483648'], $value)); } $res = pack('l', $value); return \danog\MadelineProto\Magic::$BIG_ENDIAN ? strrev($res) : $res; } public function pack_signed_long($value) { if ($value > 9223372036854775807) { throw new TL\Exception(sprintf(\danog\MadelineProto\Lang::$current_lang['value_bigger_than_9223372036854775807'], $value)); } if ($value < -9.223372036854776E+18) { throw new TL\Exception(sprintf(\danog\MadelineProto\Lang::$current_lang['value_smaller_than_9223372036854775808'], $value)); } $res = \danog\MadelineProto\Magic::$bigint ? $this->pack_signed_int($value)."\0\0\0\0" : (\danog\MadelineProto\Magic::$BIG_ENDIAN ? strrev(pack('q', $value)) : pack('q', $value)); return $res; } public function pack_unsigned_int($value) { if ($value > 4294967295) { throw new TL\Exception(sprintf(\danog\MadelineProto\Lang::$current_lang['value_bigger_than_4294967296'], $value)); } if ($value < 0) { throw new TL\Exception(sprintf(\danog\MadelineProto\Lang::$current_lang['value_smaller_than_0'], $value)); } return pack('V', $value); } public function pack_double($value) { $res = pack('d', $value); if (strlen($res) !== 8) { throw new TL\Exception(\danog\MadelineProto\Lang::$current_lang['encode_double_error']); } return \danog\MadelineProto\Magic::$BIG_ENDIAN ? strrev($res) : $res; } public function unpack_double($value) { if (strlen($value) !== 8) { throw new TL\Exception(\danog\MadelineProto\Lang::$current_lang['length_not_8']); } return unpack('d', \danog\MadelineProto\Magic::$BIG_ENDIAN ? strrev($value) : $value)[1]; } public function infloop() { while (true) { Loop::loop(); } } public function wait($promise) { if ($promise instanceof \Generator) { $promise = new Coroutine($promise); } elseif (!($promise instanceof Promise)) { return $promise; } do { try { return wait($promise); } catch (\Throwable $e) { if ($e->getMessage() !== 'Loop stopped without resolving the promise') { //$this->logger->logger("AN EXCEPTION SURFACED " . $e, \danog\MadelineProto\Logger::ERROR); throw $e; } } } while (true); } public function call($promise) { if ($promise instanceof \Generator) { $promise = new Coroutine($promise); } elseif (!($promise instanceof Promise)) { return new Success($promise); } return $promise; } public function after($a, $b) { $a = $this->call($a); $deferred = new Deferred(); $a->onResolve(function ($e, $res) use ($b, $deferred) { if ($e) { throw $e; } $b = $this->call($b()); $b->onResolve(static function ($e, $res) use ($deferred) { if ($e) { throw $e; } $deferred->resolve($res); }); }); return $deferred->promise(); } public function sleep_async($time) { return new \Amp\Delayed($time * 1000); } } // Core types (no need to gen) //vector#1cb5c415 {t:Type} # [ t ] = Vector t; /////////////////////////////// /////////////////// Layer cons /////////////////////////////// //invokeAfterMsg#cb9f372d msg_id:long query:!X = X; //invokeAfterMsgs#3dc4b4f0 msg_ids:Vector query:!X = X; //invokeWithLayer1#53835315 query:!X = X; //invokeWithLayer2#289dd1f6 query:!X = X; //invokeWithLayer3#b7475268 query:!X = X; //invokeWithLayer4#dea0d430 query:!X = X; //invokeWithLayer5#417a57ae query:!X = X; //invokeWithLayer6#3a64d54d query:!X = X; //invokeWithLayer7#a5be56d3 query:!X = X; //invokeWithLayer8#e9abd9fd query:!X = X; //invokeWithLayer9#76715a63 query:!X = X; //invokeWithLayer10#39620c41 query:!X = X; //invokeWithLayer11#a6b88fdf query:!X = X; //invokeWithLayer12#dda60d3c query:!X = X; //invokeWithLayer13#427c8ea2 query:!X = X; //invokeWithLayer14#2b9b08fa query:!X = X; //invokeWithLayer15#b4418b64 query:!X = X; //invokeWithLayer16#cf5f0987 query:!X = X; //invokeWithLayer17#50858a19 query:!X = X; //invokeWithLayer18#1c900537 query:!X = X; //invokeWithLayer#da9b0d0d layer:int query:!X = X; // after 18 layer /////////////////////////////// /// Authorization key creation /////////////////////////////// resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector = ResPQ; p_q_inner_data#83c95aec pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data; server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params; server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params; server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data; client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data; dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer; dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer; dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer; destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes; destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes; destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes; ---functions--- req_pq#60469778 nonce:int128 = ResPQ; req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params; set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer; destroy_auth_key#d1435160 = DestroyAuthKeyRes; /////////////////////////////// ////////////// System messages /////////////////////////////// ---types--- msgs_ack#62d6b459 msg_ids:Vector = MsgsAck; bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification; bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification; msgs_state_req#da69fb52 msg_ids:Vector = MsgsStateReq; msgs_state_info#04deb57d req_msg_id:long info:string = MsgsStateInfo; msgs_all_info#8cc0d131 msg_ids:Vector info:string = MsgsAllInfo; msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo; msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo; msg_resend_req#7d861a08 msg_ids:Vector = MsgResendReq; //rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult; // parsed manually rpc_error#2144ca19 error_code:int error_message:string = RpcError; rpc_answer_unknown#5e2ad36e = RpcDropAnswer; rpc_answer_dropped_running#cd78e586 = RpcDropAnswer; rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer; future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt; future_salts#ae500895 req_msg_id:long now:int salts:vector = FutureSalts; pong#347773c5 msg_id:long ping_id:long = Pong; destroy_session_ok#e22045fc session_id:long = DestroySessionRes; destroy_session_none#62d350c9 session_id:long = DestroySessionRes; new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession; //message msg_id:long seqno:int bytes:int body:Object = Message; // parsed manually //msg_container#73f1f8dc messages:vector = MessageContainer; // parsed manually //msg_copy#e06046b2 orig_message:Message = MessageCopy; // parsed manually, not used - use msg_container //gzip_packed#3072cfa1 packed_data:string = Object; // parsed manually http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait; ipPort ipv4:int port:int = IpPort; help.configSimple#d997c3c5 date:int expires:int dc_id:int ip_port_list:Vector = help.ConfigSimple; ---functions--- rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer; get_future_salts#b921bd04 num:int = FutureSalts; ping#7abe77ec ping_id:long = Pong; ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong; destroy_session#e7512126 session_id:long = DestroySessionRes; contest.saveDeveloperInfo#9a5f6e95 vk_id:int name:string phone_number:string age:int city:string = Bool; /////////////////////////////// ///////// Main application API /////////////////////////////// ---types--- boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#2f37e231 flags:# file:InputFile caption:string stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaPhoto#81fa373a flags:# id:InputPhoto caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; inputMediaUploadedDocument#e39621fd flags:# file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector caption:string stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaDocument#5acb668e flags:# id:InputDocument caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#922aec1 flags:# url:string caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaDocumentExternal#b6f74335 flags:# url:string caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputMediaInvoice#92153685 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string start_param:string = InputMedia; inputMediaGeoLive#7b1a118f geo_point:InputGeoPoint period:int = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#fb95c6c4 id:long access_hash:long = InputPhoto; inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#430f0724 id:long access_hash:long version:int = InputFileLocation; inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation; userEmpty#200250ba id:int = User; user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#cb44b1c flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; channelFull#76af5481 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#90dddc11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int post_author:flags.16?string = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#b5223b0f flags:# photo:flags.0?Photo caption:flags.1?string ttl_seconds:flags.2?int = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#7c4414d3 flags:# document:flags.0?Document caption:flags.1?string ttl_seconds:flags.2?int = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia; messageMediaGeoLive#7c3c2609 geo:GeoPoint period:int = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction; messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; messageActionScreenshotTaken#4792929b = MessageAction; messageActionCustomAction#fae69f56 message:string = MessageAction; dialog#e4def5db flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#2049d70c long:double lat:double = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#5e002502 flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyAll#a429b886 = InputNotifyPeer; inputPeerNotifyEventsEmpty#f03064d8 = InputPeerNotifyEvents; inputPeerNotifyEventsAll#e86a2c74 = InputPeerNotifyEvents; inputPeerNotifySettings#38935eb2 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = InputPeerNotifySettings; peerNotifyEventsEmpty#add53cb3 = PeerNotifyEvents; peerNotifyEventsAll#6d1ded88 = PeerNotifyEvents; peerNotifySettingsEmpty#70a68512 = PeerNotifySettings; peerNotifySettings#9acda4c0 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = PeerNotifySettings; peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; userFull#f220f3f flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#eae87e42 contacts:Vector saved_count:int users:Vector = contacts.Contacts; contacts.importedContacts#77d01c3b imported:Vector popular_invites:Vector retry_contacts:Vector users:Vector = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector users:Vector = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector users:Vector = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#99262e37 flags:# pts:int count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; messages.chatsSlice#9cd81144 count:int chats:Vector = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector users:Vector = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterPhotoVideoDocuments#d95e73bb = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter; inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter; inputMessagesFilterContacts#e062db83 = MessagesFilter; inputMessagesFilterGeo#e7026d0d = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updateDialogPinned#d711a2cc flags:# pinned:flags.0?true peer:Peer = Update; updatePinnedDialogs#d8caf68d flags:# order:flags.0?Vector = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updateLangPackTooLong#10c2404b = Update; updateLangPack#56022f4d difference:LangPackDifference = Update; updateFavedStickers#e511996d = Update; updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector = Update; updateContactsReset#7084a7be = Update; updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector intermediate_state:updates.State = updates.Difference; updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; upload.fileCdnRedirect#ea52fe5a dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes cdn_file_hashes:Vector = upload.File; dcOption#5d8c6cc flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int = DcOption; config#9c840964 flags:# phonecalls_enabled:flags.1?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string suggested_lang_code:flags.2?string lang_pack_version:flags.2?int disabled_features:Vector = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#8987f311 id:int critical:Bool url:string text:string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#18798952 id:long access_hash:long = InputDocument; documentEmpty#36f8c871 id:long = Document; document#87232bc7 id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int version:int attributes:Vector = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyAll#74d07c60 = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; sendMessageRecordRoundAction#88f27fbc = SendMessageAction; sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; contacts.found#1aa1f784 results:Vector chats:Vector users:Vector = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector = PrivacyRule; account.privacyRules#554abb6f rules:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#8a8ecd32 hash:string stickers:Vector = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector = messages.AllStickers; disabledFeature#ae636f24 feature:string description:string = DisabledFeature; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector = account.Authorizations; account.noPassword#96dabc18 new_salt:bytes email_unconfirmed_pattern:string = account.Password; account.password#7c18141c current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = account.Password; account.passwordSettings#b7b72ab3 email:string = account.PasswordSettings; account.passwordInputSettings#86916deb flags:# new_salt:flags.0?bytes new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#cd303b41 flags:# installed:flags.0?true archived:flags.1?true official:flags.2?true masks:flags.3?true id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#98e81d3a user_id:int description:string commands:Vector = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector = ReplyMarkup; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector users:Vector = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#6a9d7b35 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int messages:Vector chats:Vector users:Vector = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector other_updates:Vector chats:Vector users:Vector = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantAdmin#a82fa898 flags:# can_edit:flags.0?true user_id:int inviter_id:int promoted_by:int date:int admin_rights:ChannelAdminRights = ChannelParticipant; channelParticipantBanned#222c1886 flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChannelBannedRights = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter; channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter; channels.channelParticipants#f56ee2a8 count:int participants:Vector users:Vector = channels.ChannelParticipants; channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector = channels.ChannelParticipant; help.termsOfService#f1ee3e90 text:string = help.TermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector = messages.SavedGifs; inputBotInlineMessageMediaAuto#292fed13 flags:# caption:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#c1b15d65 flags:# geo_point:InputGeoPoint period:int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#aaafadc8 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#2daf01a7 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#2cbbe15a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#a74b15b flags:# caption:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#b722de65 flags:# geo:GeoPoint period:int reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#4366232e flags:# geo:GeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#9bebaeb9 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector cache_time:int users:Vector = messages.BotResults; exportedMessageLink#1f486803 link:string = ExportedMessageLink; messageFwdHeader#fadff4ac flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; messages.peerDialogs#3371c354 dialogs:Vector messages:Vector chats:Vector users:Vector state:updates.State = messages.PeerDialogs; topPeer#edcdc05b peer:Peer rating:double = TopPeer; topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; topPeerCategoryBotsInline#148677e2 = TopPeerCategory; topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector chats:Vector users:Vector = contacts.TopPeers; draftMessageEmpty#ba4baec5 = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; messages.featuredStickers#f89d88e5 hash:int sets:Vector unread:Vector = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#5ce20970 hash:int stickers:Vector = messages.RecentStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector = messages.ArchivedStickers; messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector = messages.StickerSetInstallResult; stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector users:Vector = messages.HighScores; textEmpty#dc3d824f = RichText; textPlain#744694e0 text:string = RichText; textBold#6724abc4 text:RichText = RichText; textItalic#d912a59c text:RichText = RichText; textUnderline#c12622c4 text:RichText = RichText; textStrike#9bf8bb95 text:RichText = RichText; textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; pageBlockHeader#bfd064ec text:RichText = PageBlock; pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; pageBlockParagraph#467a0766 text:RichText = PageBlock; pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; pageBlockList#3a58c7f4 ordered:Bool items:Vector = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; pageBlockVideo#d9d71866 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:RichText = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; pageBlockEmbed#cde200d1 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:int h:int caption:RichText = PageBlock; pageBlockEmbedPost#292c7be9 url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:RichText = PageBlock; pageBlockCollage#8b31c4f items:Vector caption:RichText = PageBlock; pageBlockSlideshow#130c8963 items:Vector caption:RichText = PageBlock; pageBlockChannel#ef1751b5 channel:Chat = PageBlock; pageBlockAudio#31b81a7f audio_id:long caption:RichText = PageBlock; pagePart#8e3f9ebe blocks:Vector photos:Vector documents:Vector = Page; pageFull#556ec7aa blocks:Vector photos:Vector documents:Vector = Page; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true currency:string prices:Vector = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; webDocument#c61acbd8 url:string access_hash:long size:int mime_type:string attributes:Vector dc_id:int = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector = payments.PaymentReceipt; payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; shippingOption#b6213cdf id:string title:string prices:Vector = ShippingOption; inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCall#ffe6ab67 id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector = phone.PhoneCall; upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey; cdnConfig#5725e40a public_keys:Vector = CdnConfig; langPackString#cad181f6 key:string value:string = LangPackString; langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString; langPackStringDeleted#2979eeb2 key:string = LangPackString; langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector = LangPackDifference; langPackLanguage#117698f1 name:string native_name:string lang_code:string = LangPackLanguage; channelAdminRights#5d7ceba5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true invite_link:flags.6?true pin_messages:flags.7?true add_admins:flags.9?true = ChannelAdminRights; channelBannedRights#58cf4249 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true until_date:int = ChannelBannedRights; channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangePhoto#b82f55c3 prev_photo:ChatPhoto new_photo:ChatPhoto = ChannelAdminLogEventAction; channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; cdnFileHash#77eec38f offset:int limit:int hash:bytes = CdnFileHash; messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers; messages.favedStickers#f37f2f16 hash:int packs:Vector stickers:Vector = messages.FavedStickers; help.recentMeUrls#e0310d7 urls:Vector chats:Vector users:Vector = help.RecentMeUrls; recentMeUrlUser#8dbc3336 url:string user_id:int = RecentMeUrl; recentMeUrlChat#a01b22f9 url:string chat_id:int = RecentMeUrl; recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl; recentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl; recentMeUrlUnknown#46e1d13d url:string = RecentMeUrl; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X; initConnection#c7481da6 {X:Type} api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone; auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.sendInvites#771c1d97 phone_numbers:Vector message:string = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector = Bool; account.registerDevice#637ea878 token_type:int token:string = Bool; account.unregisterDevice#65c55b40 token_type:int token:string = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; account.getTmpPassword#4a82327e password_hash:bytes period:int = account.TmpPassword; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; contacts.getStatuses#c4a353ee = Vector; contacts.getContacts#c023849f hash:int = contacts.Contacts; contacts.importContacts#2c800be5 contacts:Vector = contacts.ImportedContacts; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector; contacts.importCard#4fe196fe export_card:Vector = User; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; contacts.resetSaved#879537f1 = Bool; messages.getMessages#4222fa74 id:Vector = messages.Messages; messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs; messages.getHistory#afa92846 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.search#39e9ea0 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.sendMedia#c8f16791 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.getChats#3c6aa187 id:Vector = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector title:string = Updates; messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#25223e24 message:string = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#5d1b8dd flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true peer:InputPeer id:int message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector geo_point:flags.13?InputGeoPoint = Updates; messages.editInlineBotMessage#130c2c85 flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#2d9776b9 peers:Vector = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector = Bool; messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#3289be6a flags:# pinned:flags.0?true peer:InputPeer = Bool; messages.reorderPinnedDialogs#959ff644 flags:# force:flags.0?true order:Vector = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia; messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates; messages.getFavedStickers#21ce0b0e hash:int = messages.FavedStickers; messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool; messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.getRecentLocations#249431e2 peer:InputPeer limit:int = messages.Messages; messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector = Vector; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; upload.reuploadCdnFile#1af91c09 file_token:bytes request_token:bytes = Vector; upload.getCdnFileHashes#f715c87b file_token:bytes offset:int = Vector; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#ae2de196 = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector = Bool; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#9010ef6f prev_app_version:string = Updates; help.getTermsOfService#350170f3 = help.TermsOfService; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector = Bool; channels.getMessages#93d7b347 channel:InputChannel id:Vector = messages.Messages; channels.getParticipants#123e05e9 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#20b88214 channel:InputChannel user_id:InputUser admin_rights:ChannelAdminRights = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; channels.exportMessageLink#c846d22d channel:InputChannel id:int = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; channels.editBanned#bfd915cd channel:InputChannel user_id:InputUser banned_rights:ChannelBannedRights = Updates; channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector max_id:long min_id:long limit:int = channels.AdminLogResults; channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool; channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector = Bool; channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool; channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm; payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt; payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult; payments.getSavedInfo#227d824b = payments.SavedInfo; payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet; stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; phone.getCallConfig#55451fa9 = DataJSON; phone.requestCall#5b95b3d4 user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = Updates; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; langpack.getLangPack#9ab5c58e lang_code:string = LangPackDifference; langpack.getStrings#2e1ee318 lang_code:string keys:Vector = Vector; langpack.getDifference#b2e4d7d from_version:int = LangPackDifference; langpack.getLanguages#800fd57d = Vector; // LAYER 72 . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; use danog\MadelineProto\MTProtoTools\ReferenceDatabase; use danog\MadelineProto\Stream\MTProtoTransport\HttpsStream; use danog\MadelineProto\Stream\MTProtoTransport\HttpStream; use danog\MadelineProto\TL\TLCallback; /** * Manages all of the mtproto stuff. */ class MTProto implements TLCallback { use \danog\Serializable; use \danog\MadelineProto\MTProtoTools\AckHandler; use \danog\MadelineProto\MTProtoTools\AuthKeyHandler; use \danog\MadelineProto\MTProtoTools\CallHandler; use \danog\MadelineProto\MTProtoTools\Crypt; use \danog\MadelineProto\MTProtoTools\PeerHandler; use \danog\MadelineProto\MTProtoTools\ResponseHandler; use \danog\MadelineProto\MTProtoTools\SeqNoHandler; use \danog\MadelineProto\MTProtoTools\UpdateHandler; use \danog\MadelineProto\MTProtoTools\Files; use \danog\MadelineProto\SecretChats\AuthKeyHandler; use \danog\MadelineProto\SecretChats\MessageHandler; use \danog\MadelineProto\SecretChats\ResponseHandler; use \danog\MadelineProto\SecretChats\SeqNoHandler; use \danog\MadelineProto\TL\TL; use \danog\MadelineProto\TL\Conversion\BotAPI; use \danog\MadelineProto\TL\Conversion\BotAPIFiles; use \danog\MadelineProto\TL\Conversion\Extension; use \danog\MadelineProto\TL\Conversion\TD; use \danog\MadelineProto\Tools; use \danog\MadelineProto\VoIP\AuthKeyHandler; use \danog\MadelineProto\Wrappers\DialogHandler; use \danog\MadelineProto\Wrappers\Events; use \danog\MadelineProto\Wrappers\Webhook; use \danog\MadelineProto\Wrappers\Callback; use \danog\MadelineProto\Wrappers\Login; use \danog\MadelineProto\Wrappers\Loop; use \danog\MadelineProto\Wrappers\Noop; use \danog\MadelineProto\Wrappers\Start; use \danog\MadelineProto\Wrappers\Templates; use \danog\MadelineProto\Wrappers\TOS; /* const V = 71; */ const V = 118; const RELEASE = '4.0'; const NOT_LOGGED_IN = 0; const WAITING_CODE = 1; const WAITING_SIGNUP = -1; const WAITING_PASSWORD = 2; const LOGGED_IN = 3; const DISALLOWED_METHODS = ['account.updatePasswordSettings' => 'You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info)', 'account.getPasswordSettings' => 'You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info)', 'messages.receivedQueue' => 'You cannot use this method directly', 'messages.getDhConfig' => 'You cannot use this method directly, instead use $MadelineProto->get_dh_config();', 'auth.bindTempAuthKey' => 'You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info', 'auth.exportAuthorization' => 'You cannot use this method directly, use $MadelineProto->export_authorization() instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'auth.importAuthorization' => 'You cannot use this method directly, use $MadelineProto->import_authorization($authorization) instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'auth.logOut' => 'You cannot use this method directly, use the logout method instead (see https://docs.madelineproto.xyz for more info)', 'auth.importBotAuthorization' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'auth.sendCode' => 'You cannot use this method directly, use the phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'auth.signIn' => 'You cannot use this method directly, use the complete_phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'auth.checkPassword' => 'You cannot use this method directly, use the complete_2fa_login method instead (see https://docs.madelineproto.xyz for more info)', 'auth.signUp' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'users.getFullUser' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'channels.getFullChannel' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'messages.getFullChat' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'contacts.resolveUsername' => 'You cannot use this method directly, use the resolve_username, get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'messages.acceptEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'messages.discardEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'messages.requestEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'phone.requestCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'phone.acceptCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'phone.confirmCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'phone.discardCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'updates.getChannelDifference' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'updates.getDifference' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'updates.getState' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'upload.getCdnFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'upload.getFileHashes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'upload.getCdnFileHashes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'upload.reuploadCdnFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'upload.getFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'upload.saveFilePart' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'upload.saveBigFilePart' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info']; const BAD_MSG_ERROR_CODES = [16 => 'msg_id too low (most likely, client time is wrong; it would be worthwhile to synchronize it using msg_id notifications and re-send the original message with the “correct” msg_id or wrap it in a container with a new msg_id if the original message had waited too long on the client to be transmitted)', 17 => 'msg_id too high (similar to the previous case, the client time has to be synchronized, and the message re-sent with the correct msg_id)', 18 => 'incorrect two lower order msg_id bits (the server expects client message msg_id to be divisible by 4)', 19 => 'container msg_id is the same as msg_id of a previously received message (this must never happen)', 20 => 'message too old, and it cannot be verified whether the server has received a message with this msg_id or not', 32 => 'msg_seqno too low (the server has already received a message with a lower msg_id but with either a higher or an equal and odd seqno)', 33 => 'msg_seqno too high (similarly, there is a message with a higher msg_id but with either a lower or an equal and odd seqno)', 34 => 'an even msg_seqno expected (irrelevant message), but odd received', 35 => 'odd msg_seqno expected (relevant message), but even received', 48 => 'incorrect server salt (in this case, the bad_server_salt response is received with the correct salt, and the message is to be re-sent with it)', 64 => 'invalid container.']; const MSGS_INFO_FLAGS = [1 => 'nothing is known about the message (msg_id too low, the other party may have forgotten it)', 2 => 'message not received (msg_id falls within the range of stored identifiers; however, the other party has certainly not received a message like that)', 3 => 'message not received (msg_id too high; however, the other party has certainly not received it yet)', 4 => 'message received (note that this response is also at the same time a receipt acknowledgment)', 8 => ' and message already acknowledged', 16 => ' and message not requiring acknowledgment', 32 => ' and RPC query contained in message being processed or processing already complete', 64 => ' and content-related response to message already generated', 128 => ' and other party knows for a fact that message is already received']; const REQUESTED = 0; const ACCEPTED = 1; const CONFIRMED = 2; const READY = 3; const TD_PARAMS_CONVERSION = ['updateNewMessage' => ['_' => 'updateNewMessage', 'disable_notification' => ['message', 'silent'], 'message' => ['message']], 'message' => ['_' => 'message', 'id' => ['id'], 'sender_user_id' => ['from_id'], 'chat_id' => ['to_id', 'choose_chat_id_from_botapi'], 'send_state' => ['choose_incoming_or_sent'], 'can_be_edited' => ['choose_can_edit'], 'can_be_deleted' => ['choose_can_delete'], 'is_post' => ['post'], 'date' => ['date'], 'edit_date' => ['edit_date'], 'forward_info' => ['fwd_info', 'choose_forward_info'], 'reply_to_message_id' => ['reply_to_msg_id'], 'ttl' => ['choose_ttl'], 'ttl_expires_in' => ['choose_ttl_expires_in'], 'via_bot_user_id' => ['via_bot_id'], 'views' => ['views'], 'content' => ['choose_message_content'], 'reply_markup' => ['reply_markup']], 'messages.sendMessage' => ['chat_id' => ['peer'], 'reply_to_message_id' => ['reply_to_msg_id'], 'disable_notification' => ['silent'], 'from_background' => ['background'], 'input_message_content' => ['choose_message_content'], 'reply_markup' => ['reply_markup']]]; const TD_REVERSE = ['sendMessage' => 'messages.sendMessage']; const TD_IGNORE = ['updateMessageID']; const BOTAPI_PARAMS_CONVERSION = ['disable_web_page_preview' => 'no_webpage', 'disable_notification' => 'silent', 'reply_to_message_id' => 'reply_to_msg_id', 'chat_id' => 'peer', 'text' => 'message']; const NOT_CONTENT_RELATED = [ //'rpc_result', //'rpc_error', 'rpc_drop_answer', 'rpc_answer_unknown', 'rpc_answer_dropped_running', 'rpc_answer_dropped', 'get_future_salts', 'future_salt', 'future_salts', 'ping', 'pong', 'ping_delay_disconnect', 'destroy_session', 'destroy_session_ok', 'destroy_session_none', //'new_session_created', 'msg_container', 'msg_copy', 'gzip_packed', 'http_wait', 'msgs_ack', 'bad_msg_notification', 'bad_server_salt', 'msgs_state_req', 'msgs_state_info', 'msgs_all_info', 'msg_detailed_info', 'msg_new_detailed_info', 'msg_resend_req', 'msg_resend_ans_req', ]; const DEFAULT_GETUPDATES_PARAMS = ['offset' => 0, 'limit' => null, 'timeout' => 0]; public $wrapper; public $hook_url = false; public $settings = []; private $config = ['expires' => -1]; private $tos = ['expires' => 0, 'accepted' => true]; private $initing_authorization = false; public $authorization = null; public $authorized = 0; public $authorized_dc = -1; private $rsa_keys = []; private $last_recv = 0; private $dh_config = ['version' => 0]; public $chats = []; public $channel_participants = []; public $last_stored = 0; public $qres = []; public $full_chats = []; private $msg_ids = []; private $v = 0; private $dialog_params = ['_' => 'MadelineProto.dialogParams', 'limit' => 0, 'offset_date' => 0, 'offset_id' => 0, 'offset_peer' => ['_' => 'inputPeerEmpty'], 'count' => 0]; private $ipv6 = false; public $run_workers = false; public $setdem = false; public $storage = []; private $postpone_updates = false; private $postpone_pwrchat = false; private $pending_pwrchat = []; private $altervista = false; private $supportUser = 0; public $referenceDatabase; public $update_deferred; public function __magic_construct($settings = []) { \danog\MadelineProto\Magic::class_exists(); // Parse settings $this->parse_settings($settings); if (!defined('\\phpseclib\\Crypt\\Common\\SymmetricKey::MODE_IGE') || \phpseclib\Crypt\Common\SymmetricKey::MODE_IGE !== 6) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['phpseclib_fork']); } if (!extension_loaded('xml')) { throw new Exception(['extension', 'xml']); } if (!extension_loaded('json')) { throw new Exception(['extension', 'json']); } // Connect to servers $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['inst_dc'], Logger::ULTRA_VERBOSE); if (!isset($this->datacenter)) { $this->datacenter = new DataCenter($this, $this->settings['connection'], $this->settings['connection_settings']); } if (!isset($this->referenceDatabase)) { $this->referenceDatabase = new ReferenceDatabase($this); } // Load rsa keys $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['load_rsa'], Logger::ULTRA_VERBOSE); foreach ($this->settings['authorization']['rsa_keys'] as $key) { $key = new RSA($key); $this->rsa_keys[$key->fp] = $key; } /* * *********************************************************************** * Define some needed numbers for BigInteger */ $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['TL_translation'], Logger::ULTRA_VERBOSE); $this->construct_TL($this->settings['tl_schema']['src'], [$this, $this->referenceDatabase]); $this->connect_to_all_dcs(); $this->datacenter->curdc = 2; if ((!isset($this->authorization['user']['bot']) || !$this->authorization['user']['bot']) && $this->datacenter->sockets[$this->datacenter->curdc]->temp_auth_key !== null) { try { $nearest_dc = $this->method_call('help.getNearestDc', [], ['datacenter' => $this->datacenter->curdc]); $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['nearest_dc'], $nearest_dc['country'], $nearest_dc['nearest_dc']), Logger::NOTICE); if ($nearest_dc['nearest_dc'] != $nearest_dc['this_dc']) { $this->settings['connection_settings']['default_dc'] = $this->datacenter->curdc = (int) $nearest_dc['nearest_dc']; } } catch (RPCErrorException $e) { if ($e->rpc !== 'BOT_METHOD_INVALID') { throw $e; } } } $this->get_config([], ['datacenter' => $this->datacenter->curdc]); $this->v = self::V; return $this->settings; } public function __sleep() { return ['supportUser', 'referenceDatabase', 'channel_participants', 'event_handler', 'event_handler_instance', 'loop_callback', 'web_template', 'encrypted_layer', 'settings', 'config', 'authorization', 'authorized', 'rsa_keys', 'last_recv', 'dh_config', 'chats', 'last_stored', 'qres', 'pending_updates', 'pending_pwrchat', 'postpone_pwrchat', 'updates_state', 'got_state', 'channels_state', 'updates', 'updates_key', 'full_chats', 'msg_ids', 'dialog_params', 'datacenter', 'v', 'constructors', 'td_constructors', 'methods', 'td_methods', 'td_descriptions', 'tl_callbacks', 'temp_requested_secret_chats', 'temp_rekeyed_secret_chats', 'secret_chats', 'hook_url', 'storage', 'authorized_dc', 'tos']; } public function isAltervista() { return $this->altervista; } public function isInitingAuthorization() { return $this->initing_authorization; } public function __wakeup() { set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']); set_exception_handler(['\\danog\\MadelineProto\\Serialization', 'serialize_all']); $this->setup_logger(); if (\danog\MadelineProto\Magic::$has_thread && is_object(\Thread::getCurrentThread())) { return; } Lang::$current_lang = &Lang::$lang['en']; if (isset($this->settings['app_info']['lang_code']) && isset(Lang::$lang[$this->settings['app_info']['lang_code']])) { Lang::$current_lang = &Lang::$lang[$this->settings['app_info']['lang_code']]; } if (!defined('\\phpseclib\\Crypt\\AES::MODE_IGE')) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['phpseclib_fork']); } if (!extension_loaded('xml')) { throw new Exception(['extension', 'xml']); } if (!isset($this->referenceDatabase)) { $this->referenceDatabase = new ReferenceDatabase($this); } $this->update_callbacks([$this, $this->referenceDatabase]); $this->altervista = isset($_SERVER['SERVER_ADMIN']) && strpos($_SERVER['SERVER_ADMIN'], 'altervista.org'); $this->settings['connection_settings']['all']['ipv6'] = \danog\MadelineProto\Magic::$ipv6; /*if (isset($this->settings['pwr']['update_handler']) && $this->settings['pwr']['update_handler'] === $this->settings['updates']['callback']) { unset($this->settings['pwr']['update_handler']); $this->updates = []; }*/ $keys = array_keys((array) get_object_vars($this)); if (count($keys) !== count(array_unique($keys))) { throw new Bug74586Exception(); } if (isset($this->data)) { foreach ($this->data as $k => $v) { $this->{$k} = $v; } unset($this->data); } if ($this->authorized === true) { $this->authorized = self::LOGGED_IN; } $this->updates_state['sync_loading'] = false; foreach ($this->channels_state as $key => $state) { $this->channels_state[$key]['sync_loading'] = false; } $this->postpone_updates = false; $this->postpone_pwrchat = false; if ($this->event_handler && class_exists($this->event_handler) && is_subclass_of($this->event_handler, '\danog\MadelineProto\EventHandler')) { $this->setEventHandler($this->event_handler); } $force = false; $this->reset_session(); $backtrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 3); if (isset($backtrace[2]['function']) && isset($backtrace[2]['class']) && isset($backtrace[2]['args']) && $backtrace[2]['class'] === 'danog\\MadelineProto\\API' && $backtrace[2]['function'] === '__magic_construct') { if (count($backtrace[2]['args']) === 2) { $this->parse_settings(array_replace_recursive($this->settings, $backtrace[2]['args'][1])); } } if (isset($this->settings['tl_schema']['src']['botAPI']) && $this->settings['tl_schema']['src']['botAPI'] !== __DIR__.'/TL_botAPI.tl') { unset($this->v); } if (!isset($this->v) || $this->v !== self::V) { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['serialization_ofd'], Logger::WARNING); foreach ($this->datacenter->sockets as $dc_id => $socket) { if ($this->authorized === self::LOGGED_IN && strpos($dc_id, '_') === false && $socket->auth_key !== null && $socket->temp_auth_key !== null) { $socket->authorized = true; } } $settings = $this->settings; if (isset($settings['updates']['callback'][0]) && $settings['updates']['callback'][0] === $this) { $settings['updates']['callback'] = 'get_updates_update_handler'; } if (isset($settings['updates']['getdifference_interval']) && $settings['updates']['getdifference_interval'] === -1) { unset($settings['updates']['getdifference_interval']); } unset($settings['tl_schema']); if (isset($settings['authorization']['rsa_key'])) { unset($settings['authorization']['rsa_key']); } if (!isset($this->full_chats)) { $this->full_chats = []; } if (!isset($this->secret_chats)) { $this->secret_chats = []; } foreach ($this->full_chats as $id => $full) { $this->full_chats[$id] = ['full' => $full['full'], 'last_update' => $full['last_update']]; } foreach ($this->secret_chats as $key => &$chat) { if (!is_array($chat)) { unset($this->secret_chats[$key]); continue; } if ($chat['layer'] >= 73) { $chat['mtproto'] = 2; } else { $chat['mtproto'] = 1; } } foreach ($settings['connection_settings'] as $key => &$connection) { if (!is_array($connection)) { unset($settings['connection_settings'][$key]); continue; } if (!isset($connection['proxy'])) { $connection['proxy'] = '\\Socket'; } if (!isset($connection['proxy_extra'])) { $connection['proxy_extra'] = []; } if (!isset($connection['pfs'])) { $connection['pfs'] = extension_loaded('gmp'); } if ($connection['protocol'] === 'obfuscated2') { $connection['protocol'] = 'tcp_intermediate_padded'; $connection['obfuscated'] = true; } } if ($settings['app_info']['api_id'] === 6) { unset($settings['app_info']); } $this->reset_session(true, true); $this->config = ['expires' => -1]; $this->dh_config = ['version' => 0]; $this->__construct($settings); $force = true; foreach ($this->secret_chats as $chat => $data) { try { if (isset($this->secret_chats[$chat]) && $this->secret_chats[$chat]['InputEncryptedChat'] !== null) { $this->notify_layer($chat); } } catch (\danog\MadelineProto\RPCErrorException $e) { } } } if (!$this->settings['updates']['handle_old_updates']) { $this->channels_state = []; $this->got_state = false; } $this->connect_to_all_dcs(); foreach ($this->calls as $id => $controller) { if (!is_object($controller)) { unset($this->calls[$id]); } elseif ($controller->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { $controller->setMadeline($this); $controller->discard(); } else { $controller->setMadeline($this); } } if ($this->get_self()) { $this->authorized = self::LOGGED_IN; } if ($this->authorized === self::LOGGED_IN) { $this->get_cdn_config($this->datacenter->curdc); $this->setup_logger(); } if ($this->authorized === self::LOGGED_IN && !$this->authorization['user']['bot'] && $this->settings['peer']['cache_all_peers_on_startup']) { $this->get_dialogs($force); } if ($this->authorized === self::LOGGED_IN && $this->settings['updates']['handle_updates'] && !$this->updates_state['sync_loading']) { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['getupdates_deserialization'], Logger::NOTICE); $this->get_updates_difference(); } $this->datacenter->sockets[$this->settings['connection_settings']['default_dc']]->updater->start(); } public function __destruct() { if (\danog\MadelineProto\Magic::$has_thread && is_object(\Thread::getCurrentThread())) { return; } } public function serialize() { if ($this->wrapper instanceof \danog\MadelineProto\API && isset($this->wrapper->session) && !is_null($this->wrapper->session)) { $this->wrapper->serialize($this->wrapper->session); } } public function parse_settings($settings) { if (isset($this->settings['connection_settings']['default_dc'])) { $settings['connection_settings']['default_dc'] = $this->settings['connection_settings']['default_dc']; } if (!isset($settings['app_info']['api_id']) || !$settings['app_info']['api_id']) { if (isset($this->settings['app_info']['api_id']) && $this->settings['app_info']['api_id']) { $settings['app_info']['api_id'] = $this->settings['app_info']['api_id']; $settings['app_info']['api_hash'] = $this->settings['app_info']['api_hash']; } else { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['api_not_set'], 0, null, 'MadelineProto', 1); } } // Detect device model try { $device_model = php_uname('s'); } catch (\danog\MadelineProto\Exception $e) { $device_model = 'Web server'; } if ($settings['app_info']['api_id'] === 6) { // TG DEV NOTICE: these app info spoofing measures were implemented for NON-MALICIOUS purposes. // All accounts registered with a custom API ID require manual verification through recover@telegram.org, to avoid instant permabans. // This makes usage of all MTProto libraries very difficult, at least for new users. // To help a bit, when the android API ID is used, the android app infos are spoofed too. // THE ANDROID API HASH IS NOT PRESENT IN THIS REPOSITORY, AND WILL NOT BE GIVEN TO EVERYONE. // This measure was NOT created with the intent to aid spammers, flooders, and other scum. // // I understand that automated account registration through headless libraries may indicate the creation of a botnet, //...and I understand why these automatic bans were implemented in the first place. // Manual requests to activate numbers through recover@telegram.org will still be required for the majority of users of this library, //...those that choose to user their own API ID for their application. // // To be honest, I wrote this feature just for me, since I honestly don't want to //...go through the hassle of registering => recovering => logging in to every account I use for my services (mainly webradios and test userbots) $device_model = 'LGENexus 5'; } // Detect system version try { $system_version = php_uname('r'); } catch (\danog\MadelineProto\Exception $e) { $system_version = phpversion(); } if ($settings['app_info']['api_id'] === 6) { // TG DEV NOTICE: these app info spoofing measures were implemented for NON-MALICIOUS purposes. // All accounts registered with a custom API ID require manual verification through recover@telegram.org, to avoid instant permabans. // This makes usage of all MTProto libraries very difficult, at least for new users. // To help a bit, when the android API ID is used, the android app infos are spoofed too. // THE ANDROID API HASH IS NOT PRESENT IN THIS REPOSITORY, AND WILL NOT BE GIVEN TO EVERYONE. // This measure was NOT created with the intent to aid spammers, flooders, and other scum. // // I understand that automated account registration through headless libraries may indicate the creation of a botnet, //...and I understand why these automatic bans were implemented in the first place. // Manual requests to activate numbers through recover@telegram.org will still be required for the majority of users of this library, //...and in particular those that choose to user their own API ID for their application. // // To be honest, I wrote this feature just for me, since I honestly don't want to //...go through the hassle of registering => recovering => logging in to every account I use for my services (mainly webradios and test userbots) $system_version = 'SDK 28'; } // Detect language $lang_code = 'en'; Lang::$current_lang = &Lang::$lang[$lang_code]; if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $lang_code = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); } elseif (isset($_SERVER['LANG'])) { $lang_code = explode('_', $_SERVER['LANG'])[0]; } if (isset(Lang::$lang[$lang_code])) { Lang::$current_lang = &Lang::$lang[$lang_code]; } // Detect language pack $lang_pack = ''; if ($settings['app_info']['api_id'] === 6) { // TG DEV NOTICE: these app info spoofing measures were implemented for NON-MALICIOUS purposes. // All accounts registered with a custom API ID require manual verification through recover@telegram.org, to avoid instant permabans. // This makes usage of all MTProto libraries very difficult, at least for new users. // To help a bit, when the android API ID is used, the android app infos are spoofed too. // THE ANDROID API HASH IS NOT PRESENT IN THIS REPOSITORY, AND WILL NOT BE GIVEN TO EVERYONE. // This measure was NOT created with the intent to aid spammers, flooders, and other scum. // // I understand that automated account registration through headless libraries may indicate the creation of a botnet, //...and I understand why these automatic bans were implemented in the first place. // Manual requests to activate numbers through recover@telegram.org will still be required for the majority of users of this library, //...and in particular those that choose to user their own API ID for their application. // // To be honest, I wrote this feature just for me, since I honestly don't want to //...go through the hassle of registering => recovering => logging in to every account I use for my services (mainly webradios and test userbots) $lang_pack = 'android'; } // Detect app version $app_version = self::RELEASE.' ('.self::V.', '.Magic::$revision.')'; if ($settings['app_info']['api_id'] === 6) { // TG DEV NOTICE: these app info spoofing measures were implemented for NON-MALICIOUS purposes. // All accounts registered with a custom API ID require manual verification through recover@telegram.org, to avoid instant permabans. // This makes usage of all MTProto libraries very difficult, at least for new users. // To help a bit, when the android API ID is used, the android app infos are spoofed too. // THE ANDROID API HASH IS NOT PRESENT IN THIS REPOSITORY, AND WILL NOT BE GIVEN TO EVERYONE. // This measure was NOT created with the intent to aid spammers, flooders, and other scum. // // I understand that automated account registration through headless libraries may indicate the creation of a botnet, //...and I understand why these automatic bans were implemented in the first place. // Manual requests to activate numbers through recover@telegram.org will still be required for the majority of users of this library, //...and in particular those that choose to user their own API ID for their application. // // To be honest, I wrote this feature just for me, since I honestly don't want to //...go through the hassle of registering => recovering => logging in to every account I use for my services (mainly webradios and test userbots) $app_version = '4.9.1 (13613)'; } $this->altervista = isset($_SERVER['SERVER_ADMIN']) && strpos($_SERVER['SERVER_ADMIN'], 'altervista.org'); // Set default settings $default_settings = ['authorization' => [ // Authorization settings 'default_temp_auth_key_expires_in' => 1 * 24 * 60 * 60, // validity of temporary keys and the binding of the temporary and permanent keys 'rsa_keys' => ["-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6\nlyDONS789sVoD/xCS9Y0hkkC3gtL1tSfTlgCMOOul9lcixlEKzwKENj1Yz/s7daS\nan9tqw3bfUV/nqgbhGX81v/+7RFAEd+RwFnK7a+XYl9sluzHRyVVaTTveB2GazTw\nEfzk2DWgkBluml8OREmvfraX3bkHZJTKX4EQSjBbbdJ2ZXIsRrYOXfaA+xayEGB+\n8hdlLmAjbCVfaigxX0CDqWeR1yFL9kwd9P0NsZRPsmoqVwMbMu7mStFai6aIhc3n\nSlv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB\n-----END RSA PUBLIC KEY-----", "-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAxq7aeLAqJR20tkQQMfRn+ocfrtMlJsQ2Uksfs7Xcoo77jAid0bRt\nksiVmT2HEIJUlRxfABoPBV8wY9zRTUMaMA654pUX41mhyVN+XoerGxFvrs9dF1Ru\nvCHbI02dM2ppPvyytvvMoefRoL5BTcpAihFgm5xCaakgsJ/tH5oVl74CdhQw8J5L\nxI/K++KJBUyZ26Uba1632cOiq05JBUW0Z2vWIOk4BLysk7+U9z+SxynKiZR3/xdi\nXvFKk01R3BHV+GUKM2RYazpS/P8v7eyKhAbKxOdRcFpHLlVwfjyM1VlDQrEZxsMp\nNTLYXb6Sce1Uov0YtNx5wEowlREH1WOTlwIDAQAB\n-----END RSA PUBLIC KEY-----", "-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAsQZnSWVZNfClk29RcDTJQ76n8zZaiTGuUsi8sUhW8AS4PSbPKDm+\nDyJgdHDWdIF3HBzl7DHeFrILuqTs0vfS7Pa2NW8nUBwiaYQmPtwEa4n7bTmBVGsB\n1700/tz8wQWOLUlL2nMv+BPlDhxq4kmJCyJfgrIrHlX8sGPcPA4Y6Rwo0MSqYn3s\ng1Pu5gOKlaT9HKmE6wn5Sut6IiBjWozrRQ6n5h2RXNtO7O2qCDqjgB2vBxhV7B+z\nhRbLbCmW0tYMDsvPpX5M8fsO05svN+lKtCAuz1leFns8piZpptpSCFn7bWxiA9/f\nx5x17D7pfah3Sy2pA+NDXyzSlGcKdaUmwQIDAQAB\n-----END RSA PUBLIC KEY-----", "-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAwqjFW0pi4reKGbkc9pK83Eunwj/k0G8ZTioMMPbZmW99GivMibwa\nxDM9RDWabEMyUtGoQC2ZcDeLWRK3W8jMP6dnEKAlvLkDLfC4fXYHzFO5KHEqF06i\nqAqBdmI1iBGdQv/OQCBcbXIWCGDY2AsiqLhlGQfPOI7/vvKc188rTriocgUtoTUc\n/n/sIUzkgwTqRyvWYynWARWzQg0I9olLBBC2q5RQJJlnYXZwyTL3y9tdb7zOHkks\nWV9IMQmZmyZh/N7sMbGWQpt4NMchGpPGeJ2e5gHBjDnlIf2p1yZOYeUYrdbwcS0t\nUiggS4UeE8TzIuXFQxw7fzEIlmhIaq3FnwIDAQAB\n-----END RSA PUBLIC KEY-----"], ], 'connection' => [ // List of datacenters/subdomains where to connect 'ssl_subdomains' => [ // Subdomains of web.telegram.org for https protocol 1 => 'pluto', 2 => 'venus', 3 => 'aurora', 4 => 'vesta', 5 => 'flora', ], 'test' => [ // Test datacenters 'ipv4' => [ // ipv4 addresses 2 => [ // The rest will be fetched using help.getConfig 'ip_address' => '149.154.167.40', 'port' => 443, 'media_only' => false, 'tcpo_only' => false, ], ], 'ipv6' => [ // ipv6 addresses 2 => [ // The rest will be fetched using help.getConfig 'ip_address' => '2001:067c:04e8:f002:0000:0000:0000:000e', 'port' => 443, 'media_only' => false, 'tcpo_only' => false, ], ], ], 'main' => [ // Main datacenters 'ipv4' => [ // ipv4 addresses 2 => [ // The rest will be fetched using help.getConfig 'ip_address' => '149.154.167.51', 'port' => 443, 'media_only' => false, 'tcpo_only' => false, ], ], 'ipv6' => [ // ipv6 addresses 2 => [ // The rest will be fetched using help.getConfig 'ip_address' => '2001:067c:04e8:f002:0000:0000:0000:000a', 'port' => 443, 'media_only' => false, 'tcpo_only' => false, ], ], ], ], 'connection_settings' => [ // connection settings 'all' => [ // These settings will be applied on every datacenter that hasn't a custom settings subarray... 'protocol' => $this->altervista ? 'http' : 'tcp_abridged', // can be tcp_full, tcp_abridged, tcp_intermediate, http, https, obfuscated2, udp (unsupported) 'test_mode' => false, // decides whether to connect to the main telegram servers or to the testing servers (deep telegram) 'ipv6' => \danog\MadelineProto\Magic::$ipv6, // decides whether to use ipv6, ipv6 attribute of API attribute of API class contains autodetected boolean 'timeout' => 2, // timeout for sockets 'proxy' => $this->altervista ? '\\HttpProxy' : '\\Socket', // The proxy class to use 'proxy_extra' => $this->altervista ? ['address' => 'localhost', 'port' => 80] : [], // Extra parameters to pass to the proxy class using setExtra 'obfuscated' => false, 'transport' => 'tcp', 'pfs' => extension_loaded('gmp'), ], 'default_dc' => 2, ], 'app_info' => [ // obtained in https://my.telegram.org //'api_id' => you should put an API id in the settings array you provide //'api_hash' => you should put an API hash in the settings array you provide 'device_model' => $device_model, 'system_version' => $system_version, 'app_version' => $app_version, // 🌚 // 'app_version' => self::V, 'lang_code' => $lang_code, 'lang_pack' => $lang_pack, ], 'tl_schema' => [ // TL scheme files 'layer' => 91, // layer version 'src' => [ 'mtproto' => __DIR__.'/TL_mtproto_v1.tl', // mtproto TL scheme 'telegram' => __DIR__.'/TL_telegram_v91.tl', // telegram TL scheme 'secret' => __DIR__.'/TL_secret.tl', // secret chats TL scheme 'calls' => __DIR__.'/TL_calls.tl', // calls TL scheme //'td' => __DIR__.'/TL_td.tl', // telegram-cli TL scheme 'botAPI' => __DIR__.'/TL_botAPI.tl', ], ], 'logger' => [ // Logger settings /* * logger modes: * 0 - No logger * 1 - Log to the default logger destination * 2 - Log to file defined in second parameter * 3 - Echo logs * 4 - Call callable provided in logger_param. logger_param must accept two parameters: array $message, int $level * $message is an array containing the messages the log, $level, is the logging level */ // write to 'logger_param' => getcwd().'/MadelineProto.log', 'logger' => php_sapi_name() === 'cli' ? 3 : 2, // overwrite previous setting and echo logs 'logger_level' => Logger::VERBOSE, 'max_size' => 100 * 1024 * 1024, // Logging level, available logging levels are: ULTRA_VERBOSE, VERBOSE, NOTICE, WARNING, ERROR, FATAL_ERROR. Can be provided as last parameter to the logging function. 'rollbar_token' => '', ], 'max_tries' => [ 'query' => 5, // How many times should I try to call a method or send an object before throwing an exception 'authorization' => 5, // How many times should I try to generate an authorization key before throwing an exception 'response' => 5, ], 'flood_timeout' => ['wait_if_lt' => 20], 'msg_array_limit' => [ // How big should be the arrays containing the incoming and outgoing messages? 'incoming' => 200, 'outgoing' => 200, 'call_queue' => 200, ], 'peer' => [ 'full_info_cache_time' => 3600, // Full peer info cache validity 'full_fetch' => false, // Should madeline fetch the full member list of every group it meets? 'cache_all_peers_on_startup' => false, ], 'requests' => ['gzip_encode_if_gt' => 1024 * 1024], 'updates' => [ 'handle_updates' => false, // Should I handle updates? 'handle_old_updates' => true, // Should I handle old updates on startup? 'getdifference_interval' => 10, // Getdifference manual polling interval 'callback' => 'get_updates_update_handler', // Update callback 'run_callback' => true, ], 'secret_chats' => ['accept_chats' => true], 'serialization' => ['serialization_interval' => 30], 'threading' => [ 'allow_threading' => false, // Should I use threading, if it is enabled? 'handler_workers' => 10, ], 'upload' => [ 'allow_automatic_upload' => true, 'part_size' => 512 * 1024, ], 'download' => [ 'report_broken_media' => true, 'part_size' => 1024 * 1024, ], 'pwr' => [ 'pwr' => false, // Need info ? 'db_token' => false, // Need info ? 'strict' => false, // Need info ? 'requests' => true, ]]; if (!is_array($settings)) { $settings = []; } $settings = array_replace_recursive($this->array_cast_recursive($default_settings, true), $this->array_cast_recursive($settings, true)); if (isset(Lang::$lang[$settings['app_info']['lang_code']])) { Lang::$current_lang = &Lang::$lang[$settings['app_info']['lang_code']]; } /*if ($settings['app_info']['api_id'] < 20) { $settings['connection_settings']['all']['protocol'] = 'obfuscated2'; }*/ switch ($settings['logger']['logger_level']) { case 'ULTRA_VERBOSE': $settings['logger']['logger_level'] = 5; break; case 'VERBOSE': $settings['logger']['logger_level'] = 4; break; case 'NOTICE': $settings['logger']['logger_level'] = 3; break; case 'WARNING': $settings['logger']['logger_level'] = 2; break; case 'ERROR': $settings['logger']['logger_level'] = 1; break; case 'FATAL ERROR': $settings['logger']['logger_level'] = 0; break; } $this->settings = $settings; if (!$this->settings['updates']['handle_updates']) { $this->updates = []; } // Setup logger $this->setup_logger(); } public function setup_logger() { if (isset($this->settings['logger']['rollbar_token']) && $this->settings['logger']['rollbar_token'] !== '') { @\Rollbar\Rollbar::init(['environment' => 'production', 'root' => __DIR__, 'access_token' => isset($this->settings['logger']['rollbar_token']) && !in_array($this->settings['logger']['rollbar_token'], ['f9fff6689aea4905b58eec73f66c791d', '300afd7ccef346ea84d0c185ae831718', '11a8c2fe4c474328b40a28193f8d63f5', 'beef2d426496462ba34dcaad33d44a14']) || $this->settings['pwr']['pwr'] ? $this->settings['logger']['rollbar_token'] : 'c07d9b2f73c2461297b0beaef6c1662f'], false, false); } else { Exception::$rollbar = false; RPCErrorException::$rollbar = false; } $this->logger = new \danog\MadelineProto\Logger($this->settings['logger']['logger'], isset($this->settings['logger']['logger_param']) ? $this->settings['logger']['logger_param'] : '', isset($this->authorization['user']) ? isset($this->authorization['user']['username']) ? $this->authorization['user']['username'] : $this->authorization['user']['id'] : '', isset($this->settings['logger']['logger_level']) ? $this->settings['logger']['logger_level'] : Logger::VERBOSE, isset($this->settings['logger']['max_size']) ? $this->settings['logger']['max_size'] : 100 * 1024 * 1024); if (!\danog\MadelineProto\Logger::$default) { \danog\MadelineProto\Logger::constructor($this->settings['logger']['logger'], $this->settings['logger']['logger_param'], isset($this->authorization['user']) ? isset($this->authorization['user']['username']) ? $this->authorization['user']['username'] : $this->authorization['user']['id'] : '', isset($this->settings['logger']['logger_level']) ? $this->settings['logger']['logger_level'] : Logger::VERBOSE, isset($this->settings['logger']['max_size']) ? $this->settings['logger']['max_size'] : 100 * 1024 * 1024); } } public function reset_session($de = true, $auth_key = false) { if (!is_object($this->datacenter)) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['session_corrupted']); } foreach ($this->datacenter->sockets as $id => $socket) { if ($de) { //$this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['reset_session_seqno'], $id), Logger::VERBOSE); $socket->session_id = $this->random(8); $socket->session_in_seq_no = 0; $socket->session_out_seq_no = 0; $socket->max_incoming_id = null; $socket->max_outgoing_id = null; } if ($auth_key) { $socket->temp_auth_key = null; } /* $socket->incoming_messages = []; $socket->outgoing_messages = []; $socket->new_outgoing = []; $socket->new_incoming = []; */ } } public function is_http($datacenter) { return in_array($this->datacenter->sockets[$datacenter]->getCtx()->getStreamName(), [HttpStream::getName(), HttpsStream::getName()]); } public function close_and_reopen($datacenter) { $this->wait($this->datacenter->sockets[$datacenter]->reconnect()); /*if ($this->is_http($datacenter) && $this->datacenter->sockets[$datacenter]->temp_auth_key !== null && isset($this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited']) && $this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited'] === true) { $this->method_call('ping', ['ping_id' => 0], ['datacenter' => $datacenter]); }*/ } // Connects to all datacenters and if necessary creates authorization keys, binds them and writes client info public function connect_to_all_dcs() { return $this->wait($this->connect_to_all_dcs_async()); } public function connect_to_all_dcs_async(): \Generator { $this->datacenter->__construct($this, $this->settings['connection'], $this->settings['connection_settings']); $dcs = []; foreach ($this->datacenter->get_dcs() as $new_dc) { $dcs[] = $this->datacenter->dc_connect_async($new_dc); } yield $dcs; yield $this->init_authorization_async(); $dcs = []; foreach ($this->datacenter->get_dcs(false) as $new_dc) { $dcs[] = $this->datacenter->dc_connect_async($new_dc); } yield $dcs; yield $this->init_authorization_async(); } public function get_config($config = [], $options = []) { return $this->wait($this->get_config_async($config, $options)); } public function get_config_async($config = [], $options = []) { if ($this->config['expires'] > time()) { return $this->config; } $this->config = empty($config) ? yield $this->method_call_async_read('help.getConfig', $config, $options) : $config; yield $this->parse_config(); return $this->config; } public function get_cdn_config($datacenter) { /* * *********************************************************************** * Fetch RSA keys for CDN datacenters */ try { foreach ($this->method_call('help.getCdnConfig', [], ['datacenter' => $datacenter])['public_keys'] as $curkey) { $tempkey = new \danog\MadelineProto\RSA($curkey['public_key']); $this->rsa_keys[$tempkey->fp] = $tempkey; } } catch (\danog\MadelineProto\TL\Exception $e) { $this->logger->logger($e->getMessage(), \danog\MadelineProto\Logger::FATAL_ERROR); } } public function parse_config() { if (isset($this->config['dc_options'])) { yield $this->parse_dc_options($this->config['dc_options']); unset($this->config['dc_options']); } $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['config_updated'], Logger::NOTICE); $this->logger->logger($this->config, Logger::NOTICE); } public function parse_dc_options($dc_options) { unset($this->settings[$this->config['test_mode']]); foreach ($dc_options as $dc) { $test = $this->config['test_mode'] ? 'test' : 'main'; $id = $dc['id']; if (isset($dc['static'])) { //$id .= $dc['static'] ? '_static' : ''; } if (isset($dc['cdn'])) { $id .= $dc['cdn'] ? '_cdn' : ''; } $id .= $dc['media_only'] ? '_media' : ''; $ipv6 = $dc['ipv6'] ? 'ipv6' : 'ipv4'; //$id .= isset($this->settings['connection'][$test][$ipv6][$id]) && $this->settings['connection'][$test][$ipv6][$id]['ip_address'] != $dc['ip_address'] ? '_bk' : ''; if (is_numeric($id)) { $id = (int) $id; } unset($dc['cdn']); unset($dc['media_only']); unset($dc['id']); unset($dc['ipv6']); $this->settings['connection'][$test][$ipv6][$id] = $dc; } $curdc = $this->datacenter->curdc; $this->logger->logger('Got new DC options, reconnecting'); yield $this->connect_to_all_dcs(); $this->datacenter->curdc = $curdc; } public function get_self() { try { $this->authorization = ['user' => $this->method_call('users.getUsers', ['id' => [['_' => 'inputUserSelf']]], ['datacenter' => $this->datacenter->curdc])[0]]; } catch (RPCErrorException $e) { $this->logger->logger($e->getMessage()); return false; } return $this->authorization['user']; } public function getMethodCallbacks(): array { return []; } public function getMethodBeforeCallbacks(): array { return []; } public function getConstructorCallbacks(): array { return array_merge( array_fill_keys(['chat', 'chatEmpty', 'chatForbidden', 'channel', 'channelEmpty', 'channelForbidden'], [[$this, 'add_chat']]), array_fill_keys(['user', 'userEmpty'], [[$this, 'add_user']]), ['help.support' => [[$this, 'add_support']]] ); } public function getConstructorBeforeCallbacks(): array { return []; } public function getConstructorSerializeCallbacks(): array { return []; } public function getTypeMismatchCallbacks(): array { return array_merge( array_fill_keys(['User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputPeer', 'InputDialogPeer', 'InputNotifyPeer'], [$this, 'get_info']), array_fill_keys(['InputMedia', 'InputDocument', 'InputPhoto'], [$this, 'get_file_info']), array_fill_keys(['InputFileLocation'], [$this, 'get_download_info']) ); } public function __debugInfo() { return ['MadelineProto instance '.spl_object_hash($this)]; } const ALL_MIMES = ['webp' => [0 => 'image/webp'], 'png' => [0 => 'image/png', 1 => 'image/x-png'], 'bmp' => [0 => 'image/bmp', 1 => 'image/x-bmp', 2 => 'image/x-bitmap', 3 => 'image/x-xbitmap', 4 => 'image/x-win-bitmap', 5 => 'image/x-windows-bmp', 6 => 'image/ms-bmp', 7 => 'image/x-ms-bmp', 8 => 'application/bmp', 9 => 'application/x-bmp', 10 => 'application/x-win-bitmap'], 'gif' => [0 => 'image/gif'], 'jpeg' => [0 => 'image/jpeg', 1 => 'image/pjpeg'], 'xspf' => [0 => 'application/xspf+xml'], 'vlc' => [0 => 'application/videolan'], 'wmv' => [0 => 'video/x-ms-wmv', 1 => 'video/x-ms-asf'], 'au' => [0 => 'audio/x-au'], 'ac3' => [0 => 'audio/ac3'], 'flac' => [0 => 'audio/x-flac'], 'ogg' => [0 => 'audio/ogg', 1 => 'video/ogg', 2 => 'application/ogg'], 'kmz' => [0 => 'application/vnd.google-earth.kmz'], 'kml' => [0 => 'application/vnd.google-earth.kml+xml'], 'rtx' => [0 => 'text/richtext'], 'rtf' => [0 => 'text/rtf'], 'jar' => [0 => 'application/java-archive', 1 => 'application/x-java-application', 2 => 'application/x-jar'], 'zip' => [0 => 'application/x-zip', 1 => 'application/zip', 2 => 'application/x-zip-compressed', 3 => 'application/s-compressed', 4 => 'multipart/x-zip'], '7zip' => [0 => 'application/x-compressed'], 'xml' => [0 => 'application/xml', 1 => 'text/xml'], 'svg' => [0 => 'image/svg+xml'], '3g2' => [0 => 'video/3gpp2'], '3gp' => [0 => 'video/3gp', 1 => 'video/3gpp'], 'mp4' => [0 => 'video/mp4'], 'm4a' => [0 => 'audio/x-m4a'], 'f4v' => [0 => 'video/x-f4v'], 'flv' => [0 => 'video/x-flv'], 'webm' => [0 => 'video/webm'], 'aac' => [0 => 'audio/x-acc'], 'm4u' => [0 => 'application/vnd.mpegurl'], 'pdf' => [0 => 'application/pdf', 1 => 'application/octet-stream'], 'pptx' => [0 => 'application/vnd.openxmlformats-officedocument.presentationml.presentation'], 'ppt' => [0 => 'application/powerpoint', 1 => 'application/vnd.ms-powerpoint', 2 => 'application/vnd.ms-office', 3 => 'application/msword'], 'docx' => [0 => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'], 'xlsx' => [0 => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 1 => 'application/vnd.ms-excel'], 'xl' => [0 => 'application/excel'], 'xls' => [0 => 'application/msexcel', 1 => 'application/x-msexcel', 2 => 'application/x-ms-excel', 3 => 'application/x-excel', 4 => 'application/x-dos_ms_excel', 5 => 'application/xls', 6 => 'application/x-xls'], 'xsl' => [0 => 'text/xsl'], 'mpeg' => [0 => 'video/mpeg'], 'mov' => [0 => 'video/quicktime'], 'avi' => [0 => 'video/x-msvideo', 1 => 'video/msvideo', 2 => 'video/avi', 3 => 'application/x-troff-msvideo'], 'movie' => [0 => 'video/x-sgi-movie'], 'log' => [0 => 'text/x-log'], 'txt' => [0 => 'text/plain'], 'css' => [0 => 'text/css'], 'html' => [0 => 'text/html'], 'wav' => [0 => 'audio/x-wav', 1 => 'audio/wave', 2 => 'audio/wav'], 'xhtml' => [0 => 'application/xhtml+xml'], 'tar' => [0 => 'application/x-tar'], 'tgz' => [0 => 'application/x-gzip-compressed'], 'psd' => [0 => 'application/x-photoshop', 1 => 'image/vnd.adobe.photoshop'], 'exe' => [0 => 'application/x-msdownload'], 'js' => [0 => 'application/x-javascript'], 'mp3' => [0 => 'audio/mpeg', 1 => 'audio/mpg', 2 => 'audio/mpeg3', 3 => 'audio/mp3'], 'rar' => [0 => 'application/x-rar', 1 => 'application/rar', 2 => 'application/x-rar-compressed'], 'gzip' => [0 => 'application/x-gzip'], 'hqx' => [0 => 'application/mac-binhex40', 1 => 'application/mac-binhex', 2 => 'application/x-binhex40', 3 => 'application/x-mac-binhex40'], 'cpt' => [0 => 'application/mac-compactpro'], 'bin' => [0 => 'application/macbinary', 1 => 'application/mac-binary', 2 => 'application/x-binary', 3 => 'application/x-macbinary'], 'oda' => [0 => 'application/oda'], 'ai' => [0 => 'application/postscript'], 'smil' => [0 => 'application/smil'], 'mif' => [0 => 'application/vnd.mif'], 'wbxml' => [0 => 'application/wbxml'], 'wmlc' => [0 => 'application/wmlc'], 'dcr' => [0 => 'application/x-director'], 'dvi' => [0 => 'application/x-dvi'], 'gtar' => [0 => 'application/x-gtar'], 'php' => [0 => 'application/x-httpd-php', 1 => 'application/php', 2 => 'application/x-php', 3 => 'text/php', 4 => 'text/x-php', 5 => 'application/x-httpd-php-source'], 'swf' => [0 => 'application/x-shockwave-flash'], 'sit' => [0 => 'application/x-stuffit'], 'z' => [0 => 'application/x-compress'], 'mid' => [0 => 'audio/midi'], 'aif' => [0 => 'audio/x-aiff', 1 => 'audio/aiff'], 'ram' => [0 => 'audio/x-pn-realaudio'], 'rpm' => [0 => 'audio/x-pn-realaudio-plugin'], 'ra' => [0 => 'audio/x-realaudio'], 'rv' => [0 => 'video/vnd.rn-realvideo'], 'jp2' => [0 => 'image/jp2', 1 => 'video/mj2', 2 => 'image/jpx', 3 => 'image/jpm'], 'tiff' => [0 => 'image/tiff'], 'eml' => [0 => 'message/rfc822'], 'pem' => [0 => 'application/x-x509-user-cert', 1 => 'application/x-pem-file'], 'p10' => [0 => 'application/x-pkcs10', 1 => 'application/pkcs10'], 'p12' => [0 => 'application/x-pkcs12'], 'p7a' => [0 => 'application/x-pkcs7-signature'], 'p7c' => [0 => 'application/pkcs7-mime', 1 => 'application/x-pkcs7-mime'], 'p7r' => [0 => 'application/x-pkcs7-certreqresp'], 'p7s' => [0 => 'application/pkcs7-signature'], 'crt' => [0 => 'application/x-x509-ca-cert', 1 => 'application/pkix-cert'], 'crl' => [0 => 'application/pkix-crl', 1 => 'application/pkcs-crl'], 'pgp' => [0 => 'application/pgp'], 'gpg' => [0 => 'application/gpg-keys'], 'rsa' => [0 => 'application/x-pkcs7'], 'ics' => [0 => 'text/calendar'], 'zsh' => [0 => 'text/x-scriptzsh'], 'cdr' => [0 => 'application/cdr', 1 => 'application/coreldraw', 2 => 'application/x-cdr', 3 => 'application/x-coreldraw', 4 => 'image/cdr', 5 => 'image/x-cdr', 6 => 'zz-application/zz-winassoc-cdr'], 'wma' => [0 => 'audio/x-ms-wma'], 'vcf' => [0 => 'text/x-vcard'], 'srt' => [0 => 'text/srt'], 'vtt' => [0 => 'text/vtt'], 'ico' => [0 => 'image/x-icon', 1 => 'image/x-ico', 2 => 'image/vnd.microsoft.icon'], 'csv' => [0 => 'text/x-comma-separated-values', 1 => 'text/comma-separated-values', 2 => 'application/vnd.msexcel'], 'json' => [0 => 'application/json', 1 => 'text/json']]; } ---types--- ipPort#d433ad73 ipv4:int port:int = IpPort; ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort; accessPointRule#4679b65f phone_prefix_rules:string dc_id:int ips:vector = AccessPointRule; help.configSimple#5a592a6c date:int expires:int rules:vector = help.ConfigSimple; boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaPhoto#b3ba0635 flags:# id:InputPhoto ttl_seconds:flags.0?int = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia; inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaDocument#23ab23d2 flags:# id:InputDocument ttl_seconds:flags.0?int = InputMedia; inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = InputMedia; inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia; inputMediaGeoLive#ce4e82fd flags:# stopped:flags.0?true geo_point:InputGeoPoint period:flags.1?int = InputMedia; inputMediaPoll#6b3765b poll:Poll = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#3bb3b94a id:long access_hash:long file_reference:bytes = InputPhoto; inputFileLocation#dfdaabe1 volume_id:long local_id:int secret:long file_reference:bytes = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#196683d9 id:long access_hash:long file_reference:bytes = InputFileLocation; inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation; inputTakeoutFileLocation#29be5899 = InputFileLocation; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#91d11eb dc_id:int volume_id:long local_id:int secret:long file_reference:bytes = FileLocation; userEmpty#200250ba id:int = User; user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#c88974ac flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights participants_count:flags.17?int = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; chatFull#edd2a791 flags:# id:int participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int = ChatFull; channelFull#1c87a71a flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_view_stats:flags.12?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#44f9b43d flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#cbf24940 phone_number:string first_name:string last_name:string vcard:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#9cb070d7 flags:# document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia; messageMediaGeoLive#7c3c2609 geo:GeoPoint period:int = MessageMedia; messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction; messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; messageActionScreenshotTaken#4792929b = MessageAction; messageActionCustomAction#fae69f56 message:string = MessageAction; messageActionBotAllowed#abe9affe domain:string = MessageAction; messageActionSecureValuesSentMe#1b287353 values:Vector credentials:SecureCredentialsEncrypted = MessageAction; messageActionSecureValuesSent#d95c6154 types:Vector = MessageAction; messageActionContactSignUp#f3f25f76 = MessageAction; dialog#e4def5db flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9c477dd8 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#38faab5f flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int terms_of_service:flags.3?help.TermsOfService = auth.SentCode; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyBroadcasts#b1db7c7e = InputNotifyPeer; inputPeerNotifySettings#9c3d198e flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = InputPeerNotifySettings; peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = PeerNotifySettings; peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonChildAbuse#adf44ee3 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; inputReportReasonCopyright#9b89f93a = ReportReason; userFull#8ea4a881 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#eae87e42 contacts:Vector saved_count:int users:Vector = contacts.Contacts; contacts.importedContacts#77d01c3b imported:Vector popular_invites:Vector retry_contacts:Vector users:Vector = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector users:Vector = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector users:Vector = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#99262e37 flags:# inexact:flags.1?true pts:int count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesNotModified#74535f21 count:int = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; messages.chatsSlice#9cd81144 count:int chats:Vector = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector users:Vector = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter; inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter; inputMessagesFilterGeo#e7026d0d = MessagesFilter; inputMessagesFilterContacts#e062db83 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updateDialogPinned#19d27f3c flags:# pinned:flags.0?true peer:DialogPeer = Update; updatePinnedDialogs#ea4cb65b flags:# order:flags.0?Vector = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updateLangPackTooLong#46560264 lang_code:string = Update; updateLangPack#56022f4d difference:LangPackDifference = Update; updateFavedStickers#e511996d = Update; updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector = Update; updateContactsReset#7084a7be = Update; updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update; updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update; updateUserPinnedMessage#4c43da18 user_id:int id:int = Update; updateChatPinnedMessage#22893b26 chat_id:int id:int = Update; updateMessagePoll#aca1657b flags:# poll_id:long poll:flags.0?Poll results:PollResults = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector intermediate_state:updates.State = updates.Difference; updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector = upload.File; dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption; config#e6ca25f6 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#1da7158f flags:# popup:flags.0?true id:int version:string text:string entities:Vector document:flags.1?Document url:flags.2?string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument; documentEmpty#36f8c871 id:long = Document; document#59534e4c id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumb:PhotoSize dc_id:int attributes:Vector = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyBroadcasts#d612e8ef = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; sendMessageRecordRoundAction#88f27fbc = SendMessageAction; sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; contacts.found#b3134d9d my_results:Vector results:Vector chats:Vector users:Vector = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; inputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; privacyKeyPhoneP2P#39491cc8 = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector = PrivacyRule; account.privacyRules#554abb6f rules:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true supports_streaming:flags.1?true duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#e4599bbd hash:int stickers:Vector = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector = messages.AllStickers; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; authorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true password_pending:flags.2?true hash:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector = account.Authorizations; account.password#ad2641f8 flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes = account.Password; account.passwordSettings#9a5c33e5 flags:# email:flags.0?string secure_settings:flags.1?SecureSecretSettings = account.PasswordSettings; account.passwordInputSettings#c23727c9 flags:# new_algo:flags.0?PasswordKdfAlgo new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string new_secure_settings:flags.2?SecureSecretSettings = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#5585a139 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#98e81d3a user_id:int description:string commands:Vector = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector = ReplyMarkup; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; messageEntityPhone#9b69e34b offset:int length:int = MessageEntity; messageEntityCashtag#4c4e743f offset:int length:int = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector users:Vector = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#6a9d7b35 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int messages:Vector chats:Vector users:Vector = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector other_updates:Vector chats:Vector users:Vector = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantAdmin#a82fa898 flags:# can_edit:flags.0?true user_id:int inviter_id:int promoted_by:int date:int admin_rights:ChannelAdminRights = ChannelParticipant; channelParticipantBanned#222c1886 flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChannelBannedRights = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter; channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter; channels.channelParticipants#f56ee2a8 count:int participants:Vector users:Vector = channels.ChannelParticipants; channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector = channels.ChannelParticipant; help.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector min_age_confirm:flags.1?int = help.TermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector = messages.SavedGifs; inputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#c1b15d65 flags:# geo_point:InputGeoPoint period:int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#b722de65 flags:# geo:GeoPoint period:int reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector cache_time:int users:Vector = messages.BotResults; exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink; messageFwdHeader#559ebe6d flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; messages.peerDialogs#3371c354 dialogs:Vector messages:Vector chats:Vector users:Vector state:updates.State = messages.PeerDialogs; topPeer#edcdc05b peer:Peer rating:double = TopPeer; topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; topPeerCategoryBotsInline#148677e2 = TopPeerCategory; topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector chats:Vector users:Vector = contacts.TopPeers; contacts.topPeersDisabled#b52c939d = contacts.TopPeers; draftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; messages.featuredStickers#f89d88e5 hash:int sets:Vector unread:Vector = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#22f3afb3 hash:int packs:Vector stickers:Vector dates:Vector = messages.RecentStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector = messages.ArchivedStickers; messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector = messages.StickerSetInstallResult; stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector users:Vector = messages.HighScores; textEmpty#dc3d824f = RichText; textPlain#744694e0 text:string = RichText; textBold#6724abc4 text:RichText = RichText; textItalic#d912a59c text:RichText = RichText; textUnderline#c12622c4 text:RichText = RichText; textStrike#9bf8bb95 text:RichText = RichText; textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector = RichText; textSubscript#ed6a8504 text:RichText = RichText; textSuperscript#c7fb5e01 text:RichText = RichText; textMarked#34b8621 text:RichText = RichText; textPhone#1ccb966a text:RichText phone:string = RichText; textImage#81ccf4f document_id:long w:int h:int = RichText; textAnchor#35553762 text:RichText name:string = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; pageBlockHeader#bfd064ec text:RichText = PageBlock; pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; pageBlockParagraph#467a0766 text:RichText = PageBlock; pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; pageBlockList#e4e88011 items:Vector = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; pageBlockPhoto#1759c560 flags:# photo_id:long caption:PageCaption url:flags.0?string webpage_id:flags.0?long = PageBlock; pageBlockVideo#7c8fe7b6 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:PageCaption = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; pageBlockEmbed#a8718dc5 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:flags.5?int h:flags.5?int caption:PageCaption = PageBlock; pageBlockEmbedPost#f259a80b url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:PageCaption = PageBlock; pageBlockCollage#65a0fa4d items:Vector caption:PageCaption = PageBlock; pageBlockSlideshow#31f9590 items:Vector caption:PageCaption = PageBlock; pageBlockChannel#ef1751b5 channel:Chat = PageBlock; pageBlockAudio#804361ea audio_id:long caption:PageCaption = PageBlock; pageBlockKicker#1e148390 text:RichText = PageBlock; pageBlockTable#bf4dea82 flags:# bordered:flags.0?true striped:flags.1?true title:RichText rows:Vector = PageBlock; pageBlockOrderedList#9a8ae1e1 items:Vector = PageBlock; pageBlockDetails#76768bed flags:# open:flags.0?true blocks:Vector title:RichText = PageBlock; pageBlockRelatedArticles#16115a96 title:RichText articles:Vector = PageBlock; pageBlockMap#a44f3ef6 geo:GeoPoint zoom:int w:int h:int caption:PageCaption = PageBlock; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; webDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector = WebDocument; webDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector = payments.PaymentReceipt; payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsAndroidPay#ca05d50e payment_token:DataJSON google_transaction_id:string = InputPaymentCredentials; account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; shippingOption#b6213cdf id:string title:string prices:Vector = ShippingOption; inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCall#e6f9ddf3 flags:# p2p_allowed:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector = phone.PhoneCall; upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey; cdnConfig#5725e40a public_keys:Vector = CdnConfig; langPackString#cad181f6 key:string value:string = LangPackString; langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString; langPackStringDeleted#2979eeb2 key:string = LangPackString; langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector = LangPackDifference; langPackLanguage#eeca5ce3 flags:# official:flags.0?true rtl:flags.2?true beta:flags.3?true name:string native_name:string lang_code:string base_lang_code:flags.1?string plural_code:string strings_count:int translated_count:int translations_url:string = LangPackLanguage; channelAdminRights#5d7ceba5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true invite_link:flags.6?true pin_messages:flags.7?true add_admins:flags.9?true manage_call:flags.10?true = ChannelAdminRights; channelBannedRights#58cf4249 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true until_date:int = ChannelBannedRights; channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangePhoto#b82f55c3 prev_photo:ChatPhoto new_photo:ChatPhoto = ChannelAdminLogEventAction; channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers; messages.favedStickers#f37f2f16 hash:int packs:Vector stickers:Vector = messages.FavedStickers; recentMeUrlUnknown#46e1d13d url:string = RecentMeUrl; recentMeUrlUser#8dbc3336 url:string user_id:int = RecentMeUrl; recentMeUrlChat#a01b22f9 url:string chat_id:int = RecentMeUrl; recentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl; recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl; help.recentMeUrls#e0310d7 urls:Vector chats:Vector users:Vector = help.RecentMeUrls; inputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector = InputSingleMedia; webAuthorization#cac943f2 hash:long bot_id:int domain:string browser:string platform:string date_created:int date_active:int ip:string region:string = WebAuthorization; account.webAuthorizations#ed56c9fc authorizations:Vector users:Vector = account.WebAuthorizations; inputMessageID#a676a322 id:int = InputMessage; inputMessageReplyTo#bad88395 id:int = InputMessage; inputMessagePinned#86872538 = InputMessage; inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer; dialogPeer#e56dbf05 peer:Peer = DialogPeer; messages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets; messages.foundStickerSets#5108d648 hash:int sets:Vector = messages.FoundStickerSets; fileHash#6242c773 offset:int limit:int hash:bytes = FileHash; inputClientProxy#75588b3f address:string port:int = InputClientProxy; help.proxyDataEmpty#e09e1fb8 expires:int = help.ProxyData; help.proxyDataPromo#2bf7ee23 expires:int peer:Peer chats:Vector users:Vector = help.ProxyData; help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate; help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate; inputSecureFileUploaded#3334b0f0 id:long parts:int md5_checksum:string file_hash:bytes secret:bytes = InputSecureFile; inputSecureFile#5367e5be id:long access_hash:long = InputSecureFile; secureFileEmpty#64199744 = SecureFile; secureFile#e0277a62 id:long access_hash:long size:int dc_id:int date:int file_hash:bytes secret:bytes = SecureFile; secureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData; securePlainPhone#7d6099dd phone:string = SecurePlainData; securePlainEmail#21ec5a5f email:string = SecurePlainData; secureValueTypePersonalDetails#9d2a81e3 = SecureValueType; secureValueTypePassport#3dac6a00 = SecureValueType; secureValueTypeDriverLicense#6e425c4 = SecureValueType; secureValueTypeIdentityCard#a0d0744b = SecureValueType; secureValueTypeInternalPassport#99a48f23 = SecureValueType; secureValueTypeAddress#cbe31e26 = SecureValueType; secureValueTypeUtilityBill#fc36954e = SecureValueType; secureValueTypeBankStatement#89137c0d = SecureValueType; secureValueTypeRentalAgreement#8b883488 = SecureValueType; secureValueTypePassportRegistration#99e3806a = SecureValueType; secureValueTypeTemporaryRegistration#ea02ec33 = SecureValueType; secureValueTypePhone#b320aadb = SecureValueType; secureValueTypeEmail#8e3ca7ee = SecureValueType; secureValue#187fa0ca flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile translation:flags.6?Vector files:flags.4?Vector plain_data:flags.5?SecurePlainData hash:bytes = SecureValue; inputSecureValue#db21d0a7 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?InputSecureFile reverse_side:flags.2?InputSecureFile selfie:flags.3?InputSecureFile translation:flags.6?Vector files:flags.4?Vector plain_data:flags.5?SecurePlainData = InputSecureValue; secureValueHash#ed1ecdb0 type:SecureValueType hash:bytes = SecureValueHash; secureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError; secureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector text:string = SecureValueError; secureValueError#869d758f type:SecureValueType hash:bytes text:string = SecureValueError; secureValueErrorTranslationFile#a1144770 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorTranslationFiles#34636dd8 type:SecureValueType file_hash:Vector text:string = SecureValueError; secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted; account.authorizationForm#ad2e1cd8 flags:# required_types:Vector values:Vector errors:Vector users:Vector privacy_policy_url:flags.0?string = account.AuthorizationForm; account.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode; help.deepLinkInfoEmpty#66afa166 = help.DeepLinkInfo; help.deepLinkInfo#6a4ee832 flags:# update_app:flags.0?true message:string entities:flags.1?Vector = help.DeepLinkInfo; savedPhoneContact#1142bd56 phone:string first_name:string last_name:string date:int = SavedContact; account.takeout#4dba4501 id:long = account.Takeout; passwordKdfAlgoUnknown#d45ab096 = PasswordKdfAlgo; passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow#3a912d4a salt1:bytes salt2:bytes g:int p:bytes = PasswordKdfAlgo; securePasswordKdfAlgoUnknown#4a8537 = SecurePasswordKdfAlgo; securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 salt:bytes = SecurePasswordKdfAlgo; securePasswordKdfAlgoSHA512#86471d92 salt:bytes = SecurePasswordKdfAlgo; secureSecretSettings#1527bcac secure_algo:SecurePasswordKdfAlgo secure_secret:bytes secure_secret_id:long = SecureSecretSettings; inputCheckPasswordEmpty#9880f658 = InputCheckPasswordSRP; inputCheckPasswordSRP#d27ff082 srp_id:long A:bytes M1:bytes = InputCheckPasswordSRP; secureRequiredType#829d99da flags:# native_names:flags.0?true selfie_required:flags.1?true translation_required:flags.2?true type:SecureValueType = SecureRequiredType; secureRequiredTypeOneOf#27477b4 types:Vector = SecureRequiredType; help.passportConfigNotModified#bfb9f457 = help.PassportConfig; help.passportConfig#a098d6af hash:int countries_langs:DataJSON = help.PassportConfig; inputAppEvent#1d1b1245 time:double type:string peer:long data:JSONValue = InputAppEvent; jsonObjectValue#c0de1bd9 key:string value:JSONValue = JSONObjectValue; jsonNull#3f6d7b68 = JSONValue; jsonBool#c7345e6a value:Bool = JSONValue; jsonNumber#2be0dfa4 value:double = JSONValue; jsonString#b71e767a value:string = JSONValue; jsonArray#f7444763 value:Vector = JSONValue; jsonObject#99c1d49d value:Vector = JSONValue; pageTableCell#34566b6a flags:# header:flags.0?true align_center:flags.3?true align_right:flags.4?true valign_middle:flags.5?true valign_bottom:flags.6?true text:flags.7?RichText colspan:flags.1?int rowspan:flags.2?int = PageTableCell; pageTableRow#e0c0c5e5 cells:Vector = PageTableRow; pageCaption#6f747657 text:RichText credit:RichText = PageCaption; pageListItemText#b92fb6cd text:RichText = PageListItem; pageListItemBlocks#25e073fc blocks:Vector = PageListItem; pageListOrderedItemText#5e068047 num:string text:RichText = PageListOrderedItem; pageListOrderedItemBlocks#98dd8936 num:string blocks:Vector = PageListOrderedItem; pageRelatedArticle#b390dc08 flags:# url:string webpage_id:long title:flags.0?string description:flags.1?string photo_id:flags.2?long author:flags.3?string published_date:flags.4?int = PageRelatedArticle; page#ae891bec flags:# part:flags.0?true rtl:flags.1?true v2:flags.2?true url:string blocks:Vector photos:Vector documents:Vector = Page; help.supportName#8c05f1c9 name:string = help.SupportName; help.userInfoEmpty#f3ae2eed = help.UserInfo; help.userInfo#1eb3758 message:string entities:Vector author:string date:int = help.UserInfo; pollAnswer#6ca9c2e9 text:string option:bytes = PollAnswer; poll#d5529d06 id:long flags:# closed:flags.0?true question:string answers:Vector = Poll; pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true option:bytes voters:int = PollAnswerVoters; pollResults#5755785a flags:# min:flags.0?true results:flags.1?Vector total_voters:flags.2?int = PollResults; chatOnlines#f041e250 onlines:int = ChatOnlines; statsURL#47a971e0 url:string = StatsURL; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X; initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X; invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X; auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#d18b4d16 password:InputCheckPasswordSRP = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector = Bool; account.registerDevice#5cbea590 token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector = Bool; account.unregisterDevice#3076c4bf token_type:int token:string other_uids:Vector = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#9cd4eaf9 password:InputCheckPasswordSRP = account.PasswordSettings; account.updatePasswordSettings#a59b102f password:InputCheckPasswordSRP new_settings:account.PasswordInputSettings = Bool; account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; account.getTmpPassword#449e0b51 password:InputCheckPasswordSRP period:int = account.TmpPassword; account.getWebAuthorizations#182e6d6f = account.WebAuthorizations; account.resetWebAuthorization#2d01b9ef hash:long = Bool; account.resetWebAuthorizations#682d2594 = Bool; account.getAllSecureValues#b288bc7d = Vector; account.getSecureValue#73665bc2 types:Vector = Vector; account.saveSecureValue#899fe31d value:InputSecureValue secure_secret_id:long = SecureValue; account.deleteSecureValue#b880bc4b types:Vector = Bool; account.getAuthorizationForm#b86ba8e1 bot_id:int scope:string public_key:string = account.AuthorizationForm; account.acceptAuthorization#e7027c94 bot_id:int scope:string public_key:string value_hashes:Vector credentials:SecureCredentialsEncrypted = Bool; account.sendVerifyPhoneCode#823380b4 flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool; account.sendVerifyEmailCode#7011509f email:string = account.SentEmailCode; account.verifyEmail#ecba39db email:string code:string = Bool; account.initTakeoutSession#f05b4804 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?int = account.Takeout; account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool; account.confirmPasswordEmail#8fdf1920 code:string = Bool; account.resendPasswordEmail#7a7f2a15 = Bool; account.cancelPasswordEmail#c1cbd5b6 = Bool; account.getContactSignUpNotification#9f07c728 = Bool; account.setContactSignUpNotification#cff43f61 silent:Bool = Bool; account.getNotifyExceptions#53577479 flags:# compare_sound:flags.1?true peer:flags.0?InputNotifyPeer = Updates; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector = Bool; contacts.getContactIDs#2caa4a42 hash:int = Vector; contacts.getStatuses#c4a353ee = Vector; contacts.getContacts#c023849f hash:int = contacts.Contacts; contacts.importContacts#2c800be5 contacts:Vector = contacts.ImportedContacts; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector = Bool; contacts.deleteByPhones#1013fd9e phones:Vector = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; contacts.resetSaved#879537f1 = Bool; contacts.getSaved#82f1e39f = Vector; contacts.toggleTopPeers#8514bdda enabled:Bool = Bool; messages.getMessages#63c66506 id:Vector = messages.Messages; messages.getDialogs#b098aee6 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:int = messages.Dialogs; messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.search#8614ef68 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.sendMedia#b8d1262b flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true grouped:flags.9?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.report#bd82b658 peer:InputPeer id:Vector reason:ReportReason = Bool; messages.getChats#3c6aa187 id:Vector = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector title:string = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; messages.getStickers#43d4f2c emoticon:string hash:int = messages.Stickers; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#8b68b0cc flags:# message:string entities:flags.3?Vector = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#d116f31e flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.editInlineBotMessage#83557dba flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#e470bcfd peers:Vector = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector = Bool; messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; messages.reorderPinnedDialogs#5b51d63f flags:# force:flags.0?true order:Vector = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia; messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates; messages.getFavedStickers#21ce0b0e hash:int = messages.FavedStickers; messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool; messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory; messages.getRecentLocations#bbc45b09 peer:InputPeer limit:int hash:int = messages.Messages; messages.sendMultiMedia#2095512f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; messages.searchStickerSets#c2b7d08b flags:# exclude_featured:flags.0?true q:string hash:int = messages.FoundStickerSets; messages.getSplitRanges#1cff7e08 = Vector; messages.markDialogUnread#c286d98f flags:# unread:flags.0?true peer:InputDialogPeer = Bool; messages.getDialogUnreadMarks#22e24e22 = Vector; messages.clearAllDrafts#7e58ee9c = Bool; messages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true peer:InputPeer id:int = Updates; messages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector = Updates; messages.getPollResults#73bb643b peer:InputPeer msg_id:int = Updates; messages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines; messages.getStatsURL#83f6c0cd peer:InputPeer = StatsURL; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector = Vector; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; upload.reuploadCdnFile#9b2754a8 file_token:bytes request_token:bytes = Vector; upload.getCdnFileHashes#4da54231 file_token:bytes offset:int = Vector; upload.getFileHashes#c7025931 location:InputFileLocation offset:int = Vector; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#522d5a7d source:string = help.AppUpdate; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#9010ef6f prev_app_version:string = Updates; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls; help.getProxyData#3d7758e1 = help.ProxyData; help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate; help.acceptTermsOfService#ee72f79a id:DataJSON = Bool; help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo; help.getAppConfig#98914110 = JSONValue; help.saveAppLog#6f02f748 events:Vector = Bool; help.getPassportConfig#c661ad08 hash:int = help.PassportConfig; help.getSupportName#d360e72c = help.SupportName; help.getUserInfo#38a08d3 user_id:InputUser = help.UserInfo; help.editUserInfo#66b91b70 user_id:InputUser message:string entities:Vector = help.UserInfo; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector = Bool; channels.getMessages#ad8c9a23 channel:InputChannel id:Vector = messages.Messages; channels.getParticipants#123e05e9 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#20b88214 channel:InputChannel user_id:InputUser admin_rights:ChannelAdminRights = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; channels.exportMessageLink#ceb77163 channel:InputChannel id:int grouped:Bool = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; channels.editBanned#bfd915cd channel:InputChannel user_id:InputUser banned_rights:ChannelBannedRights = Updates; channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector max_id:long min_id:long limit:int = channels.AdminLogResults; channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool; channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector = Bool; channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool; channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates; channels.getLeftChannels#8341ecc0 offset:int = messages.Chats; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm; payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt; payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult; payments.getSavedInfo#227d824b = payments.SavedInfo; payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet; stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; phone.getCallConfig#55451fa9 = DataJSON; phone.requestCall#5b95b3d4 user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = Updates; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference; langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector = Vector; langpack.getDifference#9d51e814 lang_code:string from_version:int = LangPackDifference; langpack.getLanguages#42c6978f lang_pack:string = Vector; langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage; // LAYER 91 resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector = ResPQ; vector {t:Type} # [ t ] = Vector t; p_q_inner_data_dc#a9f55f95 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data; p_q_inner_data_temp_dc#56fddf88 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data; p_q_inner_data pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data; p_q_inner_data_temp pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data; server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params; server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params; server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data; client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data; dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer; dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer; dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer; bind_auth_key_inner#75a3f765 nonce:long temp_auth_key_id:long perm_auth_key_id:long temp_session_id:long expires_at:int = BindAuthKeyInner; rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult; rpc_error#2144ca19 error_code:int error_message:string = RpcError; rpc_answer_unknown#5e2ad36e = RpcDropAnswer; rpc_answer_dropped_running#cd78e586 = RpcDropAnswer; rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer; future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt; future_salts#ae500895 req_msg_id:long now:int salts:vector = FutureSalts; pong#347773c5 msg_id:long ping_id:long = Pong; destroy_session_ok#e22045fc session_id:long = DestroySessionRes; destroy_session_none#62d350c9 session_id:long = DestroySessionRes; new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession; msg_container#73f1f8dc messages:vector<%Message> = MessageContainer; message msg_id:long seqno:int bytes:int body:Object = Message; msg_copy#e06046b2 orig_message:Message = MessageCopy; gzip_packed#3072cfa1 packed_data:bytes = Object; msgs_ack#62d6b459 msg_ids:Vector = MsgsAck; bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification; bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification; msg_resend_ans_req#8610baeb msg_ids:Vector = MsgResendReq; msg_resend_req#7d861a08 msg_ids:Vector = MsgResendReq; msgs_state_req#da69fb52 msg_ids:Vector = MsgsStateReq; msgs_state_info#04deb57d req_msg_id:long info:string = MsgsStateInfo; msgs_all_info#8cc0d131 msg_ids:Vector info:string = MsgsAllInfo; msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo; msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo; rsa_public_key n:string e:string = RSAPublicKey; http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait; ---functions--- req_pq_multi#be7e8ef1 nonce:int128 = ResPQ; req_pq nonce:int128 = ResPQ; req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params; set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer; rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer; get_future_salts#b921bd04 num:int = FutureSalts; ping#7abe77ec ping_id:long = Pong; ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong; destroy_session#e7512126 session_id:long = DestroySessionRes; //test.useGzipPacked = GzipPacked; //test.useServerDhInnerData = Server_DH_inner_data; //test.useNewSessionCreated = NewSession; //test.useMsgsAck = MsgsAck; //test.useBadMsgNotification = BadMsgNotification; //test.useOther key:rsa_public_key p_q_data:P_Q_inner_data dh_data:client_DH_inner_data = RpcError; { "constructors": [ { "id": "-1132882121", "predicate": "boolFalse", "params": [], "type": "Bool" }, { "id": "-1720552011", "predicate": "boolTrue", "params": [], "type": "Bool" }, { "id": "481674261", "predicate": "vector", "params": [], "type": "Vector t" }, { "id": "-994444869", "predicate": "error", "params": [ { "name": "code", "type": "int" }, { "name": "text", "type": "string" } ], "type": "Error" }, { "id": "1450380236", "predicate": "null", "params": [], "type": "Null" }, { "id": "2134579434", "predicate": "inputPeerEmpty", "params": [], "type": "InputPeer" }, { "id": "2107670217", "predicate": "inputPeerSelf", "params": [], "type": "InputPeer" }, { "id": "396093539", "predicate": "inputPeerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1182234929", "predicate": "inputUserEmpty", "params": [], "type": "InputUser" }, { "id": "-138301121", "predicate": "inputUserSelf", "params": [], "type": "InputUser" }, { "id": "-208488460", "predicate": "inputPhoneContact", "params": [ { "name": "client_id", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputContact" }, { "id": "-181407105", "predicate": "inputFile", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" }, { "name": "md5_checksum", "type": "string" } ], "type": "InputFile" }, { "id": "-1771768449", "predicate": "inputMediaEmpty", "params": [], "type": "InputMedia" }, { "id": "-139464256", "predicate": "inputMediaUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-373312269", "predicate": "inputMediaPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-104578748", "predicate": "inputMediaGeoPoint", "params": [ { "name": "geo_point", "type": "InputGeoPoint" } ], "type": "InputMedia" }, { "id": "-1494984313", "predicate": "inputMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputMedia" }, { "id": "-2106507297", "predicate": "inputMediaUploadedVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "2004934137", "predicate": "inputMediaUploadedThumbVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-1821749571", "predicate": "inputMediaVideo", "params": [ { "name": "id", "type": "InputVideo" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "480546647", "predicate": "inputChatPhotoEmpty", "params": [], "type": "InputChatPhoto" }, { "id": "-1809496270", "predicate": "inputChatUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-1293828344", "predicate": "inputChatPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-457104426", "predicate": "inputGeoPointEmpty", "params": [], "type": "InputGeoPoint" }, { "id": "-206066487", "predicate": "inputGeoPoint", "params": [ { "name": "lat", "type": "double" }, { "name": "long", "type": "double" } ], "type": "InputGeoPoint" }, { "id": "483901197", "predicate": "inputPhotoEmpty", "params": [], "type": "InputPhoto" }, { "id": "-74070332", "predicate": "inputPhoto", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputPhoto" }, { "id": "1426648181", "predicate": "inputVideoEmpty", "params": [], "type": "InputVideo" }, { "id": "-296249774", "predicate": "inputVideo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputVideo" }, { "id": "342061462", "predicate": "inputFileLocation", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1023632620", "predicate": "inputVideoFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-1377390588", "predicate": "inputPhotoCropAuto", "params": [], "type": "InputPhotoCrop" }, { "id": "-644787419", "predicate": "inputPhotoCrop", "params": [ { "name": "crop_left", "type": "double" }, { "name": "crop_top", "type": "double" }, { "name": "crop_width", "type": "double" } ], "type": "InputPhotoCrop" }, { "id": "1996904104", "predicate": "inputAppEvent", "params": [ { "name": "time", "type": "double" }, { "name": "type", "type": "string" }, { "name": "peer", "type": "long" }, { "name": "data", "type": "string" } ], "type": "InputAppEvent" }, { "id": "-1649296275", "predicate": "peerUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "Peer" }, { "id": "-1160714821", "predicate": "peerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Peer" }, { "id": "-1432995067", "predicate": "storage.fileUnknown", "params": [], "type": "storage.FileType" }, { "id": "8322574", "predicate": "storage.fileJpeg", "params": [], "type": "storage.FileType" }, { "id": "-891180321", "predicate": "storage.fileGif", "params": [], "type": "storage.FileType" }, { "id": "172975040", "predicate": "storage.filePng", "params": [], "type": "storage.FileType" }, { "id": "-1373745011", "predicate": "storage.filePdf", "params": [], "type": "storage.FileType" }, { "id": "1384777335", "predicate": "storage.fileMp3", "params": [], "type": "storage.FileType" }, { "id": "1258941372", "predicate": "storage.fileMov", "params": [], "type": "storage.FileType" }, { "id": "1086091090", "predicate": "storage.filePartial", "params": [], "type": "storage.FileType" }, { "id": "-1278304028", "predicate": "storage.fileMp4", "params": [], "type": "storage.FileType" }, { "id": "276907596", "predicate": "storage.fileWebp", "params": [], "type": "storage.FileType" }, { "id": "2086234950", "predicate": "fileLocationUnavailable", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "1406570614", "predicate": "fileLocation", "params": [ { "name": "dc_id", "type": "int" }, { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "537022650", "predicate": "userEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "User" }, { "id": "1326562017", "predicate": "userProfilePhotoEmpty", "params": [], "type": "UserProfilePhoto" }, { "id": "-715532088", "predicate": "userProfilePhoto", "params": [ { "name": "photo_id", "type": "long" }, { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "UserProfilePhoto" }, { "id": "164646985", "predicate": "userStatusEmpty", "params": [], "type": "UserStatus" }, { "id": "-306628279", "predicate": "userStatusOnline", "params": [ { "name": "expires", "type": "int" } ], "type": "UserStatus" }, { "id": "9203775", "predicate": "userStatusOffline", "params": [ { "name": "was_online", "type": "int" } ], "type": "UserStatus" }, { "id": "-1683826688", "predicate": "chatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Chat" }, { "id": "1930607688", "predicate": "chat", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Chat" }, { "id": "120753115", "predicate": "chatForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Chat" }, { "id": "771925524", "predicate": "chatFull", "params": [ { "name": "id", "type": "int" }, { "name": "participants", "type": "ChatParticipants" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector" } ], "type": "ChatFull" }, { "id": "-925415106", "predicate": "chatParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "-57668565", "predicate": "chatParticipantsForbidden", "params": [ { "name": "flags", "type": "#" }, { "name": "chat_id", "type": "int" }, { "name": "self_participant", "type": "flags.0?ChatParticipant" } ], "type": "ChatParticipants" }, { "id": "2017571861", "predicate": "chatParticipants", "params": [ { "name": "chat_id", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "version", "type": "int" } ], "type": "ChatParticipants" }, { "id": "935395612", "predicate": "chatPhotoEmpty", "params": [], "type": "ChatPhoto" }, { "id": "1632839530", "predicate": "chatPhoto", "params": [ { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "ChatPhoto" }, { "id": "-2082087340", "predicate": "messageEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Message" }, { "id": "1537633299", "predicate": "message", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "reply_markup", "type": "flags.6?ReplyMarkup" }, { "name": "entities", "type": "flags.7?Vector" }, { "name": "views", "type": "flags.10?int" } ], "type": "Message" }, { "id": "-1066691065", "predicate": "messageService", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "Message" }, { "id": "1038967584", "predicate": "messageMediaEmpty", "params": [], "type": "MessageMedia" }, { "id": "1032643901", "predicate": "messageMediaPhoto", "params": [ { "name": "photo", "type": "Photo" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1540298357", "predicate": "messageMediaVideo", "params": [ { "name": "video", "type": "Video" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1457575028", "predicate": "messageMediaGeo", "params": [ { "name": "geo", "type": "GeoPoint" } ], "type": "MessageMedia" }, { "id": "1585262393", "predicate": "messageMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "user_id", "type": "int" } ], "type": "MessageMedia" }, { "id": "-1618676578", "predicate": "messageMediaUnsupported", "params": [], "type": "MessageMedia" }, { "id": "-1230047312", "predicate": "messageActionEmpty", "params": [], "type": "MessageAction" }, { "id": "-1503425638", "predicate": "messageActionChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "users", "type": "Vector" } ], "type": "MessageAction" }, { "id": "-1247687078", "predicate": "messageActionChatEditTitle", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "2144015272", "predicate": "messageActionChatEditPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageAction" }, { "id": "-1780220945", "predicate": "messageActionChatDeletePhoto", "params": [], "type": "MessageAction" }, { "id": "1581055051", "predicate": "messageActionChatAddUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1297179892", "predicate": "messageActionChatDeleteUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1042448310", "predicate": "dialog", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Dialog" }, { "id": "590459437", "predicate": "photoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Photo" }, { "id": "-840088834", "predicate": "photo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "sizes", "type": "Vector" } ], "type": "Photo" }, { "id": "236446268", "predicate": "photoSizeEmpty", "params": [ { "name": "type", "type": "string" } ], "type": "PhotoSize" }, { "id": "2009052699", "predicate": "photoSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "size", "type": "int" } ], "type": "PhotoSize" }, { "id": "-374917894", "predicate": "photoCachedSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "PhotoSize" }, { "id": "-1056548696", "predicate": "videoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Video" }, { "id": "-148338733", "predicate": "video", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "Video" }, { "id": "286776671", "predicate": "geoPointEmpty", "params": [], "type": "GeoPoint" }, { "id": "541710092", "predicate": "geoPoint", "params": [ { "name": "long", "type": "double" }, { "name": "lat", "type": "double" } ], "type": "GeoPoint" }, { "id": "-2128698738", "predicate": "auth.checkedPhone", "params": [ { "name": "phone_registered", "type": "Bool" } ], "type": "auth.CheckedPhone" }, { "id": "-269659687", "predicate": "auth.sentCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "-16553231", "predicate": "auth.authorization", "params": [ { "name": "user", "type": "User" } ], "type": "auth.Authorization" }, { "id": "-543777747", "predicate": "auth.exportedAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.ExportedAuthorization" }, { "id": "-1195615476", "predicate": "inputNotifyPeer", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "InputNotifyPeer" }, { "id": "423314455", "predicate": "inputNotifyUsers", "params": [], "type": "InputNotifyPeer" }, { "id": "1251338318", "predicate": "inputNotifyChats", "params": [], "type": "InputNotifyPeer" }, { "id": "-1540769658", "predicate": "inputNotifyAll", "params": [], "type": "InputNotifyPeer" }, { "id": "-265263912", "predicate": "inputPeerNotifyEventsEmpty", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "-395694988", "predicate": "inputPeerNotifyEventsAll", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "1185074840", "predicate": "inputPeerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "InputPeerNotifySettings" }, { "id": "-1378534221", "predicate": "peerNotifyEventsEmpty", "params": [], "type": "PeerNotifyEvents" }, { "id": "1830677896", "predicate": "peerNotifyEventsAll", "params": [], "type": "PeerNotifyEvents" }, { "id": "1889961234", "predicate": "peerNotifySettingsEmpty", "params": [], "type": "PeerNotifySettings" }, { "id": "-1923214866", "predicate": "peerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "PeerNotifySettings" }, { "id": "-860866985", "predicate": "wallPaper", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "sizes", "type": "Vector" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "1518971995", "predicate": "userFull", "params": [ { "name": "user", "type": "User" }, { "name": "link", "type": "contacts.Link" }, { "name": "profile_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "blocked", "type": "Bool" }, { "name": "bot_info", "type": "BotInfo" } ], "type": "UserFull" }, { "id": "-116274796", "predicate": "contact", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual", "type": "Bool" } ], "type": "Contact" }, { "id": "-805141448", "predicate": "importedContact", "params": [ { "name": "user_id", "type": "int" }, { "name": "client_id", "type": "long" } ], "type": "ImportedContact" }, { "id": "1444661369", "predicate": "contactBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ContactBlocked" }, { "id": "1038193057", "predicate": "contactSuggested", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual_contacts", "type": "int" } ], "type": "ContactSuggested" }, { "id": "-748155807", "predicate": "contactStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "ContactStatus" }, { "id": "986597452", "predicate": "contacts.link", "params": [ { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" }, { "name": "user", "type": "User" } ], "type": "contacts.Link" }, { "id": "-1219778094", "predicate": "contacts.contactsNotModified", "params": [], "type": "contacts.Contacts" }, { "id": "1871416498", "predicate": "contacts.contacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Contacts" }, { "id": "-1387117803", "predicate": "contacts.importedContacts", "params": [ { "name": "imported", "type": "Vector" }, { "name": "retry_contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ImportedContacts" }, { "id": "471043349", "predicate": "contacts.blocked", "params": [ { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "-1878523231", "predicate": "contacts.blockedSlice", "params": [ { "name": "count", "type": "int" }, { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "1447681221", "predicate": "contacts.suggested", "params": [ { "name": "results", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Suggested" }, { "id": "364538944", "predicate": "messages.dialogs", "params": [ { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "1910543603", "predicate": "messages.dialogsSlice", "params": [ { "name": "count", "type": "int" }, { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "-1938715001", "predicate": "messages.messages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "189033187", "predicate": "messages.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "1694474197", "predicate": "messages.chats", "params": [ { "name": "chats", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "-438840932", "predicate": "messages.chatFull", "params": [ { "name": "full_chat", "type": "ChatFull" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.ChatFull" }, { "id": "-1269012015", "predicate": "messages.affectedHistory", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "1474492012", "predicate": "inputMessagesFilterEmpty", "params": [], "type": "MessagesFilter" }, { "id": "-1777752804", "predicate": "inputMessagesFilterPhotos", "params": [], "type": "MessagesFilter" }, { "id": "-1614803355", "predicate": "inputMessagesFilterVideo", "params": [], "type": "MessagesFilter" }, { "id": "1458172132", "predicate": "inputMessagesFilterPhotoVideo", "params": [], "type": "MessagesFilter" }, { "id": "-648121413", "predicate": "inputMessagesFilterPhotoVideoDocuments", "params": [], "type": "MessagesFilter" }, { "id": "-1629621880", "predicate": "inputMessagesFilterDocument", "params": [], "type": "MessagesFilter" }, { "id": "-808946398", "predicate": "inputMessagesFilterAudio", "params": [], "type": "MessagesFilter" }, { "id": "1526462308", "predicate": "inputMessagesFilterAudioDocuments", "params": [], "type": "MessagesFilter" }, { "id": "2129714567", "predicate": "inputMessagesFilterUrl", "params": [], "type": "MessagesFilter" }, { "id": "522914557", "predicate": "updateNewMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1318109142", "predicate": "updateMessageID", "params": [ { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Update" }, { "id": "-1576161051", "predicate": "updateDeleteMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1548249383", "predicate": "updateUserTyping", "params": [ { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "-1704596961", "predicate": "updateChatUserTyping", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "125178264", "predicate": "updateChatParticipants", "params": [ { "name": "participants", "type": "ChatParticipants" } ], "type": "Update" }, { "id": "469489699", "predicate": "updateUserStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "Update" }, { "id": "-1489818765", "predicate": "updateUserName", "params": [ { "name": "user_id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "Update" }, { "id": "-1791935732", "predicate": "updateUserPhoto", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "previous", "type": "Bool" } ], "type": "Update" }, { "id": "628472761", "predicate": "updateContactRegistered", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1657903163", "predicate": "updateContactLink", "params": [ { "name": "user_id", "type": "int" }, { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" } ], "type": "Update" }, { "id": "-1895411046", "predicate": "updateNewAuthorization", "params": [ { "name": "auth_key_id", "type": "long" }, { "name": "date", "type": "int" }, { "name": "device", "type": "string" }, { "name": "location", "type": "string" } ], "type": "Update" }, { "id": "-1519637954", "predicate": "updates.state", "params": [ { "name": "pts", "type": "int" }, { "name": "qts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "unread_count", "type": "int" } ], "type": "updates.State" }, { "id": "1567990072", "predicate": "updates.differenceEmpty", "params": [ { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "updates.Difference" }, { "id": "16030880", "predicate": "updates.difference", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-1459938943", "predicate": "updates.differenceSlice", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "intermediate_state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-484987010", "predicate": "updatesTooLong", "params": [], "type": "Updates" }, { "id": "-136766906", "predicate": "updateShortMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "-892863022", "predicate": "updateShortChatMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "chat_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "2027216577", "predicate": "updateShort", "params": [ { "name": "update", "type": "Update" }, { "name": "date", "type": "int" } ], "type": "Updates" }, { "id": "1918567619", "predicate": "updatesCombined", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq_start", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "1957577280", "predicate": "updates", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "-1916114267", "predicate": "photos.photos", "params": [ { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "352657236", "predicate": "photos.photosSlice", "params": [ { "name": "count", "type": "int" }, { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "539045032", "predicate": "photos.photo", "params": [ { "name": "photo", "type": "Photo" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photo" }, { "id": "157948117", "predicate": "upload.file", "params": [ { "name": "type", "type": "storage.FileType" }, { "name": "mtime", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "upload.File" }, { "id": "98092748", "predicate": "dcOption", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "ip_address", "type": "string" }, { "name": "port", "type": "int" } ], "type": "DcOption" }, { "id": "1311946900", "predicate": "config", "params": [ { "name": "date", "type": "int" }, { "name": "expires", "type": "int" }, { "name": "test_mode", "type": "Bool" }, { "name": "this_dc", "type": "int" }, { "name": "dc_options", "type": "Vector" }, { "name": "chat_size_max", "type": "int" }, { "name": "broadcast_size_max", "type": "int" }, { "name": "forwarded_count_max", "type": "int" }, { "name": "online_update_period_ms", "type": "int" }, { "name": "offline_blur_timeout_ms", "type": "int" }, { "name": "offline_idle_timeout_ms", "type": "int" }, { "name": "online_cloud_timeout_ms", "type": "int" }, { "name": "notify_cloud_delay_ms", "type": "int" }, { "name": "notify_default_delay_ms", "type": "int" }, { "name": "chat_big_size", "type": "int" }, { "name": "push_chat_period_ms", "type": "int" }, { "name": "push_chat_limit", "type": "int" }, { "name": "disabled_features", "type": "Vector" } ], "type": "Config" }, { "id": "-1910892683", "predicate": "nearestDc", "params": [ { "name": "country", "type": "string" }, { "name": "this_dc", "type": "int" }, { "name": "nearest_dc", "type": "int" } ], "type": "NearestDc" }, { "id": "-1987579119", "predicate": "help.appUpdate", "params": [ { "name": "id", "type": "int" }, { "name": "critical", "type": "Bool" }, { "name": "url", "type": "string" }, { "name": "text", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "-1000708810", "predicate": "help.noAppUpdate", "params": [], "type": "help.AppUpdate" }, { "id": "415997816", "predicate": "help.inviteText", "params": [ { "name": "message", "type": "string" } ], "type": "help.InviteText" }, { "id": "1662091044", "predicate": "wallPaperSolid", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "bg_color", "type": "int" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "314359194", "predicate": "updateNewEncryptedMessage", "params": [ { "name": "message", "type": "EncryptedMessage" }, { "name": "qts", "type": "int" } ], "type": "Update" }, { "id": "386986326", "predicate": "updateEncryptedChatTyping", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Update" }, { "id": "-1264392051", "predicate": "updateEncryption", "params": [ { "name": "chat", "type": "EncryptedChat" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "956179895", "predicate": "updateEncryptedMessagesRead", "params": [ { "name": "chat_id", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1417756512", "predicate": "encryptedChatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "1006044124", "predicate": "encryptedChatWaiting", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-931638658", "predicate": "encryptedChatRequested", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "-94974410", "predicate": "encryptedChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a_or_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "332848423", "predicate": "encryptedChatDiscarded", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-247351839", "predicate": "inputEncryptedChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedChat" }, { "id": "-1038136962", "predicate": "encryptedFileEmpty", "params": [], "type": "EncryptedFile" }, { "id": "1248893260", "predicate": "encryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "EncryptedFile" }, { "id": "406307684", "predicate": "inputEncryptedFileEmpty", "params": [], "type": "InputEncryptedFile" }, { "id": "1690108678", "predicate": "inputEncryptedFileUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "md5_checksum", "type": "string" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "1511503333", "predicate": "inputEncryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedFile" }, { "id": "-182231723", "predicate": "inputEncryptedFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-317144808", "predicate": "encryptedMessage", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" }, { "name": "file", "type": "EncryptedFile" } ], "type": "EncryptedMessage" }, { "id": "594758406", "predicate": "encryptedMessageService", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "EncryptedMessage" }, { "id": "-1058912715", "predicate": "messages.dhConfigNotModified", "params": [ { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "740433629", "predicate": "messages.dhConfig", "params": [ { "name": "g", "type": "int" }, { "name": "p", "type": "bytes" }, { "name": "version", "type": "int" }, { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "1443858741", "predicate": "messages.sentEncryptedMessage", "params": [ { "name": "date", "type": "int" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1802240206", "predicate": "messages.sentEncryptedFile", "params": [ { "name": "date", "type": "int" }, { "name": "file", "type": "EncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-95482955", "predicate": "inputFileBig", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" } ], "type": "InputFile" }, { "id": "767652808", "predicate": "inputEncryptedFileBigUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "-364179876", "predicate": "updateChatParticipantAdd", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1851755554", "predicate": "updateChatParticipantDelete", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1906403213", "predicate": "updateDcOptions", "params": [ { "name": "dc_options", "type": "Vector" } ], "type": "Update" }, { "id": "1313442987", "predicate": "inputMediaUploadedAudio", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1986820223", "predicate": "inputMediaAudio", "params": [ { "name": "id", "type": "InputAudio" } ], "type": "InputMedia" }, { "id": "-1610888", "predicate": "inputMediaUploadedDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "1095242886", "predicate": "inputMediaUploadedThumbDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "-779818943", "predicate": "inputMediaDocument", "params": [ { "name": "id", "type": "InputDocument" } ], "type": "InputMedia" }, { "id": "802824708", "predicate": "messageMediaDocument", "params": [ { "name": "document", "type": "Document" } ], "type": "MessageMedia" }, { "id": "-961117440", "predicate": "messageMediaAudio", "params": [ { "name": "audio", "type": "Audio" } ], "type": "MessageMedia" }, { "id": "-648356732", "predicate": "inputAudioEmpty", "params": [], "type": "InputAudio" }, { "id": "2010398975", "predicate": "inputAudio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputAudio" }, { "id": "1928391342", "predicate": "inputDocumentEmpty", "params": [], "type": "InputDocument" }, { "id": "410618194", "predicate": "inputDocument", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputDocument" }, { "id": "1960591437", "predicate": "inputAudioFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1313188841", "predicate": "inputDocumentFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1483311320", "predicate": "audioEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Audio" }, { "id": "-102543275", "predicate": "audio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" } ], "type": "Audio" }, { "id": "922273905", "predicate": "documentEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Document" }, { "id": "-106717361", "predicate": "document", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "attributes", "type": "Vector" } ], "type": "Document" }, { "id": "398898678", "predicate": "help.support", "params": [ { "name": "phone_number", "type": "string" }, { "name": "user", "type": "User" } ], "type": "help.Support" }, { "id": "-1613493288", "predicate": "notifyPeer", "params": [ { "name": "peer", "type": "Peer" } ], "type": "NotifyPeer" }, { "id": "-1261946036", "predicate": "notifyUsers", "params": [], "type": "NotifyPeer" }, { "id": "-1073230141", "predicate": "notifyChats", "params": [], "type": "NotifyPeer" }, { "id": "1959820384", "predicate": "notifyAll", "params": [], "type": "NotifyPeer" }, { "id": "-2131957734", "predicate": "updateUserBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "blocked", "type": "Bool" } ], "type": "Update" }, { "id": "-1094555409", "predicate": "updateNotifySettings", "params": [ { "name": "peer", "type": "NotifyPeer" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Update" }, { "id": "-484053553", "predicate": "auth.sentAppCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "381645902", "predicate": "sendMessageTypingAction", "params": [], "type": "SendMessageAction" }, { "id": "-44119819", "predicate": "sendMessageCancelAction", "params": [], "type": "SendMessageAction" }, { "id": "-1584933265", "predicate": "sendMessageRecordVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-378127636", "predicate": "sendMessageUploadVideoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-718310409", "predicate": "sendMessageRecordAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-212740181", "predicate": "sendMessageUploadAudioAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-774682074", "predicate": "sendMessageUploadPhotoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-1441998364", "predicate": "sendMessageUploadDocumentAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "393186209", "predicate": "sendMessageGeoLocationAction", "params": [], "type": "SendMessageAction" }, { "id": "1653390447", "predicate": "sendMessageChooseContactAction", "params": [], "type": "SendMessageAction" }, { "id": "446822276", "predicate": "contacts.found", "params": [ { "name": "results", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Found" }, { "id": "942527460", "predicate": "updateServiceNotification", "params": [ { "name": "type", "type": "string" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" }, { "name": "popup", "type": "Bool" } ], "type": "Update" }, { "id": "-496024847", "predicate": "userStatusRecently", "params": [], "type": "UserStatus" }, { "id": "129960444", "predicate": "userStatusLastWeek", "params": [], "type": "UserStatus" }, { "id": "2011940674", "predicate": "userStatusLastMonth", "params": [], "type": "UserStatus" }, { "id": "-298113238", "predicate": "updatePrivacy", "params": [ { "name": "key", "type": "PrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "Update" }, { "id": "1335282456", "predicate": "inputPrivacyKeyStatusTimestamp", "params": [], "type": "InputPrivacyKey" }, { "id": "-1137792208", "predicate": "privacyKeyStatusTimestamp", "params": [], "type": "PrivacyKey" }, { "id": "218751099", "predicate": "inputPrivacyValueAllowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "407582158", "predicate": "inputPrivacyValueAllowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "320652927", "predicate": "inputPrivacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "195371015", "predicate": "inputPrivacyValueDisallowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "-697604407", "predicate": "inputPrivacyValueDisallowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "-1877932953", "predicate": "inputPrivacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "-123988", "predicate": "privacyValueAllowContacts", "params": [], "type": "PrivacyRule" }, { "id": "1698855810", "predicate": "privacyValueAllowAll", "params": [], "type": "PrivacyRule" }, { "id": "1297858060", "predicate": "privacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "-125240806", "predicate": "privacyValueDisallowContacts", "params": [], "type": "PrivacyRule" }, { "id": "-1955338397", "predicate": "privacyValueDisallowAll", "params": [], "type": "PrivacyRule" }, { "id": "209668535", "predicate": "privacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "1430961007", "predicate": "account.privacyRules", "params": [ { "name": "rules", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "-1194283041", "predicate": "accountDaysTTL", "params": [ { "name": "days", "type": "int" } ], "type": "AccountDaysTTL" }, { "id": "-1527411636", "predicate": "account.sentChangePhoneCode", "params": [ { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" } ], "type": "account.SentChangePhoneCode" }, { "id": "314130811", "predicate": "updateUserPhone", "params": [ { "name": "user_id", "type": "int" }, { "name": "phone", "type": "string" } ], "type": "Update" }, { "id": "1815593308", "predicate": "documentAttributeImageSize", "params": [ { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "297109817", "predicate": "documentAttributeAnimated", "params": [], "type": "DocumentAttribute" }, { "id": "978674434", "predicate": "documentAttributeSticker", "params": [ { "name": "alt", "type": "string" }, { "name": "stickerset", "type": "InputStickerSet" } ], "type": "DocumentAttribute" }, { "id": "1494273227", "predicate": "documentAttributeVideo", "params": [ { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "-556656416", "predicate": "documentAttributeAudio", "params": [ { "name": "duration", "type": "int" }, { "name": "title", "type": "string" }, { "name": "performer", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "358154344", "predicate": "documentAttributeFilename", "params": [ { "name": "file_name", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "-244016606", "predicate": "messages.stickersNotModified", "params": [], "type": "messages.Stickers" }, { "id": "-1970352846", "predicate": "messages.stickers", "params": [ { "name": "hash", "type": "string" }, { "name": "stickers", "type": "Vector" } ], "type": "messages.Stickers" }, { "id": "313694676", "predicate": "stickerPack", "params": [ { "name": "emoticon", "type": "string" }, { "name": "documents", "type": "Vector" } ], "type": "StickerPack" }, { "id": "-395967805", "predicate": "messages.allStickersNotModified", "params": [], "type": "messages.AllStickers" }, { "id": "-719474725", "predicate": "messages.allStickers", "params": [ { "name": "hash", "type": "string" }, { "name": "sets", "type": "Vector" } ], "type": "messages.AllStickers" }, { "id": "-1369215196", "predicate": "disabledFeature", "params": [ { "name": "feature", "type": "string" }, { "name": "description", "type": "string" } ], "type": "DisabledFeature" }, { "id": "-1721631396", "predicate": "updateReadHistoryInbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "791617983", "predicate": "updateReadHistoryOutbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-2066640507", "predicate": "messages.affectedMessages", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "1599050311", "predicate": "contactLinkUnknown", "params": [], "type": "ContactLink" }, { "id": "-17968211", "predicate": "contactLinkNone", "params": [], "type": "ContactLink" }, { "id": "646922073", "predicate": "contactLinkHasPhone", "params": [], "type": "ContactLink" }, { "id": "-721239344", "predicate": "contactLinkContact", "params": [], "type": "ContactLink" }, { "id": "2139689491", "predicate": "updateWebPage", "params": [ { "name": "webpage", "type": "WebPage" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-350980120", "predicate": "webPageEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "WebPage" }, { "id": "-981018084", "predicate": "webPagePending", "params": [ { "name": "id", "type": "long" }, { "name": "date", "type": "int" } ], "type": "WebPage" }, { "id": "-897446185", "predicate": "webPage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "long" }, { "name": "url", "type": "string" }, { "name": "display_url", "type": "string" }, { "name": "type", "type": "flags.0?string" }, { "name": "site_name", "type": "flags.1?string" }, { "name": "title", "type": "flags.2?string" }, { "name": "description", "type": "flags.3?string" }, { "name": "photo", "type": "flags.4?Photo" }, { "name": "embed_url", "type": "flags.5?string" }, { "name": "embed_type", "type": "flags.5?string" }, { "name": "embed_width", "type": "flags.6?int" }, { "name": "embed_height", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "author", "type": "flags.8?string" }, { "name": "document", "type": "flags.9?Document" } ], "type": "WebPage" }, { "id": "-1557277184", "predicate": "messageMediaWebPage", "params": [ { "name": "webpage", "type": "WebPage" } ], "type": "MessageMedia" }, { "id": "2079516406", "predicate": "authorization", "params": [ { "name": "hash", "type": "long" }, { "name": "flags", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "platform", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "api_id", "type": "int" }, { "name": "app_name", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "date_created", "type": "int" }, { "name": "date_active", "type": "int" }, { "name": "ip", "type": "string" }, { "name": "country", "type": "string" }, { "name": "region", "type": "string" } ], "type": "Authorization" }, { "id": "307276766", "predicate": "account.authorizations", "params": [ { "name": "authorizations", "type": "Vector" } ], "type": "account.Authorizations" }, { "id": "-1764049896", "predicate": "account.noPassword", "params": [ { "name": "new_salt", "type": "bytes" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "2081952796", "predicate": "account.password", "params": [ { "name": "current_salt", "type": "bytes" }, { "name": "new_salt", "type": "bytes" }, { "name": "hint", "type": "string" }, { "name": "has_recovery", "type": "Bool" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "-1212732749", "predicate": "account.passwordSettings", "params": [ { "name": "email", "type": "string" } ], "type": "account.PasswordSettings" }, { "id": "-1124314324", "predicate": "account.passwordInputSettings", "params": [ { "name": "flags", "type": "#" }, { "name": "new_salt", "type": "flags.0?bytes" }, { "name": "new_password_hash", "type": "flags.0?bytes" }, { "name": "hint", "type": "flags.0?string" }, { "name": "email", "type": "flags.1?string" } ], "type": "account.PasswordInputSettings" }, { "id": "326715557", "predicate": "auth.passwordRecovery", "params": [ { "name": "email_pattern", "type": "string" } ], "type": "auth.PasswordRecovery" }, { "id": "673687578", "predicate": "inputMediaVenue", "params": [ { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "InputMedia" }, { "id": "2031269663", "predicate": "messageMediaVenue", "params": [ { "name": "geo", "type": "GeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "MessageMedia" }, { "id": "-1551583367", "predicate": "receivedNotifyMessage", "params": [ { "name": "id", "type": "int" }, { "name": "flags", "type": "int" } ], "type": "ReceivedNotifyMessage" }, { "id": "1776236393", "predicate": "chatInviteEmpty", "params": [], "type": "ExportedChatInvite" }, { "id": "-64092740", "predicate": "chatInviteExported", "params": [ { "name": "link", "type": "string" } ], "type": "ExportedChatInvite" }, { "id": "1516793212", "predicate": "chatInviteAlready", "params": [ { "name": "chat", "type": "Chat" } ], "type": "ChatInvite" }, { "id": "-1813406880", "predicate": "chatInvite", "params": [ { "name": "flags", "type": "#" }, { "name": "title", "type": "string" } ], "type": "ChatInvite" }, { "id": "-123931160", "predicate": "messageActionChatJoinedByLink", "params": [ { "name": "inviter_id", "type": "int" } ], "type": "MessageAction" }, { "id": "1757493555", "predicate": "updateReadMessagesContents", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-4838507", "predicate": "inputStickerSetEmpty", "params": [], "type": "InputStickerSet" }, { "id": "-1645763991", "predicate": "inputStickerSetID", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputStickerSet" }, { "id": "-2044933984", "predicate": "inputStickerSetShortName", "params": [ { "name": "short_name", "type": "string" } ], "type": "InputStickerSet" }, { "id": "-852477119", "predicate": "stickerSet", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "short_name", "type": "string" }, { "name": "count", "type": "int" }, { "name": "hash", "type": "int" } ], "type": "StickerSet" }, { "id": "-1240849242", "predicate": "messages.stickerSet", "params": [ { "name": "set", "type": "StickerSet" }, { "name": "packs", "type": "Vector" }, { "name": "documents", "type": "Vector" } ], "type": "messages.StickerSet" }, { "id": "585404530", "predicate": "user", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "flags.0?long" }, { "name": "first_name", "type": "flags.1?string" }, { "name": "last_name", "type": "flags.2?string" }, { "name": "username", "type": "flags.3?string" }, { "name": "phone", "type": "flags.4?string" }, { "name": "photo", "type": "flags.5?UserProfilePhoto" }, { "name": "status", "type": "flags.6?UserStatus" }, { "name": "bot_info_version", "type": "flags.14?int" } ], "type": "User" }, { "id": "-1032140601", "predicate": "botCommand", "params": [ { "name": "command", "type": "string" }, { "name": "description", "type": "string" } ], "type": "BotCommand" }, { "id": "-1154598962", "predicate": "botInfoEmpty", "params": [], "type": "BotInfo" }, { "id": "164583517", "predicate": "botInfo", "params": [ { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" }, { "name": "share_text", "type": "string" }, { "name": "description", "type": "string" }, { "name": "commands", "type": "Vector" } ], "type": "BotInfo" }, { "id": "-1560655744", "predicate": "keyboardButton", "params": [ { "name": "text", "type": "string" } ], "type": "KeyboardButton" }, { "id": "2002815875", "predicate": "keyboardButtonRow", "params": [ { "name": "buttons", "type": "Vector" } ], "type": "KeyboardButtonRow" }, { "id": "-1606526075", "predicate": "replyKeyboardHide", "params": [ { "name": "flags", "type": "#" } ], "type": "ReplyMarkup" }, { "id": "-200242528", "predicate": "replyKeyboardForceReply", "params": [ { "name": "flags", "type": "#" } ], "type": "ReplyMarkup" }, { "id": "889353612", "predicate": "replyKeyboardMarkup", "params": [ { "name": "flags", "type": "#" }, { "name": "rows", "type": "Vector" } ], "type": "ReplyMarkup" }, { "id": "2072935910", "predicate": "inputPeerUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "-668391402", "predicate": "inputUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputUser" }, { "id": "-1350696044", "predicate": "help.appChangelogEmpty", "params": [], "type": "help.AppChangelog" }, { "id": "1181279933", "predicate": "help.appChangelog", "params": [ { "name": "text", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-1148011883", "predicate": "messageEntityUnknown", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-100378723", "predicate": "messageEntityMention", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1868782349", "predicate": "messageEntityHashtag", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1827637959", "predicate": "messageEntityBotCommand", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1859134776", "predicate": "messageEntityUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1692693954", "predicate": "messageEntityEmail", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-1117713463", "predicate": "messageEntityBold", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-2106619040", "predicate": "messageEntityItalic", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "681706865", "predicate": "messageEntityCode", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1938967520", "predicate": "messageEntityPre", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "language", "type": "string" } ], "type": "MessageEntity" }, { "id": "1990644519", "predicate": "messageEntityTextUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "url", "type": "string" } ], "type": "MessageEntity" }, { "id": "301019932", "predicate": "updateShortSentMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "-292807034", "predicate": "inputChannelEmpty", "params": [], "type": "InputChannel" }, { "id": "-1343524562", "predicate": "inputChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputChannel" }, { "id": "-1109531342", "predicate": "peerChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Peer" }, { "id": "548253432", "predicate": "inputPeerChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "1737397639", "predicate": "channel", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "username", "type": "flags.6?string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Chat" }, { "id": "763724588", "predicate": "channelForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" } ], "type": "Chat" }, { "id": "2131196633", "predicate": "contacts.resolvedPeer", "params": [ { "name": "peer", "type": "Peer" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ResolvedPeer" }, { "id": "-88925533", "predicate": "channelFull", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "about", "type": "string" }, { "name": "participants_count", "type": "flags.0?int" }, { "name": "admins_count", "type": "flags.1?int" }, { "name": "kicked_count", "type": "flags.2?int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" } ], "type": "ChatFull" }, { "id": "1535415986", "predicate": "dialogChannel", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "top_important_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "pts", "type": "int" } ], "type": "Dialog" }, { "id": "182649427", "predicate": "messageRange", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "MessageRange" }, { "id": "-399216813", "predicate": "messageGroup", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "count", "type": "int" }, { "name": "date", "type": "int" } ], "type": "MessageGroup" }, { "id": "-1139861572", "predicate": "messages.channelMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "pts", "type": "int" }, { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "collapsed", "type": "flags.0?Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "-1781355374", "predicate": "messageActionChannelCreate", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "1620337698", "predicate": "updateChannelTooLong", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Update" }, { "id": "-1227598250", "predicate": "updateChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Update" }, { "id": "-1016324548", "predicate": "updateChannelGroup", "params": [ { "name": "channel_id", "type": "int" }, { "name": "group", "type": "MessageGroup" } ], "type": "Update" }, { "id": "1656358105", "predicate": "updateNewChannelMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1108669311", "predicate": "updateReadChannelInbox", "params": [ { "name": "channel_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "Update" }, { "id": "-1015733815", "predicate": "updateDeleteChannelMessages", "params": [ { "name": "channel_id", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-1734268085", "predicate": "updateChannelMessageViews", "params": [ { "name": "channel_id", "type": "int" }, { "name": "id", "type": "int" }, { "name": "views", "type": "int" } ], "type": "Update" }, { "id": "1041346555", "predicate": "updates.channelDifferenceEmpty", "params": [ { "name": "flags", "type": "#" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" } ], "type": "updates.ChannelDifference" }, { "id": "1578530374", "predicate": "updates.channelDifferenceTooLong", "params": [ { "name": "flags", "type": "#" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "top_message", "type": "int" }, { "name": "top_important_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "updates.ChannelDifference" }, { "id": "543450958", "predicate": "updates.channelDifference", "params": [ { "name": "flags", "type": "#" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "new_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "updates.ChannelDifference" }, { "id": "-1798033689", "predicate": "channelMessagesFilterEmpty", "params": [], "type": "ChannelMessagesFilter" }, { "id": "-847783593", "predicate": "channelMessagesFilter", "params": [ { "name": "flags", "type": "#" }, { "name": "ranges", "type": "Vector" } ], "type": "ChannelMessagesFilter" }, { "id": "-100588754", "predicate": "channelMessagesFilterCollapsed", "params": [], "type": "ChannelMessagesFilter" }, { "id": "367766557", "predicate": "channelParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1557620115", "predicate": "channelParticipantSelf", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1861910545", "predicate": "channelParticipantModerator", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1743180447", "predicate": "channelParticipantEditor", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1933187430", "predicate": "channelParticipantKicked", "params": [ { "name": "user_id", "type": "int" }, { "name": "kicked_by", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-471670279", "predicate": "channelParticipantCreator", "params": [ { "name": "user_id", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-566281095", "predicate": "channelParticipantsRecent", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-1268741783", "predicate": "channelParticipantsAdmins", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "1010285434", "predicate": "channelParticipantsKicked", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-1299865402", "predicate": "channelRoleEmpty", "params": [], "type": "ChannelParticipantRole" }, { "id": "-1776756363", "predicate": "channelRoleModerator", "params": [], "type": "ChannelParticipantRole" }, { "id": "-2113143156", "predicate": "channelRoleEditor", "params": [], "type": "ChannelParticipantRole" }, { "id": "-177282392", "predicate": "channels.channelParticipants", "params": [ { "name": "count", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "channels.ChannelParticipants" }, { "id": "-791039645", "predicate": "channels.channelParticipant", "params": [ { "name": "participant", "type": "ChannelParticipant" }, { "name": "users", "type": "Vector" } ], "type": "channels.ChannelParticipant" } ], "methods": [ { "id": "-878758099", "method": "invokeAfterMsg", "params": [ { "name": "msg_id", "type": "long" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1036301552", "method": "invokeAfterMsgs", "params": [ { "name": "msg_ids", "type": "Vector" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1877286395", "method": "auth.checkPhone", "params": [ { "name": "phone_number", "type": "string" } ], "type": "auth.CheckedPhone" }, { "id": "1988976461", "method": "auth.sendCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "sms_type", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "auth.SentCode" }, { "id": "63247716", "method": "auth.sendCall", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "453408308", "method": "auth.signUp", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1126886015", "method": "auth.signIn", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "1461180992", "method": "auth.logOut", "params": [], "type": "Bool" }, { "id": "-1616179942", "method": "auth.resetAuthorizations", "params": [], "type": "Bool" }, { "id": "1998331287", "method": "auth.sendInvites", "params": [ { "name": "phone_numbers", "type": "Vector" }, { "name": "message", "type": "string" } ], "type": "Bool" }, { "id": "-440401971", "method": "auth.exportAuthorization", "params": [ { "name": "dc_id", "type": "int" } ], "type": "auth.ExportedAuthorization" }, { "id": "-470837741", "method": "auth.importAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-841733627", "method": "auth.bindTempAuthKey", "params": [ { "name": "perm_auth_key_id", "type": "long" }, { "name": "nonce", "type": "long" }, { "name": "expires_at", "type": "int" }, { "name": "encrypted_message", "type": "bytes" } ], "type": "Bool" }, { "id": "1147957548", "method": "account.registerDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "app_sandbox", "type": "Bool" }, { "name": "lang_code", "type": "string" } ], "type": "Bool" }, { "id": "1707432768", "method": "account.unregisterDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" } ], "type": "Bool" }, { "id": "-2067899501", "method": "account.updateNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" }, { "name": "settings", "type": "InputPeerNotifySettings" } ], "type": "Bool" }, { "id": "313765169", "method": "account.getNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" } ], "type": "PeerNotifySettings" }, { "id": "-612493497", "method": "account.resetNotifySettings", "params": [], "type": "Bool" }, { "id": "-259486360", "method": "account.updateProfile", "params": [ { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "User" }, { "id": "1713919532", "method": "account.updateStatus", "params": [ { "name": "offline", "type": "Bool" } ], "type": "Bool" }, { "id": "-1068696894", "method": "account.getWallPapers", "params": [], "type": "Vector" }, { "id": "227648840", "method": "users.getUsers", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-902781519", "method": "users.getFullUser", "params": [ { "name": "id", "type": "InputUser" } ], "type": "UserFull" }, { "id": "-995929106", "method": "contacts.getStatuses", "params": [], "type": "Vector" }, { "id": "583445000", "method": "contacts.getContacts", "params": [ { "name": "hash", "type": "string" } ], "type": "contacts.Contacts" }, { "id": "-634342611", "method": "contacts.importContacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "replace", "type": "Bool" } ], "type": "contacts.ImportedContacts" }, { "id": "-847825880", "method": "contacts.getSuggested", "params": [ { "name": "limit", "type": "int" } ], "type": "contacts.Suggested" }, { "id": "-1902823612", "method": "contacts.deleteContact", "params": [ { "name": "id", "type": "InputUser" } ], "type": "contacts.Link" }, { "id": "1504393374", "method": "contacts.deleteContacts", "params": [ { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "858475004", "method": "contacts.block", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-448724803", "method": "contacts.unblock", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-176409329", "method": "contacts.getBlocked", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "contacts.Blocked" }, { "id": "-2065352905", "method": "contacts.exportCard", "params": [], "type": "Vector" }, { "id": "1340184318", "method": "contacts.importCard", "params": [ { "name": "export_card", "type": "Vector" } ], "type": "User" }, { "id": "1109588596", "method": "messages.getMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "-2053423812", "method": "messages.getDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-1970355494", "method": "messages.getHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset_id", "type": "int" }, { "name": "add_offset", "type": "int" }, { "name": "limit", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" } ], "type": "messages.Messages" }, { "id": "-732523960", "method": "messages.search", "params": [ { "name": "flags", "type": "#" }, { "name": "peer", "type": "InputPeer" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "-1336990448", "method": "messages.readHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-185009311", "method": "messages.deleteHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-1510897371", "method": "messages.deleteMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "94983360", "method": "messages.receivedMessages", "params": [ { "name": "max_id", "type": "int" } ], "type": "Vector" }, { "id": "-1551737264", "method": "messages.setTyping", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Bool" }, { "id": "-91733382", "method": "messages.sendMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" }, { "name": "entities", "type": "flags.3?Vector" } ], "type": "Updates" }, { "id": "-923703407", "method": "messages.sendMedia", "params": [ { "name": "flags", "type": "#" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "Updates" }, { "id": "1888354709", "method": "messages.forwardMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "from_peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "random_id", "type": "Vector" }, { "name": "to_peer", "type": "InputPeer" } ], "type": "Updates" }, { "id": "-820669733", "method": "messages.reportSpam", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "Bool" }, { "id": "1013621127", "method": "messages.getChats", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "998448230", "method": "messages.getFullChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "messages.ChatFull" }, { "id": "-599447467", "method": "messages.editChatTitle", "params": [ { "name": "chat_id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-900957736", "method": "messages.editChatPhoto", "params": [ { "name": "chat_id", "type": "int" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-106911223", "method": "messages.addChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "fwd_limit", "type": "int" } ], "type": "Updates" }, { "id": "-530505962", "method": "messages.deleteChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" } ], "type": "Updates" }, { "id": "164303470", "method": "messages.createChat", "params": [ { "name": "users", "type": "Vector" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-304838614", "method": "updates.getState", "params": [], "type": "updates.State" }, { "id": "168039573", "method": "updates.getDifference", "params": [ { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "qts", "type": "int" } ], "type": "updates.Difference" }, { "id": "-285902432", "method": "photos.updateProfilePhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "UserProfilePhoto" }, { "id": "-720397176", "method": "photos.uploadProfilePhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "photos.Photo" }, { "id": "-2016444625", "method": "photos.deletePhotos", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-1291540959", "method": "upload.saveFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "-475607115", "method": "upload.getFile", "params": [ { "name": "location", "type": "InputFileLocation" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "upload.File" }, { "id": "-990308245", "method": "help.getConfig", "params": [], "type": "Config" }, { "id": "531836966", "method": "help.getNearestDc", "params": [], "type": "NearestDc" }, { "id": "-938300290", "method": "help.getAppUpdate", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "1862465352", "method": "help.saveAppLog", "params": [ { "name": "events", "type": "Vector" } ], "type": "Bool" }, { "id": "-1532407418", "method": "help.getInviteText", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.InviteText" }, { "id": "-1848823128", "method": "photos.getUserPhotos", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "long" }, { "name": "limit", "type": "int" } ], "type": "photos.Photos" }, { "id": "865483769", "method": "messages.forwardMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Updates" }, { "id": "-1082919718", "method": "messages.sendBroadcast", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "random_id", "type": "Vector" }, { "name": "message", "type": "string" }, { "name": "media", "type": "InputMedia" } ], "type": "Updates" }, { "id": "651135312", "method": "messages.getDhConfig", "params": [ { "name": "version", "type": "int" }, { "name": "random_length", "type": "int" } ], "type": "messages.DhConfig" }, { "id": "-162681021", "method": "messages.requestEncryption", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "random_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "1035731989", "method": "messages.acceptEncryption", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "g_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "-304536635", "method": "messages.discardEncryption", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Bool" }, { "id": "2031374829", "method": "messages.setEncryptedTyping", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "2135648522", "method": "messages.readEncryptedHistory", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "max_date", "type": "int" } ], "type": "Bool" }, { "id": "-1451792525", "method": "messages.sendEncrypted", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1701831834", "method": "messages.sendEncryptedFile", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" }, { "name": "file", "type": "InputEncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "852769188", "method": "messages.sendEncryptedService", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "1436924774", "method": "messages.receivedQueue", "params": [ { "name": "max_qts", "type": "int" } ], "type": "Vector" }, { "id": "-562337987", "method": "upload.saveBigFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "file_total_parts", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "1769565673", "method": "initConnection", "params": [ { "name": "api_id", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-1663104819", "method": "help.getSupport", "params": [], "type": "help.Support" }, { "id": "229241832", "method": "auth.sendSms", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "916930423", "method": "messages.readMessageContents", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "655677548", "method": "account.checkUsername", "params": [ { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "1040964988", "method": "account.updateUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "301470424", "method": "contacts.search", "params": [ { "name": "q", "type": "string" }, { "name": "limit", "type": "int" } ], "type": "contacts.Found" }, { "id": "-623130288", "method": "account.getPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" } ], "type": "account.PrivacyRules" }, { "id": "-906486552", "method": "account.setPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "1099779595", "method": "account.deleteAccount", "params": [ { "name": "reason", "type": "string" } ], "type": "Bool" }, { "id": "150761757", "method": "account.getAccountTTL", "params": [], "type": "AccountDaysTTL" }, { "id": "608323678", "method": "account.setAccountTTL", "params": [ { "name": "ttl", "type": "AccountDaysTTL" } ], "type": "Bool" }, { "id": "-627372787", "method": "invokeWithLayer", "params": [ { "name": "layer", "type": "int" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-113456221", "method": "contacts.resolveUsername", "params": [ { "name": "username", "type": "string" } ], "type": "contacts.ResolvedPeer" }, { "id": "-1543001868", "method": "account.sendChangePhoneCode", "params": [ { "name": "phone_number", "type": "string" } ], "type": "account.SentChangePhoneCode" }, { "id": "1891839707", "method": "account.changePhone", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "User" }, { "id": "-1373446075", "method": "messages.getStickers", "params": [ { "name": "emoticon", "type": "string" }, { "name": "hash", "type": "string" } ], "type": "messages.Stickers" }, { "id": "-1438922648", "method": "messages.getAllStickers", "params": [ { "name": "hash", "type": "string" } ], "type": "messages.AllStickers" }, { "id": "954152242", "method": "account.updateDeviceLocked", "params": [ { "name": "period", "type": "int" } ], "type": "Bool" }, { "id": "1738800940", "method": "auth.importBotAuthorization", "params": [ { "name": "flags", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "bot_auth_token", "type": "string" } ], "type": "auth.Authorization" }, { "id": "623001124", "method": "messages.getWebPagePreview", "params": [ { "name": "message", "type": "string" } ], "type": "MessageMedia" }, { "id": "-484392616", "method": "account.getAuthorizations", "params": [], "type": "account.Authorizations" }, { "id": "-545786948", "method": "account.resetAuthorization", "params": [ { "name": "hash", "type": "long" } ], "type": "Bool" }, { "id": "1418342645", "method": "account.getPassword", "params": [], "type": "account.Password" }, { "id": "-1131605573", "method": "account.getPasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" } ], "type": "account.PasswordSettings" }, { "id": "-92517498", "method": "account.updatePasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" }, { "name": "new_settings", "type": "account.PasswordInputSettings" } ], "type": "Bool" }, { "id": "174260510", "method": "auth.checkPassword", "params": [ { "name": "password_hash", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-661144474", "method": "auth.requestPasswordRecovery", "params": [], "type": "auth.PasswordRecovery" }, { "id": "1319464594", "method": "auth.recoverPassword", "params": [ { "name": "code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1080796745", "method": "invokeWithoutUpdates", "params": [ { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "2106086025", "method": "messages.exportChatInvite", "params": [ { "name": "chat_id", "type": "int" } ], "type": "ExportedChatInvite" }, { "id": "1051570619", "method": "messages.checkChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "ChatInvite" }, { "id": "1817183516", "method": "messages.importChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "Updates" }, { "id": "639215886", "method": "messages.getStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "messages.StickerSet" }, { "id": "2066793382", "method": "messages.installStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" }, { "name": "disabled", "type": "Bool" } ], "type": "Bool" }, { "id": "-110209570", "method": "messages.uninstallStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "Bool" }, { "id": "457052156", "method": "messages.startBot", "params": [ { "name": "bot", "type": "InputUser" }, { "name": "chat_id", "type": "int" }, { "name": "random_id", "type": "long" }, { "name": "start_param", "type": "string" } ], "type": "Updates" }, { "id": "1537966002", "method": "help.getAppChangelog", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-993483427", "method": "messages.getMessagesViews", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "increment", "type": "Bool" } ], "type": "Vector" }, { "id": "-1445735863", "method": "channels.getDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-575067701", "method": "channels.getImportantHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "offset_id", "type": "int" }, { "name": "add_offset", "type": "int" }, { "name": "limit", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" } ], "type": "messages.Messages" }, { "id": "-871347913", "method": "channels.readHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "max_id", "type": "int" } ], "type": "Bool" }, { "id": "-2067661490", "method": "channels.deleteMessages", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "-787622117", "method": "channels.deleteUserHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" } ], "type": "messages.AffectedHistory" }, { "id": "-32999408", "method": "channels.reportSpam", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "-1814580409", "method": "channels.getMessages", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "618237842", "method": "channels.getParticipants", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "filter", "type": "ChannelParticipantsFilter" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "channels.ChannelParticipants" }, { "id": "1416484774", "method": "channels.getParticipant", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" } ], "type": "channels.ChannelParticipant" }, { "id": "176122811", "method": "channels.getChannels", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "141781513", "method": "channels.getFullChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "messages.ChatFull" }, { "id": "1428281412", "method": "channels.createChannel", "params": [ { "name": "flags", "type": "#" }, { "name": "title", "type": "string" }, { "name": "about", "type": "string" }, { "name": "users", "type": "Vector" } ], "type": "Updates" }, { "id": "333610782", "method": "channels.editAbout", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "about", "type": "string" } ], "type": "Bool" }, { "id": "1387358562", "method": "channels.editAdmin", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "role", "type": "ChannelParticipantRole" } ], "type": "Bool" }, { "id": "1450044624", "method": "channels.editTitle", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-248621111", "method": "channels.editPhoto", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-1432183160", "method": "channels.toggleComments", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "283557164", "method": "channels.checkUsername", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "890549214", "method": "channels.updateUsername", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "615851205", "method": "channels.joinChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "-130635115", "method": "channels.leaveChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "429865580", "method": "channels.inviteToChannel", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "users", "type": "Vector" } ], "type": "Updates" }, { "id": "-1502421484", "method": "channels.kickFromChannel", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "kicked", "type": "Bool" } ], "type": "Updates" }, { "id": "-950663035", "method": "channels.exportInvite", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "ExportedChatInvite" }, { "id": "-1072619549", "method": "channels.deleteChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "-1154295872", "method": "updates.getChannelDifference", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "filter", "type": "ChannelMessagesFilter" }, { "name": "pts", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "updates.ChannelDifference" } ] }===8=== decryptedMessage#1f814f1f random_id:long random_bytes:bytes message:string media:DecryptedMessageMedia = DecryptedMessage; decryptedMessageService#aa48327d random_id:long random_bytes:bytes action:DecryptedMessageAction = DecryptedMessage; decryptedMessageMediaEmpty#89f5c4a = DecryptedMessageMedia; decryptedMessageMediaPhoto#32798a8c thumb:bytes thumb_w:int thumb_h:int w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia; decryptedMessageMediaVideo#4cee6ef3 thumb:bytes thumb_w:int thumb_h:int duration:int w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia; decryptedMessageMediaGeoPoint#35480a59 lat:double long:double = DecryptedMessageMedia; decryptedMessageMediaContact#588a0a97 phone_number:string first_name:string last_name:string user_id:int = DecryptedMessageMedia; decryptedMessageActionSetMessageTTL#a1733aec ttl_seconds:int = DecryptedMessageAction; decryptedMessageMediaDocument#b095434b thumb:bytes thumb_w:int thumb_h:int file_name:string mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia; decryptedMessageMediaAudio#6080758f duration:int size:int key:bytes iv:bytes = DecryptedMessageMedia; decryptedMessageActionReadMessages#c4f40be random_ids:Vector = DecryptedMessageAction; decryptedMessageActionDeleteMessages#65614304 random_ids:Vector = DecryptedMessageAction; decryptedMessageActionScreenshotMessages#8ac1f475 random_ids:Vector = DecryptedMessageAction; decryptedMessageActionFlushHistory#6719e45c = DecryptedMessageAction; ===17=== decryptedMessage#204d3878 random_id:long ttl:int message:string media:DecryptedMessageMedia = DecryptedMessage; decryptedMessageService#73164160 random_id:long action:DecryptedMessageAction = DecryptedMessage; decryptedMessageMediaVideo#524a415d thumb:bytes thumb_w:int thumb_h:int duration:int mime_type:string w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia; decryptedMessageMediaAudio#57e0a9cb duration:int mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia; decryptedMessageLayer#1be31789 random_bytes:bytes layer:int in_seq_no:int out_seq_no:int message:DecryptedMessage = DecryptedMessageLayer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#92042ff7 = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#e6ac8a6f = SendMessageAction; sendMessageUploadPhotoAction#990a3c1a = SendMessageAction; sendMessageUploadDocumentAction#8faee98e = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; decryptedMessageActionResend#511110b0 start_seq_no:int end_seq_no:int = DecryptedMessageAction; decryptedMessageActionNotifyLayer#f3048883 layer:int = DecryptedMessageAction; decryptedMessageActionTyping#ccb27641 action:SendMessageAction = DecryptedMessageAction; ===20=== decryptedMessageActionRequestKey#f3c9611b exchange_id:long g_a:bytes = DecryptedMessageAction; decryptedMessageActionAcceptKey#6fe1735b exchange_id:long g_b:bytes key_fingerprint:long = DecryptedMessageAction; decryptedMessageActionAbortKey#dd05ec6b exchange_id:long = DecryptedMessageAction; decryptedMessageActionCommitKey#ec2e0b9b exchange_id:long key_fingerprint:long = DecryptedMessageAction; decryptedMessageActionNoop#a82fdd63 = DecryptedMessageAction; ===23=== documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#fb0a5727 = DocumentAttribute; documentAttributeVideo#5910cccb duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#51448e5 duration:int = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation; decryptedMessageMediaExternalDocument#fa95b0dd id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int attributes:Vector = DecryptedMessageMedia; ===45=== decryptedMessage#36b091de flags:# random_id:long ttl:int message:string media:flags.9?DecryptedMessageMedia entities:flags.7?Vector via_bot_name:flags.11?string reply_to_random_id:flags.3?long = DecryptedMessage; decryptedMessageMediaPhoto#f1fa8d78 thumb:bytes thumb_w:int thumb_h:int w:int h:int size:int key:bytes iv:bytes caption:string = DecryptedMessageMedia; decryptedMessageMediaVideo#970c8c0e thumb:bytes thumb_w:int thumb_h:int duration:int mime_type:string w:int h:int size:int key:bytes iv:bytes caption:string = DecryptedMessageMedia; decryptedMessageMediaDocument#7afe8ae2 thumb:bytes thumb_w:int thumb_h:int mime_type:string size:int key:bytes iv:bytes attributes:Vector caption:string = DecryptedMessageMedia; ===46=== decryptedMessageMediaVenue#8a0df56f lat:double long:double title:string address:string provider:string venue_id:string = DecryptedMessageMedia; documentAttributeAudio#ded218e0 duration:int title:string performer:string = DocumentAttribute; decryptedMessageMediaWebPage#e50511d8 url:string = DecryptedMessageMedia; ===55=== documentAttributeSticker#3a556302 alt:string stickerset:InputStickerSet = DocumentAttribute; ===66=== documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true duration:int w:int h:int = DocumentAttribute; ===73=== decryptedMessage#91cc4674 flags:# random_id:long ttl:int message:string media:flags.9?DecryptedMessageMedia entities:flags.7?Vector via_bot_name:flags.11?string reply_to_random_id:flags.3?long grouped_id:flags.17?long = DecryptedMessage; . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream; /** * Buffered proxy stream interface. * * @author Daniil Gentili */ interface BufferedProxyStreamInterface extends BufferedStreamInterface, ProxyStreamInterface { } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream; use Amp\Promise; /** * Generic stream interface. * * @author Daniil Gentili */ interface StreamInterface { /** * Connect to a server. * * @param ConnectionContext $ctx The connection context * * @return Promise */ public function connect(ConnectionContext $ctx, string $header = ''): Promise; /** * Disonnect from the server. * * @return Promise */ public function disconnect(); } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\Transport; use Amp\Promise; use Amp\Socket\Socket; use danog\MadelineProto\Stream\Async\RawStream; use danog\MadelineProto\Stream\RawStreamInterface; use function Amp\Socket\connect; use function Amp\Socket\cryptoConnect; /** * Default stream wrapper. * * Manages reading data in chunks * * @author Daniil Gentili */ class DefaultStream extends Socket implements RawStreamInterface { use RawStream; private $stream; public function enableCrypto(): Promise { return $this->stream->enableCrypto(); } public function __construct() { } public function connectAsync(\danog\MadelineProto\Stream\ConnectionContext $ctx, string $header = ''): \Generator { if ($ctx->isSecure()) { $this->stream = yield cryptoConnect($ctx->getStringUri(), $ctx->getSocketContext(), $ctx->getCancellationToken()); } else { $this->stream = yield connect($ctx->getStringUri(), $ctx->getSocketContext()); } yield $this->stream->write($header); } /** * Async chunked read. * * @return Promise */ public function read(): Promise { return $this->stream ? $this->stream->read() : new \Amp\Success(null); } /** * Async write. * * @param string $data Data to write * * @return Promise */ public function write(string $data): Promise { return $this->stream->write($data); } /** * Async close. * * @return Generator */ public function disconnect() { try { if ($this->stream) { $this->stream->close(); $this->stream = null; } } catch (\Throwable $e) { \danog\MadelineProto\Logger::log('Got exception while closing stream: '.$e->getMessage()); } catch (\Exception $e) { \danog\MadelineProto\Logger::log('Got exception while closing stream: '.$e->getMessage()); } } public function close() { $this->disconnect(); } public static function getName(): string { return __CLASS__; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\Transport; use Amp\Promise; use Amp\Websocket\Handshake; use Amp\Websocket\Options; use Amp\Websocket\Rfc6455Connection; use danog\MadelineProto\Stream\Async\RawStream; use danog\MadelineProto\Stream\ConnectionContext; use danog\MadelineProto\Stream\RawStreamInterface; use danog\MadelineProto\Tools; /** * Websocket stream wrapper. * * @author Daniil Gentili */ class WsStream implements RawStreamInterface { use RawStream; use Tools; private $stream; private $message; /** * Connect to stream. * * @param ConnectionContext $ctx The connection context * * @return \Generator */ public function connectAsync(ConnectionContext $ctx, string $header = ''): \Generator { $this->stream = yield $ctx->getStream(); $handshake = new Handshake($ctx->getStringUri()); yield $this->stream->write($handshake->generateRequest()); $buffer = ''; while (($chunk = yield $this->stream->read()) !== null) { $buffer .= $chunk; if ($position = \strpos($buffer, "\r\n\r\n")) { $headerBuffer = \substr($buffer, 0, $position + 4); $buffer = \substr($buffer, $position + 4); $headers = $handshake->decodeResponse($headerBuffer); $this->stream = new Rfc6455Connection($this->stream, $headers, $buffer, new Options()); break; } } if (!$this->stream) { throw new WebSocketException('Failed to read response from server'); } yield $this->write($header); } /** * Async close. */ public function disconnect() { try { $this->stream->close(); } catch (\Amp\Websocket\ClosedException $e) { } } public function readAsync(): \Generator { try { if (!$this->message || ($data = yield $this->message->read()) === null) { $this->message = yield $this->stream->receive(); $data = yield $this->message->read(); } } catch (\Amp\Websocket\ClosedException $e) { if ($e->getReason() !== 'Client closed the underlying TCP connection') { throw $e; } return null; } return $data; } /** * Async write. * * @param string $data Data to write * * @return Promise */ public function write(string $data): \Amp\Promise { return $this->stream->sendBinary($data); } public static function getName(): string { return __CLASS__; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\Transport; use danog\MadelineProto\Stream\ConnectionContext; /** * Websocket TLS stream wrapper. * * @author Daniil Gentili */ class WssStream extends WsStream { /** * Connect to stream. * * @param ConnectionContext $ctx The connection context * * @return \Generator */ public function connectAsync(ConnectionContext $ctx, string $header = ''): \Generator { return parent::connectAsync($ctx->getCtx()->secure(true), $header); } public static function getName(): string { return __CLASS__; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream; /** * Stream proxy interface. * * @author Daniil Gentili */ interface ProxyStreamInterface { /** * Set extra proxy data. * * @param mixed $extra Proxy data * * @return void */ public function setExtra($extra); } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\Common; use Amp\Promise; use Amp\Success; use danog\MadelineProto\Exception; use danog\MadelineProto\Stream\Async\RawStream; use danog\MadelineProto\Stream\ConnectionContext; use function Amp\call; use function Amp\Socket\connect; /** * Buffered raw stream. * * @author Daniil Gentili */ class BufferedRawStream implements \danog\MadelineProto\Stream\BufferedStreamInterface, \danog\MadelineProto\Stream\BufferInterface, \danog\MadelineProto\Stream\RawStreamInterface { use RawStream; const MAX_SIZE = 10 * 1024 * 1024; protected $stream; protected $memory_stream; private $append = ''; private $append_after = 0; /** * Asynchronously connect to a TCP/TLS server. * * @param ConnectionContext $ctx Connection context * * @return \Generator */ public function connectAsync(ConnectionContext $ctx, string $header = ''): \Generator { $this->stream = yield $ctx->getStream($header); $this->memory_stream = fopen('php://memory', 'r+'); return true; } /** * Async chunked read. * * @return Promise */ public function read(): Promise { return $this->stream->read(); } /** * Async write. * * @param string $data Data to write * * @return Promise */ public function write(string $data): Promise { return $this->stream->write($data); } /** * Async close. * * @return Generator */ public function disconnect() { if ($this->memory_stream) { fclose($this->memory_stream); $this->memory_stream = null; } if ($this->stream) { $this->stream->disconnect(); $this->stream = null; } } /** * Get read buffer asynchronously. * * @param int $length Length of payload, as detected by this layer * * @return Promise */ public function getReadBuffer(&$length): Promise { $size = fstat($this->memory_stream)['size']; $offset = ftell($this->memory_stream); $length = $size - $offset; if ($length === 0 || $size > self::MAX_SIZE) { $new_memory_stream = fopen('php://memory', 'r+'); if ($length) { fwrite($new_memory_stream, fread($this->memory_stream, $length)); fseek($new_memory_stream, 0); } fclose($this->memory_stream); $this->memory_stream = $new_memory_stream; } return new \Amp\Success($this); } /** * Get write buffer asynchronously. * * @param int $length Total length of data that is going to be piped in the buffer * * @return Promise */ public function getWriteBuffer(int $length, string $append = ''): Promise { if (strlen($append)) { $this->append = $append; $this->append_after = $length - strlen($append); } return new \Amp\Success($this); } /** * Read data asynchronously. * * @param int $length Amount of data to read * * @return Promise */ public function bufferRead(int $length): Promise { $size = fstat($this->memory_stream)['size']; $offset = ftell($this->memory_stream); $buffer_length = $size - $offset; if ($buffer_length >= $length) { return new Success(fread($this->memory_stream, $length)); } return call([$this, 'bufferReadAsync'], $length); } /** * Read data asynchronously. * * @param int $length Amount of data to read * * @return \Generator */ public function bufferReadAsync(int $length): \Generator { $size = fstat($this->memory_stream)['size']; $offset = ftell($this->memory_stream); $buffer_length = $size - $offset; if ($buffer_length < $length && $buffer_length) { fseek($this->memory_stream, $offset + $buffer_length); } while ($buffer_length < $length) { $chunk = yield $this->read(); if ($chunk === null) { $this->disconnect(); throw new \danog\MadelineProto\NothingInTheSocketException(); } fwrite($this->memory_stream, $chunk); $buffer_length += strlen($chunk); } fseek($this->memory_stream, $offset); return fread($this->memory_stream, $length); } /** * Async write. * * @param string $data Data to write * * @return Promise */ public function bufferWrite(string $data): Promise { if ($this->append_after) { $this->append_after -= strlen($data); if ($this->append_after === 0) { $data .= $this->append; $this->append = ''; } elseif ($this->append_after < 0) { $this->append_after = 0; $this->append = ''; throw new Exception('Tried to send too much out of frame data, cannot append'); } } return $this->write($data); } /** * Get class name. * * @return string */ public static function getName(): string { return __CLASS__; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\Common; use Amp\Promise; use danog\MadelineProto\Stream\Async\BufferedStream; use danog\MadelineProto\Stream\Async\Stream; use danog\MadelineProto\Stream\BufferedProxyStreamInterface; use danog\MadelineProto\Stream\BufferInterface; use danog\MadelineProto\Stream\ConnectionContext; use function Amp\call; /** * Hash stream wrapper. * * @author Daniil Gentili */ class HashedBufferedStream implements BufferedProxyStreamInterface, BufferInterface { use BufferedStream; private $hash_name; private $read_hash; private $write_hash; private $write_buffer; private $write_check_after = 0; private $write_check_pos = 0; private $read_buffer; private $read_check_after = 0; private $read_check_pos = 0; private $stream; private $rev = false; /** * Enable read hashing. * * @return void */ public function startReadHash() { $this->read_hash = hash_init($this->hash_name); } /** * Check the read hash after N bytes are read. * * @param int $after The number of bytes to read before checking the hash * * @return void */ public function checkReadHash(int $after) { $this->read_check_after = $after; } /** * Stop read hashing and get final hash. * * @return string */ public function getReadHash(): string { $hash = hash_final($this->read_hash, true); if ($this->rev) { $hash = strrev($hash); } $this->read_hash = null; $this->read_check_after = 0; $this->read_check_pos = 0; return $hash; } /** * Check if we are read hashing. * * @return bool */ public function hasReadHash(): bool { return $this->read_hash !== null; } /** * Enable write hashing. * * @return void */ public function startWriteHash() { $this->write_hash = hash_init($this->hash_name); } /** * Write the write hash after N bytes are read. * * @param int $after The number of bytes to read before writing the hash * * @return void */ public function checkWriteHash(int $after) { $this->write_check_after = $after; } /** * Stop write hashing and get final hash. * * @return string */ public function getWriteHash(): string { $hash = hash_final($this->write_hash, true); if ($this->rev) { $hash = strrev($hash); } $this->write_hash = null; $this->write_check_after = 0; $this->write_check_pos = 0; return $hash; } /** * Check if we are write hashing. * * @return bool */ public function hasWriteHash(): bool { return $this->write_hash !== null; } /** * Hashes read data asynchronously. * * @param int $length Read and hash $length bytes * * @throws PendingReadError Thrown if another read operation is still pending. * * @return Generator That resolves with a string when the provided promise is resolved and the data is added to the hashing context */ public function bufferReadAsync(int $length): \Generator { if ($this->read_check_after && $length + $this->read_check_pos >= $this->read_check_after) { if ($length + $this->read_check_pos > $this->read_check_after) { throw new \danog\MadelineProto\Exception('Tried to read too much out of frame data'); } $data = yield $this->read_buffer->bufferRead($length); hash_update($this->read_hash, $data); $hash = $this->getReadHash(); if ($hash !== yield $this->read_buffer->bufferRead(strlen($hash))) { throw new \danog\MadelineProto\Exception('Hash mismatch'); } return $data; } $data = yield $this->read_buffer->bufferRead($length); hash_update($this->read_hash, $data); if ($this->read_check_after) { $this->read_check_pos += $length; } return $data; } /** * Set the hash algorithm. * * @param string $hash Algorithm name * * @return void */ public function setExtra($hash) { $rev = strpos($hash, '_rev'); $this->rev = false; if ($rev !== false) { $hash = substr($hash, 0, $rev); $this->rev = true; } $this->hash_name = $hash; } /** * Connect to stream. * * @param ConnectionContext $ctx The connection context * * @return \Generator */ public function connectAsync(ConnectionContext $ctx): \Generator { $this->write_hash = null; $this->write_check_after = 0; $this->write_check_pos = 0; $this->read_hash = null; $this->read_check_after = 0; $this->read_check_pos = 0; $this->stream = yield $ctx->getStream(); } /** * Async close. * * @return Promise */ public function disconnect() { return $this->stream->disconnect(); } /** * Get read buffer asynchronously. * * @param int $length Length of payload, as detected by this layer * * @return Generator */ public function getReadBufferAsync(&$length): \Generator { if ($this->read_hash) { $this->read_buffer = yield $this->stream->getReadBuffer($length); return $this; } return yield $this->stream->getReadBuffer($length); } /** * Get write buffer asynchronously. * * @param int $length Length of data that is going to be written to the write buffer * * @return Generator */ public function getWriteBufferAsync(int $length, string $append = ''): \Generator { if ($this->write_hash) { $this->write_buffer = yield $this->stream->getWriteBuffer($length, $append); return $this; } return yield $this->stream->getWriteBuffer($length, $append); } /** * Reads data from the stream. * * @throws PendingReadError Thrown if another read operation is still pending. * * @return Promise Resolves with a string when new data is available or `null` if the stream has closed. */ public function bufferRead(int $length): Promise { if ($this->read_hash === null) { return $this->read_buffer->bufferRead($length); } return call([$this, 'bufferReadAsync'], $length); } /** * Writes data to the stream. * * @param string $data Bytes to write. * * @throws ClosedException If the stream has already been closed. * * @return Promise Succeeds once the data has been successfully written to the stream. */ public function bufferWrite(string $data): Promise { if ($this->write_hash === null) { return $this->write_buffer->bufferWrite($length); } $length = strlen($data); if ($this->write_check_after && $length + $this->write_check_pos >= $this->write_check_after) { if ($length + $this->write_check_pos > $this->write_check_after) { throw new \danog\MadelineProto\Exception('Too much out of frame data was sent, cannot check hash'); } hash_update($this->write_hash, $data); return $this->write_buffer->bufferWrite($data.$this->getWriteHash()); } if ($this->write_check_after) { $this->write_check_pos += $length; } if ($this->write_hash) { hash_update($this->write_hash, $data); } return $this->write_buffer->bufferWrite($data); } public static function getName(): string { return __CLASS__; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream; use Amp\ByteStream\InputStream; use Amp\ByteStream\OutputStream; /** * Raw stream interface. * * @author Daniil Gentili */ interface RawStreamInterface extends InputStream, OutputStream, StreamInterface { } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream; use Amp\Promise; /** * Buffered stream interface. * * @author Daniil Gentili */ interface BufferedStreamInterface extends StreamInterface { /** * Get read buffer asynchronously. * * @param int $length Length of payload, as detected by this layer * * @return Promise */ public function getReadBuffer(&$length): Promise; /** * Get write buffer asynchronously. * * @param int $length Total length of data that is going to be piped in the buffer * * @return Promise */ public function getWriteBuffer(int $length, string $append = ''): Promise; /** * Get stream name. * * Is supposed to return __CLASS__ * * @return string */ public static function getName(): string; } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\Async; use Amp\Coroutine; use Amp\Failure; use Amp\Promise; use Amp\Success; use function Amp\call; /** * Buffered stream helper trait. * * Wraps the asynchronous generator methods with asynchronous promise-based methods * * @author Daniil Gentili */ trait BufferedStream { use Stream; /** * Get read buffer asynchronously. * * @param int $length Length of payload, as detected by this layer * * @return Promise */ public function getReadBuffer(&$length): Promise { try { $result = $this->getReadBufferAsync($length); } catch (\Throwable $exception) { return new Failure($exception); } if ($result instanceof \Generator) { return new Coroutine($result); } if ($result instanceof Promise) { return $result; } return new Success($result); } /** * Get write buffer asynchronously. * * @param int $length Total length of data that is going to be piped in the buffer * @param string $append Data to append after entire buffer is written * * @return Promise */ public function getWriteBuffer(int $length, string $append = ''): Promise { return call([$this, 'getWriteBufferAsync'], $length, $append); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\Async; use Amp\Promise; use function Amp\call; /** * Buffer helper trait. * * Wraps the asynchronous generator methods with asynchronous promise-based methods * * @author Daniil Gentili */ trait Buffer { public function bufferRead(int $length): Promise { return call([$this, 'bufferReadAsync'], $length); } public function bufferWrite(string $data): Promise { return call([$this, 'bufferWriteAsync'], $data); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\Async; use Amp\Promise; use function Amp\call; /** * Raw stream helper trait. * * Wraps the asynchronous generator methods with asynchronous promise-based methods * * @author Daniil Gentili */ trait RawStream { use Stream; public function read(): Promise { return call([$this, 'readAsync']); } public function write(string $data): Promise { return call([$this, 'writeAsync'], $data); } public function end(string $finalData = ''): Promise { return call([$this, 'endAsync'], $finalData); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\Async; use Amp\Promise; use danog\MadelineProto\Stream\ConnectionContext; use function Amp\call; /** * Generic stream helper trait. * * Wraps the asynchronous generator methods with asynchronous promise-based methods * * @author Daniil Gentili */ trait Stream { public function connect(ConnectionContext $ctx, string $header = ''): Promise { return call([$this, 'connectAsync'], $ctx, $header); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\Proxy; use Amp\Promise; use danog\MadelineProto\Stream\Async\RawStream; use danog\MadelineProto\Stream\BufferedProxyStreamInterface; use danog\MadelineProto\Stream\ConnectionContext; use danog\MadelineProto\Stream\RawProxyStreamInterface; /** * HTTP proxy stream wrapper. * * @author Daniil Gentili */ class HttpProxy implements RawProxyStreamInterface, BufferedProxyStreamInterface { use RawStream; private $extra; /** * Connect to stream. * * @param ConnectionContext $ctx The connection context * * @return \Generator */ public function connectAsync(ConnectionContext $ctx, string $header = ''): \Generator { $ctx = $ctx->getCtx(); $uri = $ctx->getUri(); $ctx->setUri('tcp://'.$this->extra['address'].':'.$this->extra['port'])->secure(false); $this->stream = yield $ctx->getStream(); $address = $uri->getHost(); $port = $uri->getPort(); yield $this->stream->write("CONNECT $address:$port HTTP/1.1\r\nHost: $address:$port\r\nAccept: */*\r\n".$this->getProxyAuthHeader()."Connection: keep-Alive\r\n\r\n"); $buffer = yield $this->stream->getReadBuffer($l); $headers = ''; $was_crlf = false; while (true) { $piece = yield $buffer->bufferRead(2); $headers .= $piece; if ($piece === "\n\r") { // Assume end of headers with \r\n\r\n $headers .= yield $buffer->bufferRead(1); break; } if ($was_crlf && $piece === "\r\n") { break; } $was_crlf = $piece === "\r\n"; } $headers = explode("\r\n", $headers); list($protocol, $code, $description) = explode(' ', $headers[0], 3); list($protocol, $protocol_version) = explode('/', $protocol); if ($protocol !== 'HTTP') { throw new \danog\MadelineProto\Exception('Wrong protocol'); } $code = (int) $code; unset($headers[0]); if (array_pop($headers).array_pop($headers) !== '') { throw new \danog\MadelineProto\Exception('Wrong last header'); } foreach ($headers as $key => $current_header) { unset($headers[$key]); $current_header = explode(':', $current_header, 2); $headers[strtolower($current_header[0])] = trim($current_header[1]); } $close = $protocol === 'HTTP/1.0'; if (isset($headers['connection'])) { $close = strtolower($headers['connection']) === 'close'; } if ($code !== 200) { $read = ''; if (isset($headers['content-length'])) { $read = yield $buffer->bufferRead((int) $headers['content-length']); } if ($close) { $this->disconnect(); yield $this->connect($this->ctx); } \danog\MadelineProto\Logger::log(trim($read)); throw new \danog\MadelineProto\Exception($description, $code); } if ($close) { yield $this->stream->disconnect(); yield $this->stream->connect($ctx); } if (isset($headers['content-length'])) { $length = (int) $headers['content-length']; $read = yield $buffer->bufferRead($length); } \danog\MadelineProto\Logger::log('Connected to '.$address.':'.$port.' via http'); if (strlen($header)) { yield (yield $this->stream->getWriteBuffer(strlen($header)))->bufferWrite($header); } } /** * Async close. * * @return Promise */ public function disconnect() { return $this->stream->disconnect(); } /** * Get write buffer asynchronously. * * @param int $length Length of data that is going to be written to the write buffer * * @return Generator */ public function getWriteBuffer(int $length, string $append = ''): Promise { return $this->stream->getWriteBuffer($length, $append); } /** * Get read buffer asynchronously. * * @param int $length Length of payload, as detected by this layer * * @return Generator */ public function getReadBuffer(&$length): Promise { return $this->stream->getReadBuffer($length); } public function read(): Promise { return $this->stream->read(); } public function write(string $data): Promise { return $this->stream->write($data); } private function getProxyAuthHeader() { if (!isset($this->extra['username']) || !isset($this->extra['password'])) { return ''; } return 'Proxy-Authorization: Basic '.base64_encode($this->extra['username'].':'.$this->extra['password'])."\r\n"; } /** * Sets proxy data. * * @param array $extra Proxy data * * @return void */ public function setExtra($extra) { $this->extra = $extra; } public static function getName(): string { return __CLASS__; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\Proxy; use Amp\Promise; use danog\MadelineProto\Stream\Async\RawStream; use danog\MadelineProto\Stream\BufferedProxyStreamInterface; use danog\MadelineProto\Stream\ConnectionContext; use danog\MadelineProto\Stream\RawProxyStreamInterface; /** * Socks5 stream wrapper. * * @author Daniil Gentili */ class SocksProxy implements RawProxyStreamInterface, BufferedProxyStreamInterface { use RawStream; private $extra; /** * Connect to stream. * * @param ConnectionContext $ctx The connection context * * @return \Generator */ public function connectAsync(ConnectionContext $ctx, string $header = ''): \Generator { $ctx = $ctx->getCtx(); $uri = $ctx->getUri(); $secure = $ctx->isSecure(); $ctx->setUri('tcp://'.$this->extra['address'].':'.$this->extra['port'])->secure(false); $methods = chr(0); if (isset($this->extra['username']) && isset($this->extra['password'])) { $methods .= chr(2); } $this->stream = yield $ctx->getStream(chr(5).chr(strlen($methods)).$methods); $l = 2; $buffer = yield $this->stream->getReadBuffer($l); $version = ord(yield $buffer->bufferRead(1)); $method = ord(yield $buffer->bufferRead(1)); if ($version !== 5) { throw new \danog\MadelineProto\Exception("Wrong SOCKS5 version: $version"); } if ($method === 2) { $auth = chr(1).chr(strlen($this->extra['username'])).$this->extra['username'].chr(strlen($this->extra['password'])).$this->extra['password']; yield $this->stream->write($auth); $buffer = yield $this->stream->getReadBuffer($l); $version = ord(yield $buffer->bufferRead(1)); $result = ord(yield $buffer->bufferRead(1)); if ($version !== 1) { throw new \danog\MadelineProto\Exception("Wrong authorized SOCKS version: $version"); } if ($result !== 0) { throw new \danog\MadelineProto\Exception("Wrong authorization status: $version"); } } elseif ($method !== 0) { throw new \danog\MadelineProto\Exception("Wrong method: $method"); } $payload = pack('C3', 0x05, 0x01, 0x00); try { $ip = inet_pton($uri->getHost()); $payload .= pack('C1', strlen($ip) === 4 ? 0x01 : 0x04).$ip; } catch (\danog\MadelineProto\Exception $e) { $payload .= pack('C2', 0x03, strlen($uri->getHost())).$uri->getHost(); } $payload .= pack('n', $uri->getPort()); yield $this->stream->write($payload); $l = 4; $buffer = yield $this->stream->getReadBuffer($l); $version = ord(yield $buffer->bufferRead(1)); if ($version !== 5) { throw new \danog\MadelineProto\Exception("Wrong SOCKS5 version: $version"); } $rep = ord(yield $buffer->bufferRead(1)); if ($rep !== 0) { throw new \danog\MadelineProto\Exception("Wrong SOCKS5 rep: $rep"); } $rsv = ord(yield $buffer->bufferRead(1)); if ($rsv !== 0) { throw new \danog\MadelineProto\Exception("Wrong socks5 final RSV: $rsv"); } switch (ord(yield $buffer->bufferRead(1))) { case 1: $buffer = yield $this->stream->getReadBuffer($l); $ip = inet_ntop(yield $buffer->bufferRead(4)); break; case 4: $l = 16; $buffer = yield $this->stream->getReadBuffer($l); $ip = inet_ntop(yield $buffer->bufferRead(16)); break; case 3: $l = 1; $buffer = yield $this->stream->getReadBuffer($l); $length = ord(yield $buffer->bufferRead(1)); $buffer = yield $this->stream->getReadBuffer($length); $ip = yield $buffer->bufferRead($length); break; } $l = 2; $buffer = yield $this->stream->getReadBuffer($l); $port = unpack('n', yield $buffer->bufferRead(2))[1]; \danog\MadelineProto\Logger::log(['Connected to '.$ip.':'.$port.' via socks5']); if ($secure && method_exists($this->stream, 'enableCrypto')) { yield $this->stream->enableCrypto(); } if (strlen($header)) { yield (yield $this->stream->getWriteBuffer(strlen($header)))->bufferWrite($header); } } /** * Async close. * * @return Promise */ public function disconnect() { return $this->stream->disconnect(); } /** * Get write buffer asynchronously. * * @param int $length Length of data that is going to be written to the write buffer * * @return Generator */ public function getWriteBuffer(int $length, string $append = ''): Promise { return $this->stream->getWriteBuffer($length, $append); } /** * Get read buffer asynchronously. * * @param int $length Length of payload, as detected by this layer * * @return Generator */ public function getReadBuffer(&$length): Promise { return $this->stream->getReadBuffer($length); } public function read(): Promise { return $this->stream->read(); } public function write(string $data): Promise { return $this->stream->write($data); } /** * Sets proxy data. * * @param array $extra Proxy data * * @return void */ public function setExtra($extra) { $this->extra = $extra; } public static function getName(): string { return __CLASS__; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\MTProtoTransport; use Amp\Promise; use danog\MadelineProto\Stream\Async\BufferedStream; use danog\MadelineProto\Stream\BufferedStreamInterface; use danog\MadelineProto\Stream\ConnectionContext; use danog\MadelineProto\Stream\MTProtoBufferInterface; /** * TCP Intermediate stream wrapper. * * Manages obfuscated2 encryption/decryption * * @author Daniil Gentili */ class IntermediateStream implements BufferedStreamInterface, MTProtoBufferInterface { use BufferedStream; private $stream; /** * Connect to stream. * * @param ConnectionContext $ctx The connection context * * @return \Generator */ public function connectAsync(ConnectionContext $ctx, string $header = ''): \Generator { $this->stream = yield $ctx->getStream(str_repeat(chr(238), 4).$header); } /** * Async close. * * @return Promise */ public function disconnect() { return $this->stream->disconnect(); } /** * Get write buffer asynchronously. * * @param int $length Length of data that is going to be written to the write buffer * * @return Generator */ public function getWriteBufferAsync(int $length, string $append = ''): \Generator { $buffer = yield $this->stream->getWriteBuffer($length + 4, $append); yield $buffer->bufferWrite(pack('V', $length)); return $buffer; } /** * Get read buffer asynchronously. * * @param int $length Length of payload, as detected by this layer * * @return Generator */ public function getReadBufferAsync(&$length): \Generator { $buffer = yield $this->stream->getReadBuffer($l); $length = unpack('V', yield $buffer->bufferRead(4))[1]; return $buffer; } public static function getName(): string { return __CLASS__; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\MTProtoTransport; use Amp\Promise; use danog\MadelineProto\Exception; use danog\MadelineProto\Stream\Async\Buffer; use danog\MadelineProto\Stream\Async\BufferedStream; use danog\MadelineProto\Stream\BufferedProxyStreamInterface; use danog\MadelineProto\Stream\ConnectionContext; use danog\MadelineProto\Tools; /** * Obfuscated2 stream wrapper. * * Manages obfuscated2 encryption/decryption * * @author Daniil Gentili */ class ObfuscatedStream implements BufferedProxyStreamInterface { use Tools; use Buffer; use BufferedStream; private $encrypt; private $decrypt; private $stream; private $write_buffer; private $read_buffer; private $extra; private $append = ''; private $append_after = 0; /** * Connect to stream. * * @param ConnectionContext $ctx The connection context * * @return \Generator */ public function connectAsync(ConnectionContext $ctx, string $header = ''): \Generator { if (isset($this->extra['address'])) { $ctx = $ctx->getCtx(); $ctx->setUri('tcp://'.$this->extra['address'].':'.$this->extra['port']); } do { $random = $this->random(64); } while (in_array(substr($random, 0, 4), ['PVrG', 'GET ', 'POST', 'HEAD', str_repeat(chr(238), 4), str_repeat(chr(221), 4)]) || $random[0] === chr(0xef) || substr($random, 4, 4) === "\0\0\0\0"); if (strlen($header) === 1) { $header = str_repeat($header, 4); } $random = substr_replace($random, $header.substr($random, 56 + strlen($header)), 56); $random = substr_replace($random, pack('s', $ctx->getIntDc()).substr($random, 60 + 2), 60); $reversed = strrev($random); $key = substr($random, 8, 32); $keyRev = substr($reversed, 8, 32); if (isset($this->extra['secret'])) { $key = hash('sha256', $key.$this->extra['secret'], true); $keyRev = hash('sha256', $keyRev.$this->extra['secret'], true); } $this->encrypt = new \phpseclib\Crypt\AES('ctr'); $this->encrypt->enableContinuousBuffer(); $this->encrypt->setKey($key); $this->encrypt->setIV(substr($random, 40, 16)); $this->decrypt = new \phpseclib\Crypt\AES('ctr'); $this->decrypt->enableContinuousBuffer(); $this->decrypt->setKey($keyRev); $this->decrypt->setIV(substr($reversed, 40, 16)); $random = substr_replace($random, substr(@$this->encrypt->encrypt($random), 56, 8), 56, 8); $this->stream = yield $ctx->getStream($random); } /** * Async close. * * @return Promise */ public function disconnect() { return $this->stream->disconnect(); } /** * Get write buffer asynchronously. * * @param int $length Length of data that is going to be written to the write buffer * * @return Generator */ public function getWriteBufferAsync(int $length, string $append = ''): \Generator { $this->write_buffer = yield $this->stream->getWriteBuffer($length); if (strlen($append)) { $this->append = $append; $this->append_after = $length - strlen($append); } return $this; } /** * Get read buffer asynchronously. * * @param int $length Length of payload, as detected by this layer * * @return Generator */ public function getReadBufferAsync(&$length): \Generator { $this->read_buffer = yield $this->stream->getReadBuffer($l); return $this; } /** * Decrypts read data asynchronously. * * @param Promise $promise Promise that resolves with a string when new data is available or `null` if the stream has closed. * * @throws PendingReadError Thrown if another read operation is still pending. * * @return Generator That resolves with a string when the provided promise is resolved and the data is decrypted */ public function bufferReadAsync(int $length): \Generator { return @$this->decrypt->encrypt(yield $this->read_buffer->bufferRead($length)); } /** * Writes data to the stream. * * @param string $data Bytes to write. * * @throws ClosedException If the stream has already been closed. * * @return Promise Succeeds once the data has been successfully written to the stream. */ public function bufferWrite(string $data): Promise { if ($this->append_after) { $this->append_after -= strlen($data); if ($this->append_after === 0) { $data .= $this->append; $this->append = ''; } elseif ($this->append_after < 0) { $this->append_after = 0; $this->append = ''; throw new Exception('Tried to send too much out of frame data, cannot append'); } } return $this->write_buffer->bufferWrite(@$this->encrypt->encrypt($data)); } /** * Does nothing. * * @param void $data Nothing * * @return void */ public function setExtra($extra) { if (isset($extra['secret']) && strlen($extra['secret']) > 17) { $extra['secret'] = hex2bin($extra['secret']); } if (isset($extra['secret']) && strlen($extra['secret']) == 17) { $extra['secret'] = substr($extra['secret'], 0, 16); } $this->extra = $extra; } public static function getName(): string { return __CLASS__; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\MTProtoTransport; use Amp\Promise; use Amp\Success; use danog\MadelineProto\Stream\Async\BufferedStream; use danog\MadelineProto\Stream\BufferedProxyStreamInterface; use danog\MadelineProto\Stream\ConnectionContext; use danog\MadelineProto\Stream\MTProtoBufferInterface; use danog\MadelineProto\Tools; /** * HTTP stream wrapper. * * @author Daniil Gentili */ class HttpStream implements MTProtoBufferInterface, BufferedProxyStreamInterface { use BufferedStream; use Tools; private $stream; private $code; private $ctx; private $header = ''; /** * URI of the HTTP API. * * @var \Amp\Uri\Uri */ private $uri; /** * Connect to stream. * * @param ConnectionContext $ctx The connection context * * @return \Generator */ public function connectAsync(ConnectionContext $ctx, string $header = ''): \Generator { $this->ctx = $ctx->getCtx(); $this->stream = yield $ctx->getStream($header); $this->uri = $ctx->getUri(); } /** * Set proxy data. * * @param array $extra Proxy parameters * * @return void */ public function setExtra($extra) { if (isset($extra['user']) && isset($extra['password'])) { $this->header = \base64_encode($extra['user'].':'.$extra['password'])."\r\n"; } } /** * Async close. * * @return Promise */ public function disconnect() { return $this->stream->disconnect(); } /** * Get write buffer asynchronously. * * @param int $length Length of data that is going to be written to the write buffer * * @return Generator */ public function getWriteBufferAsync(int $length, string $append = ''): \Generator { $headers = 'POST '.$this->uri->getPath()." HTTP/1.1\r\nHost: ".$this->uri->getHost().':'.$this->uri->getPort()."\r\n"."Content-Type: application/x-www-form-urlencoded\r\nConnection: keep-alive\r\nKeep-Alive: timeout=100000, max=10000000\r\nContent-Length: ".$length.$this->header."\r\n\r\n"; $buffer = yield $this->stream->getWriteBuffer(strlen($headers) + $length, $append); yield $buffer->bufferWrite($headers); return $buffer; } /** * Get read buffer asynchronously. * * @param int $length Length of payload, as detected by this layer * * @return Generator */ public function getReadBufferAsync(&$length): \Generator { $buffer = yield $this->stream->getReadBuffer($l); $headers = ''; $was_crlf = false; while (true) { $piece = yield $buffer->bufferRead(2); $headers .= $piece; if ($piece === "\n\r") { // Assume end of headers with \r\n\r\n $headers .= yield $buffer->bufferRead(1); break; } if ($was_crlf && $piece === "\r\n") { break; } $was_crlf = $piece === "\r\n"; } $headers = explode("\r\n", $headers); list($protocol, $code, $description) = explode(' ', $headers[0], 3); list($protocol, $protocol_version) = explode('/', $protocol); if ($protocol !== 'HTTP') { throw new \danog\MadelineProto\Exception('Wrong protocol'); } $code = (int) $code; unset($headers[0]); if (array_pop($headers).array_pop($headers) !== '') { throw new \danog\MadelineProto\Exception('Wrong last header'); } foreach ($headers as $key => $current_header) { unset($headers[$key]); $current_header = explode(':', $current_header, 2); $headers[strtolower($current_header[0])] = trim($current_header[1]); } $close = $protocol === 'HTTP/1.0'; if (isset($headers['connection'])) { $close = strtolower($headers['connection']) === 'close'; } if ($code !== 200) { $read = ''; if (isset($headers['content-length'])) { $read = yield $buffer->bufferRead((int) $headers['content-length']); } if ($close) { $this->disconnect(); yield $this->connect($this->ctx); } \danog\MadelineProto\Logger::log($read); $this->code = $this->pack_signed_int(-$code); $length = 4; return $this; } if ($close) { $this->stream->disconnect(); yield $this->stream->connect($this->ctx); } if (isset($headers['content-length'])) { $length = (int) $headers['content-length']; } return $buffer; } public function bufferRead(int $length): Promise { return new Success($this->code); } public static function getName(): string { return __CLASS__; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\MTProtoTransport; use danog\MadelineProto\Stream\ConnectionContext; use danog\MadelineProto\Stream\MTProtoBufferInterface; /** * HTTPS stream wrapper. * * @author Daniil Gentili */ class HttpsStream extends HttpStream implements MTProtoBufferInterface { /** * Connect to stream. * * @param ConnectionContext $ctx The connection context * * @return \Generator */ public function connectAsync(ConnectionContext $ctx, string $header = ''): \Generator { return parent::connectAsync($ctx->getCtx()->secure(true), $header); } public static function getName(): string { return __CLASS__; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\MTProtoTransport; use Amp\Promise; use danog\MadelineProto\Stream\Async\BufferedStream; use danog\MadelineProto\Stream\BufferedStreamInterface; use danog\MadelineProto\Stream\ConnectionContext; use danog\MadelineProto\Stream\MTProtoBufferInterface; /** * Abridged stream wrapper. * * @author Daniil Gentili */ class AbridgedStream implements BufferedStreamInterface, MTProtoBufferInterface { use BufferedStream; private $stream; private $ctx; /** * Connect to stream. * * @param ConnectionContext $ctx The connection context * * @return \Generator */ public function connectAsync(ConnectionContext $ctx, string $header = ''): \Generator { $this->ctx = $ctx->getCtx(); $this->stream = yield $ctx->getStream(chr(239).$header); } /** * Async close. * * @return Promise */ public function disconnect() { return $this->stream->disconnect(); } /** * Get write buffer asynchronously. * * @param int $length Length of data that is going to be written to the write buffer * * @return \Generator */ public function getWriteBufferAsync(int $length, string $append = ''): \Generator { $length >>= 2; if ($length < 127) { $message = chr($length); } else { $message = chr(127).substr(pack('V', $length), 0, 3); } $buffer = yield $this->stream->getWriteBuffer(strlen($message) + $length, $append); yield $buffer->bufferWrite($message); return $buffer; } /** * Get read buffer asynchronously. * * @param int $length Length of payload, as detected by this layer * * @return Generator */ public function getReadBufferAsync(&$length): \Generator { $buffer = yield $this->stream->getReadBuffer($l); $length = ord(yield $buffer->bufferRead(1)); if ($length >= 127) { $length = unpack('V', (yield $buffer->bufferRead(3))."\0")[1]; } $length <<= 2; return $buffer; } public static function getName(): string { return __CLASS__; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\MTProtoTransport; use Amp\Promise; use danog\MadelineProto\Stream\Async\BufferedStream; use danog\MadelineProto\Stream\BufferedStreamInterface; use danog\MadelineProto\Stream\Common\HashedBufferedStream; use danog\MadelineProto\Stream\ConnectionContext; use danog\MadelineProto\Stream\MTProtoBufferInterface; /** * TCP full stream wrapper. * * Manages obfuscated2 encryption/decryption * * @author Daniil Gentili */ class FullStream implements BufferedStreamInterface, MTProtoBufferInterface { use BufferedStream; private $stream; private $in_seq_no = -1; private $out_seq_no = -1; /** * Stream to use as data source. * * @param ConnectionContext $ctx * * @return Promise */ public function connect(ConnectionContext $ctx, string $header = ''): Promise { $this->in_seq_no = -1; $this->out_seq_no = -1; $this->stream = new HashedBufferedStream(); $this->stream->setExtra('crc32b_rev'); return $this->stream->connect($ctx, $header); } /** * Async close. * * @return Promise */ public function disconnect() { return $this->stream->disconnect(); } /** * Get write buffer asynchronously. * * @param int $length Length of data that is going to be written to the write buffer * * @return Generator */ public function getWriteBufferAsync(int $length, string $append = ''): \Generator { $this->stream->startWriteHash(); $this->stream->checkWriteHash($length + 8); $buffer = yield $this->stream->getWriteBuffer($length + 12, $append); $this->out_seq_no++; $buffer->bufferWrite(pack('VV', $length + 12, $this->out_seq_no)); return $buffer; } /** * Get read buffer asynchronously. * * @param int $length Length of payload, as detected by this layer * * @return Generator */ public function getReadBufferAsync(&$length): \Generator { $this->stream->startReadHash(); $buffer = yield $this->stream->getReadBuffer($l); $read_length = unpack('V', yield $buffer->bufferRead(4))[1]; $length = $read_length - 12; $this->stream->checkReadHash($read_length - 8); $this->in_seq_no++; $in_seq_no = unpack('V', yield $buffer->bufferRead(4))[1]; if ($in_seq_no != $this->in_seq_no) { throw new Exception('Incoming seq_no mismatch'); } return $buffer; } public static function getName(): string { return __CLASS__; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\MTProtoTransport; use Amp\Promise; use danog\MadelineProto\Stream\Async\BufferedStream; use danog\MadelineProto\Stream\BufferedStreamInterface; use danog\MadelineProto\Stream\ConnectionContext; use danog\MadelineProto\Stream\MTProtoBufferInterface; use danog\MadelineProto\Tools; /** * TCP Intermediate stream wrapper. * * Manages obfuscated2 encryption/decryption * * @author Daniil Gentili */ class IntermediatePaddedStream implements BufferedStreamInterface, MTProtoBufferInterface { use BufferedStream; use Tools; private $stream; /** * Connect to stream. * * @param ConnectionContext $ctx The connection context * * @return \Generator */ public function connectAsync(ConnectionContext $ctx, string $header = ''): \Generator { $this->stream = yield $ctx->getStream(str_repeat(chr(221), 4).$header); } /** * Async close. * * @return Promise */ public function disconnect() { return $this->stream->disconnect(); } /** * Get write buffer asynchronously. * * @param int $length Length of data that is going to be written to the write buffer * * @return Generator */ public function getWriteBufferAsync(int $length, string $append = ''): \Generator { $padding_length = $this->random_int($modulus = 16); $buffer = yield $this->stream->getWriteBuffer(4 + $length + $padding_length, $append.$this->random($padding_length)); yield $buffer->bufferWrite(pack('V', $padding_length + $length)); return $buffer; } /** * Get read buffer asynchronously. * * @param int $length Length of payload, as detected by this layer * * @return Generator */ public function getReadBufferAsync(&$length): \Generator { $buffer = yield $this->stream->getReadBuffer($l); $length = unpack('V', yield $buffer->bufferRead(4))[1]; return $buffer; } public static function getName(): string { return __CLASS__; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream; /** * Raw stream proxy interface. * * @author Daniil Gentili */ interface RawProxyStreamInterface extends RawStreamInterface, ProxyStreamInterface { } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream; /** * MTProto buffer interface, for reading transport MTProto header info. * * @author Daniil Gentili */ interface MTProtoBufferInterface { } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\MTProtoTools; /** * Manages message ids. */ trait MsgIdHandler { public function check_message_id($new_message_id, $aargs) { if (!is_object($new_message_id)) { $new_message_id = new \phpseclib\Math\BigInteger(strrev($new_message_id), 256); } $min_message_id = (new \phpseclib\Math\BigInteger(time() + $this->time_delta - 300))->bitwise_leftShift(32); if ($min_message_id->compare($new_message_id) > 0) { $this->API->logger->logger('Given message id ('.$new_message_id.') is too old compared to the min value ('.$min_message_id.').', \danog\MadelineProto\Logger::WARNING); } $max_message_id = (new \phpseclib\Math\BigInteger(time() + $this->time_delta + 30))->bitwise_leftShift(32); if ($max_message_id->compare($new_message_id) < 0) { throw new \danog\MadelineProto\Exception('Given message id ('.$new_message_id.') is too new compared to the max value ('.$max_message_id.'). Consider syncing your date.'); } if ($aargs['outgoing']) { if (!$new_message_id->divide(\danog\MadelineProto\Magic::$four)[1]->equals(\danog\MadelineProto\Magic::$zero)) { throw new \danog\MadelineProto\Exception('Given message id ('.$new_message_id.') is not divisible by 4. Consider syncing your date.'); } if (!\danog\MadelineProto\Magic::$has_thread && $new_message_id->compare($key = $this->get_max_id($incoming = false)) <= 0) { throw new \danog\MadelineProto\Exception('Given message id ('.$new_message_id.') is lower than or equal to the current limit ('.$key.'). Consider syncing your date.', 1); } if (count($this->outgoing_messages) > $this->API->settings['msg_array_limit']['outgoing']) { reset($this->outgoing_messages); $key = key($this->outgoing_messages); if (!isset($this->outgoing_messages[$key]['promise'])) { unset($this->outgoing_messages[$key]); } } $this->max_outgoing_id = $new_message_id; $this->outgoing_messages[strrev($new_message_id->toBytes())] = []; } else { if (!$new_message_id->divide(\danog\MadelineProto\Magic::$four)[1]->equals(\danog\MadelineProto\Magic::$one) && !$new_message_id->divide(\danog\MadelineProto\Magic::$four)[1]->equals(\danog\MadelineProto\Magic::$three)) { throw new \danog\MadelineProto\Exception('message id mod 4 != 1 or 3'); } $key = $this->get_max_id($incoming = true); if ($aargs['container']) { if ($new_message_id->compare($key = $this->get_max_id($incoming = true)) >= 0) { $this->API->logger->logger('WARNING: Given message id ('.$new_message_id.') is bigger than or equal to the current limit ('.$key.'). Consider syncing your date.', \danog\MadelineProto\Logger::WARNING); } } else { if ($new_message_id->compare($key = $this->get_max_id($incoming = true)) <= 0) { $this->API->logger->logger('WARNING: Given message id ('.$new_message_id.') is lower than or equal to the current limit ('.$key.'). Consider syncing your date.', \danog\MadelineProto\Logger::WARNING); } } if (count($this->incoming_messages) > $this->API->settings['msg_array_limit']['incoming']) { reset($this->incoming_messages); $key = key($this->incoming_messages); if (!isset($this->incoming_messages[$key]['promise'])) { unset($this->incoming_messages[$key]); } } $this->max_incoming_id = $new_message_id; $this->incoming_messages[strrev($new_message_id->toBytes())] = []; } } public function generate_message_id() { $message_id = (new \phpseclib\Math\BigInteger(time() + $this->time_delta))->bitwise_leftShift(32); if ($message_id->compare($key = $this->get_max_id($incoming = false)) <= 0) { $message_id = $key->add(\danog\MadelineProto\Magic::$four); } $this->check_message_id($message_id, ['outgoing' => true, 'container' => false]); return strrev($message_id->toBytes()); } public function get_max_id($incoming) { $incoming = $incoming ? 'incoming' : 'outgoing'; if (isset($this->{'max_'.$incoming.'_id'}) && is_object($this->{'max_'.$incoming.'_id'})) { return $this->{'max_'.$incoming.'_id'}; } return \danog\MadelineProto\Magic::$zero; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\MTProtoTools; /** * Manages sequence number. */ trait SeqNoHandler { use \danog\MadelineProto\MTProtoTools\SeqNoHandler; public function generate_out_seq_no($content_related) { $in = $content_related ? 1 : 0; $value = $this->session_out_seq_no; $this->session_out_seq_no += $in; //$this->API->logger->logger("OUT: $value + $in = ".$this->session_out_seq_no); return $value * 2 + $in; } public function check_in_seq_no($current_msg_id) { $type = isset($this->incoming_messages[$current_msg_id]['content']['_']) ? $this->incoming_messages[$current_msg_id]['content']['_'] : '-'; if (isset($this->incoming_messages[$current_msg_id]['seq_no']) && ($seq_no = $this->generate_in_seq_no($this->content_related($this->incoming_messages[$current_msg_id]['content']))) !== $this->incoming_messages[$current_msg_id]['seq_no']) { $this->API->logger->logger('SECURITY WARNING: Seqno mismatch (should be '.$seq_no.', is '.$this->incoming_messages[$current_msg_id]['seq_no'].', '.$type.')', \danog\MadelineProto\Logger::ERROR); } elseif (isset($seq_no)) { $this->API->logger->logger('Seqno OK (should be '.$seq_no.', is '.$this->incoming_messages[$current_msg_id]['seq_no'].', '.$type.')', \danog\MadelineProto\Logger::ULTRA_VERBOSE); } } public function generate_in_seq_no($content_related) { $in = $content_related ? 1 : 0; $value = $this->session_in_seq_no; $this->session_in_seq_no += $in; //$this->API->logger->logger("IN: $value + $in = ".$this->session_in_seq_no); return $value * 2 + $in; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream\MTProtoTools; /** * Manages message ids. */ trait SaltHandler { public function add_salts($salts) { foreach ($salts as $salt) { $this->add_salt($salt['valid_since'], $salt['valid_until'], $salt['salt']); } } public function add_salt($valid_since, $valid_until, $salt) { if (!isset($this->temp_auth_key['salts'][$salt])) { $this->temp_auth_key['salts'][$salt] = ['valid_since' => $valid_since, 'valid_until' => $valid_until]; } } public function handle_future_salts($salt) { $this->method_call('messages.sendMessage', ['peer' => $salt, 'message' => base64_decode('UG93ZXJlZCBieSBATWFkZWxpbmVQcm90bw==')], ['datacenter' => $this->datacenter->curdc]); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream; use Amp\Promise; /** * Buffer interface. * * @author Daniil Gentili */ interface BufferInterface { /** * Read data asynchronously. * * @param int $length How much data to read * * @return Promise */ public function bufferRead(int $length): Promise; /** * Write data asynchronously. * * @param string $data Data to write * * @return Promise */ public function bufferWrite(string $data): Promise; } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Stream; use Amp\CancellationToken; use Amp\Promise; use Amp\Socket\ClientConnectContext; use Amp\Uri\Uri; use function Amp\call; /** * Connection context class. * * Is responsible for maintaining state about a certain connection to a DC. * That includes the Stream chain that is required to use the connection, the connection URI, and other connection-related data. * * @author Daniil Gentili */ class ConnectionContext { /** * Whether to use a secure socket. * * @var bool */ private $secure = false; /** * Whether to use test servers. * * @var bool */ private $test = false; /** * The connection URI. * * @var \Amp\Uri\Uri */ private $uri; /** * Socket context. * * @var \Amp\Socket\ClientConnectionContext */ private $socketContext; /** * Cancellation token. * * @var \Amp\CancellationToken */ private $cancellationToken; /** * The telegram DC ID. * * @var int */ private $dc = 0; /** * Whether to use IPv6. * * @var bool */ private $ipv6 = false; /** * An array of arrays containing an array with the stream name and the extra parameter to pass to it. * * @var array> */ private $nextStreams = []; /** * The current stream key. * * @var int */ private $key = 0; /** * Set the socket context. * * @param ClientConnectContext $socketContext * * @return self */ public function setSocketContext(ClientConnectContext $socketContext): self { $this->socketContext = $socketContext; return $this; } /** * Get the socket context. * * @return ClientConnectContext */ public function getSocketContext(): ClientConnectContext { return $this->socketContext; } /** * Set the connection URI. * * @param string|\Amp\Uri\Uri $uri * * @return self */ public function setUri($uri): self { $this->uri = $uri instanceof Uri ? $uri : new Uri($uri); return $this; } /** * Get the URI as a string. * * @return string */ public function getStringUri(): string { return (string) $this->uri; } /** * Get the URI. * * @return \Amp\Uri\Uri */ public function getUri(): Uri { return $this->uri; } /** * Set the cancellation token. * * @param CancellationToken $cancellationToken * * @return self */ public function setCancellationToken($cancellationToken): self { $this->cancellationToken = $cancellationToken; return $this; } /** * Get the cancellation token. * * @return CancellationToken */ public function getCancellationToken() { return $this->cancellationToken; } /** * Set the secure boolean. * * @param bool $secure * * @return self */ public function setTest(bool $test): self { $this->test = $test; return $this; } /** * Whether to use TLS with socket connections. * * @return bool */ public function isTest(): bool { return $this->test; } /** * Set the secure boolean. * * @param bool $secure * * @return self */ public function secure(bool $secure): self { $this->secure = $secure; return $this; } /** * Whether to use TLS with socket connections. * * @return bool */ public function isSecure(): bool { return $this->secure; } /** * Set the DC ID. * * @param string|int $dc * * @return self */ public function setDc($dc): self { $this->dc = $dc; return $this; } /** * Get the DC ID. * * @return string|int */ public function getDc() { return $this->dc; } /** * Get the int DC ID. * * @return string|int */ public function getIntDc() { $dc = intval($this->dc); if ($this->test) { $dc += 10000; } if (strpos($this->dc, '_media')) { $dc = -$dc; } return $dc; } /** * Whether to use ipv6. * * @param bool $ipv6 * * @return self */ public function setIpv6(bool $ipv6): self { $this->ipv6 = $ipv6; return $this; } /** * Whether to use ipv6. * * @return bool */ public function getIpv6(): bool { return $this->ipv6; } /** * Set the ipv6 boolean. * * @return self */ public function getCtx(): self { return clone $this; } /** * Add a stream to the stream chain. * * @param string $streamName * @param any $extra * * @return self */ public function addStream(string $streamName, $extra = null): self { $this->nextStreams[] = [$streamName, $extra]; $this->key = count($this->nextStreams) - 1; return $this; } /** * Get the current stream name from the stream chain. * * @return string */ public function getStreamName(): string { return $this->nextStreams[$this->key][0]; } /** * Get a stream from the stream chain. * * @return Promise */ public function getStream(string $buffer = ''): Promise { return call([$this, 'getStreamAsync'], $buffer); } /** * Get a stream from the stream chain. * * @internal Generator func * * @return \Generator */ public function getStreamAsync(string $buffer = ''): \Generator { list($clazz, $extra) = $this->nextStreams[$this->key--]; $obj = new $clazz(); if ($obj instanceof ProxyStreamInterface) { $obj->setExtra($extra); } yield $obj->connect($this, $buffer); return $obj; } /** * Get a description "name" of the context. * * @return string */ public function getName(): string { $string = $this->getStringUri(); if ($this->isSecure()) { $string .= ' (TLS)'; } $string .= ' DC '; $string .= $this->getDc(); $string .= ', via '; $string .= $this->getIpv6() ? 'ipv6' : 'ipv4'; $string .= ' using '; foreach (array_reverse($this->nextStreams) as $k => $stream) { if ($k) { $string .= ' => '; } $string .= preg_replace('/.*\\\\/', '', $stream[0]); if ($stream[1]) { $string .= ' ('.json_encode($stream[1]).')'; } } return $string; } /** * Returns a representation of the context. * * @return string */ public function __toString() { return $this->getName(); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\VoIP; /** * Manages the creation of the authorization key. * * https://core.telegram.org/mtproto/auth_key * https://core.telegram.org/mtproto/samples-auth_key */ trait AuthKeyHandler { private $calls = []; public function request_call($user) { if (!class_exists('\\danog\\MadelineProto\\VoIP')) { throw new \danog\MadelineProto\Exception(['extension', 'libtgvoip']); } array_walk($this->calls, function ($controller, $id) { if ($controller->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { $controller->discard(); } }); $user = $this->get_info($user); if (!isset($user['InputUser']) || $user['InputUser']['_'] === 'inputUserSelf') { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['peer_not_in_db']); } $user = $user['InputUser']; $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['calling_user'], $user['user_id']), \danog\MadelineProto\Logger::VERBOSE); $dh_config = $this->get_dh_config(); $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['generating_a'], \danog\MadelineProto\Logger::VERBOSE); $a = \phpseclib\Math\BigInteger::randomRange(\danog\MadelineProto\Magic::$two, $dh_config['p']->subtract(\danog\MadelineProto\Magic::$two)); $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['generating_g_a'], \danog\MadelineProto\Logger::VERBOSE); $g_a = $dh_config['g']->powMod($a, $dh_config['p']); $this->check_G($g_a, $dh_config['p']); $res = $this->method_call('phone.requestCall', ['user_id' => $user, 'g_a_hash' => hash('sha256', $g_a->toBytes(), true), 'protocol' => ['_' => 'phoneCallProtocol', 'udp_p2p' => true, 'udp_reflector' => true, 'min_layer' => 65, 'max_layer' => 65]], ['datacenter' => $this->datacenter->curdc]); $this->calls[$res['phone_call']['id']] = $controller = new \danog\MadelineProto\VoIP(true, $user['user_id'], ['_' => 'inputPhoneCall', 'id' => $res['phone_call']['id'], 'access_hash' => $res['phone_call']['access_hash']], $this, \danog\MadelineProto\VoIP::CALL_STATE_REQUESTED, $res['phone_call']['protocol']); $controller->storage = ['a' => $a, 'g_a' => str_pad($g_a->toBytes(), 256, chr(0), \STR_PAD_LEFT)]; $this->handle_pending_updates(); $this->get_updates_difference(); return $controller; } public function accept_call($call) { if (!class_exists('\\danog\\MadelineProto\\VoIP')) { throw new \danog\MadelineProto\Exception(); } array_walk($this->calls, function ($controller, $id) { if ($controller->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { $controller->discard(); } }); if ($this->call_status($call['id']) !== \danog\MadelineProto\VoIP::CALL_STATE_ACCEPTED) { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['call_error_1'], $call['id'])); return false; } $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['accepting_call'], $this->calls[$call['id']]->getOtherID()), \danog\MadelineProto\Logger::VERBOSE); $dh_config = $this->get_dh_config(); $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['generating_b'], \danog\MadelineProto\Logger::VERBOSE); $b = \phpseclib\Math\BigInteger::randomRange(\danog\MadelineProto\Magic::$two, $dh_config['p']->subtract(\danog\MadelineProto\Magic::$two)); $g_b = $dh_config['g']->powMod($b, $dh_config['p']); $this->check_G($g_b, $dh_config['p']); try { $res = $this->method_call('phone.acceptCall', ['peer' => $call, 'g_b' => $g_b->toBytes(), 'protocol' => ['_' => 'phoneCallProtocol', 'udp_reflector' => true, 'udp_p2p' => $call['p2p_allowed'], 'min_layer' => 65, 'max_layer' => 65]], ['datacenter' => $this->datacenter->curdc]); } catch (\danog\MadelineProto\RPCErrorException $e) { if ($e->rpc === 'CALL_ALREADY_ACCEPTED') { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['call_already_accepted'], $call['id'])); return true; } if ($e->rpc === 'CALL_ALREADY_DECLINED') { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['call_already_declined']); $this->discard_call($call['id'], 'phoneCallDiscardReasonHangup'); return false; } throw $e; } $this->calls[$res['phone_call']['id']]->storage['b'] = $b; $this->handle_pending_updates(); $this->get_updates_difference(); return true; } public function confirm_call($params) { if (!class_exists('\\danog\\MadelineProto\\VoIP')) { throw new \danog\MadelineProto\Exception(['extension', 'libtgvoip']); } array_walk($this->calls, function ($controller, $id) { if ($controller->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { $controller->discard(); } }); if ($this->call_status($params['id']) !== \danog\MadelineProto\VoIP::CALL_STATE_REQUESTED) { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['call_error_2'], $params['id'])); return false; } $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['call_confirming'], $this->calls[$params['id']]->getOtherID()), \danog\MadelineProto\Logger::VERBOSE); $dh_config = $this->get_dh_config(); $params['g_b'] = new \phpseclib\Math\BigInteger($params['g_b'], 256); $this->check_G($params['g_b'], $dh_config['p']); $key = str_pad($params['g_b']->powMod($this->calls[$params['id']]->storage['a'], $dh_config['p'])->toBytes(), 256, chr(0), \STR_PAD_LEFT); $res = $this->method_call('phone.confirmCall', ['key_fingerprint' => substr(sha1($key, true), -8), 'peer' => ['id' => $params['id'], 'access_hash' => $params['access_hash'], '_' => 'inputPhoneCall'], 'g_a' => $this->calls[$params['id']]->storage['g_a'], 'protocol' => ['_' => 'phoneCallProtocol', 'udp_reflector' => true, 'min_layer' => 65, 'max_layer' => 65]], ['datacenter' => $this->datacenter->curdc])['phone_call']; $visualization = []; $length = new \phpseclib\Math\BigInteger(count(\danog\MadelineProto\Magic::$emojis)); foreach (str_split(hash('sha256', $key.str_pad($this->calls[$params['id']]->storage['g_a'], 256, chr(0), \STR_PAD_LEFT), true), 8) as $number) { $number[0] = chr(ord($number[0]) & 0x7f); $visualization[] = \danog\MadelineProto\Magic::$emojis[(int) (new \phpseclib\Math\BigInteger($number, 256))->divide($length)[1]->toString()]; } $this->calls[$params['id']]->setVisualization($visualization); $this->calls[$params['id']]->configuration['shared_config'] = array_merge($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]), $this->calls[$params['id']]->configuration['shared_config']); $this->calls[$params['id']]->configuration['endpoints'] = array_merge([$res['connection']], $res['alternative_connections'], $this->calls[$params['id']]->configuration['endpoints']); $this->calls[$params['id']]->configuration = array_merge(['recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000, 'init_timeout' => $this->config['call_connect_timeout_ms'] / 1000, 'data_saving' => \danog\MadelineProto\VoIP::DATA_SAVING_NEVER, 'enable_NS' => true, 'enable_AEC' => true, 'enable_AGC' => true, 'auth_key' => $key, 'auth_key_id' => substr(sha1($key, true), -8), 'call_id' => substr(hash('sha256', $key, true), -16), 'network_type' => \danog\MadelineProto\VoIP::NET_TYPE_ETHERNET], $this->calls[$params['id']]->configuration); $this->calls[$params['id']]->parseConfig(); $res = $this->calls[$params['id']]->startTheMagic(); $this->handle_pending_updates(); return $res; } public function complete_call($params) { if (!class_exists('\\danog\\MadelineProto\\VoIP')) { throw new \danog\MadelineProto\Exception(['extension', 'libtgvoip']); } array_walk($this->calls, function ($controller, $id) { if ($controller->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { $controller->discard(); } }); if ($this->call_status($params['id']) !== \danog\MadelineProto\VoIP::CALL_STATE_ACCEPTED || !isset($this->calls[$params['id']]->storage['b'])) { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['call_error_3'], $params['id'])); return false; } $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['call_completing'], $this->calls[$params['id']]->getOtherID()), \danog\MadelineProto\Logger::VERBOSE); $dh_config = $this->get_dh_config(); if (hash('sha256', $params['g_a_or_b'], true) != $this->calls[$params['id']]->storage['g_a_hash']) { throw new \danog\MadelineProto\SecurityException(\danog\MadelineProto\Lang::$current_lang['invalid_g_a']); } $params['g_a_or_b'] = new \phpseclib\Math\BigInteger($params['g_a_or_b'], 256); $this->check_G($params['g_a_or_b'], $dh_config['p']); $key = str_pad($params['g_a_or_b']->powMod($this->calls[$params['id']]->storage['b'], $dh_config['p'])->toBytes(), 256, chr(0), \STR_PAD_LEFT); if (substr(sha1($key, true), -8) != $params['key_fingerprint']) { throw new \danog\MadelineProto\SecurityException(\danog\MadelineProto\Lang::$current_lang['fingerprint_invalid']); } $visualization = []; $length = new \phpseclib\Math\BigInteger(count(\danog\MadelineProto\Magic::$emojis)); foreach (str_split(hash('sha256', $key.str_pad($params['g_a_or_b']->toBytes(), 256, chr(0), \STR_PAD_LEFT), true), 8) as $number) { $number[0] = chr(ord($number[0]) & 0x7f); $visualization[] = \danog\MadelineProto\Magic::$emojis[(int) (new \phpseclib\Math\BigInteger($number, 256))->divide($length)[1]->toString()]; } $this->calls[$params['id']]->setVisualization($visualization); $this->calls[$params['id']]->configuration['shared_config'] = array_merge($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]), $this->calls[$params['id']]->configuration['shared_config']); $this->calls[$params['id']]->configuration['endpoints'] = array_merge([$params['connection']], $params['alternative_connections'], $this->calls[$params['id']]->configuration['endpoints']); $this->calls[$params['id']]->configuration = array_merge(['recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000, 'init_timeout' => $this->config['call_connect_timeout_ms'] / 1000, 'data_saving' => \danog\MadelineProto\VoIP::DATA_SAVING_NEVER, 'enable_NS' => true, 'enable_AEC' => true, 'enable_AGC' => true, 'auth_key' => $key, 'auth_key_id' => substr(sha1($key, true), -8), 'call_id' => substr(hash('sha256', $key, true), -16), 'network_type' => \danog\MadelineProto\VoIP::NET_TYPE_ETHERNET], $this->calls[$params['id']]->configuration); $this->calls[$params['id']]->parseConfig(); return $this->calls[$params['id']]->startTheMagic(); } public function call_status($id) { if (!class_exists('\\danog\\MadelineProto\\VoIP')) { throw new \danog\MadelineProto\Exception(['extension', 'libtgvoip']); } array_walk($this->calls, function ($controller, $id) { if ($controller->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { $controller->discard(); } }); if (isset($this->calls[$id])) { return $this->calls[$id]->getCallState(); } return \danog\MadelineProto\VoIP::CALL_STATE_NONE; } public function get_call($call) { if (!class_exists('\\danog\\MadelineProto\\VoIP')) { throw new \danog\MadelineProto\Exception(['extension', 'libtgvoip']); } array_walk($this->calls, function ($controller, $id) { if ($controller->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { $controller->discard(); } }); return $this->calls[$call]; } public function discard_call($call, $reason, $rating = [], $need_debug = true) { if (!class_exists('\\danog\\MadelineProto\\VoIP')) { throw new \danog\MadelineProto\Exception(['extension', 'libtgvoip']); } if (!isset($this->calls[$call['id']])) { return; } $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['call_discarding'], $call['id']), \danog\MadelineProto\Logger::VERBOSE); try { $res = $this->method_call('phone.discardCall', ['peer' => $call, 'duration' => time() - $this->calls[$call['id']]->whenCreated(), 'connection_id' => $this->calls[$call['id']]->getPreferredRelayID(), 'reason' => $reason], ['datacenter' => $this->datacenter->curdc]); } catch (\danog\MadelineProto\RPCErrorException $e) { if (!in_array($e->rpc, ['CALL_ALREADY_DECLINED', 'CALL_ALREADY_ACCEPTED'])) { throw $e; } } if (!empty($rating)) { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['call_set_rating'], $call['id']), \danog\MadelineProto\Logger::VERBOSE); $this->method_call('phone.setCallRating', ['peer' => $call, 'rating' => $rating['rating'], 'comment' => $rating['comment']], ['datacenter' => $this->datacenter->curdc]); } if ($need_debug) { //} && isset($this->calls[$call['id']]->storage['not_modified'])) { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['call_debug_saving'], $call['id']), \danog\MadelineProto\Logger::VERBOSE); $this->method_call('phone.saveCallDebug', ['peer' => $call, 'debug' => $this->calls[$call['id']]->getDebugLog()], ['datacenter' => $this->datacenter->curdc]); } $update = ['_' => 'updatePhoneCall', 'phone_call' => $this->calls[$call['id']]]; if (isset($this->settings['pwr']['strict']) && $this->settings['pwr']['strict']) { $this->pwr_update_handler($update); } else { in_array($this->settings['updates']['callback'], [['danog\\MadelineProto\\API', 'get_updates_update_handler'], 'get_updates_update_handler']) ? $this->get_updates_update_handler($update) : $this->settings['updates']['callback']($update); } unset($this->calls[$call['id']]); array_walk($this->calls, function ($controller, $id) { if ($controller->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { $controller->discard(); } }); } } // Core types (no need to gen) //vector#1cb5c415 {t:Type} # [ t ] = Vector t; /////////////////////////////// /////////////////// Layer cons /////////////////////////////// //invokeAfterMsg#cb9f372d msg_id:long query:!X = X; //invokeAfterMsgs#3dc4b4f0 msg_ids:Vector query:!X = X; //invokeWithLayer1#53835315 query:!X = X; //invokeWithLayer2#289dd1f6 query:!X = X; //invokeWithLayer3#b7475268 query:!X = X; //invokeWithLayer4#dea0d430 query:!X = X; //invokeWithLayer5#417a57ae query:!X = X; //invokeWithLayer6#3a64d54d query:!X = X; //invokeWithLayer7#a5be56d3 query:!X = X; //invokeWithLayer8#e9abd9fd query:!X = X; //invokeWithLayer9#76715a63 query:!X = X; //invokeWithLayer10#39620c41 query:!X = X; //invokeWithLayer11#a6b88fdf query:!X = X; //invokeWithLayer12#dda60d3c query:!X = X; //invokeWithLayer13#427c8ea2 query:!X = X; //invokeWithLayer14#2b9b08fa query:!X = X; //invokeWithLayer15#b4418b64 query:!X = X; //invokeWithLayer16#cf5f0987 query:!X = X; //invokeWithLayer17#50858a19 query:!X = X; //invokeWithLayer18#1c900537 query:!X = X; //invokeWithLayer#da9b0d0d layer:int query:!X = X; // after 18 layer /////////////////////////////// /// Authorization key creation /////////////////////////////// resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector = ResPQ; p_q_inner_data#83c95aec pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data; server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params; server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params; server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data; client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data; dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer; dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer; dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer; destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes; destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes; destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes; ---functions--- req_pq#60469778 nonce:int128 = ResPQ; req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params; set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer; destroy_auth_key#d1435160 = DestroyAuthKeyRes; /////////////////////////////// ////////////// System messages /////////////////////////////// ---types--- msgs_ack#62d6b459 msg_ids:Vector = MsgsAck; bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification; bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification; msgs_state_req#da69fb52 msg_ids:Vector = MsgsStateReq; msgs_state_info#04deb57d req_msg_id:long info:string = MsgsStateInfo; msgs_all_info#8cc0d131 msg_ids:Vector info:string = MsgsAllInfo; msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo; msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo; msg_resend_req#7d861a08 msg_ids:Vector = MsgResendReq; //rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult; // parsed manually rpc_error#2144ca19 error_code:int error_message:string = RpcError; rpc_answer_unknown#5e2ad36e = RpcDropAnswer; rpc_answer_dropped_running#cd78e586 = RpcDropAnswer; rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer; future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt; future_salts#ae500895 req_msg_id:long now:int salts:vector = FutureSalts; pong#347773c5 msg_id:long ping_id:long = Pong; destroy_session_ok#e22045fc session_id:long = DestroySessionRes; destroy_session_none#62d350c9 session_id:long = DestroySessionRes; new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession; //message msg_id:long seqno:int bytes:int body:Object = Message; // parsed manually //msg_container#73f1f8dc messages:vector = MessageContainer; // parsed manually //msg_copy#e06046b2 orig_message:Message = MessageCopy; // parsed manually, not used - use msg_container //gzip_packed#3072cfa1 packed_data:string = Object; // parsed manually http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait; ipPort ipv4:int port:int = IpPort; help.configSimple#d997c3c5 date:int expires:int dc_id:int ip_port_list:Vector = help.ConfigSimple; ---functions--- rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer; get_future_salts#b921bd04 num:int = FutureSalts; ping#7abe77ec ping_id:long = Pong; ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong; destroy_session#e7512126 session_id:long = DestroySessionRes; contest.saveDeveloperInfo#9a5f6e95 vk_id:int name:string phone_number:string age:int city:string = Bool; /////////////////////////////// ///////// Main application API /////////////////////////////// ---types--- boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#2f37e231 flags:# file:InputFile caption:string stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaPhoto#81fa373a flags:# id:InputPhoto caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; inputMediaUploadedDocument#e39621fd flags:# file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector caption:string stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaDocument#5acb668e flags:# id:InputDocument caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaVenue#2827a81a geo_point:InputGeoPoint title:string address:string provider:string venue_id:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#922aec1 flags:# url:string caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaDocumentExternal#b6f74335 flags:# url:string caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputMediaInvoice#92153685 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string start_param:string = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#fb95c6c4 id:long access_hash:long = InputPhoto; inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#430f0724 id:long access_hash:long version:int = InputFileLocation; inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation; userEmpty#200250ba id:int = User; user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#cb44b1c flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; channelFull#17f45fcf flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#90dddc11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int post_author:flags.16?string = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#b5223b0f flags:# photo:flags.0?Photo caption:flags.1?string ttl_seconds:flags.2?int = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#7c4414d3 flags:# document:flags.0?Document caption:flags.1?string ttl_seconds:flags.2?int = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#7912b71f geo:GeoPoint title:string address:string provider:string venue_id:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction; messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; messageActionScreenshotTaken#4792929b = MessageAction; dialog#e4def5db flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#2049d70c long:double lat:double = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#5e002502 flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyAll#a429b886 = InputNotifyPeer; inputPeerNotifyEventsEmpty#f03064d8 = InputPeerNotifyEvents; inputPeerNotifyEventsAll#e86a2c74 = InputPeerNotifyEvents; inputPeerNotifySettings#38935eb2 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = InputPeerNotifySettings; peerNotifyEventsEmpty#add53cb3 = PeerNotifyEvents; peerNotifyEventsAll#6d1ded88 = PeerNotifyEvents; peerNotifySettingsEmpty#70a68512 = PeerNotifySettings; peerNotifySettings#9acda4c0 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = PeerNotifySettings; peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; userFull#f220f3f flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#eae87e42 contacts:Vector saved_count:int users:Vector = contacts.Contacts; contacts.importedContacts#77d01c3b imported:Vector popular_invites:Vector retry_contacts:Vector users:Vector = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector users:Vector = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector users:Vector = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#99262e37 flags:# pts:int count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; messages.chatsSlice#9cd81144 count:int chats:Vector = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector users:Vector = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterPhotoVideoDocuments#d95e73bb = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter; inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter; inputMessagesFilterMyMentionsUnread#46caf4a8 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updateDialogPinned#d711a2cc flags:# pinned:flags.0?true peer:Peer = Update; updatePinnedDialogs#d8caf68d flags:# order:flags.0?Vector = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updateLangPackTooLong#10c2404b = Update; updateLangPack#56022f4d difference:LangPackDifference = Update; updateFavedStickers#e511996d = Update; updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector = Update; updateContactsReset#7084a7be = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector intermediate_state:updates.State = updates.Difference; updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; upload.fileCdnRedirect#ea52fe5a dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes cdn_file_hashes:Vector = upload.File; dcOption#5d8c6cc flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int = DcOption; config#8df376a4 flags:# date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int phonecalls_enabled:flags.1?true call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string suggested_lang_code:flags.2?string lang_pack_version:flags.2?int disabled_features:Vector = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#8987f311 id:int critical:Bool url:string text:string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#18798952 id:long access_hash:long = InputDocument; documentEmpty#36f8c871 id:long = Document; document#87232bc7 id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int version:int attributes:Vector = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyAll#74d07c60 = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; sendMessageRecordRoundAction#88f27fbc = SendMessageAction; sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; contacts.found#1aa1f784 results:Vector chats:Vector users:Vector = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector = PrivacyRule; account.privacyRules#554abb6f rules:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#8a8ecd32 hash:string stickers:Vector = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector = messages.AllStickers; disabledFeature#ae636f24 feature:string description:string = DisabledFeature; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector = account.Authorizations; account.noPassword#96dabc18 new_salt:bytes email_unconfirmed_pattern:string = account.Password; account.password#7c18141c current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = account.Password; account.passwordSettings#b7b72ab3 email:string = account.PasswordSettings; account.passwordInputSettings#86916deb flags:# new_salt:flags.0?bytes new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#cd303b41 flags:# installed:flags.0?true archived:flags.1?true official:flags.2?true masks:flags.3?true id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#98e81d3a user_id:int description:string commands:Vector = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector = ReplyMarkup; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector users:Vector = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#6a9d7b35 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int messages:Vector chats:Vector users:Vector = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector other_updates:Vector chats:Vector users:Vector = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantAdmin#a82fa898 flags:# can_edit:flags.0?true user_id:int inviter_id:int promoted_by:int date:int admin_rights:ChannelAdminRights = ChannelParticipant; channelParticipantBanned#222c1886 flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChannelBannedRights = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter; channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter; channels.channelParticipants#f56ee2a8 count:int participants:Vector users:Vector = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector = channels.ChannelParticipant; help.termsOfService#f1ee3e90 text:string = help.TermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector = messages.SavedGifs; inputBotInlineMessageMediaAuto#292fed13 flags:# caption:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#f4a59de1 flags:# geo_point:InputGeoPoint reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#aaafadc8 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#2daf01a7 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#2cbbe15a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#a74b15b flags:# caption:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#3a8fd8b8 flags:# geo:GeoPoint reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#4366232e flags:# geo:GeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#9bebaeb9 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; messages.botResults#ccd3563d flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector cache_time:int = messages.BotResults; exportedMessageLink#1f486803 link:string = ExportedMessageLink; messageFwdHeader#fadff4ac flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; messages.peerDialogs#3371c354 dialogs:Vector messages:Vector chats:Vector users:Vector state:updates.State = messages.PeerDialogs; topPeer#edcdc05b peer:Peer rating:double = TopPeer; topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; topPeerCategoryBotsInline#148677e2 = TopPeerCategory; topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector chats:Vector users:Vector = contacts.TopPeers; draftMessageEmpty#ba4baec5 = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; messages.featuredStickers#f89d88e5 hash:int sets:Vector unread:Vector = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#5ce20970 hash:int stickers:Vector = messages.RecentStickers; messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers; messages.favedStickers#f37f2f16 hash:int packs:Vector stickers:Vector = messages.FavedStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector = messages.ArchivedStickers; messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector = messages.StickerSetInstallResult; stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector users:Vector = messages.HighScores; textEmpty#dc3d824f = RichText; textPlain#744694e0 text:string = RichText; textBold#6724abc4 text:RichText = RichText; textItalic#d912a59c text:RichText = RichText; textUnderline#c12622c4 text:RichText = RichText; textStrike#9bf8bb95 text:RichText = RichText; textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; pageBlockHeader#bfd064ec text:RichText = PageBlock; pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; pageBlockParagraph#467a0766 text:RichText = PageBlock; pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; pageBlockList#3a58c7f4 ordered:Bool items:Vector = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; pageBlockVideo#d9d71866 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:RichText = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; pageBlockEmbed#cde200d1 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:int h:int caption:RichText = PageBlock; pageBlockEmbedPost#292c7be9 url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:RichText = PageBlock; pageBlockCollage#8b31c4f items:Vector caption:RichText = PageBlock; pageBlockSlideshow#130c8963 items:Vector caption:RichText = PageBlock; pageBlockChannel#ef1751b5 channel:Chat = PageBlock; pageBlockAudio#31b81a7f audio_id:long caption:RichText = PageBlock; pagePart#8e3f9ebe blocks:Vector photos:Vector documents:Vector = Page; pageFull#556ec7aa blocks:Vector photos:Vector documents:Vector = Page; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true currency:string prices:Vector = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; webDocument#c61acbd8 url:string access_hash:long size:int mime_type:string attributes:Vector dc_id:int = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector = payments.PaymentReceipt; payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; shippingOption#b6213cdf id:string title:string prices:Vector = ShippingOption; inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCall#ffe6ab67 id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector = phone.PhoneCall; upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey; cdnConfig#5725e40a public_keys:Vector = CdnConfig; langPackString#cad181f6 key:string value:string = LangPackString; langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString; langPackStringDeleted#2979eeb2 key:string = LangPackString; langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector = LangPackDifference; langPackLanguage#117698f1 name:string native_name:string lang_code:string = LangPackLanguage; channelAdminRights#5d7ceba5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true invite_link:flags.6?true pin_messages:flags.7?true add_admins:flags.9?true = ChannelAdminRights; channelBannedRights#58cf4249 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true until_date:int = ChannelBannedRights; channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangePhoto#b82f55c3 prev_photo:ChatPhoto new_photo:ChatPhoto = ChannelAdminLogEventAction; channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; cdnFileHash#77eec38f offset:int limit:int hash:bytes = CdnFileHash; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X; initConnection#c7481da6 {X:Type} api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone; auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.sendInvites#771c1d97 phone_numbers:Vector message:string = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector = Bool; account.registerDevice#637ea878 token_type:int token:string = Bool; account.unregisterDevice#65c55b40 token_type:int token:string = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; account.getTmpPassword#4a82327e password_hash:bytes period:int = account.TmpPassword; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; contacts.getStatuses#c4a353ee = Vector; contacts.getContacts#c023849f hash:int = contacts.Contacts; contacts.importContacts#2c800be5 contacts:Vector = contacts.ImportedContacts; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector; contacts.importCard#4fe196fe export_card:Vector = User; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; contacts.resetSaved#879537f1 = Bool; messages.getMessages#4222fa74 id:Vector = messages.Messages; messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs; messages.getHistory#afa92846 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.search#039e9ea0 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.sendMedia#c8f16791 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.getChats#3c6aa187 id:Vector = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector title:string = Updates; messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#25223e24 message:string = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#ce91e4ca flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.editInlineBotMessage#130c2c85 flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#2d9776b9 peers:Vector = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector = Bool; messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#3289be6a flags:# pinned:flags.0?true peer:InputPeer = Bool; messages.reorderPinnedDialogs#959ff644 flags:# force:flags.0?true order:Vector = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia; messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates; messages.getFavedStickers#21ce0b0e hash:int = messages.FavedStickers; messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool; messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector = Vector; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; upload.reuploadCdnFile#1af91c09 file_token:bytes request_token:bytes = Vector; upload.getCdnFileHashes#f715c87b file_token:bytes offset:int = Vector; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#ae2de196 = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector = Bool; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#9010ef6f prev_app_version:string = Updates; help.getTermsOfService#350170f3 = help.TermsOfService; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector = Bool; channels.getMessages#93d7b347 channel:InputChannel id:Vector = messages.Messages; channels.getParticipants#24d98f92 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#20b88214 channel:InputChannel user_id:InputUser admin_rights:ChannelAdminRights = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; channels.exportMessageLink#c846d22d channel:InputChannel id:int = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; channels.editBanned#bfd915cd channel:InputChannel user_id:InputUser banned_rights:ChannelBannedRights = Updates; channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector max_id:long min_id:long limit:int = channels.AdminLogResults; channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool; channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector = Bool; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm; payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt; payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult; payments.getSavedInfo#227d824b = payments.SavedInfo; payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet; stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; phone.getCallConfig#55451fa9 = DataJSON; phone.requestCall#5b95b3d4 user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = Updates; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; langpack.getLangPack#9ab5c58e lang_code:string = LangPackDifference; langpack.getStrings#2e1ee318 lang_code:string keys:Vector = Vector; langpack.getDifference#b2e4d7d from_version:int = LangPackDifference; langpack.getLanguages#800fd57d = Vector; // LAYER 71 . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Threads; /** * Manages packing and unpacking of messages, and the list of sent and received messages. */ class SocketReader extends \Threaded implements \Collectable { public $ready = false; public function __construct($me, $current) { $this->API = $me; $this->current = $current; } public function __sleep() { return ['current', 'API', 'garbage']; } public function __destruct() { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['shutting_down_reader_pool'].$this->current, \danog\MadelineProto\Logger::NOTICE); } /** * Reading connection and receiving message from server. Check the CRC32. */ public function run() { require __DIR__.'/../../../../vendor/autoload.php'; $handler_pool = new \Pool($this->API->settings['threading']['handler_workers']); $this->ready = true; while ($this->API->run_workers) { try { $this->API->datacenter->sockets[$this->current]->reading = true; //$this->logger->logger('RECEIVING'); $error = $this->API->recv_message($this->current); $this->logger->logger('NOW HANDLE'); $handler_pool->submit(new SocketHandler($this->API, $this->current, $error)); $this->logger->logger('SUBMITTED'); $this->API->datacenter->sockets[$this->current]->reading = false; } catch (\danog\MadelineProto\NothingInTheSocketException $e) { //$this->logger->logger('Nothing in the socket for dc '.$this->current, \danog\MadelineProto\Logger::VERBOSE); } } while ($number = $handler_pool->collect()) { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['shutting_down_handler_pool'], $this->current, $number), \danog\MadelineProto\Logger::NOTICE); } $this->setGarbage(); } public $garbage = false; public function setGarbage() { $this->garbage = true; } public function isGarbage() { return $this->garbage; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Threads; /** * Manages packing and unpacking of messages, and the list of sent and received messages. */ class SocketHandler extends \Threaded implements \Collectable { public function __construct(&$me, $current, $error) { $this->API = $me; $this->current = $current; $this->error = $error; } /** * Reading connection and receiving message from server. Check the CRC32. */ public function run() { require __DIR__.'/../../../../vendor/autoload.php'; if ($this->error !== true) { if ($this->error === -404) { if ($this->API->datacenter->sockets[$this->current]->temp_auth_key !== null) { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['resetting_auth_key'], \danog\MadelineProto\Logger::WARNING); $this->API->datacenter->sockets[$this->current]->temp_auth_key = null; $this->API->init_authorization(); throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['recreate_temp_auth_key']); } } throw new \danog\MadelineProto\RPCErrorException($this->error, $this->error); } $this->API->handle_messages($this->current); $this->setGarbage(); } protected $garbage = false; public function setGarbage() { $this->garbage = true; } public function isGarbage() { return $this->garbage; } } decryptedDataBlock#dbf948c1 random_id:long random_bytes:string flags:# voice_call_id:flags.2?int128 in_seq_no:flags.4?int out_seq_no:flags.4?int recent_received_mask:flags.5?int proto:flags.3?int extra:flags.1?string raw_data:flags.0?string = DecryptedDataBlock; simpleDataBlock#cc0d0e76 random_id:long random_bytes:string raw_data:string = DecryptedDataBlock; . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class NothingInTheSocketException extends \Exception { } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ /* * Logger class */ namespace danog\MadelineProto; use Amp\ByteStream\ResourceOutputStream; class Logger { const foreground = ['default' => 39, 'black' => 30, 'red' => 31, 'green' => 32, 'yellow' => 33, 'blue' => 34, 'magenta' => 35, 'cyan' => 36, 'light_gray' => 37, 'dark_gray' => 90, 'light_red' => 91, 'light_green' => 92, 'light_yellow' => 93, 'light_blue' => 94, 'light_magenta' => 95, 'light_cyan' => 96, 'white' => 97]; const background = ['default' => 49, 'black' => 40, 'red' => 41, 'magenta' => 45, 'yellow' => 43, 'green' => 42, 'blue' => 44, 'cyan' => 46, 'light_gray' => 47, 'dark_gray' => 100, 'light_red' => 101, 'light_green' => 102, 'light_yellow' => 103, 'light_blue' => 104, 'light_magenta' => 105, 'light_cyan' => 106, 'white' => 107]; const set = ['bold' => 1, 'dim' => 2, 'underlined' => 3, 'blink' => 4, 'reverse' => 5, 'hidden' => 6]; const reset = ['all' => 0, 'bold' => 21, 'dim' => 22, 'underlined' => 24, 'blink' => 25, 'reverse' => 26, 'hidden' => 28]; public $mode = 0; public $optional = null; public $prefix = ''; public $level = 3; public $colors = []; public $newline = "\n"; public static $default; public static $printed = false; const ULTRA_VERBOSE = 5; const VERBOSE = 4; const NOTICE = 3; const WARNING = 2; const ERROR = 1; const FATAL_ERROR = 0; /* * Constructor function * Accepts various logger modes: * 0 - No logger * 1 - Log to the default logger destination * 2 - Log to file defined in second parameter * 3 - Echo logs * 4 - Call callable provided in logger_param. logger_param must accept two parameters: array $message, int $level * $message is an array containing the messages the log, $level, is the logging level */ public static function constructor($mode, $optional = null, $prefix = '', $level = self::NOTICE, $max_size = 100 * 1024 * 1024) { self::$default = new self($mode, $optional, $prefix, $level, $max_size); } public function __construct($mode, $optional = null, $prefix = '', $level = self::NOTICE, $max_size = 100 * 1024 * 1024) { if ($mode === null) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['no_mode_specified']); } $this->mode = $mode; $this->optional = $mode == 2 ? Absolute::absolute($optional) : $optional; $this->prefix = $prefix === '' ? '' : ', '.$prefix; $this->level = $level; if ($this->mode === 2 && !file_exists(pathinfo($this->optional, PATHINFO_DIRNAME))) { $this->optional = Absolute::absolute(getcwd().'/MadelineProto.log'); } if ($this->mode === 2 && !preg_match('/\.log$/', $this->optional)) { $this->optional .= '.log'; } if ($mode === 2 && $max_size !== -1 && file_exists($this->optional) && filesize($this->optional) > $max_size) { unlink($this->optional); } $this->colors[self::ULTRA_VERBOSE] = implode(';', [self::foreground['light_gray'], self::set['dim']]); $this->colors[self::VERBOSE] = implode(';', [self::foreground['green'], self::set['bold']]); $this->colors[self::NOTICE] = implode(';', [self::foreground['yellow'], self::set['bold']]); $this->colors[self::WARNING] = implode(';', [self::foreground['white'], self::set['dim'], self::background['red']]); $this->colors[self::ERROR] = implode(';', [self::foreground['white'], self::set['bold'], self::background['red']]); $this->colors[self::FATAL_ERROR] = implode(';', [self::foreground['red'], self::set['bold'], self::background['light_gray']]); $this->newline = PHP_EOL; if ($this->mode === 3) { $this->stdout = new ResourceOutputStream(STDOUT); if (php_sapi_name() !== 'cli') $this->newline = '
'.$this->newline; } elseif ($this->mode === 2) { $this->stdout = new ResourceOutputStream(fopen($this->optional, 'a+')); } elseif ($this->mode === 1) { $result = @ini_get('error_log'); if ($result === 'syslog') { $this->stdout = new ResourceOutputStream(STDERR); } elseif ($result) { $this->stdout = new ResourceOutputStream(fopen($result, 'a+')); } else { $this->stdout = new ResourceOutputStream(STDERR); } } } public static function log($param, $level = self::NOTICE) { if (!is_null(self::$default)) { self::$default->logger($param, $level, basename(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]['file'], '.php')); } } public function logger($param, $level = self::NOTICE, $file = null) { if ($level > $this->level || $this->mode === 0) { return false; } if (!self::$printed) { self::$printed = true; $this->colors[self::NOTICE] = implode(';', [self::foreground['light_gray'], self::set['bold'], self::background['blue']]); $this->logger('MadelineProto'); $this->logger('Copyright (C) 2016-2018 Daniil Gentili'); $this->logger('Licensed under AGPLv3'); $this->logger('https://github.com/danog/MadelineProto'); $this->colors[self::NOTICE] = implode(';', [self::foreground['yellow'], self::set['bold']]); } if ($this->mode === 4) { return call_user_func_array($this->optional, [$param, $level]); } $prefix = $this->prefix; if (\danog\MadelineProto\Magic::$has_thread && is_object(\Thread::getCurrentThread())) { $prefix .= ' (t)'; } if (\danog\MadelineProto\Magic::is_fork()) { $prefix .= ' (p)'; } if (!is_string($param)) { $param = json_encode($param, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); } if ($file === null) { $file = basename(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]['file'], '.php'); } $param = str_pad($file.$prefix.': ', 16 + strlen($prefix))."\t".$param; switch ($this->mode) { case 1: $this->stdout->write($param.$this->newline); break; default: $this->stdout->write(Magic::$isatty ? "\33[".$this->colors[$level].'m'.$param."\33[0m".$this->newline : $param.$this->newline); break; } } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; abstract class CombinedEventHandler { private $CombinedAPI; public function __construct($CombinedAPI) { $this->CombinedAPI = $CombinedAPI; foreach ($CombinedAPI->instances as $path => $instance) { $this->referenceInstance($path); } } final public function __sleep() { $keys = method_exists($this, '__magic_sleep') ? $this->__magic_sleep() : get_object_vars($this); unset($keys['CombinedAPI']); foreach ($this->CombinedAPI->instance_paths as $path) { unset($keys[$path]); } return array_keys($keys); } final public function referenceInstance($path) { $this->{$path} = $this->CombinedAPI->instances[$path]; } final public function removeInstance($path) { if (isset($this->{$path})) { unset($this->{$path}); } } } // Core types (no need to gen) //vector#1cb5c415 {t:Type} # [ t ] = Vector t; /////////////////////////////// /////////////////// Layer cons /////////////////////////////// //invokeAfterMsg#cb9f372d msg_id:long query:!X = X; //invokeAfterMsgs#3dc4b4f0 msg_ids:Vector query:!X = X; //invokeWithLayer1#53835315 query:!X = X; //invokeWithLayer2#289dd1f6 query:!X = X; //invokeWithLayer3#b7475268 query:!X = X; //invokeWithLayer4#dea0d430 query:!X = X; //invokeWithLayer5#417a57ae query:!X = X; //invokeWithLayer6#3a64d54d query:!X = X; //invokeWithLayer7#a5be56d3 query:!X = X; //invokeWithLayer8#e9abd9fd query:!X = X; //invokeWithLayer9#76715a63 query:!X = X; //invokeWithLayer10#39620c41 query:!X = X; //invokeWithLayer11#a6b88fdf query:!X = X; //invokeWithLayer12#dda60d3c query:!X = X; //invokeWithLayer13#427c8ea2 query:!X = X; //invokeWithLayer14#2b9b08fa query:!X = X; //invokeWithLayer15#b4418b64 query:!X = X; //invokeWithLayer16#cf5f0987 query:!X = X; //invokeWithLayer17#50858a19 query:!X = X; //invokeWithLayer18#1c900537 query:!X = X; //invokeWithLayer#da9b0d0d layer:int query:!X = X; // after 18 layer /////////////////////////////// /// Authorization key creation /////////////////////////////// resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector = ResPQ; p_q_inner_data#83c95aec pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data; server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params; server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params; server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data; client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data; dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer; dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer; dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer; destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes; destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes; destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes; ---functions--- req_pq#60469778 nonce:int128 = ResPQ; req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params; set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer; destroy_auth_key#d1435160 = DestroyAuthKeyRes; /////////////////////////////// ////////////// System messages /////////////////////////////// ---types--- msgs_ack#62d6b459 msg_ids:Vector = MsgsAck; bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification; bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification; msgs_state_req#da69fb52 msg_ids:Vector = MsgsStateReq; msgs_state_info#04deb57d req_msg_id:long info:string = MsgsStateInfo; msgs_all_info#8cc0d131 msg_ids:Vector info:string = MsgsAllInfo; msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo; msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo; msg_resend_req#7d861a08 msg_ids:Vector = MsgResendReq; //rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult; // parsed manually rpc_error#2144ca19 error_code:int error_message:string = RpcError; rpc_answer_unknown#5e2ad36e = RpcDropAnswer; rpc_answer_dropped_running#cd78e586 = RpcDropAnswer; rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer; future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt; future_salts#ae500895 req_msg_id:long now:int salts:vector = FutureSalts; pong#347773c5 msg_id:long ping_id:long = Pong; destroy_session_ok#e22045fc session_id:long = DestroySessionRes; destroy_session_none#62d350c9 session_id:long = DestroySessionRes; new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession; //message msg_id:long seqno:int bytes:int body:Object = Message; // parsed manually //msg_container#73f1f8dc messages:vector = MessageContainer; // parsed manually //msg_copy#e06046b2 orig_message:Message = MessageCopy; // parsed manually, not used - use msg_container //gzip_packed#3072cfa1 packed_data:string = Object; // parsed manually http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait; ---functions--- rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer; get_future_salts#b921bd04 num:int = FutureSalts; ping#7abe77ec ping_id:long = Pong; ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong; destroy_session#e7512126 session_id:long = DestroySessionRes; contest.saveDeveloperInfo#9a5f6e95 vk_id:int name:string phone_number:string age:int city:string = Bool; /////////////////////////////// ///////// Main application API /////////////////////////////// ---types--- boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#630c9af1 flags:# file:InputFile caption:string stickers:flags.0?Vector = InputMedia; inputMediaPhoto#e9bfb4f3 id:InputPhoto caption:string = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; inputMediaUploadedDocument#d070f1e9 flags:# file:InputFile mime_type:string attributes:Vector caption:string stickers:flags.0?Vector = InputMedia; inputMediaUploadedThumbDocument#50d88cae flags:# file:InputFile thumb:InputFile mime_type:string attributes:Vector caption:string stickers:flags.0?Vector = InputMedia; inputMediaDocument#1a77f29c id:InputDocument caption:string = InputMedia; inputMediaVenue#2827a81a geo_point:InputGeoPoint title:string address:string provider:string venue_id:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#b55f4f18 url:string caption:string = InputMedia; inputMediaDocumentExternal#e5e9607c url:string caption:string = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputMediaInvoice#92153685 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string start_param:string = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#fb95c6c4 id:long access_hash:long = InputPhoto; inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#430f0724 id:long access_hash:long version:int = InputFileLocation; inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation; userEmpty#200250ba id:int = User; user#d10d979a flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#a14dca52 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true editor:flags.3?true moderator:flags.4?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string = Chat; channelForbidden#8537784f flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; channelFull#c3d5512f flags:# can_view_participants:flags.3?true can_set_username:flags.6?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#c09be45f flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#3d8ce53d photo:Photo caption:string = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#f3e02ea8 document:Document caption:string = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#7912b71f geo:GeoPoint title:string address:string provider:string venue_id:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction; messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; dialog#66ffba14 flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#2049d70c long:double lat:double = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#5e002502 flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyAll#a429b886 = InputNotifyPeer; inputPeerNotifyEventsEmpty#f03064d8 = InputPeerNotifyEvents; inputPeerNotifyEventsAll#e86a2c74 = InputPeerNotifyEvents; inputPeerNotifySettings#38935eb2 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = InputPeerNotifySettings; peerNotifyEventsEmpty#add53cb3 = PeerNotifyEvents; peerNotifyEventsAll#6d1ded88 = PeerNotifyEvents; peerNotifySettingsEmpty#70a68512 = PeerNotifySettings; peerNotifySettings#9acda4c0 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = PeerNotifySettings; peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; userFull#f220f3f flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#6f8b8cb2 contacts:Vector users:Vector = contacts.Contacts; contacts.importedContacts#ad524315 imported:Vector retry_contacts:Vector users:Vector = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector users:Vector = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector users:Vector = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#99262e37 flags:# pts:int count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; messages.chatsSlice#9cd81144 count:int chats:Vector = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector users:Vector = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterPhotoVideoDocuments#d95e73bb = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updateDialogPinned#d711a2cc flags:# pinned:flags.0?true peer:Peer = Update; updatePinnedDialogs#d8caf68d flags:# order:flags.0?Vector = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector intermediate_state:updates.State = updates.Difference; updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; dcOption#5d8c6cc flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true id:int ip_address:string port:int = DcOption; config#cb601684 flags:# phonecalls_enabled:flags.1?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int rating_e_decay:int stickers_recent_limit:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string disabled_features:Vector = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#8987f311 id:int critical:Bool url:string text:string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#18798952 id:long access_hash:long = InputDocument; documentEmpty#36f8c871 id:long = Document; document#87232bc7 id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int version:int attributes:Vector = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyAll#74d07c60 = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; contacts.found#1aa1f784 results:Vector chats:Vector users:Vector = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector = PrivacyRule; account.privacyRules#554abb6f rules:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; documentAttributeVideo#5910cccb duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#8a8ecd32 hash:string stickers:Vector = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector = messages.AllStickers; disabledFeature#ae636f24 feature:string description:string = DisabledFeature; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector = account.Authorizations; account.noPassword#96dabc18 new_salt:bytes email_unconfirmed_pattern:string = account.Password; account.password#7c18141c current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = account.Password; account.passwordSettings#b7b72ab3 email:string = account.PasswordSettings; account.passwordInputSettings#86916deb flags:# new_salt:flags.0?bytes new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#cd303b41 flags:# installed:flags.0?true archived:flags.1?true official:flags.2?true masks:flags.3?true id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#98e81d3a user_id:int description:string commands:Vector = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector = ReplyMarkup; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector users:Vector = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#410dee07 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int messages:Vector chats:Vector users:Vector = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector other_updates:Vector chats:Vector users:Vector = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantModerator#91057fef user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantEditor#98192d61 user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantKicked#8cc5e69a user_id:int kicked_by:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#3c37bb7a = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelRoleEmpty#b285a0c6 = ChannelParticipantRole; channelRoleModerator#9618d975 = ChannelParticipantRole; channelRoleEditor#820bfe8c = ChannelParticipantRole; channels.channelParticipants#f56ee2a8 count:int participants:Vector users:Vector = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector = channels.ChannelParticipant; help.termsOfService#f1ee3e90 text:string = help.TermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector = messages.SavedGifs; inputBotInlineMessageMediaAuto#292fed13 flags:# caption:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#f4a59de1 flags:# geo_point:InputGeoPoint reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#aaafadc8 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#2daf01a7 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#2cbbe15a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#a74b15b flags:# caption:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#3a8fd8b8 flags:# geo:GeoPoint reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#4366232e flags:# geo:GeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#9bebaeb9 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; messages.botResults#ccd3563d flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector cache_time:int = messages.BotResults; exportedMessageLink#1f486803 link:string = ExportedMessageLink; messageFwdHeader#c786ddcb flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; messages.peerDialogs#3371c354 dialogs:Vector messages:Vector chats:Vector users:Vector state:updates.State = messages.PeerDialogs; topPeer#edcdc05b peer:Peer rating:double = TopPeer; topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; topPeerCategoryBotsInline#148677e2 = TopPeerCategory; topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector chats:Vector users:Vector = contacts.TopPeers; draftMessageEmpty#ba4baec5 = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; messages.featuredStickers#f89d88e5 hash:int sets:Vector unread:Vector = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#5ce20970 hash:int stickers:Vector = messages.RecentStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector = messages.ArchivedStickers; messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector = messages.StickerSetInstallResult; stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector users:Vector = messages.HighScores; textEmpty#dc3d824f = RichText; textPlain#744694e0 text:string = RichText; textBold#6724abc4 text:RichText = RichText; textItalic#d912a59c text:RichText = RichText; textUnderline#c12622c4 text:RichText = RichText; textStrike#9bf8bb95 text:RichText = RichText; textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; pageBlockHeader#bfd064ec text:RichText = PageBlock; pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; pageBlockParagraph#467a0766 text:RichText = PageBlock; pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; pageBlockList#3a58c7f4 ordered:Bool items:Vector = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; pageBlockVideo#d9d71866 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:RichText = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; pageBlockEmbed#cde200d1 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:int h:int caption:RichText = PageBlock; pageBlockEmbedPost#292c7be9 url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:RichText = PageBlock; pageBlockCollage#8b31c4f items:Vector caption:RichText = PageBlock; pageBlockSlideshow#130c8963 items:Vector caption:RichText = PageBlock; pagePart#8dee6c44 blocks:Vector photos:Vector videos:Vector = Page; pageFull#d7a19d69 blocks:Vector photos:Vector videos:Vector = Page; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true currency:string prices:Vector = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; webDocument#c61acbd8 url:string access_hash:long size:int mime_type:string attributes:Vector dc_id:int = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector = payments.PaymentReceipt; payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; shippingOption#b6213cdf id:string title:string prices:Vector = ShippingOption; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCall#ffe6ab67 id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector = phone.PhoneCall; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X; initConnection#69796de9 {X:Type} api_id:int device_model:string system_version:string app_version:string lang_code:string query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone; auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.sendInvites#771c1d97 phone_numbers:Vector message:string = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int a:flags.0?true b:flags.0?true c:flags.0?true d:flags.0?true api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector = Bool; account.registerDevice#637ea878 token_type:int token:string = Bool; account.unregisterDevice#65c55b40 token_type:int token:string = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; account.getTmpPassword#4a82327e password_hash:bytes period:int = account.TmpPassword; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; contacts.getStatuses#c4a353ee = Vector; contacts.getContacts#22c6aa08 hash:string = contacts.Contacts; contacts.importContacts#da30b32d contacts:Vector replace:Bool = contacts.ImportedContacts; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector; contacts.importCard#4fe196fe export_card:Vector = User; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; messages.getMessages#4222fa74 id:Vector = messages.Messages; messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs; messages.getHistory#afa92846 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.search#d4569248 flags:# peer:InputPeer q:string filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.sendMedia#c8f16791 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.getChats#3c6aa187 id:Vector = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector title:string = Updates; messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#25223e24 message:string = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#ce91e4ca flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.editInlineBotMessage#130c2c85 flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#2d9776b9 peers:Vector = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector = Bool; messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#3289be6a flags:# pinned:flags.0?true peer:InputPeer = Bool; messages.reorderPinnedDialogs#959ff644 flags:# force:flags.0?true order:Vector = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector = Vector; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#ae2de196 = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector = Bool; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#9010ef6f prev_app_version:string = Updates; help.getTermsOfService#350170f3 = help.TermsOfService; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector = Bool; channels.getMessages#93d7b347 channel:InputChannel id:Vector = messages.Messages; channels.getParticipants#24d98f92 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#eb7611d0 channel:InputChannel user_id:InputUser role:ChannelParticipantRole = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector = Updates; channels.kickFromChannel#a672de14 channel:InputChannel user_id:InputUser kicked:Bool = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; channels.exportMessageLink#c846d22d channel:InputChannel id:int = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm; payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt; payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult; payments.getSavedInfo#227d824b = payments.SavedInfo; payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; phone.getCallConfig#55451fa9 = DataJSON; phone.requestCall#5b95b3d4 user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = Updates; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; // LAYER 65 { "constructors": [ { "id": "-1132882121", "predicate": "boolFalse", "params": [], "type": "Bool" }, { "id": "-1720552011", "predicate": "boolTrue", "params": [], "type": "Bool" }, { "id": "1072550713", "predicate": "true", "params": [], "type": "True" }, { "id": "481674261", "predicate": "vector", "params": [], "type": "Vector t" }, { "id": "-994444869", "predicate": "error", "params": [ { "name": "code", "type": "int" }, { "name": "text", "type": "string" } ], "type": "Error" }, { "id": "1450380236", "predicate": "null", "params": [], "type": "Null" }, { "id": "2134579434", "predicate": "inputPeerEmpty", "params": [], "type": "InputPeer" }, { "id": "2107670217", "predicate": "inputPeerSelf", "params": [], "type": "InputPeer" }, { "id": "396093539", "predicate": "inputPeerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1182234929", "predicate": "inputUserEmpty", "params": [], "type": "InputUser" }, { "id": "-138301121", "predicate": "inputUserSelf", "params": [], "type": "InputUser" }, { "id": "-208488460", "predicate": "inputPhoneContact", "params": [ { "name": "client_id", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputContact" }, { "id": "-181407105", "predicate": "inputFile", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" }, { "name": "md5_checksum", "type": "string" } ], "type": "InputFile" }, { "id": "-1771768449", "predicate": "inputMediaEmpty", "params": [], "type": "InputMedia" }, { "id": "-139464256", "predicate": "inputMediaUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-373312269", "predicate": "inputMediaPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-104578748", "predicate": "inputMediaGeoPoint", "params": [ { "name": "geo_point", "type": "InputGeoPoint" } ], "type": "InputMedia" }, { "id": "-1494984313", "predicate": "inputMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputMedia" }, { "id": "-2106507297", "predicate": "inputMediaUploadedVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "2004934137", "predicate": "inputMediaUploadedThumbVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-1821749571", "predicate": "inputMediaVideo", "params": [ { "name": "id", "type": "InputVideo" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "480546647", "predicate": "inputChatPhotoEmpty", "params": [], "type": "InputChatPhoto" }, { "id": "-1809496270", "predicate": "inputChatUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-1293828344", "predicate": "inputChatPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-457104426", "predicate": "inputGeoPointEmpty", "params": [], "type": "InputGeoPoint" }, { "id": "-206066487", "predicate": "inputGeoPoint", "params": [ { "name": "lat", "type": "double" }, { "name": "long", "type": "double" } ], "type": "InputGeoPoint" }, { "id": "483901197", "predicate": "inputPhotoEmpty", "params": [], "type": "InputPhoto" }, { "id": "-74070332", "predicate": "inputPhoto", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputPhoto" }, { "id": "1426648181", "predicate": "inputVideoEmpty", "params": [], "type": "InputVideo" }, { "id": "-296249774", "predicate": "inputVideo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputVideo" }, { "id": "342061462", "predicate": "inputFileLocation", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1023632620", "predicate": "inputVideoFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-1377390588", "predicate": "inputPhotoCropAuto", "params": [], "type": "InputPhotoCrop" }, { "id": "-644787419", "predicate": "inputPhotoCrop", "params": [ { "name": "crop_left", "type": "double" }, { "name": "crop_top", "type": "double" }, { "name": "crop_width", "type": "double" } ], "type": "InputPhotoCrop" }, { "id": "1996904104", "predicate": "inputAppEvent", "params": [ { "name": "time", "type": "double" }, { "name": "type", "type": "string" }, { "name": "peer", "type": "long" }, { "name": "data", "type": "string" } ], "type": "InputAppEvent" }, { "id": "-1649296275", "predicate": "peerUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "Peer" }, { "id": "-1160714821", "predicate": "peerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Peer" }, { "id": "-1432995067", "predicate": "storage.fileUnknown", "params": [], "type": "storage.FileType" }, { "id": "8322574", "predicate": "storage.fileJpeg", "params": [], "type": "storage.FileType" }, { "id": "-891180321", "predicate": "storage.fileGif", "params": [], "type": "storage.FileType" }, { "id": "172975040", "predicate": "storage.filePng", "params": [], "type": "storage.FileType" }, { "id": "-1373745011", "predicate": "storage.filePdf", "params": [], "type": "storage.FileType" }, { "id": "1384777335", "predicate": "storage.fileMp3", "params": [], "type": "storage.FileType" }, { "id": "1258941372", "predicate": "storage.fileMov", "params": [], "type": "storage.FileType" }, { "id": "1086091090", "predicate": "storage.filePartial", "params": [], "type": "storage.FileType" }, { "id": "-1278304028", "predicate": "storage.fileMp4", "params": [], "type": "storage.FileType" }, { "id": "276907596", "predicate": "storage.fileWebp", "params": [], "type": "storage.FileType" }, { "id": "2086234950", "predicate": "fileLocationUnavailable", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "1406570614", "predicate": "fileLocation", "params": [ { "name": "dc_id", "type": "int" }, { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "537022650", "predicate": "userEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "User" }, { "id": "1326562017", "predicate": "userProfilePhotoEmpty", "params": [], "type": "UserProfilePhoto" }, { "id": "-715532088", "predicate": "userProfilePhoto", "params": [ { "name": "photo_id", "type": "long" }, { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "UserProfilePhoto" }, { "id": "164646985", "predicate": "userStatusEmpty", "params": [], "type": "UserStatus" }, { "id": "-306628279", "predicate": "userStatusOnline", "params": [ { "name": "expires", "type": "int" } ], "type": "UserStatus" }, { "id": "9203775", "predicate": "userStatusOffline", "params": [ { "name": "was_online", "type": "int" } ], "type": "UserStatus" }, { "id": "-1683826688", "predicate": "chatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Chat" }, { "id": "-652419756", "predicate": "chat", "params": [ { "name": "flags", "type": "#" }, { "name": "creator", "type": "flags.0?true" }, { "name": "kicked", "type": "flags.1?true" }, { "name": "left", "type": "flags.2?true" }, { "name": "admins_enabled", "type": "flags.3?true" }, { "name": "admin", "type": "flags.4?true" }, { "name": "deactivated", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" }, { "name": "migrated_to", "type": "flags.6?InputChannel" } ], "type": "Chat" }, { "id": "120753115", "predicate": "chatForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Chat" }, { "id": "771925524", "predicate": "chatFull", "params": [ { "name": "id", "type": "int" }, { "name": "participants", "type": "ChatParticipants" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector" } ], "type": "ChatFull" }, { "id": "-925415106", "predicate": "chatParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "-57668565", "predicate": "chatParticipantsForbidden", "params": [ { "name": "flags", "type": "#" }, { "name": "chat_id", "type": "int" }, { "name": "self_participant", "type": "flags.0?ChatParticipant" } ], "type": "ChatParticipants" }, { "id": "1061556205", "predicate": "chatParticipants", "params": [ { "name": "chat_id", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "version", "type": "int" } ], "type": "ChatParticipants" }, { "id": "935395612", "predicate": "chatPhotoEmpty", "params": [], "type": "ChatPhoto" }, { "id": "1632839530", "predicate": "chatPhoto", "params": [ { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "ChatPhoto" }, { "id": "-2082087340", "predicate": "messageEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Message" }, { "id": "1537633299", "predicate": "message", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "reply_markup", "type": "flags.6?ReplyMarkup" }, { "name": "entities", "type": "flags.7?Vector" }, { "name": "views", "type": "flags.10?int" } ], "type": "Message" }, { "id": "-1066691065", "predicate": "messageService", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "Message" }, { "id": "1038967584", "predicate": "messageMediaEmpty", "params": [], "type": "MessageMedia" }, { "id": "1032643901", "predicate": "messageMediaPhoto", "params": [ { "name": "photo", "type": "Photo" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1540298357", "predicate": "messageMediaVideo", "params": [ { "name": "video", "type": "Video" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1457575028", "predicate": "messageMediaGeo", "params": [ { "name": "geo", "type": "GeoPoint" } ], "type": "MessageMedia" }, { "id": "1585262393", "predicate": "messageMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "user_id", "type": "int" } ], "type": "MessageMedia" }, { "id": "-1618676578", "predicate": "messageMediaUnsupported", "params": [], "type": "MessageMedia" }, { "id": "-1230047312", "predicate": "messageActionEmpty", "params": [], "type": "MessageAction" }, { "id": "-1503425638", "predicate": "messageActionChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "users", "type": "Vector" } ], "type": "MessageAction" }, { "id": "-1247687078", "predicate": "messageActionChatEditTitle", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "2144015272", "predicate": "messageActionChatEditPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageAction" }, { "id": "-1780220945", "predicate": "messageActionChatDeletePhoto", "params": [], "type": "MessageAction" }, { "id": "1217033015", "predicate": "messageActionChatAddUser", "params": [ { "name": "users", "type": "Vector" } ], "type": "MessageAction" }, { "id": "-1297179892", "predicate": "messageActionChatDeleteUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1042448310", "predicate": "dialog", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Dialog" }, { "id": "590459437", "predicate": "photoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Photo" }, { "id": "-840088834", "predicate": "photo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "sizes", "type": "Vector" } ], "type": "Photo" }, { "id": "236446268", "predicate": "photoSizeEmpty", "params": [ { "name": "type", "type": "string" } ], "type": "PhotoSize" }, { "id": "2009052699", "predicate": "photoSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "size", "type": "int" } ], "type": "PhotoSize" }, { "id": "-374917894", "predicate": "photoCachedSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "PhotoSize" }, { "id": "-1056548696", "predicate": "videoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Video" }, { "id": "-148338733", "predicate": "video", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "Video" }, { "id": "286776671", "predicate": "geoPointEmpty", "params": [], "type": "GeoPoint" }, { "id": "541710092", "predicate": "geoPoint", "params": [ { "name": "long", "type": "double" }, { "name": "lat", "type": "double" } ], "type": "GeoPoint" }, { "id": "-2128698738", "predicate": "auth.checkedPhone", "params": [ { "name": "phone_registered", "type": "Bool" } ], "type": "auth.CheckedPhone" }, { "id": "-269659687", "predicate": "auth.sentCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "-16553231", "predicate": "auth.authorization", "params": [ { "name": "user", "type": "User" } ], "type": "auth.Authorization" }, { "id": "-543777747", "predicate": "auth.exportedAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.ExportedAuthorization" }, { "id": "-1195615476", "predicate": "inputNotifyPeer", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "InputNotifyPeer" }, { "id": "423314455", "predicate": "inputNotifyUsers", "params": [], "type": "InputNotifyPeer" }, { "id": "1251338318", "predicate": "inputNotifyChats", "params": [], "type": "InputNotifyPeer" }, { "id": "-1540769658", "predicate": "inputNotifyAll", "params": [], "type": "InputNotifyPeer" }, { "id": "-265263912", "predicate": "inputPeerNotifyEventsEmpty", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "-395694988", "predicate": "inputPeerNotifyEventsAll", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "1185074840", "predicate": "inputPeerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "InputPeerNotifySettings" }, { "id": "-1378534221", "predicate": "peerNotifyEventsEmpty", "params": [], "type": "PeerNotifyEvents" }, { "id": "1830677896", "predicate": "peerNotifyEventsAll", "params": [], "type": "PeerNotifyEvents" }, { "id": "1889961234", "predicate": "peerNotifySettingsEmpty", "params": [], "type": "PeerNotifySettings" }, { "id": "-1923214866", "predicate": "peerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "PeerNotifySettings" }, { "id": "-860866985", "predicate": "wallPaper", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "sizes", "type": "Vector" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "1490799288", "predicate": "inputReportReasonSpam", "params": [], "type": "ReportReason" }, { "id": "505595789", "predicate": "inputReportReasonViolence", "params": [], "type": "ReportReason" }, { "id": "777640226", "predicate": "inputReportReasonPornography", "params": [], "type": "ReportReason" }, { "id": "-512463606", "predicate": "inputReportReasonOther", "params": [ { "name": "text", "type": "string" } ], "type": "ReportReason" }, { "id": "1518971995", "predicate": "userFull", "params": [ { "name": "user", "type": "User" }, { "name": "link", "type": "contacts.Link" }, { "name": "profile_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "blocked", "type": "Bool" }, { "name": "bot_info", "type": "BotInfo" } ], "type": "UserFull" }, { "id": "-116274796", "predicate": "contact", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual", "type": "Bool" } ], "type": "Contact" }, { "id": "-805141448", "predicate": "importedContact", "params": [ { "name": "user_id", "type": "int" }, { "name": "client_id", "type": "long" } ], "type": "ImportedContact" }, { "id": "1444661369", "predicate": "contactBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ContactBlocked" }, { "id": "1038193057", "predicate": "contactSuggested", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual_contacts", "type": "int" } ], "type": "ContactSuggested" }, { "id": "-748155807", "predicate": "contactStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "ContactStatus" }, { "id": "986597452", "predicate": "contacts.link", "params": [ { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" }, { "name": "user", "type": "User" } ], "type": "contacts.Link" }, { "id": "-1219778094", "predicate": "contacts.contactsNotModified", "params": [], "type": "contacts.Contacts" }, { "id": "1871416498", "predicate": "contacts.contacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Contacts" }, { "id": "-1387117803", "predicate": "contacts.importedContacts", "params": [ { "name": "imported", "type": "Vector" }, { "name": "retry_contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ImportedContacts" }, { "id": "471043349", "predicate": "contacts.blocked", "params": [ { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "-1878523231", "predicate": "contacts.blockedSlice", "params": [ { "name": "count", "type": "int" }, { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "1447681221", "predicate": "contacts.suggested", "params": [ { "name": "results", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Suggested" }, { "id": "364538944", "predicate": "messages.dialogs", "params": [ { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "1910543603", "predicate": "messages.dialogsSlice", "params": [ { "name": "count", "type": "int" }, { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "-1938715001", "predicate": "messages.messages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "189033187", "predicate": "messages.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "1694474197", "predicate": "messages.chats", "params": [ { "name": "chats", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "-438840932", "predicate": "messages.chatFull", "params": [ { "name": "full_chat", "type": "ChatFull" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.ChatFull" }, { "id": "-1269012015", "predicate": "messages.affectedHistory", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "1474492012", "predicate": "inputMessagesFilterEmpty", "params": [], "type": "MessagesFilter" }, { "id": "-1777752804", "predicate": "inputMessagesFilterPhotos", "params": [], "type": "MessagesFilter" }, { "id": "-1614803355", "predicate": "inputMessagesFilterVideo", "params": [], "type": "MessagesFilter" }, { "id": "1458172132", "predicate": "inputMessagesFilterPhotoVideo", "params": [], "type": "MessagesFilter" }, { "id": "-648121413", "predicate": "inputMessagesFilterPhotoVideoDocuments", "params": [], "type": "MessagesFilter" }, { "id": "-1629621880", "predicate": "inputMessagesFilterDocument", "params": [], "type": "MessagesFilter" }, { "id": "-808946398", "predicate": "inputMessagesFilterAudio", "params": [], "type": "MessagesFilter" }, { "id": "1526462308", "predicate": "inputMessagesFilterAudioDocuments", "params": [], "type": "MessagesFilter" }, { "id": "2129714567", "predicate": "inputMessagesFilterUrl", "params": [], "type": "MessagesFilter" }, { "id": "522914557", "predicate": "updateNewMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1318109142", "predicate": "updateMessageID", "params": [ { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Update" }, { "id": "-1576161051", "predicate": "updateDeleteMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1548249383", "predicate": "updateUserTyping", "params": [ { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "-1704596961", "predicate": "updateChatUserTyping", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "125178264", "predicate": "updateChatParticipants", "params": [ { "name": "participants", "type": "ChatParticipants" } ], "type": "Update" }, { "id": "469489699", "predicate": "updateUserStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "Update" }, { "id": "-1489818765", "predicate": "updateUserName", "params": [ { "name": "user_id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "Update" }, { "id": "-1791935732", "predicate": "updateUserPhoto", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "previous", "type": "Bool" } ], "type": "Update" }, { "id": "628472761", "predicate": "updateContactRegistered", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1657903163", "predicate": "updateContactLink", "params": [ { "name": "user_id", "type": "int" }, { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" } ], "type": "Update" }, { "id": "-1895411046", "predicate": "updateNewAuthorization", "params": [ { "name": "auth_key_id", "type": "long" }, { "name": "date", "type": "int" }, { "name": "device", "type": "string" }, { "name": "location", "type": "string" } ], "type": "Update" }, { "id": "-1519637954", "predicate": "updates.state", "params": [ { "name": "pts", "type": "int" }, { "name": "qts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "unread_count", "type": "int" } ], "type": "updates.State" }, { "id": "1567990072", "predicate": "updates.differenceEmpty", "params": [ { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "updates.Difference" }, { "id": "16030880", "predicate": "updates.difference", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-1459938943", "predicate": "updates.differenceSlice", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "intermediate_state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-484987010", "predicate": "updatesTooLong", "params": [], "type": "Updates" }, { "id": "-136766906", "predicate": "updateShortMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "-892863022", "predicate": "updateShortChatMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "chat_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "2027216577", "predicate": "updateShort", "params": [ { "name": "update", "type": "Update" }, { "name": "date", "type": "int" } ], "type": "Updates" }, { "id": "1918567619", "predicate": "updatesCombined", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq_start", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "1957577280", "predicate": "updates", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "-1916114267", "predicate": "photos.photos", "params": [ { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "352657236", "predicate": "photos.photosSlice", "params": [ { "name": "count", "type": "int" }, { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "539045032", "predicate": "photos.photo", "params": [ { "name": "photo", "type": "Photo" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photo" }, { "id": "157948117", "predicate": "upload.file", "params": [ { "name": "type", "type": "storage.FileType" }, { "name": "mtime", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "upload.File" }, { "id": "98092748", "predicate": "dcOption", "params": [ { "name": "flags", "type": "#" }, { "name": "ipv6", "type": "flags.0?true" }, { "name": "media_only", "type": "flags.1?true" }, { "name": "id", "type": "int" }, { "name": "ip_address", "type": "string" }, { "name": "port", "type": "int" } ], "type": "DcOption" }, { "id": "1823925854", "predicate": "config", "params": [ { "name": "date", "type": "int" }, { "name": "expires", "type": "int" }, { "name": "test_mode", "type": "Bool" }, { "name": "this_dc", "type": "int" }, { "name": "dc_options", "type": "Vector" }, { "name": "chat_size_max", "type": "int" }, { "name": "megagroup_size_max", "type": "int" }, { "name": "forwarded_count_max", "type": "int" }, { "name": "online_update_period_ms", "type": "int" }, { "name": "offline_blur_timeout_ms", "type": "int" }, { "name": "offline_idle_timeout_ms", "type": "int" }, { "name": "online_cloud_timeout_ms", "type": "int" }, { "name": "notify_cloud_delay_ms", "type": "int" }, { "name": "notify_default_delay_ms", "type": "int" }, { "name": "chat_big_size", "type": "int" }, { "name": "push_chat_period_ms", "type": "int" }, { "name": "push_chat_limit", "type": "int" }, { "name": "disabled_features", "type": "Vector" } ], "type": "Config" }, { "id": "-1910892683", "predicate": "nearestDc", "params": [ { "name": "country", "type": "string" }, { "name": "this_dc", "type": "int" }, { "name": "nearest_dc", "type": "int" } ], "type": "NearestDc" }, { "id": "-1987579119", "predicate": "help.appUpdate", "params": [ { "name": "id", "type": "int" }, { "name": "critical", "type": "Bool" }, { "name": "url", "type": "string" }, { "name": "text", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "-1000708810", "predicate": "help.noAppUpdate", "params": [], "type": "help.AppUpdate" }, { "id": "415997816", "predicate": "help.inviteText", "params": [ { "name": "message", "type": "string" } ], "type": "help.InviteText" }, { "id": "1662091044", "predicate": "wallPaperSolid", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "bg_color", "type": "int" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "314359194", "predicate": "updateNewEncryptedMessage", "params": [ { "name": "message", "type": "EncryptedMessage" }, { "name": "qts", "type": "int" } ], "type": "Update" }, { "id": "386986326", "predicate": "updateEncryptedChatTyping", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Update" }, { "id": "-1264392051", "predicate": "updateEncryption", "params": [ { "name": "chat", "type": "EncryptedChat" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "956179895", "predicate": "updateEncryptedMessagesRead", "params": [ { "name": "chat_id", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1417756512", "predicate": "encryptedChatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "1006044124", "predicate": "encryptedChatWaiting", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-931638658", "predicate": "encryptedChatRequested", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "-94974410", "predicate": "encryptedChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a_or_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "332848423", "predicate": "encryptedChatDiscarded", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-247351839", "predicate": "inputEncryptedChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedChat" }, { "id": "-1038136962", "predicate": "encryptedFileEmpty", "params": [], "type": "EncryptedFile" }, { "id": "1248893260", "predicate": "encryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "EncryptedFile" }, { "id": "406307684", "predicate": "inputEncryptedFileEmpty", "params": [], "type": "InputEncryptedFile" }, { "id": "1690108678", "predicate": "inputEncryptedFileUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "md5_checksum", "type": "string" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "1511503333", "predicate": "inputEncryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedFile" }, { "id": "-182231723", "predicate": "inputEncryptedFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-317144808", "predicate": "encryptedMessage", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" }, { "name": "file", "type": "EncryptedFile" } ], "type": "EncryptedMessage" }, { "id": "594758406", "predicate": "encryptedMessageService", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "EncryptedMessage" }, { "id": "-1058912715", "predicate": "messages.dhConfigNotModified", "params": [ { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "740433629", "predicate": "messages.dhConfig", "params": [ { "name": "g", "type": "int" }, { "name": "p", "type": "bytes" }, { "name": "version", "type": "int" }, { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "1443858741", "predicate": "messages.sentEncryptedMessage", "params": [ { "name": "date", "type": "int" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1802240206", "predicate": "messages.sentEncryptedFile", "params": [ { "name": "date", "type": "int" }, { "name": "file", "type": "EncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-95482955", "predicate": "inputFileBig", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" } ], "type": "InputFile" }, { "id": "767652808", "predicate": "inputEncryptedFileBigUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "-364179876", "predicate": "updateChatParticipantAdd", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1851755554", "predicate": "updateChatParticipantDelete", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1906403213", "predicate": "updateDcOptions", "params": [ { "name": "dc_options", "type": "Vector" } ], "type": "Update" }, { "id": "1313442987", "predicate": "inputMediaUploadedAudio", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1986820223", "predicate": "inputMediaAudio", "params": [ { "name": "id", "type": "InputAudio" } ], "type": "InputMedia" }, { "id": "-1610888", "predicate": "inputMediaUploadedDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "1095242886", "predicate": "inputMediaUploadedThumbDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "-779818943", "predicate": "inputMediaDocument", "params": [ { "name": "id", "type": "InputDocument" } ], "type": "InputMedia" }, { "id": "802824708", "predicate": "messageMediaDocument", "params": [ { "name": "document", "type": "Document" } ], "type": "MessageMedia" }, { "id": "-961117440", "predicate": "messageMediaAudio", "params": [ { "name": "audio", "type": "Audio" } ], "type": "MessageMedia" }, { "id": "-648356732", "predicate": "inputAudioEmpty", "params": [], "type": "InputAudio" }, { "id": "2010398975", "predicate": "inputAudio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputAudio" }, { "id": "1928391342", "predicate": "inputDocumentEmpty", "params": [], "type": "InputDocument" }, { "id": "410618194", "predicate": "inputDocument", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputDocument" }, { "id": "1960591437", "predicate": "inputAudioFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1313188841", "predicate": "inputDocumentFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1483311320", "predicate": "audioEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Audio" }, { "id": "-102543275", "predicate": "audio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" } ], "type": "Audio" }, { "id": "922273905", "predicate": "documentEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Document" }, { "id": "-106717361", "predicate": "document", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "attributes", "type": "Vector" } ], "type": "Document" }, { "id": "398898678", "predicate": "help.support", "params": [ { "name": "phone_number", "type": "string" }, { "name": "user", "type": "User" } ], "type": "help.Support" }, { "id": "-1613493288", "predicate": "notifyPeer", "params": [ { "name": "peer", "type": "Peer" } ], "type": "NotifyPeer" }, { "id": "-1261946036", "predicate": "notifyUsers", "params": [], "type": "NotifyPeer" }, { "id": "-1073230141", "predicate": "notifyChats", "params": [], "type": "NotifyPeer" }, { "id": "1959820384", "predicate": "notifyAll", "params": [], "type": "NotifyPeer" }, { "id": "-2131957734", "predicate": "updateUserBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "blocked", "type": "Bool" } ], "type": "Update" }, { "id": "-1094555409", "predicate": "updateNotifySettings", "params": [ { "name": "peer", "type": "NotifyPeer" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Update" }, { "id": "-484053553", "predicate": "auth.sentAppCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "381645902", "predicate": "sendMessageTypingAction", "params": [], "type": "SendMessageAction" }, { "id": "-44119819", "predicate": "sendMessageCancelAction", "params": [], "type": "SendMessageAction" }, { "id": "-1584933265", "predicate": "sendMessageRecordVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-378127636", "predicate": "sendMessageUploadVideoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-718310409", "predicate": "sendMessageRecordAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-212740181", "predicate": "sendMessageUploadAudioAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-774682074", "predicate": "sendMessageUploadPhotoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-1441998364", "predicate": "sendMessageUploadDocumentAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "393186209", "predicate": "sendMessageGeoLocationAction", "params": [], "type": "SendMessageAction" }, { "id": "1653390447", "predicate": "sendMessageChooseContactAction", "params": [], "type": "SendMessageAction" }, { "id": "446822276", "predicate": "contacts.found", "params": [ { "name": "results", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Found" }, { "id": "942527460", "predicate": "updateServiceNotification", "params": [ { "name": "type", "type": "string" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" }, { "name": "popup", "type": "Bool" } ], "type": "Update" }, { "id": "-496024847", "predicate": "userStatusRecently", "params": [], "type": "UserStatus" }, { "id": "129960444", "predicate": "userStatusLastWeek", "params": [], "type": "UserStatus" }, { "id": "2011940674", "predicate": "userStatusLastMonth", "params": [], "type": "UserStatus" }, { "id": "-298113238", "predicate": "updatePrivacy", "params": [ { "name": "key", "type": "PrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "Update" }, { "id": "1335282456", "predicate": "inputPrivacyKeyStatusTimestamp", "params": [], "type": "InputPrivacyKey" }, { "id": "-1137792208", "predicate": "privacyKeyStatusTimestamp", "params": [], "type": "PrivacyKey" }, { "id": "218751099", "predicate": "inputPrivacyValueAllowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "407582158", "predicate": "inputPrivacyValueAllowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "320652927", "predicate": "inputPrivacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "195371015", "predicate": "inputPrivacyValueDisallowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "-697604407", "predicate": "inputPrivacyValueDisallowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "-1877932953", "predicate": "inputPrivacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "-123988", "predicate": "privacyValueAllowContacts", "params": [], "type": "PrivacyRule" }, { "id": "1698855810", "predicate": "privacyValueAllowAll", "params": [], "type": "PrivacyRule" }, { "id": "1297858060", "predicate": "privacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "-125240806", "predicate": "privacyValueDisallowContacts", "params": [], "type": "PrivacyRule" }, { "id": "-1955338397", "predicate": "privacyValueDisallowAll", "params": [], "type": "PrivacyRule" }, { "id": "209668535", "predicate": "privacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "1430961007", "predicate": "account.privacyRules", "params": [ { "name": "rules", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "-1194283041", "predicate": "accountDaysTTL", "params": [ { "name": "days", "type": "int" } ], "type": "AccountDaysTTL" }, { "id": "-1527411636", "predicate": "account.sentChangePhoneCode", "params": [ { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" } ], "type": "account.SentChangePhoneCode" }, { "id": "314130811", "predicate": "updateUserPhone", "params": [ { "name": "user_id", "type": "int" }, { "name": "phone", "type": "string" } ], "type": "Update" }, { "id": "1815593308", "predicate": "documentAttributeImageSize", "params": [ { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "297109817", "predicate": "documentAttributeAnimated", "params": [], "type": "DocumentAttribute" }, { "id": "978674434", "predicate": "documentAttributeSticker", "params": [ { "name": "alt", "type": "string" }, { "name": "stickerset", "type": "InputStickerSet" } ], "type": "DocumentAttribute" }, { "id": "1494273227", "predicate": "documentAttributeVideo", "params": [ { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "-556656416", "predicate": "documentAttributeAudio", "params": [ { "name": "duration", "type": "int" }, { "name": "title", "type": "string" }, { "name": "performer", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "358154344", "predicate": "documentAttributeFilename", "params": [ { "name": "file_name", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "-244016606", "predicate": "messages.stickersNotModified", "params": [], "type": "messages.Stickers" }, { "id": "-1970352846", "predicate": "messages.stickers", "params": [ { "name": "hash", "type": "string" }, { "name": "stickers", "type": "Vector" } ], "type": "messages.Stickers" }, { "id": "313694676", "predicate": "stickerPack", "params": [ { "name": "emoticon", "type": "string" }, { "name": "documents", "type": "Vector" } ], "type": "StickerPack" }, { "id": "-395967805", "predicate": "messages.allStickersNotModified", "params": [], "type": "messages.AllStickers" }, { "id": "-302170017", "predicate": "messages.allStickers", "params": [ { "name": "hash", "type": "int" }, { "name": "sets", "type": "Vector" } ], "type": "messages.AllStickers" }, { "id": "-1369215196", "predicate": "disabledFeature", "params": [ { "name": "feature", "type": "string" }, { "name": "description", "type": "string" } ], "type": "DisabledFeature" }, { "id": "-1721631396", "predicate": "updateReadHistoryInbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "791617983", "predicate": "updateReadHistoryOutbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-2066640507", "predicate": "messages.affectedMessages", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "1599050311", "predicate": "contactLinkUnknown", "params": [], "type": "ContactLink" }, { "id": "-17968211", "predicate": "contactLinkNone", "params": [], "type": "ContactLink" }, { "id": "646922073", "predicate": "contactLinkHasPhone", "params": [], "type": "ContactLink" }, { "id": "-721239344", "predicate": "contactLinkContact", "params": [], "type": "ContactLink" }, { "id": "2139689491", "predicate": "updateWebPage", "params": [ { "name": "webpage", "type": "WebPage" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-350980120", "predicate": "webPageEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "WebPage" }, { "id": "-981018084", "predicate": "webPagePending", "params": [ { "name": "id", "type": "long" }, { "name": "date", "type": "int" } ], "type": "WebPage" }, { "id": "-897446185", "predicate": "webPage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "long" }, { "name": "url", "type": "string" }, { "name": "display_url", "type": "string" }, { "name": "type", "type": "flags.0?string" }, { "name": "site_name", "type": "flags.1?string" }, { "name": "title", "type": "flags.2?string" }, { "name": "description", "type": "flags.3?string" }, { "name": "photo", "type": "flags.4?Photo" }, { "name": "embed_url", "type": "flags.5?string" }, { "name": "embed_type", "type": "flags.5?string" }, { "name": "embed_width", "type": "flags.6?int" }, { "name": "embed_height", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "author", "type": "flags.8?string" }, { "name": "document", "type": "flags.9?Document" } ], "type": "WebPage" }, { "id": "-1557277184", "predicate": "messageMediaWebPage", "params": [ { "name": "webpage", "type": "WebPage" } ], "type": "MessageMedia" }, { "id": "2079516406", "predicate": "authorization", "params": [ { "name": "hash", "type": "long" }, { "name": "flags", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "platform", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "api_id", "type": "int" }, { "name": "app_name", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "date_created", "type": "int" }, { "name": "date_active", "type": "int" }, { "name": "ip", "type": "string" }, { "name": "country", "type": "string" }, { "name": "region", "type": "string" } ], "type": "Authorization" }, { "id": "307276766", "predicate": "account.authorizations", "params": [ { "name": "authorizations", "type": "Vector" } ], "type": "account.Authorizations" }, { "id": "-1764049896", "predicate": "account.noPassword", "params": [ { "name": "new_salt", "type": "bytes" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "2081952796", "predicate": "account.password", "params": [ { "name": "current_salt", "type": "bytes" }, { "name": "new_salt", "type": "bytes" }, { "name": "hint", "type": "string" }, { "name": "has_recovery", "type": "Bool" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "-1212732749", "predicate": "account.passwordSettings", "params": [ { "name": "email", "type": "string" } ], "type": "account.PasswordSettings" }, { "id": "-1124314324", "predicate": "account.passwordInputSettings", "params": [ { "name": "flags", "type": "#" }, { "name": "new_salt", "type": "flags.0?bytes" }, { "name": "new_password_hash", "type": "flags.0?bytes" }, { "name": "hint", "type": "flags.0?string" }, { "name": "email", "type": "flags.1?string" } ], "type": "account.PasswordInputSettings" }, { "id": "326715557", "predicate": "auth.passwordRecovery", "params": [ { "name": "email_pattern", "type": "string" } ], "type": "auth.PasswordRecovery" }, { "id": "673687578", "predicate": "inputMediaVenue", "params": [ { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "InputMedia" }, { "id": "2031269663", "predicate": "messageMediaVenue", "params": [ { "name": "geo", "type": "GeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "MessageMedia" }, { "id": "-1551583367", "predicate": "receivedNotifyMessage", "params": [ { "name": "id", "type": "int" }, { "name": "flags", "type": "int" } ], "type": "ReceivedNotifyMessage" }, { "id": "1776236393", "predicate": "chatInviteEmpty", "params": [], "type": "ExportedChatInvite" }, { "id": "-64092740", "predicate": "chatInviteExported", "params": [ { "name": "link", "type": "string" } ], "type": "ExportedChatInvite" }, { "id": "1516793212", "predicate": "chatInviteAlready", "params": [ { "name": "chat", "type": "Chat" } ], "type": "ChatInvite" }, { "id": "-1813406880", "predicate": "chatInvite", "params": [ { "name": "flags", "type": "#" }, { "name": "channel", "type": "flags.0?true" }, { "name": "broadcast", "type": "flags.1?true" }, { "name": "public", "type": "flags.2?true" }, { "name": "megagroup", "type": "flags.3?true" }, { "name": "title", "type": "string" } ], "type": "ChatInvite" }, { "id": "-123931160", "predicate": "messageActionChatJoinedByLink", "params": [ { "name": "inviter_id", "type": "int" } ], "type": "MessageAction" }, { "id": "1757493555", "predicate": "updateReadMessagesContents", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-4838507", "predicate": "inputStickerSetEmpty", "params": [], "type": "InputStickerSet" }, { "id": "-1645763991", "predicate": "inputStickerSetID", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputStickerSet" }, { "id": "-2044933984", "predicate": "inputStickerSetShortName", "params": [ { "name": "short_name", "type": "string" } ], "type": "InputStickerSet" }, { "id": "-852477119", "predicate": "stickerSet", "params": [ { "name": "flags", "type": "#" }, { "name": "installed", "type": "flags.0?true" }, { "name": "disabled", "type": "flags.1?true" }, { "name": "official", "type": "flags.2?true" }, { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "short_name", "type": "string" }, { "name": "count", "type": "int" }, { "name": "hash", "type": "int" } ], "type": "StickerSet" }, { "id": "-1240849242", "predicate": "messages.stickerSet", "params": [ { "name": "set", "type": "StickerSet" }, { "name": "packs", "type": "Vector" }, { "name": "documents", "type": "Vector" } ], "type": "messages.StickerSet" }, { "id": "847885712", "predicate": "user", "params": [ { "name": "flags", "type": "#" }, { "name": "self", "type": "flags.10?true" }, { "name": "contact", "type": "flags.11?true" }, { "name": "mutual_contact", "type": "flags.12?true" }, { "name": "deleted", "type": "flags.13?true" }, { "name": "bot", "type": "flags.14?true" }, { "name": "bot_chat_history", "type": "flags.15?true" }, { "name": "bot_nochats", "type": "flags.16?true" }, { "name": "verified", "type": "flags.17?true" }, { "name": "restricted", "type": "flags.18?true" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "flags.0?long" }, { "name": "first_name", "type": "flags.1?string" }, { "name": "last_name", "type": "flags.2?string" }, { "name": "username", "type": "flags.3?string" }, { "name": "phone", "type": "flags.4?string" }, { "name": "photo", "type": "flags.5?UserProfilePhoto" }, { "name": "status", "type": "flags.6?UserStatus" }, { "name": "bot_info_version", "type": "flags.14?int" }, { "name": "restiction_reason", "type": "flags.18?string" } ], "type": "User" }, { "id": "-1032140601", "predicate": "botCommand", "params": [ { "name": "command", "type": "string" }, { "name": "description", "type": "string" } ], "type": "BotCommand" }, { "id": "-1154598962", "predicate": "botInfoEmpty", "params": [], "type": "BotInfo" }, { "id": "164583517", "predicate": "botInfo", "params": [ { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" }, { "name": "share_text", "type": "string" }, { "name": "description", "type": "string" }, { "name": "commands", "type": "Vector" } ], "type": "BotInfo" }, { "id": "-1560655744", "predicate": "keyboardButton", "params": [ { "name": "text", "type": "string" } ], "type": "KeyboardButton" }, { "id": "2002815875", "predicate": "keyboardButtonRow", "params": [ { "name": "buttons", "type": "Vector" } ], "type": "KeyboardButtonRow" }, { "id": "-1606526075", "predicate": "replyKeyboardHide", "params": [ { "name": "flags", "type": "#" }, { "name": "selective", "type": "flags.2?true" } ], "type": "ReplyMarkup" }, { "id": "-200242528", "predicate": "replyKeyboardForceReply", "params": [ { "name": "flags", "type": "#" }, { "name": "single_use", "type": "flags.1?true" }, { "name": "selective", "type": "flags.2?true" } ], "type": "ReplyMarkup" }, { "id": "889353612", "predicate": "replyKeyboardMarkup", "params": [ { "name": "flags", "type": "#" }, { "name": "resize", "type": "flags.0?true" }, { "name": "single_use", "type": "flags.1?true" }, { "name": "selective", "type": "flags.2?true" }, { "name": "rows", "type": "Vector" } ], "type": "ReplyMarkup" }, { "id": "2072935910", "predicate": "inputPeerUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "-668391402", "predicate": "inputUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputUser" }, { "id": "-1350696044", "predicate": "help.appChangelogEmpty", "params": [], "type": "help.AppChangelog" }, { "id": "1181279933", "predicate": "help.appChangelog", "params": [ { "name": "text", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-1148011883", "predicate": "messageEntityUnknown", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-100378723", "predicate": "messageEntityMention", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1868782349", "predicate": "messageEntityHashtag", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1827637959", "predicate": "messageEntityBotCommand", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1859134776", "predicate": "messageEntityUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1692693954", "predicate": "messageEntityEmail", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-1117713463", "predicate": "messageEntityBold", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-2106619040", "predicate": "messageEntityItalic", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "681706865", "predicate": "messageEntityCode", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1938967520", "predicate": "messageEntityPre", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "language", "type": "string" } ], "type": "MessageEntity" }, { "id": "1990644519", "predicate": "messageEntityTextUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "url", "type": "string" } ], "type": "MessageEntity" }, { "id": "301019932", "predicate": "updateShortSentMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "-292807034", "predicate": "inputChannelEmpty", "params": [], "type": "InputChannel" }, { "id": "-1343524562", "predicate": "inputChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputChannel" }, { "id": "-1109531342", "predicate": "peerChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Peer" }, { "id": "548253432", "predicate": "inputPeerChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "-399192472", "predicate": "channel", "params": [ { "name": "flags", "type": "#" }, { "name": "creator", "type": "flags.0?true" }, { "name": "kicked", "type": "flags.1?true" }, { "name": "left", "type": "flags.2?true" }, { "name": "editor", "type": "flags.3?true" }, { "name": "moderator", "type": "flags.4?true" }, { "name": "broadcast", "type": "flags.5?true" }, { "name": "verified", "type": "flags.7?true" }, { "name": "megagroup", "type": "flags.8?true" }, { "name": "restricted", "type": "flags.9?true" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "username", "type": "flags.6?string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" }, { "name": "restiction_reason", "type": "flags.9?string" } ], "type": "Chat" }, { "id": "763724588", "predicate": "channelForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" } ], "type": "Chat" }, { "id": "2131196633", "predicate": "contacts.resolvedPeer", "params": [ { "name": "peer", "type": "Peer" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ResolvedPeer" }, { "id": "-1640751649", "predicate": "channelFull", "params": [ { "name": "flags", "type": "#" }, { "name": "can_view_participants", "type": "flags.3?true" }, { "name": "id", "type": "int" }, { "name": "about", "type": "string" }, { "name": "participants_count", "type": "flags.0?int" }, { "name": "admins_count", "type": "flags.1?int" }, { "name": "kicked_count", "type": "flags.2?int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector" }, { "name": "migrated_from_chat_id", "type": "flags.4?int" }, { "name": "migrated_from_max_id", "type": "flags.4?int" } ], "type": "ChatFull" }, { "id": "1535415986", "predicate": "dialogChannel", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "top_important_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "pts", "type": "int" } ], "type": "Dialog" }, { "id": "182649427", "predicate": "messageRange", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "MessageRange" }, { "id": "-399216813", "predicate": "messageGroup", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "count", "type": "int" }, { "name": "date", "type": "int" } ], "type": "MessageGroup" }, { "id": "-1139861572", "predicate": "messages.channelMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "pts", "type": "int" }, { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "collapsed", "type": "flags.0?Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "-1781355374", "predicate": "messageActionChannelCreate", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "1620337698", "predicate": "updateChannelTooLong", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Update" }, { "id": "-1227598250", "predicate": "updateChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Update" }, { "id": "-1016324548", "predicate": "updateChannelGroup", "params": [ { "name": "channel_id", "type": "int" }, { "name": "group", "type": "MessageGroup" } ], "type": "Update" }, { "id": "1656358105", "predicate": "updateNewChannelMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1108669311", "predicate": "updateReadChannelInbox", "params": [ { "name": "channel_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "Update" }, { "id": "-1015733815", "predicate": "updateDeleteChannelMessages", "params": [ { "name": "channel_id", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-1734268085", "predicate": "updateChannelMessageViews", "params": [ { "name": "channel_id", "type": "int" }, { "name": "id", "type": "int" }, { "name": "views", "type": "int" } ], "type": "Update" }, { "id": "1041346555", "predicate": "updates.channelDifferenceEmpty", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" } ], "type": "updates.ChannelDifference" }, { "id": "1578530374", "predicate": "updates.channelDifferenceTooLong", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "top_message", "type": "int" }, { "name": "top_important_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "updates.ChannelDifference" }, { "id": "543450958", "predicate": "updates.channelDifference", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "new_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "updates.ChannelDifference" }, { "id": "-1798033689", "predicate": "channelMessagesFilterEmpty", "params": [], "type": "ChannelMessagesFilter" }, { "id": "-847783593", "predicate": "channelMessagesFilter", "params": [ { "name": "flags", "type": "#" }, { "name": "important_only", "type": "flags.0?true" }, { "name": "exclude_new_messages", "type": "flags.1?true" }, { "name": "ranges", "type": "Vector" } ], "type": "ChannelMessagesFilter" }, { "id": "-100588754", "predicate": "channelMessagesFilterCollapsed", "params": [], "type": "ChannelMessagesFilter" }, { "id": "367766557", "predicate": "channelParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1557620115", "predicate": "channelParticipantSelf", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1861910545", "predicate": "channelParticipantModerator", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1743180447", "predicate": "channelParticipantEditor", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1933187430", "predicate": "channelParticipantKicked", "params": [ { "name": "user_id", "type": "int" }, { "name": "kicked_by", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-471670279", "predicate": "channelParticipantCreator", "params": [ { "name": "user_id", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-566281095", "predicate": "channelParticipantsRecent", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-1268741783", "predicate": "channelParticipantsAdmins", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "1010285434", "predicate": "channelParticipantsKicked", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-1299865402", "predicate": "channelRoleEmpty", "params": [], "type": "ChannelParticipantRole" }, { "id": "-1776756363", "predicate": "channelRoleModerator", "params": [], "type": "ChannelParticipantRole" }, { "id": "-2113143156", "predicate": "channelRoleEditor", "params": [], "type": "ChannelParticipantRole" }, { "id": "-177282392", "predicate": "channels.channelParticipants", "params": [ { "name": "count", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "channels.ChannelParticipants" }, { "id": "-791039645", "predicate": "channels.channelParticipant", "params": [ { "name": "participant", "type": "ChannelParticipant" }, { "name": "users", "type": "Vector" } ], "type": "channels.ChannelParticipant" }, { "id": "-636267638", "predicate": "chatParticipantCreator", "params": [ { "name": "user_id", "type": "int" } ], "type": "ChatParticipant" }, { "id": "-489233354", "predicate": "chatParticipantAdmin", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "1855224129", "predicate": "updateChatAdmins", "params": [ { "name": "chat_id", "type": "int" }, { "name": "enabled", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1232070311", "predicate": "updateChatParticipantAdmin", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "is_admin", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1371385889", "predicate": "messageActionChatMigrateTo", "params": [ { "name": "channel_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1336546578", "predicate": "messageActionChannelMigrateFrom", "params": [ { "name": "title", "type": "string" }, { "name": "chat_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1328445861", "predicate": "channelParticipantsBots", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-236044656", "predicate": "help.termsOfService", "params": [ { "name": "text", "type": "string" } ], "type": "help.TermsOfService" }, { "id": "1753886890", "predicate": "updateNewStickerSet", "params": [ { "name": "stickerset", "type": "messages.StickerSet" } ], "type": "Update" }, { "id": "-253774767", "predicate": "updateStickerSetsOrder", "params": [ { "name": "order", "type": "Vector" } ], "type": "Update" }, { "id": "1135492588", "predicate": "updateStickerSets", "params": [], "type": "Update" }, { "id": "-814484985", "predicate": "webPageExternal", "params": [ { "name": "flags", "type": "#" }, { "name": "url", "type": "string" }, { "name": "display_url", "type": "string" }, { "name": "type", "type": "flags.0?string" }, { "name": "title", "type": "flags.1?string" }, { "name": "description", "type": "flags.2?string" }, { "name": "thumb_url", "type": "flags.3?string" }, { "name": "content_url", "type": "flags.4?string" }, { "name": "w", "type": "flags.5?int" }, { "name": "h", "type": "flags.5?int" }, { "name": "duration", "type": "flags.6?int" } ], "type": "WebPage" }, { "id": "-713438005", "predicate": "foundGif", "params": [ { "name": "webpage", "type": "WebPage" } ], "type": "FoundGif" }, { "id": "1212395773", "predicate": "inputMediaGifExternal", "params": [ { "name": "url", "type": "string" }, { "name": "q", "type": "string" } ], "type": "InputMedia" }, { "id": "1158290442", "predicate": "messages.foundGifs", "params": [ { "name": "next_offset", "type": "int" }, { "name": "results", "type": "Vector" } ], "type": "messages.FoundGifs" } ], "methods": [ { "id": "-878758099", "method": "invokeAfterMsg", "params": [ { "name": "msg_id", "type": "long" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1036301552", "method": "invokeAfterMsgs", "params": [ { "name": "msg_ids", "type": "Vector" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1877286395", "method": "auth.checkPhone", "params": [ { "name": "phone_number", "type": "string" } ], "type": "auth.CheckedPhone" }, { "id": "1988976461", "method": "auth.sendCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "sms_type", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "auth.SentCode" }, { "id": "63247716", "method": "auth.sendCall", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "453408308", "method": "auth.signUp", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1126886015", "method": "auth.signIn", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "1461180992", "method": "auth.logOut", "params": [], "type": "Bool" }, { "id": "-1616179942", "method": "auth.resetAuthorizations", "params": [], "type": "Bool" }, { "id": "1998331287", "method": "auth.sendInvites", "params": [ { "name": "phone_numbers", "type": "Vector" }, { "name": "message", "type": "string" } ], "type": "Bool" }, { "id": "-440401971", "method": "auth.exportAuthorization", "params": [ { "name": "dc_id", "type": "int" } ], "type": "auth.ExportedAuthorization" }, { "id": "-470837741", "method": "auth.importAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-841733627", "method": "auth.bindTempAuthKey", "params": [ { "name": "perm_auth_key_id", "type": "long" }, { "name": "nonce", "type": "long" }, { "name": "expires_at", "type": "int" }, { "name": "encrypted_message", "type": "bytes" } ], "type": "Bool" }, { "id": "1147957548", "method": "account.registerDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "app_sandbox", "type": "Bool" }, { "name": "lang_code", "type": "string" } ], "type": "Bool" }, { "id": "1707432768", "method": "account.unregisterDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" } ], "type": "Bool" }, { "id": "-2067899501", "method": "account.updateNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" }, { "name": "settings", "type": "InputPeerNotifySettings" } ], "type": "Bool" }, { "id": "313765169", "method": "account.getNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" } ], "type": "PeerNotifySettings" }, { "id": "-612493497", "method": "account.resetNotifySettings", "params": [], "type": "Bool" }, { "id": "-259486360", "method": "account.updateProfile", "params": [ { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "User" }, { "id": "1713919532", "method": "account.updateStatus", "params": [ { "name": "offline", "type": "Bool" } ], "type": "Bool" }, { "id": "-1068696894", "method": "account.getWallPapers", "params": [], "type": "Vector" }, { "id": "-1374118561", "method": "account.reportPeer", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "reason", "type": "ReportReason" } ], "type": "Bool" }, { "id": "227648840", "method": "users.getUsers", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-902781519", "method": "users.getFullUser", "params": [ { "name": "id", "type": "InputUser" } ], "type": "UserFull" }, { "id": "-995929106", "method": "contacts.getStatuses", "params": [], "type": "Vector" }, { "id": "583445000", "method": "contacts.getContacts", "params": [ { "name": "hash", "type": "string" } ], "type": "contacts.Contacts" }, { "id": "-634342611", "method": "contacts.importContacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "replace", "type": "Bool" } ], "type": "contacts.ImportedContacts" }, { "id": "-847825880", "method": "contacts.getSuggested", "params": [ { "name": "limit", "type": "int" } ], "type": "contacts.Suggested" }, { "id": "-1902823612", "method": "contacts.deleteContact", "params": [ { "name": "id", "type": "InputUser" } ], "type": "contacts.Link" }, { "id": "1504393374", "method": "contacts.deleteContacts", "params": [ { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "858475004", "method": "contacts.block", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-448724803", "method": "contacts.unblock", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-176409329", "method": "contacts.getBlocked", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "contacts.Blocked" }, { "id": "-2065352905", "method": "contacts.exportCard", "params": [], "type": "Vector" }, { "id": "1340184318", "method": "contacts.importCard", "params": [ { "name": "export_card", "type": "Vector" } ], "type": "User" }, { "id": "1109588596", "method": "messages.getMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "1799878989", "method": "messages.getDialogs", "params": [ { "name": "offset_date", "type": "int" }, { "name": "offset_id", "type": "int" }, { "name": "offset_peer", "type": "InputPeer" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-1970355494", "method": "messages.getHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset_id", "type": "int" }, { "name": "add_offset", "type": "int" }, { "name": "limit", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" } ], "type": "messages.Messages" }, { "id": "-732523960", "method": "messages.search", "params": [ { "name": "flags", "type": "#" }, { "name": "important_only", "type": "flags.0?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "238054714", "method": "messages.readHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "-1212072999", "method": "messages.deleteHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-1510897371", "method": "messages.deleteMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "94983360", "method": "messages.receivedMessages", "params": [ { "name": "max_id", "type": "int" } ], "type": "Vector" }, { "id": "-1551737264", "method": "messages.setTyping", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Bool" }, { "id": "-91733382", "method": "messages.sendMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.1?true" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" }, { "name": "entities", "type": "flags.3?Vector" } ], "type": "Updates" }, { "id": "-923703407", "method": "messages.sendMedia", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "Updates" }, { "id": "1888354709", "method": "messages.forwardMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "from_peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "random_id", "type": "Vector" }, { "name": "to_peer", "type": "InputPeer" } ], "type": "Updates" }, { "id": "-820669733", "method": "messages.reportSpam", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "Bool" }, { "id": "1013621127", "method": "messages.getChats", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "998448230", "method": "messages.getFullChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "messages.ChatFull" }, { "id": "-599447467", "method": "messages.editChatTitle", "params": [ { "name": "chat_id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-900957736", "method": "messages.editChatPhoto", "params": [ { "name": "chat_id", "type": "int" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-106911223", "method": "messages.addChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "fwd_limit", "type": "int" } ], "type": "Updates" }, { "id": "-530505962", "method": "messages.deleteChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" } ], "type": "Updates" }, { "id": "164303470", "method": "messages.createChat", "params": [ { "name": "users", "type": "Vector" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-304838614", "method": "updates.getState", "params": [], "type": "updates.State" }, { "id": "168039573", "method": "updates.getDifference", "params": [ { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "qts", "type": "int" } ], "type": "updates.Difference" }, { "id": "-285902432", "method": "photos.updateProfilePhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "UserProfilePhoto" }, { "id": "-720397176", "method": "photos.uploadProfilePhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "photos.Photo" }, { "id": "-2016444625", "method": "photos.deletePhotos", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-1291540959", "method": "upload.saveFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "-475607115", "method": "upload.getFile", "params": [ { "name": "location", "type": "InputFileLocation" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "upload.File" }, { "id": "-990308245", "method": "help.getConfig", "params": [], "type": "Config" }, { "id": "531836966", "method": "help.getNearestDc", "params": [], "type": "NearestDc" }, { "id": "-938300290", "method": "help.getAppUpdate", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "1862465352", "method": "help.saveAppLog", "params": [ { "name": "events", "type": "Vector" } ], "type": "Bool" }, { "id": "-1532407418", "method": "help.getInviteText", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.InviteText" }, { "id": "-1848823128", "method": "photos.getUserPhotos", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "long" }, { "name": "limit", "type": "int" } ], "type": "photos.Photos" }, { "id": "865483769", "method": "messages.forwardMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Updates" }, { "id": "-1082919718", "method": "messages.sendBroadcast", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "random_id", "type": "Vector" }, { "name": "message", "type": "string" }, { "name": "media", "type": "InputMedia" } ], "type": "Updates" }, { "id": "651135312", "method": "messages.getDhConfig", "params": [ { "name": "version", "type": "int" }, { "name": "random_length", "type": "int" } ], "type": "messages.DhConfig" }, { "id": "-162681021", "method": "messages.requestEncryption", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "random_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "1035731989", "method": "messages.acceptEncryption", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "g_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "-304536635", "method": "messages.discardEncryption", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Bool" }, { "id": "2031374829", "method": "messages.setEncryptedTyping", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "2135648522", "method": "messages.readEncryptedHistory", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "max_date", "type": "int" } ], "type": "Bool" }, { "id": "-1451792525", "method": "messages.sendEncrypted", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1701831834", "method": "messages.sendEncryptedFile", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" }, { "name": "file", "type": "InputEncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "852769188", "method": "messages.sendEncryptedService", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "1436924774", "method": "messages.receivedQueue", "params": [ { "name": "max_qts", "type": "int" } ], "type": "Vector" }, { "id": "-562337987", "method": "upload.saveBigFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "file_total_parts", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "1769565673", "method": "initConnection", "params": [ { "name": "api_id", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-1663104819", "method": "help.getSupport", "params": [], "type": "help.Support" }, { "id": "229241832", "method": "auth.sendSms", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "916930423", "method": "messages.readMessageContents", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "655677548", "method": "account.checkUsername", "params": [ { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "1040964988", "method": "account.updateUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "301470424", "method": "contacts.search", "params": [ { "name": "q", "type": "string" }, { "name": "limit", "type": "int" } ], "type": "contacts.Found" }, { "id": "-623130288", "method": "account.getPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" } ], "type": "account.PrivacyRules" }, { "id": "-906486552", "method": "account.setPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "1099779595", "method": "account.deleteAccount", "params": [ { "name": "reason", "type": "string" } ], "type": "Bool" }, { "id": "150761757", "method": "account.getAccountTTL", "params": [], "type": "AccountDaysTTL" }, { "id": "608323678", "method": "account.setAccountTTL", "params": [ { "name": "ttl", "type": "AccountDaysTTL" } ], "type": "Bool" }, { "id": "-627372787", "method": "invokeWithLayer", "params": [ { "name": "layer", "type": "int" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-113456221", "method": "contacts.resolveUsername", "params": [ { "name": "username", "type": "string" } ], "type": "contacts.ResolvedPeer" }, { "id": "-1543001868", "method": "account.sendChangePhoneCode", "params": [ { "name": "phone_number", "type": "string" } ], "type": "account.SentChangePhoneCode" }, { "id": "1891839707", "method": "account.changePhone", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "User" }, { "id": "-1373446075", "method": "messages.getStickers", "params": [ { "name": "emoticon", "type": "string" }, { "name": "hash", "type": "string" } ], "type": "messages.Stickers" }, { "id": "479598769", "method": "messages.getAllStickers", "params": [ { "name": "hash", "type": "int" } ], "type": "messages.AllStickers" }, { "id": "954152242", "method": "account.updateDeviceLocked", "params": [ { "name": "period", "type": "int" } ], "type": "Bool" }, { "id": "1738800940", "method": "auth.importBotAuthorization", "params": [ { "name": "flags", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "bot_auth_token", "type": "string" } ], "type": "auth.Authorization" }, { "id": "623001124", "method": "messages.getWebPagePreview", "params": [ { "name": "message", "type": "string" } ], "type": "MessageMedia" }, { "id": "-484392616", "method": "account.getAuthorizations", "params": [], "type": "account.Authorizations" }, { "id": "-545786948", "method": "account.resetAuthorization", "params": [ { "name": "hash", "type": "long" } ], "type": "Bool" }, { "id": "1418342645", "method": "account.getPassword", "params": [], "type": "account.Password" }, { "id": "-1131605573", "method": "account.getPasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" } ], "type": "account.PasswordSettings" }, { "id": "-92517498", "method": "account.updatePasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" }, { "name": "new_settings", "type": "account.PasswordInputSettings" } ], "type": "Bool" }, { "id": "174260510", "method": "auth.checkPassword", "params": [ { "name": "password_hash", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-661144474", "method": "auth.requestPasswordRecovery", "params": [], "type": "auth.PasswordRecovery" }, { "id": "1319464594", "method": "auth.recoverPassword", "params": [ { "name": "code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1080796745", "method": "invokeWithoutUpdates", "params": [ { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "2106086025", "method": "messages.exportChatInvite", "params": [ { "name": "chat_id", "type": "int" } ], "type": "ExportedChatInvite" }, { "id": "1051570619", "method": "messages.checkChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "ChatInvite" }, { "id": "1817183516", "method": "messages.importChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "Updates" }, { "id": "639215886", "method": "messages.getStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "messages.StickerSet" }, { "id": "2066793382", "method": "messages.installStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" }, { "name": "disabled", "type": "Bool" } ], "type": "Bool" }, { "id": "-110209570", "method": "messages.uninstallStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "Bool" }, { "id": "-421563528", "method": "messages.startBot", "params": [ { "name": "bot", "type": "InputUser" }, { "name": "peer", "type": "InputPeer" }, { "name": "random_id", "type": "long" }, { "name": "start_param", "type": "string" } ], "type": "Updates" }, { "id": "1537966002", "method": "help.getAppChangelog", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-993483427", "method": "messages.getMessagesViews", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "increment", "type": "Bool" } ], "type": "Vector" }, { "id": "-1445735863", "method": "channels.getDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-575067701", "method": "channels.getImportantHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "offset_id", "type": "int" }, { "name": "add_offset", "type": "int" }, { "name": "limit", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" } ], "type": "messages.Messages" }, { "id": "-871347913", "method": "channels.readHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "max_id", "type": "int" } ], "type": "Bool" }, { "id": "-2067661490", "method": "channels.deleteMessages", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "-787622117", "method": "channels.deleteUserHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" } ], "type": "messages.AffectedHistory" }, { "id": "-32999408", "method": "channels.reportSpam", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "-1814580409", "method": "channels.getMessages", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "618237842", "method": "channels.getParticipants", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "filter", "type": "ChannelParticipantsFilter" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "channels.ChannelParticipants" }, { "id": "1416484774", "method": "channels.getParticipant", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" } ], "type": "channels.ChannelParticipant" }, { "id": "176122811", "method": "channels.getChannels", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "141781513", "method": "channels.getFullChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "messages.ChatFull" }, { "id": "-192332417", "method": "channels.createChannel", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.0?true" }, { "name": "megagroup", "type": "flags.1?true" }, { "name": "title", "type": "string" }, { "name": "about", "type": "string" } ], "type": "Updates" }, { "id": "333610782", "method": "channels.editAbout", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "about", "type": "string" } ], "type": "Bool" }, { "id": "-344583728", "method": "channels.editAdmin", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "role", "type": "ChannelParticipantRole" } ], "type": "Updates" }, { "id": "1450044624", "method": "channels.editTitle", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-248621111", "method": "channels.editPhoto", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-1432183160", "method": "channels.toggleComments", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "283557164", "method": "channels.checkUsername", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "890549214", "method": "channels.updateUsername", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "615851205", "method": "channels.joinChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "-130635115", "method": "channels.leaveChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "429865580", "method": "channels.inviteToChannel", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "users", "type": "Vector" } ], "type": "Updates" }, { "id": "-1502421484", "method": "channels.kickFromChannel", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "kicked", "type": "Bool" } ], "type": "Updates" }, { "id": "-950663035", "method": "channels.exportInvite", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "ExportedChatInvite" }, { "id": "-1072619549", "method": "channels.deleteChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "-1154295872", "method": "updates.getChannelDifference", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "filter", "type": "ChannelMessagesFilter" }, { "name": "pts", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "updates.ChannelDifference" }, { "id": "-326379039", "method": "messages.toggleChatAdmins", "params": [ { "name": "chat_id", "type": "int" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "-1444503762", "method": "messages.editChatAdmin", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "is_admin", "type": "Bool" } ], "type": "Bool" }, { "id": "363051235", "method": "messages.migrateChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Updates" }, { "id": "-1640190800", "method": "messages.searchGlobal", "params": [ { "name": "q", "type": "string" }, { "name": "offset_date", "type": "int" }, { "name": "offset_peer", "type": "InputPeer" }, { "name": "offset_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "936873859", "method": "help.getTermsOfService", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.TermsOfService" }, { "id": "-1613775824", "method": "messages.reorderStickerSets", "params": [ { "name": "order", "type": "Vector" } ], "type": "Bool" }, { "id": "864953444", "method": "messages.getDocumentByHash", "params": [ { "name": "sha256", "type": "bytes" }, { "name": "size", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "Document" }, { "id": "-1080395925", "method": "messages.searchGifs", "params": [ { "name": "q", "type": "string" }, { "name": "offset", "type": "int" } ], "type": "messages.FoundGifs" } ] }{ "constructors": [ { "id": "-1132882121", "predicate": "boolFalse", "params": [], "type": "Bool" }, { "id": "-1720552011", "predicate": "boolTrue", "params": [], "type": "Bool" }, { "id": "481674261", "predicate": "vector", "params": [], "type": "Vector t" }, { "id": "-994444869", "predicate": "error", "params": [ { "name": "code", "type": "int" }, { "name": "text", "type": "string" } ], "type": "Error" }, { "id": "1450380236", "predicate": "null", "params": [], "type": "Null" }, { "id": "2134579434", "predicate": "inputPeerEmpty", "params": [], "type": "InputPeer" }, { "id": "2107670217", "predicate": "inputPeerSelf", "params": [], "type": "InputPeer" }, { "id": "396093539", "predicate": "inputPeerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1182234929", "predicate": "inputUserEmpty", "params": [], "type": "InputUser" }, { "id": "-138301121", "predicate": "inputUserSelf", "params": [], "type": "InputUser" }, { "id": "-208488460", "predicate": "inputPhoneContact", "params": [ { "name": "client_id", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputContact" }, { "id": "-181407105", "predicate": "inputFile", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" }, { "name": "md5_checksum", "type": "string" } ], "type": "InputFile" }, { "id": "-1771768449", "predicate": "inputMediaEmpty", "params": [], "type": "InputMedia" }, { "id": "-139464256", "predicate": "inputMediaUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-373312269", "predicate": "inputMediaPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-104578748", "predicate": "inputMediaGeoPoint", "params": [ { "name": "geo_point", "type": "InputGeoPoint" } ], "type": "InputMedia" }, { "id": "-1494984313", "predicate": "inputMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputMedia" }, { "id": "-2106507297", "predicate": "inputMediaUploadedVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "2004934137", "predicate": "inputMediaUploadedThumbVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-1821749571", "predicate": "inputMediaVideo", "params": [ { "name": "id", "type": "InputVideo" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "480546647", "predicate": "inputChatPhotoEmpty", "params": [], "type": "InputChatPhoto" }, { "id": "-1809496270", "predicate": "inputChatUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-1293828344", "predicate": "inputChatPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-457104426", "predicate": "inputGeoPointEmpty", "params": [], "type": "InputGeoPoint" }, { "id": "-206066487", "predicate": "inputGeoPoint", "params": [ { "name": "lat", "type": "double" }, { "name": "long", "type": "double" } ], "type": "InputGeoPoint" }, { "id": "483901197", "predicate": "inputPhotoEmpty", "params": [], "type": "InputPhoto" }, { "id": "-74070332", "predicate": "inputPhoto", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputPhoto" }, { "id": "1426648181", "predicate": "inputVideoEmpty", "params": [], "type": "InputVideo" }, { "id": "-296249774", "predicate": "inputVideo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputVideo" }, { "id": "342061462", "predicate": "inputFileLocation", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1023632620", "predicate": "inputVideoFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-1377390588", "predicate": "inputPhotoCropAuto", "params": [], "type": "InputPhotoCrop" }, { "id": "-644787419", "predicate": "inputPhotoCrop", "params": [ { "name": "crop_left", "type": "double" }, { "name": "crop_top", "type": "double" }, { "name": "crop_width", "type": "double" } ], "type": "InputPhotoCrop" }, { "id": "1996904104", "predicate": "inputAppEvent", "params": [ { "name": "time", "type": "double" }, { "name": "type", "type": "string" }, { "name": "peer", "type": "long" }, { "name": "data", "type": "string" } ], "type": "InputAppEvent" }, { "id": "-1649296275", "predicate": "peerUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "Peer" }, { "id": "-1160714821", "predicate": "peerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Peer" }, { "id": "-1432995067", "predicate": "storage.fileUnknown", "params": [], "type": "storage.FileType" }, { "id": "8322574", "predicate": "storage.fileJpeg", "params": [], "type": "storage.FileType" }, { "id": "-891180321", "predicate": "storage.fileGif", "params": [], "type": "storage.FileType" }, { "id": "172975040", "predicate": "storage.filePng", "params": [], "type": "storage.FileType" }, { "id": "-1373745011", "predicate": "storage.filePdf", "params": [], "type": "storage.FileType" }, { "id": "1384777335", "predicate": "storage.fileMp3", "params": [], "type": "storage.FileType" }, { "id": "1258941372", "predicate": "storage.fileMov", "params": [], "type": "storage.FileType" }, { "id": "1086091090", "predicate": "storage.filePartial", "params": [], "type": "storage.FileType" }, { "id": "-1278304028", "predicate": "storage.fileMp4", "params": [], "type": "storage.FileType" }, { "id": "276907596", "predicate": "storage.fileWebp", "params": [], "type": "storage.FileType" }, { "id": "2086234950", "predicate": "fileLocationUnavailable", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "1406570614", "predicate": "fileLocation", "params": [ { "name": "dc_id", "type": "int" }, { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "537022650", "predicate": "userEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "User" }, { "id": "1326562017", "predicate": "userProfilePhotoEmpty", "params": [], "type": "UserProfilePhoto" }, { "id": "-715532088", "predicate": "userProfilePhoto", "params": [ { "name": "photo_id", "type": "long" }, { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "UserProfilePhoto" }, { "id": "164646985", "predicate": "userStatusEmpty", "params": [], "type": "UserStatus" }, { "id": "-306628279", "predicate": "userStatusOnline", "params": [ { "name": "expires", "type": "int" } ], "type": "UserStatus" }, { "id": "9203775", "predicate": "userStatusOffline", "params": [ { "name": "was_online", "type": "int" } ], "type": "UserStatus" }, { "id": "-1683826688", "predicate": "chatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Chat" }, { "id": "1855757255", "predicate": "chat", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "left", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Chat" }, { "id": "-83047359", "predicate": "chatForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "date", "type": "int" } ], "type": "Chat" }, { "id": "771925524", "predicate": "chatFull", "params": [ { "name": "id", "type": "int" }, { "name": "participants", "type": "ChatParticipants" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector" } ], "type": "ChatFull" }, { "id": "-925415106", "predicate": "chatParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "265468810", "predicate": "chatParticipantsForbidden", "params": [ { "name": "chat_id", "type": "int" } ], "type": "ChatParticipants" }, { "id": "2017571861", "predicate": "chatParticipants", "params": [ { "name": "chat_id", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "version", "type": "int" } ], "type": "ChatParticipants" }, { "id": "935395612", "predicate": "chatPhotoEmpty", "params": [], "type": "ChatPhoto" }, { "id": "1632839530", "predicate": "chatPhoto", "params": [ { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "ChatPhoto" }, { "id": "-2082087340", "predicate": "messageEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Message" }, { "id": "-1421842653", "predicate": "message", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "fwd_from_id", "type": "flags.2?int" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "reply_markup", "type": "flags.6?ReplyMarkup" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Message" }, { "id": "-1066691065", "predicate": "messageService", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "Message" }, { "id": "1038967584", "predicate": "messageMediaEmpty", "params": [], "type": "MessageMedia" }, { "id": "1032643901", "predicate": "messageMediaPhoto", "params": [ { "name": "photo", "type": "Photo" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1540298357", "predicate": "messageMediaVideo", "params": [ { "name": "video", "type": "Video" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1457575028", "predicate": "messageMediaGeo", "params": [ { "name": "geo", "type": "GeoPoint" } ], "type": "MessageMedia" }, { "id": "1585262393", "predicate": "messageMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "user_id", "type": "int" } ], "type": "MessageMedia" }, { "id": "-1618676578", "predicate": "messageMediaUnsupported", "params": [], "type": "MessageMedia" }, { "id": "-1230047312", "predicate": "messageActionEmpty", "params": [], "type": "MessageAction" }, { "id": "-1503425638", "predicate": "messageActionChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "users", "type": "Vector" } ], "type": "MessageAction" }, { "id": "-1247687078", "predicate": "messageActionChatEditTitle", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "2144015272", "predicate": "messageActionChatEditPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageAction" }, { "id": "-1780220945", "predicate": "messageActionChatDeletePhoto", "params": [], "type": "MessageAction" }, { "id": "1581055051", "predicate": "messageActionChatAddUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1297179892", "predicate": "messageActionChatDeleteUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1042448310", "predicate": "dialog", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Dialog" }, { "id": "590459437", "predicate": "photoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Photo" }, { "id": "-840088834", "predicate": "photo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "sizes", "type": "Vector" } ], "type": "Photo" }, { "id": "236446268", "predicate": "photoSizeEmpty", "params": [ { "name": "type", "type": "string" } ], "type": "PhotoSize" }, { "id": "2009052699", "predicate": "photoSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "size", "type": "int" } ], "type": "PhotoSize" }, { "id": "-374917894", "predicate": "photoCachedSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "PhotoSize" }, { "id": "-1056548696", "predicate": "videoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Video" }, { "id": "-148338733", "predicate": "video", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "Video" }, { "id": "286776671", "predicate": "geoPointEmpty", "params": [], "type": "GeoPoint" }, { "id": "541710092", "predicate": "geoPoint", "params": [ { "name": "long", "type": "double" }, { "name": "lat", "type": "double" } ], "type": "GeoPoint" }, { "id": "-2128698738", "predicate": "auth.checkedPhone", "params": [ { "name": "phone_registered", "type": "Bool" } ], "type": "auth.CheckedPhone" }, { "id": "-269659687", "predicate": "auth.sentCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "-16553231", "predicate": "auth.authorization", "params": [ { "name": "user", "type": "User" } ], "type": "auth.Authorization" }, { "id": "-543777747", "predicate": "auth.exportedAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.ExportedAuthorization" }, { "id": "-1195615476", "predicate": "inputNotifyPeer", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "InputNotifyPeer" }, { "id": "423314455", "predicate": "inputNotifyUsers", "params": [], "type": "InputNotifyPeer" }, { "id": "1251338318", "predicate": "inputNotifyChats", "params": [], "type": "InputNotifyPeer" }, { "id": "-1540769658", "predicate": "inputNotifyAll", "params": [], "type": "InputNotifyPeer" }, { "id": "-265263912", "predicate": "inputPeerNotifyEventsEmpty", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "-395694988", "predicate": "inputPeerNotifyEventsAll", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "1185074840", "predicate": "inputPeerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "InputPeerNotifySettings" }, { "id": "-1378534221", "predicate": "peerNotifyEventsEmpty", "params": [], "type": "PeerNotifyEvents" }, { "id": "1830677896", "predicate": "peerNotifyEventsAll", "params": [], "type": "PeerNotifyEvents" }, { "id": "1889961234", "predicate": "peerNotifySettingsEmpty", "params": [], "type": "PeerNotifySettings" }, { "id": "-1923214866", "predicate": "peerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "PeerNotifySettings" }, { "id": "-860866985", "predicate": "wallPaper", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "sizes", "type": "Vector" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "1518971995", "predicate": "userFull", "params": [ { "name": "user", "type": "User" }, { "name": "link", "type": "contacts.Link" }, { "name": "profile_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "blocked", "type": "Bool" }, { "name": "bot_info", "type": "BotInfo" } ], "type": "UserFull" }, { "id": "-116274796", "predicate": "contact", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual", "type": "Bool" } ], "type": "Contact" }, { "id": "-805141448", "predicate": "importedContact", "params": [ { "name": "user_id", "type": "int" }, { "name": "client_id", "type": "long" } ], "type": "ImportedContact" }, { "id": "1444661369", "predicate": "contactBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ContactBlocked" }, { "id": "1038193057", "predicate": "contactSuggested", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual_contacts", "type": "int" } ], "type": "ContactSuggested" }, { "id": "-748155807", "predicate": "contactStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "ContactStatus" }, { "id": "986597452", "predicate": "contacts.link", "params": [ { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" }, { "name": "user", "type": "User" } ], "type": "contacts.Link" }, { "id": "-1219778094", "predicate": "contacts.contactsNotModified", "params": [], "type": "contacts.Contacts" }, { "id": "1871416498", "predicate": "contacts.contacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Contacts" }, { "id": "-1387117803", "predicate": "contacts.importedContacts", "params": [ { "name": "imported", "type": "Vector" }, { "name": "retry_contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ImportedContacts" }, { "id": "471043349", "predicate": "contacts.blocked", "params": [ { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "-1878523231", "predicate": "contacts.blockedSlice", "params": [ { "name": "count", "type": "int" }, { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "1447681221", "predicate": "contacts.suggested", "params": [ { "name": "results", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Suggested" }, { "id": "364538944", "predicate": "messages.dialogs", "params": [ { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "1910543603", "predicate": "messages.dialogsSlice", "params": [ { "name": "count", "type": "int" }, { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "-1938715001", "predicate": "messages.messages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "189033187", "predicate": "messages.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "1694474197", "predicate": "messages.chats", "params": [ { "name": "chats", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "-438840932", "predicate": "messages.chatFull", "params": [ { "name": "full_chat", "type": "ChatFull" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.ChatFull" }, { "id": "-1269012015", "predicate": "messages.affectedHistory", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "1474492012", "predicate": "inputMessagesFilterEmpty", "params": [], "type": "MessagesFilter" }, { "id": "-1777752804", "predicate": "inputMessagesFilterPhotos", "params": [], "type": "MessagesFilter" }, { "id": "-1614803355", "predicate": "inputMessagesFilterVideo", "params": [], "type": "MessagesFilter" }, { "id": "1458172132", "predicate": "inputMessagesFilterPhotoVideo", "params": [], "type": "MessagesFilter" }, { "id": "-648121413", "predicate": "inputMessagesFilterPhotoVideoDocuments", "params": [], "type": "MessagesFilter" }, { "id": "-1629621880", "predicate": "inputMessagesFilterDocument", "params": [], "type": "MessagesFilter" }, { "id": "-808946398", "predicate": "inputMessagesFilterAudio", "params": [], "type": "MessagesFilter" }, { "id": "1526462308", "predicate": "inputMessagesFilterAudioDocuments", "params": [], "type": "MessagesFilter" }, { "id": "2129714567", "predicate": "inputMessagesFilterUrl", "params": [], "type": "MessagesFilter" }, { "id": "522914557", "predicate": "updateNewMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1318109142", "predicate": "updateMessageID", "params": [ { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Update" }, { "id": "-1576161051", "predicate": "updateDeleteMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1548249383", "predicate": "updateUserTyping", "params": [ { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "-1704596961", "predicate": "updateChatUserTyping", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "125178264", "predicate": "updateChatParticipants", "params": [ { "name": "participants", "type": "ChatParticipants" } ], "type": "Update" }, { "id": "469489699", "predicate": "updateUserStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "Update" }, { "id": "-1489818765", "predicate": "updateUserName", "params": [ { "name": "user_id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "Update" }, { "id": "-1791935732", "predicate": "updateUserPhoto", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "previous", "type": "Bool" } ], "type": "Update" }, { "id": "628472761", "predicate": "updateContactRegistered", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1657903163", "predicate": "updateContactLink", "params": [ { "name": "user_id", "type": "int" }, { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" } ], "type": "Update" }, { "id": "-1895411046", "predicate": "updateNewAuthorization", "params": [ { "name": "auth_key_id", "type": "long" }, { "name": "date", "type": "int" }, { "name": "device", "type": "string" }, { "name": "location", "type": "string" } ], "type": "Update" }, { "id": "-1519637954", "predicate": "updates.state", "params": [ { "name": "pts", "type": "int" }, { "name": "qts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "unread_count", "type": "int" } ], "type": "updates.State" }, { "id": "1567990072", "predicate": "updates.differenceEmpty", "params": [ { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "updates.Difference" }, { "id": "16030880", "predicate": "updates.difference", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-1459938943", "predicate": "updates.differenceSlice", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "intermediate_state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-484987010", "predicate": "updatesTooLong", "params": [], "type": "Updates" }, { "id": "1060296792", "predicate": "updateShortMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?int" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "-113206467", "predicate": "updateShortChatMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "chat_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?int" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "2027216577", "predicate": "updateShort", "params": [ { "name": "update", "type": "Update" }, { "name": "date", "type": "int" } ], "type": "Updates" }, { "id": "1918567619", "predicate": "updatesCombined", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq_start", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "1957577280", "predicate": "updates", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "-1916114267", "predicate": "photos.photos", "params": [ { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "352657236", "predicate": "photos.photosSlice", "params": [ { "name": "count", "type": "int" }, { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "539045032", "predicate": "photos.photo", "params": [ { "name": "photo", "type": "Photo" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photo" }, { "id": "157948117", "predicate": "upload.file", "params": [ { "name": "type", "type": "storage.FileType" }, { "name": "mtime", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "upload.File" }, { "id": "98092748", "predicate": "dcOption", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "ip_address", "type": "string" }, { "name": "port", "type": "int" } ], "type": "DcOption" }, { "id": "1311946900", "predicate": "config", "params": [ { "name": "date", "type": "int" }, { "name": "expires", "type": "int" }, { "name": "test_mode", "type": "Bool" }, { "name": "this_dc", "type": "int" }, { "name": "dc_options", "type": "Vector" }, { "name": "chat_size_max", "type": "int" }, { "name": "broadcast_size_max", "type": "int" }, { "name": "forwarded_count_max", "type": "int" }, { "name": "online_update_period_ms", "type": "int" }, { "name": "offline_blur_timeout_ms", "type": "int" }, { "name": "offline_idle_timeout_ms", "type": "int" }, { "name": "online_cloud_timeout_ms", "type": "int" }, { "name": "notify_cloud_delay_ms", "type": "int" }, { "name": "notify_default_delay_ms", "type": "int" }, { "name": "chat_big_size", "type": "int" }, { "name": "push_chat_period_ms", "type": "int" }, { "name": "push_chat_limit", "type": "int" }, { "name": "disabled_features", "type": "Vector" } ], "type": "Config" }, { "id": "-1910892683", "predicate": "nearestDc", "params": [ { "name": "country", "type": "string" }, { "name": "this_dc", "type": "int" }, { "name": "nearest_dc", "type": "int" } ], "type": "NearestDc" }, { "id": "-1987579119", "predicate": "help.appUpdate", "params": [ { "name": "id", "type": "int" }, { "name": "critical", "type": "Bool" }, { "name": "url", "type": "string" }, { "name": "text", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "-1000708810", "predicate": "help.noAppUpdate", "params": [], "type": "help.AppUpdate" }, { "id": "415997816", "predicate": "help.inviteText", "params": [ { "name": "message", "type": "string" } ], "type": "help.InviteText" }, { "id": "1662091044", "predicate": "wallPaperSolid", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "bg_color", "type": "int" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "314359194", "predicate": "updateNewEncryptedMessage", "params": [ { "name": "message", "type": "EncryptedMessage" }, { "name": "qts", "type": "int" } ], "type": "Update" }, { "id": "386986326", "predicate": "updateEncryptedChatTyping", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Update" }, { "id": "-1264392051", "predicate": "updateEncryption", "params": [ { "name": "chat", "type": "EncryptedChat" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "956179895", "predicate": "updateEncryptedMessagesRead", "params": [ { "name": "chat_id", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1417756512", "predicate": "encryptedChatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "1006044124", "predicate": "encryptedChatWaiting", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-931638658", "predicate": "encryptedChatRequested", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "-94974410", "predicate": "encryptedChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a_or_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "332848423", "predicate": "encryptedChatDiscarded", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-247351839", "predicate": "inputEncryptedChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedChat" }, { "id": "-1038136962", "predicate": "encryptedFileEmpty", "params": [], "type": "EncryptedFile" }, { "id": "1248893260", "predicate": "encryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "EncryptedFile" }, { "id": "406307684", "predicate": "inputEncryptedFileEmpty", "params": [], "type": "InputEncryptedFile" }, { "id": "1690108678", "predicate": "inputEncryptedFileUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "md5_checksum", "type": "string" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "1511503333", "predicate": "inputEncryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedFile" }, { "id": "-182231723", "predicate": "inputEncryptedFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-317144808", "predicate": "encryptedMessage", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" }, { "name": "file", "type": "EncryptedFile" } ], "type": "EncryptedMessage" }, { "id": "594758406", "predicate": "encryptedMessageService", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "EncryptedMessage" }, { "id": "-1058912715", "predicate": "messages.dhConfigNotModified", "params": [ { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "740433629", "predicate": "messages.dhConfig", "params": [ { "name": "g", "type": "int" }, { "name": "p", "type": "bytes" }, { "name": "version", "type": "int" }, { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "1443858741", "predicate": "messages.sentEncryptedMessage", "params": [ { "name": "date", "type": "int" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1802240206", "predicate": "messages.sentEncryptedFile", "params": [ { "name": "date", "type": "int" }, { "name": "file", "type": "EncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-95482955", "predicate": "inputFileBig", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" } ], "type": "InputFile" }, { "id": "767652808", "predicate": "inputEncryptedFileBigUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "974056226", "predicate": "updateChatParticipantAdd", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1851755554", "predicate": "updateChatParticipantDelete", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1906403213", "predicate": "updateDcOptions", "params": [ { "name": "dc_options", "type": "Vector" } ], "type": "Update" }, { "id": "1313442987", "predicate": "inputMediaUploadedAudio", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1986820223", "predicate": "inputMediaAudio", "params": [ { "name": "id", "type": "InputAudio" } ], "type": "InputMedia" }, { "id": "-1610888", "predicate": "inputMediaUploadedDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "1095242886", "predicate": "inputMediaUploadedThumbDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "-779818943", "predicate": "inputMediaDocument", "params": [ { "name": "id", "type": "InputDocument" } ], "type": "InputMedia" }, { "id": "802824708", "predicate": "messageMediaDocument", "params": [ { "name": "document", "type": "Document" } ], "type": "MessageMedia" }, { "id": "-961117440", "predicate": "messageMediaAudio", "params": [ { "name": "audio", "type": "Audio" } ], "type": "MessageMedia" }, { "id": "-648356732", "predicate": "inputAudioEmpty", "params": [], "type": "InputAudio" }, { "id": "2010398975", "predicate": "inputAudio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputAudio" }, { "id": "1928391342", "predicate": "inputDocumentEmpty", "params": [], "type": "InputDocument" }, { "id": "410618194", "predicate": "inputDocument", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputDocument" }, { "id": "1960591437", "predicate": "inputAudioFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1313188841", "predicate": "inputDocumentFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1483311320", "predicate": "audioEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Audio" }, { "id": "-102543275", "predicate": "audio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" } ], "type": "Audio" }, { "id": "922273905", "predicate": "documentEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Document" }, { "id": "-106717361", "predicate": "document", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "attributes", "type": "Vector" } ], "type": "Document" }, { "id": "398898678", "predicate": "help.support", "params": [ { "name": "phone_number", "type": "string" }, { "name": "user", "type": "User" } ], "type": "help.Support" }, { "id": "-1613493288", "predicate": "notifyPeer", "params": [ { "name": "peer", "type": "Peer" } ], "type": "NotifyPeer" }, { "id": "-1261946036", "predicate": "notifyUsers", "params": [], "type": "NotifyPeer" }, { "id": "-1073230141", "predicate": "notifyChats", "params": [], "type": "NotifyPeer" }, { "id": "1959820384", "predicate": "notifyAll", "params": [], "type": "NotifyPeer" }, { "id": "-2131957734", "predicate": "updateUserBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "blocked", "type": "Bool" } ], "type": "Update" }, { "id": "-1094555409", "predicate": "updateNotifySettings", "params": [ { "name": "peer", "type": "NotifyPeer" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Update" }, { "id": "-484053553", "predicate": "auth.sentAppCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "381645902", "predicate": "sendMessageTypingAction", "params": [], "type": "SendMessageAction" }, { "id": "-44119819", "predicate": "sendMessageCancelAction", "params": [], "type": "SendMessageAction" }, { "id": "-1584933265", "predicate": "sendMessageRecordVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-378127636", "predicate": "sendMessageUploadVideoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-718310409", "predicate": "sendMessageRecordAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-212740181", "predicate": "sendMessageUploadAudioAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-774682074", "predicate": "sendMessageUploadPhotoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-1441998364", "predicate": "sendMessageUploadDocumentAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "393186209", "predicate": "sendMessageGeoLocationAction", "params": [], "type": "SendMessageAction" }, { "id": "1653390447", "predicate": "sendMessageChooseContactAction", "params": [], "type": "SendMessageAction" }, { "id": "-360210539", "predicate": "contactFound", "params": [ { "name": "user_id", "type": "int" } ], "type": "ContactFound" }, { "id": "90570766", "predicate": "contacts.found", "params": [ { "name": "results", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Found" }, { "id": "942527460", "predicate": "updateServiceNotification", "params": [ { "name": "type", "type": "string" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" }, { "name": "popup", "type": "Bool" } ], "type": "Update" }, { "id": "-496024847", "predicate": "userStatusRecently", "params": [], "type": "UserStatus" }, { "id": "129960444", "predicate": "userStatusLastWeek", "params": [], "type": "UserStatus" }, { "id": "2011940674", "predicate": "userStatusLastMonth", "params": [], "type": "UserStatus" }, { "id": "-298113238", "predicate": "updatePrivacy", "params": [ { "name": "key", "type": "PrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "Update" }, { "id": "1335282456", "predicate": "inputPrivacyKeyStatusTimestamp", "params": [], "type": "InputPrivacyKey" }, { "id": "-1137792208", "predicate": "privacyKeyStatusTimestamp", "params": [], "type": "PrivacyKey" }, { "id": "218751099", "predicate": "inputPrivacyValueAllowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "407582158", "predicate": "inputPrivacyValueAllowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "320652927", "predicate": "inputPrivacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "195371015", "predicate": "inputPrivacyValueDisallowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "-697604407", "predicate": "inputPrivacyValueDisallowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "-1877932953", "predicate": "inputPrivacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "-123988", "predicate": "privacyValueAllowContacts", "params": [], "type": "PrivacyRule" }, { "id": "1698855810", "predicate": "privacyValueAllowAll", "params": [], "type": "PrivacyRule" }, { "id": "1297858060", "predicate": "privacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "-125240806", "predicate": "privacyValueDisallowContacts", "params": [], "type": "PrivacyRule" }, { "id": "-1955338397", "predicate": "privacyValueDisallowAll", "params": [], "type": "PrivacyRule" }, { "id": "209668535", "predicate": "privacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "1430961007", "predicate": "account.privacyRules", "params": [ { "name": "rules", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "-1194283041", "predicate": "accountDaysTTL", "params": [ { "name": "days", "type": "int" } ], "type": "AccountDaysTTL" }, { "id": "-1527411636", "predicate": "account.sentChangePhoneCode", "params": [ { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" } ], "type": "account.SentChangePhoneCode" }, { "id": "314130811", "predicate": "updateUserPhone", "params": [ { "name": "user_id", "type": "int" }, { "name": "phone", "type": "string" } ], "type": "Update" }, { "id": "1815593308", "predicate": "documentAttributeImageSize", "params": [ { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "297109817", "predicate": "documentAttributeAnimated", "params": [], "type": "DocumentAttribute" }, { "id": "978674434", "predicate": "documentAttributeSticker", "params": [ { "name": "alt", "type": "string" }, { "name": "stickerset", "type": "InputStickerSet" } ], "type": "DocumentAttribute" }, { "id": "1494273227", "predicate": "documentAttributeVideo", "params": [ { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "-556656416", "predicate": "documentAttributeAudio", "params": [ { "name": "duration", "type": "int" }, { "name": "title", "type": "string" }, { "name": "performer", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "358154344", "predicate": "documentAttributeFilename", "params": [ { "name": "file_name", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "-244016606", "predicate": "messages.stickersNotModified", "params": [], "type": "messages.Stickers" }, { "id": "-1970352846", "predicate": "messages.stickers", "params": [ { "name": "hash", "type": "string" }, { "name": "stickers", "type": "Vector" } ], "type": "messages.Stickers" }, { "id": "313694676", "predicate": "stickerPack", "params": [ { "name": "emoticon", "type": "string" }, { "name": "documents", "type": "Vector" } ], "type": "StickerPack" }, { "id": "-395967805", "predicate": "messages.allStickersNotModified", "params": [], "type": "messages.AllStickers" }, { "id": "-719474725", "predicate": "messages.allStickers", "params": [ { "name": "hash", "type": "string" }, { "name": "sets", "type": "Vector" } ], "type": "messages.AllStickers" }, { "id": "-1369215196", "predicate": "disabledFeature", "params": [ { "name": "feature", "type": "string" }, { "name": "description", "type": "string" } ], "type": "DisabledFeature" }, { "id": "-1721631396", "predicate": "updateReadHistoryInbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "791617983", "predicate": "updateReadHistoryOutbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-2066640507", "predicate": "messages.affectedMessages", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "1599050311", "predicate": "contactLinkUnknown", "params": [], "type": "ContactLink" }, { "id": "-17968211", "predicate": "contactLinkNone", "params": [], "type": "ContactLink" }, { "id": "646922073", "predicate": "contactLinkHasPhone", "params": [], "type": "ContactLink" }, { "id": "-721239344", "predicate": "contactLinkContact", "params": [], "type": "ContactLink" }, { "id": "751004017", "predicate": "updateWebPage", "params": [ { "name": "webpage", "type": "WebPage" } ], "type": "Update" }, { "id": "-350980120", "predicate": "webPageEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "WebPage" }, { "id": "-981018084", "predicate": "webPagePending", "params": [ { "name": "id", "type": "long" }, { "name": "date", "type": "int" } ], "type": "WebPage" }, { "id": "-897446185", "predicate": "webPage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "long" }, { "name": "url", "type": "string" }, { "name": "display_url", "type": "string" }, { "name": "type", "type": "flags.0?string" }, { "name": "site_name", "type": "flags.1?string" }, { "name": "title", "type": "flags.2?string" }, { "name": "description", "type": "flags.3?string" }, { "name": "photo", "type": "flags.4?Photo" }, { "name": "embed_url", "type": "flags.5?string" }, { "name": "embed_type", "type": "flags.5?string" }, { "name": "embed_width", "type": "flags.6?int" }, { "name": "embed_height", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "author", "type": "flags.8?string" }, { "name": "document", "type": "flags.9?Document" } ], "type": "WebPage" }, { "id": "-1557277184", "predicate": "messageMediaWebPage", "params": [ { "name": "webpage", "type": "WebPage" } ], "type": "MessageMedia" }, { "id": "2079516406", "predicate": "authorization", "params": [ { "name": "hash", "type": "long" }, { "name": "flags", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "platform", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "api_id", "type": "int" }, { "name": "app_name", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "date_created", "type": "int" }, { "name": "date_active", "type": "int" }, { "name": "ip", "type": "string" }, { "name": "country", "type": "string" }, { "name": "region", "type": "string" } ], "type": "Authorization" }, { "id": "307276766", "predicate": "account.authorizations", "params": [ { "name": "authorizations", "type": "Vector" } ], "type": "account.Authorizations" }, { "id": "-1764049896", "predicate": "account.noPassword", "params": [ { "name": "new_salt", "type": "bytes" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "2081952796", "predicate": "account.password", "params": [ { "name": "current_salt", "type": "bytes" }, { "name": "new_salt", "type": "bytes" }, { "name": "hint", "type": "string" }, { "name": "has_recovery", "type": "Bool" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "-1212732749", "predicate": "account.passwordSettings", "params": [ { "name": "email", "type": "string" } ], "type": "account.PasswordSettings" }, { "id": "-1124314324", "predicate": "account.passwordInputSettings", "params": [ { "name": "flags", "type": "#" }, { "name": "new_salt", "type": "flags.0?bytes" }, { "name": "new_password_hash", "type": "flags.0?bytes" }, { "name": "hint", "type": "flags.0?string" }, { "name": "email", "type": "flags.1?string" } ], "type": "account.PasswordInputSettings" }, { "id": "326715557", "predicate": "auth.passwordRecovery", "params": [ { "name": "email_pattern", "type": "string" } ], "type": "auth.PasswordRecovery" }, { "id": "673687578", "predicate": "inputMediaVenue", "params": [ { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "InputMedia" }, { "id": "2031269663", "predicate": "messageMediaVenue", "params": [ { "name": "geo", "type": "GeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "MessageMedia" }, { "id": "-1551583367", "predicate": "receivedNotifyMessage", "params": [ { "name": "id", "type": "int" }, { "name": "flags", "type": "int" } ], "type": "ReceivedNotifyMessage" }, { "id": "1776236393", "predicate": "chatInviteEmpty", "params": [], "type": "ExportedChatInvite" }, { "id": "-64092740", "predicate": "chatInviteExported", "params": [ { "name": "link", "type": "string" } ], "type": "ExportedChatInvite" }, { "id": "1516793212", "predicate": "chatInviteAlready", "params": [ { "name": "chat", "type": "Chat" } ], "type": "ChatInvite" }, { "id": "-829325875", "predicate": "chatInvite", "params": [ { "name": "title", "type": "string" } ], "type": "ChatInvite" }, { "id": "-123931160", "predicate": "messageActionChatJoinedByLink", "params": [ { "name": "inviter_id", "type": "int" } ], "type": "MessageAction" }, { "id": "1757493555", "predicate": "updateReadMessagesContents", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-4838507", "predicate": "inputStickerSetEmpty", "params": [], "type": "InputStickerSet" }, { "id": "-1645763991", "predicate": "inputStickerSetID", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputStickerSet" }, { "id": "-2044933984", "predicate": "inputStickerSetShortName", "params": [ { "name": "short_name", "type": "string" } ], "type": "InputStickerSet" }, { "id": "-852477119", "predicate": "stickerSet", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "short_name", "type": "string" }, { "name": "count", "type": "int" }, { "name": "hash", "type": "int" } ], "type": "StickerSet" }, { "id": "-1240849242", "predicate": "messages.stickerSet", "params": [ { "name": "set", "type": "StickerSet" }, { "name": "packs", "type": "Vector" }, { "name": "documents", "type": "Vector" } ], "type": "messages.StickerSet" }, { "id": "585404530", "predicate": "user", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "flags.0?long" }, { "name": "first_name", "type": "flags.1?string" }, { "name": "last_name", "type": "flags.2?string" }, { "name": "username", "type": "flags.3?string" }, { "name": "phone", "type": "flags.4?string" }, { "name": "photo", "type": "flags.5?UserProfilePhoto" }, { "name": "status", "type": "flags.6?UserStatus" }, { "name": "bot_info_version", "type": "flags.14?int" } ], "type": "User" }, { "id": "-1032140601", "predicate": "botCommand", "params": [ { "name": "command", "type": "string" }, { "name": "description", "type": "string" } ], "type": "BotCommand" }, { "id": "-1154598962", "predicate": "botInfoEmpty", "params": [], "type": "BotInfo" }, { "id": "164583517", "predicate": "botInfo", "params": [ { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" }, { "name": "share_text", "type": "string" }, { "name": "description", "type": "string" }, { "name": "commands", "type": "Vector" } ], "type": "BotInfo" }, { "id": "-1560655744", "predicate": "keyboardButton", "params": [ { "name": "text", "type": "string" } ], "type": "KeyboardButton" }, { "id": "2002815875", "predicate": "keyboardButtonRow", "params": [ { "name": "buttons", "type": "Vector" } ], "type": "KeyboardButtonRow" }, { "id": "-1606526075", "predicate": "replyKeyboardHide", "params": [ { "name": "flags", "type": "#" } ], "type": "ReplyMarkup" }, { "id": "-200242528", "predicate": "replyKeyboardForceReply", "params": [ { "name": "flags", "type": "#" } ], "type": "ReplyMarkup" }, { "id": "889353612", "predicate": "replyKeyboardMarkup", "params": [ { "name": "flags", "type": "#" }, { "name": "rows", "type": "Vector" } ], "type": "ReplyMarkup" }, { "id": "2072935910", "predicate": "inputPeerUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "-668391402", "predicate": "inputUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputUser" }, { "id": "-1350696044", "predicate": "help.appChangelogEmpty", "params": [], "type": "help.AppChangelog" }, { "id": "1181279933", "predicate": "help.appChangelog", "params": [ { "name": "text", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-1148011883", "predicate": "messageEntityUnknown", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-100378723", "predicate": "messageEntityMention", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1868782349", "predicate": "messageEntityHashtag", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1827637959", "predicate": "messageEntityBotCommand", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1859134776", "predicate": "messageEntityUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1692693954", "predicate": "messageEntityEmail", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-1117713463", "predicate": "messageEntityBold", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-2106619040", "predicate": "messageEntityItalic", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "681706865", "predicate": "messageEntityCode", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1938967520", "predicate": "messageEntityPre", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "language", "type": "string" } ], "type": "MessageEntity" }, { "id": "1990644519", "predicate": "messageEntityTextUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "url", "type": "string" } ], "type": "MessageEntity" }, { "id": "301019932", "predicate": "updateShortSentMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "-637586372", "predicate": "inputChatEmpty", "params": [], "type": "InputChat" }, { "id": "1134934467", "predicate": "inputChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "InputChat" }, { "id": "818335347", "predicate": "inputChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputChat" }, { "id": "-1109531342", "predicate": "peerChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Peer" }, { "id": "548253432", "predicate": "inputPeerChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "-1917119391", "predicate": "channel", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Chat" }, { "id": "-343274136", "predicate": "channelFull", "params": [ { "name": "id", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" } ], "type": "ChatFull" }, { "id": "1535415986", "predicate": "dialogChannel", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "top_important_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "pts", "type": "int" } ], "type": "Dialog" }, { "id": "182649427", "predicate": "messageRange", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "MessageRange" }, { "id": "-399216813", "predicate": "messageGroup", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "count", "type": "int" }, { "name": "date", "type": "int" } ], "type": "MessageGroup" }, { "id": "-1139861572", "predicate": "messages.channelMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "pts", "type": "int" }, { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "collapsed", "type": "flags.0?Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "-1781355374", "predicate": "messageActionChannelCreate", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "1620337698", "predicate": "updateChannelTooLong", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Update" }, { "id": "1656358105", "predicate": "updateNewChannelMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-2017952899", "predicate": "updateReadChannelInbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" } ], "type": "Update" }, { "id": "299511878", "predicate": "updateDeleteChannelMessages", "params": [ { "name": "peer", "type": "Peer" }, { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1041346555", "predicate": "updates.channelDifferenceEmpty", "params": [ { "name": "flags", "type": "#" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" } ], "type": "updates.ChannelDifference" }, { "id": "1578530374", "predicate": "updates.channelDifferenceTooLong", "params": [ { "name": "flags", "type": "#" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "top_message", "type": "int" }, { "name": "top_important_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "updates.ChannelDifference" }, { "id": "543450958", "predicate": "updates.channelDifference", "params": [ { "name": "flags", "type": "#" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "new_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "updates.ChannelDifference" }, { "id": "-1798033689", "predicate": "channelMessagesFilterEmpty", "params": [], "type": "ChannelMessagesFilter" }, { "id": "-847783593", "predicate": "channelMessagesFilter", "params": [ { "name": "flags", "type": "#" }, { "name": "ranges", "type": "Vector" } ], "type": "ChannelMessagesFilter" } ], "methods": [ { "id": "-878758099", "method": "invokeAfterMsg", "params": [ { "name": "msg_id", "type": "long" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1036301552", "method": "invokeAfterMsgs", "params": [ { "name": "msg_ids", "type": "Vector" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1877286395", "method": "auth.checkPhone", "params": [ { "name": "phone_number", "type": "string" } ], "type": "auth.CheckedPhone" }, { "id": "1988976461", "method": "auth.sendCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "sms_type", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "auth.SentCode" }, { "id": "63247716", "method": "auth.sendCall", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "453408308", "method": "auth.signUp", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1126886015", "method": "auth.signIn", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "1461180992", "method": "auth.logOut", "params": [], "type": "Bool" }, { "id": "-1616179942", "method": "auth.resetAuthorizations", "params": [], "type": "Bool" }, { "id": "1998331287", "method": "auth.sendInvites", "params": [ { "name": "phone_numbers", "type": "Vector" }, { "name": "message", "type": "string" } ], "type": "Bool" }, { "id": "-440401971", "method": "auth.exportAuthorization", "params": [ { "name": "dc_id", "type": "int" } ], "type": "auth.ExportedAuthorization" }, { "id": "-470837741", "method": "auth.importAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-841733627", "method": "auth.bindTempAuthKey", "params": [ { "name": "perm_auth_key_id", "type": "long" }, { "name": "nonce", "type": "long" }, { "name": "expires_at", "type": "int" }, { "name": "encrypted_message", "type": "bytes" } ], "type": "Bool" }, { "id": "1147957548", "method": "account.registerDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "app_sandbox", "type": "Bool" }, { "name": "lang_code", "type": "string" } ], "type": "Bool" }, { "id": "1707432768", "method": "account.unregisterDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" } ], "type": "Bool" }, { "id": "-2067899501", "method": "account.updateNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" }, { "name": "settings", "type": "InputPeerNotifySettings" } ], "type": "Bool" }, { "id": "313765169", "method": "account.getNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" } ], "type": "PeerNotifySettings" }, { "id": "-612493497", "method": "account.resetNotifySettings", "params": [], "type": "Bool" }, { "id": "-259486360", "method": "account.updateProfile", "params": [ { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "User" }, { "id": "1713919532", "method": "account.updateStatus", "params": [ { "name": "offline", "type": "Bool" } ], "type": "Bool" }, { "id": "-1068696894", "method": "account.getWallPapers", "params": [], "type": "Vector" }, { "id": "227648840", "method": "users.getUsers", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-902781519", "method": "users.getFullUser", "params": [ { "name": "id", "type": "InputUser" } ], "type": "UserFull" }, { "id": "-995929106", "method": "contacts.getStatuses", "params": [], "type": "Vector" }, { "id": "583445000", "method": "contacts.getContacts", "params": [ { "name": "hash", "type": "string" } ], "type": "contacts.Contacts" }, { "id": "-634342611", "method": "contacts.importContacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "replace", "type": "Bool" } ], "type": "contacts.ImportedContacts" }, { "id": "-847825880", "method": "contacts.getSuggested", "params": [ { "name": "limit", "type": "int" } ], "type": "contacts.Suggested" }, { "id": "-1902823612", "method": "contacts.deleteContact", "params": [ { "name": "id", "type": "InputUser" } ], "type": "contacts.Link" }, { "id": "1504393374", "method": "contacts.deleteContacts", "params": [ { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "858475004", "method": "contacts.block", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-448724803", "method": "contacts.unblock", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-176409329", "method": "contacts.getBlocked", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "contacts.Blocked" }, { "id": "-2065352905", "method": "contacts.exportCard", "params": [], "type": "Vector" }, { "id": "1340184318", "method": "contacts.importCard", "params": [ { "name": "export_card", "type": "Vector" } ], "type": "User" }, { "id": "1109588596", "method": "messages.getMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "-2053423812", "method": "messages.getDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-505490651", "method": "messages.getHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "132772523", "method": "messages.search", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "-1336990448", "method": "messages.readHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-185009311", "method": "messages.deleteHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-1510897371", "method": "messages.deleteMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "94983360", "method": "messages.receivedMessages", "params": [ { "name": "max_id", "type": "int" } ], "type": "Vector" }, { "id": "-1551737264", "method": "messages.setTyping", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Bool" }, { "id": "-91733382", "method": "messages.sendMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" }, { "name": "entities", "type": "flags.3?Vector" } ], "type": "Updates" }, { "id": "-923703407", "method": "messages.sendMedia", "params": [ { "name": "flags", "type": "#" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "Updates" }, { "id": "1440838285", "method": "messages.forwardMessages", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "random_id", "type": "Vector" } ], "type": "Updates" }, { "id": "41608795", "method": "messages.getChats", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "57298430", "method": "messages.getFullChat", "params": [ { "name": "chat_id", "type": "InputChat" } ], "type": "messages.ChatFull" }, { "id": "1721357574", "method": "messages.editChatTitle", "params": [ { "name": "chat_id", "type": "InputChat" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-579504755", "method": "messages.editChatPhoto", "params": [ { "name": "chat_id", "type": "InputChat" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-2121169932", "method": "messages.addChatUser", "params": [ { "name": "chat_id", "type": "InputChat" }, { "name": "user_id", "type": "InputUser" }, { "name": "fwd_limit", "type": "int" } ], "type": "Updates" }, { "id": "-1819099025", "method": "messages.deleteChatUser", "params": [ { "name": "chat_id", "type": "InputChat" }, { "name": "user_id", "type": "InputUser" } ], "type": "Updates" }, { "id": "164303470", "method": "messages.createChat", "params": [ { "name": "users", "type": "Vector" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-304838614", "method": "updates.getState", "params": [], "type": "updates.State" }, { "id": "168039573", "method": "updates.getDifference", "params": [ { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "qts", "type": "int" } ], "type": "updates.Difference" }, { "id": "-285902432", "method": "photos.updateProfilePhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "UserProfilePhoto" }, { "id": "-720397176", "method": "photos.uploadProfilePhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "photos.Photo" }, { "id": "-2016444625", "method": "photos.deletePhotos", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-1291540959", "method": "upload.saveFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "-475607115", "method": "upload.getFile", "params": [ { "name": "location", "type": "InputFileLocation" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "upload.File" }, { "id": "-990308245", "method": "help.getConfig", "params": [], "type": "Config" }, { "id": "531836966", "method": "help.getNearestDc", "params": [], "type": "NearestDc" }, { "id": "-938300290", "method": "help.getAppUpdate", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "1862465352", "method": "help.saveAppLog", "params": [ { "name": "events", "type": "Vector" } ], "type": "Bool" }, { "id": "-1532407418", "method": "help.getInviteText", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.InviteText" }, { "id": "-1848823128", "method": "photos.getUserPhotos", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "long" }, { "name": "limit", "type": "int" } ], "type": "photos.Photos" }, { "id": "865483769", "method": "messages.forwardMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Updates" }, { "id": "-1082919718", "method": "messages.sendBroadcast", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "random_id", "type": "Vector" }, { "name": "message", "type": "string" }, { "name": "media", "type": "InputMedia" } ], "type": "Updates" }, { "id": "651135312", "method": "messages.getDhConfig", "params": [ { "name": "version", "type": "int" }, { "name": "random_length", "type": "int" } ], "type": "messages.DhConfig" }, { "id": "-162681021", "method": "messages.requestEncryption", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "random_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "1035731989", "method": "messages.acceptEncryption", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "g_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "-304536635", "method": "messages.discardEncryption", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Bool" }, { "id": "2031374829", "method": "messages.setEncryptedTyping", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "2135648522", "method": "messages.readEncryptedHistory", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "max_date", "type": "int" } ], "type": "Bool" }, { "id": "-1451792525", "method": "messages.sendEncrypted", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1701831834", "method": "messages.sendEncryptedFile", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" }, { "name": "file", "type": "InputEncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "852769188", "method": "messages.sendEncryptedService", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "1436924774", "method": "messages.receivedQueue", "params": [ { "name": "max_qts", "type": "int" } ], "type": "Vector" }, { "id": "-562337987", "method": "upload.saveBigFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "file_total_parts", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "1769565673", "method": "initConnection", "params": [ { "name": "api_id", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-1663104819", "method": "help.getSupport", "params": [], "type": "help.Support" }, { "id": "229241832", "method": "auth.sendSms", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "916930423", "method": "messages.readMessageContents", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "655677548", "method": "account.checkUsername", "params": [ { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "1040964988", "method": "account.updateUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "301470424", "method": "contacts.search", "params": [ { "name": "q", "type": "string" }, { "name": "limit", "type": "int" } ], "type": "contacts.Found" }, { "id": "-623130288", "method": "account.getPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" } ], "type": "account.PrivacyRules" }, { "id": "-906486552", "method": "account.setPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "1099779595", "method": "account.deleteAccount", "params": [ { "name": "reason", "type": "string" } ], "type": "Bool" }, { "id": "150761757", "method": "account.getAccountTTL", "params": [], "type": "AccountDaysTTL" }, { "id": "608323678", "method": "account.setAccountTTL", "params": [ { "name": "ttl", "type": "AccountDaysTTL" } ], "type": "Bool" }, { "id": "-627372787", "method": "invokeWithLayer", "params": [ { "name": "layer", "type": "int" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "200282908", "method": "contacts.resolveUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "-1543001868", "method": "account.sendChangePhoneCode", "params": [ { "name": "phone_number", "type": "string" } ], "type": "account.SentChangePhoneCode" }, { "id": "1891839707", "method": "account.changePhone", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "User" }, { "id": "-1373446075", "method": "messages.getStickers", "params": [ { "name": "emoticon", "type": "string" }, { "name": "hash", "type": "string" } ], "type": "messages.Stickers" }, { "id": "-1438922648", "method": "messages.getAllStickers", "params": [ { "name": "hash", "type": "string" } ], "type": "messages.AllStickers" }, { "id": "954152242", "method": "account.updateDeviceLocked", "params": [ { "name": "period", "type": "int" } ], "type": "Bool" }, { "id": "1738800940", "method": "auth.importBotAuthorization", "params": [ { "name": "flags", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "bot_auth_token", "type": "string" } ], "type": "auth.Authorization" }, { "id": "623001124", "method": "messages.getWebPagePreview", "params": [ { "name": "message", "type": "string" } ], "type": "MessageMedia" }, { "id": "-484392616", "method": "account.getAuthorizations", "params": [], "type": "account.Authorizations" }, { "id": "-545786948", "method": "account.resetAuthorization", "params": [ { "name": "hash", "type": "long" } ], "type": "Bool" }, { "id": "1418342645", "method": "account.getPassword", "params": [], "type": "account.Password" }, { "id": "-1131605573", "method": "account.getPasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" } ], "type": "account.PasswordSettings" }, { "id": "-92517498", "method": "account.updatePasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" }, { "name": "new_settings", "type": "account.PasswordInputSettings" } ], "type": "Bool" }, { "id": "174260510", "method": "auth.checkPassword", "params": [ { "name": "password_hash", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-661144474", "method": "auth.requestPasswordRecovery", "params": [], "type": "auth.PasswordRecovery" }, { "id": "1319464594", "method": "auth.recoverPassword", "params": [ { "name": "code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1080796745", "method": "invokeWithoutUpdates", "params": [ { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-1033305414", "method": "messages.exportChatInvite", "params": [ { "name": "chat_id", "type": "InputChat" } ], "type": "ExportedChatInvite" }, { "id": "1051570619", "method": "messages.checkChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "ChatInvite" }, { "id": "1817183516", "method": "messages.importChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "Updates" }, { "id": "639215886", "method": "messages.getStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "messages.StickerSet" }, { "id": "2066793382", "method": "messages.installStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" }, { "name": "disabled", "type": "Bool" } ], "type": "Bool" }, { "id": "-110209570", "method": "messages.uninstallStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "Bool" }, { "id": "-187955923", "method": "messages.startBot", "params": [ { "name": "bot", "type": "InputUser" }, { "name": "chat_id", "type": "InputChat" }, { "name": "random_id", "type": "long" }, { "name": "start_param", "type": "string" } ], "type": "Updates" }, { "id": "1537966002", "method": "help.getAppChangelog", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-1838639741", "method": "messages.getChannelDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "632812466", "method": "messages.getImportantHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "916529422", "method": "messages.readChannelHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" } ], "type": "Bool" }, { "id": "-641966126", "method": "messages.createChannel", "params": [ { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-1718245297", "method": "messages.deleteChannelMessages", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "613086453", "method": "updates.getChannelDifference", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "filter", "type": "ChannelMessagesFilter" }, { "name": "pts", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "updates.ChannelDifference" } ] }. * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; use Amp\Deferred; use Amp\Promise; use danog\MadelineProto\Loop\Connection\CheckLoop; use danog\MadelineProto\Loop\Connection\HttpWaitLoop; use danog\MadelineProto\Loop\Connection\ReadLoop; use danog\MadelineProto\Loop\Connection\UpdateLoop; use danog\MadelineProto\Loop\Connection\WriteLoop; use danog\MadelineProto\MTProtoTools\Crypt; use danog\MadelineProto\Stream\ConnectionContext; use danog\MadelineProto\Stream\MTProtoTools\MsgIdHandler; use danog\MadelineProto\Stream\MTProtoTools\SeqNoHandler; /** * Connection class. * * Manages connection to Telegram datacenters * * @author Daniil Gentili */ class Connection { use Crypt; use MsgIdHandler; use SeqNoHandler; use \danog\Serializable; use Tools; const API_ENDPOINT = 0; const VOIP_UDP_REFLECTOR_ENDPOINT = 1; const VOIP_TCP_REFLECTOR_ENDPOINT = 2; const VOIP_UDP_P2P_ENDPOINT = 3; const VOIP_UDP_LAN_ENDPOINT = 4; const PENDING_MAX = 2000000000; public $stream; public $time_delta = 0; public $type = 0; public $peer_tag; public $temp_auth_key; public $auth_key; public $session_id; public $session_out_seq_no = 0; public $session_in_seq_no = 0; public $incoming_messages = []; public $outgoing_messages = []; public $new_incoming = []; public $new_outgoing = []; public $pending_outgoing = []; public $pending_outgoing_key = 0; public $max_incoming_id; public $max_outgoing_id; public $authorized = false; public $call_queue = []; public $ack_queue = []; public $i = []; public $last_recv = 0; public $last_http_wait = 0; public $datacenter; public $API; public $resumeWriterDeferred; public $ctx; public $pendingCheckWatcherId; public $http_req_count = 0; public $http_res_count = 0; public function getCtx() { return $this->ctx; } /** * Connect function. * * Connects to a telegram DC using the specified protocol, proxy and connection parameters * * @param string $proxy Proxy class name * * @internal * * @return \Amp\Promise */ public function connect(ConnectionContext $ctx): Promise { return $this->call($this->connectAsync($ctx)); } /** * Connect function. * * Connects to a telegram DC using the specified protocol, proxy and connection parameters * * @param string $proxy Proxy class name * * @internal * * @return \Amp\Promise */ public function connectAsync(ConnectionContext $ctx): \Generator { $this->API->logger->logger("Trying connection via $ctx", \danog\MadelineProto\Logger::WARNING); $this->ctx = $ctx->getCtx(); $this->datacenter = $ctx->getDc(); $this->stream = yield $ctx->getStream(); if (isset($this->old)) { unset($this->old); } if (!isset($this->writer)) { $this->writer = new WriteLoop($this->API, $this->datacenter); } if (!isset($this->reader)) { $this->reader = new ReadLoop($this->API, $this->datacenter); } if (!isset($this->checker)) { $this->checker = new CheckLoop($this->API, $this->datacenter); } if (!isset($this->waiter)) { $this->waiter = new HttpWaitLoop($this->API, $this->datacenter); } if (!isset($this->updater)) { $this->updater = new UpdateLoop($this->API, $this->datacenter); } foreach ($this->new_outgoing as $message_id) { if ($this->outgoing_messages[$message_id]['unencrypted']) { $promise = $this->outgoing_messages[$message_id]['promise']; \Amp\Loop::defer(function () use ($promise) { $promise->fail(new Exception('Restart')); }); unset($this->new_outgoing[$message_id]); unset($this->outgoing_messages[$message_id]); } } $this->http_req_count = 0; $this->http_res_count = 0; $this->writer->start(); $this->reader->start(); if (!$this->checker->start()) { $this->checker->resume(); } $this->waiter->start(); if ($this->datacenter === $this->API->settings['connection_settings']['default_dc']) { $this->updater->start(); } } public function sendMessage($message, $flush = true): Promise { return $this->call($this->sendMessageGenerator($message, $flush)); } public function sendMessageGenerator($message, $flush = true): \Generator { $deferred = new Deferred(); if (!isset($message['serialized_body'])) { $body = is_object($message['body']) ? yield $message['body'] : $message['body']; $refresh_next = isset($message['refresh_next']) && $message['refresh_next']; //$refresh_next = true; if ($refresh_next) { $this->API->referenceDatabase->refreshNext(true); } if ($message['method']) { $body = $this->API->serialize_method($message['_'], $body); } else { $body = $this->API->serialize_object(['type' => $message['_']], $body, $message['_']); } if ($refresh_next) { $this->API->referenceDatabase->refreshNext(false); } $message['serialized_body'] = $body; } $message['send_promise'] = $deferred; $this->pending_outgoing[$this->pending_outgoing_key++] = $message; $this->pending_outgoing_key %= self::PENDING_MAX; if ($flush) { $this->writer->resume(); } return yield $deferred->promise(); } public function setExtra($extra) { $this->API = $extra; } public function disconnect() { $this->old = true; foreach (['reader', 'writer', 'checker', 'waiter', 'updater'] as $loop) { if (isset($this->{$loop}) && $this->{$loop}) { $this->{$loop}->signal($loop === 'reader' ? new NothingInTheSocketException() : true); } } if ($this->stream) { $this->stream->disconnect(); } } public function reconnect(): Promise { return $this->call($this->reconnectAsync()); } public function reconnectAsync(): \Generator { $this->API->logger->logger('Reconnecting'); $this->disconnect(); yield $this->API->datacenter->dc_connect_async($this->ctx->getDc()); } public function hasPendingCalls() { $API = $this->API; $datacenter = $this->datacenter; $dc_config_number = isset($API->settings['connection_settings'][$datacenter]) ? $datacenter : 'all'; $timeout = $API->settings['connection_settings'][$dc_config_number]['timeout']; foreach ($this->new_outgoing as $message_id) { if (isset($this->outgoing_messages[$message_id]['sent']) && $this->outgoing_messages[$message_id]['sent'] + $timeout < time() && ($this->temp_auth_key === null) === $this->outgoing_messages[$message_id]['unencrypted'] && $this->outgoing_messages[$message_id]['_'] !== 'msgs_state_req' ) { return true; } } return false; } public function getName(): string { return __CLASS__; } /** * Sleep function. * * @internal * * @return array */ public function __sleep() { return ['peer_tag', 'temp_auth_key', 'auth_key', 'session_id', 'session_out_seq_no', 'session_in_seq_no', 'max_incoming_id', 'max_outgoing_id', 'authorized', 'ack_queue']; } public function __wakeup() { $this->time_delta = 0; $this->pending_outgoing = []; $this->new_outgoing = []; $this->new_incoming = []; $this->outgoing_messages = []; $this->incoming_messages = []; } } { "constructors": [ { "id": "-1132882121", "predicate": "boolFalse", "params": [], "type": "Bool" }, { "id": "-1720552011", "predicate": "boolTrue", "params": [], "type": "Bool" }, { "id": "1072550713", "predicate": "true", "params": [], "type": "True" }, { "id": "481674261", "predicate": "vector", "params": [], "type": "Vector t" }, { "id": "-994444869", "predicate": "error", "params": [ { "name": "code", "type": "int" }, { "name": "text", "type": "string" } ], "type": "Error" }, { "id": "1450380236", "predicate": "null", "params": [], "type": "Null" }, { "id": "2134579434", "predicate": "inputPeerEmpty", "params": [], "type": "InputPeer" }, { "id": "2107670217", "predicate": "inputPeerSelf", "params": [], "type": "InputPeer" }, { "id": "396093539", "predicate": "inputPeerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1182234929", "predicate": "inputUserEmpty", "params": [], "type": "InputUser" }, { "id": "-138301121", "predicate": "inputUserSelf", "params": [], "type": "InputUser" }, { "id": "-208488460", "predicate": "inputPhoneContact", "params": [ { "name": "client_id", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputContact" }, { "id": "-181407105", "predicate": "inputFile", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" }, { "name": "md5_checksum", "type": "string" } ], "type": "InputFile" }, { "id": "-1771768449", "predicate": "inputMediaEmpty", "params": [], "type": "InputMedia" }, { "id": "-139464256", "predicate": "inputMediaUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-373312269", "predicate": "inputMediaPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-104578748", "predicate": "inputMediaGeoPoint", "params": [ { "name": "geo_point", "type": "InputGeoPoint" } ], "type": "InputMedia" }, { "id": "-1494984313", "predicate": "inputMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputMedia" }, { "id": "-2106507297", "predicate": "inputMediaUploadedVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "2004934137", "predicate": "inputMediaUploadedThumbVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-1821749571", "predicate": "inputMediaVideo", "params": [ { "name": "id", "type": "InputVideo" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "480546647", "predicate": "inputChatPhotoEmpty", "params": [], "type": "InputChatPhoto" }, { "id": "-1809496270", "predicate": "inputChatUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-1293828344", "predicate": "inputChatPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-457104426", "predicate": "inputGeoPointEmpty", "params": [], "type": "InputGeoPoint" }, { "id": "-206066487", "predicate": "inputGeoPoint", "params": [ { "name": "lat", "type": "double" }, { "name": "long", "type": "double" } ], "type": "InputGeoPoint" }, { "id": "483901197", "predicate": "inputPhotoEmpty", "params": [], "type": "InputPhoto" }, { "id": "-74070332", "predicate": "inputPhoto", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputPhoto" }, { "id": "1426648181", "predicate": "inputVideoEmpty", "params": [], "type": "InputVideo" }, { "id": "-296249774", "predicate": "inputVideo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputVideo" }, { "id": "342061462", "predicate": "inputFileLocation", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1023632620", "predicate": "inputVideoFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-1377390588", "predicate": "inputPhotoCropAuto", "params": [], "type": "InputPhotoCrop" }, { "id": "-644787419", "predicate": "inputPhotoCrop", "params": [ { "name": "crop_left", "type": "double" }, { "name": "crop_top", "type": "double" }, { "name": "crop_width", "type": "double" } ], "type": "InputPhotoCrop" }, { "id": "1996904104", "predicate": "inputAppEvent", "params": [ { "name": "time", "type": "double" }, { "name": "type", "type": "string" }, { "name": "peer", "type": "long" }, { "name": "data", "type": "string" } ], "type": "InputAppEvent" }, { "id": "-1649296275", "predicate": "peerUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "Peer" }, { "id": "-1160714821", "predicate": "peerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Peer" }, { "id": "-1432995067", "predicate": "storage.fileUnknown", "params": [], "type": "storage.FileType" }, { "id": "8322574", "predicate": "storage.fileJpeg", "params": [], "type": "storage.FileType" }, { "id": "-891180321", "predicate": "storage.fileGif", "params": [], "type": "storage.FileType" }, { "id": "172975040", "predicate": "storage.filePng", "params": [], "type": "storage.FileType" }, { "id": "-1373745011", "predicate": "storage.filePdf", "params": [], "type": "storage.FileType" }, { "id": "1384777335", "predicate": "storage.fileMp3", "params": [], "type": "storage.FileType" }, { "id": "1258941372", "predicate": "storage.fileMov", "params": [], "type": "storage.FileType" }, { "id": "1086091090", "predicate": "storage.filePartial", "params": [], "type": "storage.FileType" }, { "id": "-1278304028", "predicate": "storage.fileMp4", "params": [], "type": "storage.FileType" }, { "id": "276907596", "predicate": "storage.fileWebp", "params": [], "type": "storage.FileType" }, { "id": "2086234950", "predicate": "fileLocationUnavailable", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "1406570614", "predicate": "fileLocation", "params": [ { "name": "dc_id", "type": "int" }, { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "537022650", "predicate": "userEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "User" }, { "id": "1326562017", "predicate": "userProfilePhotoEmpty", "params": [], "type": "UserProfilePhoto" }, { "id": "-715532088", "predicate": "userProfilePhoto", "params": [ { "name": "photo_id", "type": "long" }, { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "UserProfilePhoto" }, { "id": "164646985", "predicate": "userStatusEmpty", "params": [], "type": "UserStatus" }, { "id": "-306628279", "predicate": "userStatusOnline", "params": [ { "name": "expires", "type": "int" } ], "type": "UserStatus" }, { "id": "9203775", "predicate": "userStatusOffline", "params": [ { "name": "was_online", "type": "int" } ], "type": "UserStatus" }, { "id": "-1683826688", "predicate": "chatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Chat" }, { "id": "-652419756", "predicate": "chat", "params": [ { "name": "flags", "type": "#" }, { "name": "creator", "type": "flags.0?true" }, { "name": "kicked", "type": "flags.1?true" }, { "name": "left", "type": "flags.2?true" }, { "name": "admins_enabled", "type": "flags.3?true" }, { "name": "admin", "type": "flags.4?true" }, { "name": "deactivated", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" }, { "name": "migrated_to", "type": "flags.6?InputChannel" } ], "type": "Chat" }, { "id": "120753115", "predicate": "chatForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Chat" }, { "id": "771925524", "predicate": "chatFull", "params": [ { "name": "id", "type": "int" }, { "name": "participants", "type": "ChatParticipants" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector" } ], "type": "ChatFull" }, { "id": "-925415106", "predicate": "chatParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "-57668565", "predicate": "chatParticipantsForbidden", "params": [ { "name": "flags", "type": "#" }, { "name": "chat_id", "type": "int" }, { "name": "self_participant", "type": "flags.0?ChatParticipant" } ], "type": "ChatParticipants" }, { "id": "1061556205", "predicate": "chatParticipants", "params": [ { "name": "chat_id", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "version", "type": "int" } ], "type": "ChatParticipants" }, { "id": "935395612", "predicate": "chatPhotoEmpty", "params": [], "type": "ChatPhoto" }, { "id": "1632839530", "predicate": "chatPhoto", "params": [ { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "ChatPhoto" }, { "id": "-2082087340", "predicate": "messageEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Message" }, { "id": "-913120932", "predicate": "message", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "via_bot_id", "type": "flags.11?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "reply_markup", "type": "flags.6?ReplyMarkup" }, { "name": "entities", "type": "flags.7?Vector" }, { "name": "views", "type": "flags.10?int" } ], "type": "Message" }, { "id": "-1066691065", "predicate": "messageService", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "Message" }, { "id": "1038967584", "predicate": "messageMediaEmpty", "params": [], "type": "MessageMedia" }, { "id": "1032643901", "predicate": "messageMediaPhoto", "params": [ { "name": "photo", "type": "Photo" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1540298357", "predicate": "messageMediaVideo", "params": [ { "name": "video", "type": "Video" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1457575028", "predicate": "messageMediaGeo", "params": [ { "name": "geo", "type": "GeoPoint" } ], "type": "MessageMedia" }, { "id": "1585262393", "predicate": "messageMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "user_id", "type": "int" } ], "type": "MessageMedia" }, { "id": "-1618676578", "predicate": "messageMediaUnsupported", "params": [], "type": "MessageMedia" }, { "id": "-1230047312", "predicate": "messageActionEmpty", "params": [], "type": "MessageAction" }, { "id": "-1503425638", "predicate": "messageActionChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "users", "type": "Vector" } ], "type": "MessageAction" }, { "id": "-1247687078", "predicate": "messageActionChatEditTitle", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "2144015272", "predicate": "messageActionChatEditPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageAction" }, { "id": "-1780220945", "predicate": "messageActionChatDeletePhoto", "params": [], "type": "MessageAction" }, { "id": "1217033015", "predicate": "messageActionChatAddUser", "params": [ { "name": "users", "type": "Vector" } ], "type": "MessageAction" }, { "id": "-1297179892", "predicate": "messageActionChatDeleteUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1042448310", "predicate": "dialog", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Dialog" }, { "id": "590459437", "predicate": "photoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Photo" }, { "id": "-840088834", "predicate": "photo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "sizes", "type": "Vector" } ], "type": "Photo" }, { "id": "236446268", "predicate": "photoSizeEmpty", "params": [ { "name": "type", "type": "string" } ], "type": "PhotoSize" }, { "id": "2009052699", "predicate": "photoSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "size", "type": "int" } ], "type": "PhotoSize" }, { "id": "-374917894", "predicate": "photoCachedSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "PhotoSize" }, { "id": "-1056548696", "predicate": "videoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Video" }, { "id": "-148338733", "predicate": "video", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "Video" }, { "id": "286776671", "predicate": "geoPointEmpty", "params": [], "type": "GeoPoint" }, { "id": "541710092", "predicate": "geoPoint", "params": [ { "name": "long", "type": "double" }, { "name": "lat", "type": "double" } ], "type": "GeoPoint" }, { "id": "-2128698738", "predicate": "auth.checkedPhone", "params": [ { "name": "phone_registered", "type": "Bool" } ], "type": "auth.CheckedPhone" }, { "id": "-269659687", "predicate": "auth.sentCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "-16553231", "predicate": "auth.authorization", "params": [ { "name": "user", "type": "User" } ], "type": "auth.Authorization" }, { "id": "-543777747", "predicate": "auth.exportedAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.ExportedAuthorization" }, { "id": "-1195615476", "predicate": "inputNotifyPeer", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "InputNotifyPeer" }, { "id": "423314455", "predicate": "inputNotifyUsers", "params": [], "type": "InputNotifyPeer" }, { "id": "1251338318", "predicate": "inputNotifyChats", "params": [], "type": "InputNotifyPeer" }, { "id": "-1540769658", "predicate": "inputNotifyAll", "params": [], "type": "InputNotifyPeer" }, { "id": "-265263912", "predicate": "inputPeerNotifyEventsEmpty", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "-395694988", "predicate": "inputPeerNotifyEventsAll", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "1185074840", "predicate": "inputPeerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "InputPeerNotifySettings" }, { "id": "-1378534221", "predicate": "peerNotifyEventsEmpty", "params": [], "type": "PeerNotifyEvents" }, { "id": "1830677896", "predicate": "peerNotifyEventsAll", "params": [], "type": "PeerNotifyEvents" }, { "id": "1889961234", "predicate": "peerNotifySettingsEmpty", "params": [], "type": "PeerNotifySettings" }, { "id": "-1923214866", "predicate": "peerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "PeerNotifySettings" }, { "id": "-860866985", "predicate": "wallPaper", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "sizes", "type": "Vector" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "1490799288", "predicate": "inputReportReasonSpam", "params": [], "type": "ReportReason" }, { "id": "505595789", "predicate": "inputReportReasonViolence", "params": [], "type": "ReportReason" }, { "id": "777640226", "predicate": "inputReportReasonPornography", "params": [], "type": "ReportReason" }, { "id": "-512463606", "predicate": "inputReportReasonOther", "params": [ { "name": "text", "type": "string" } ], "type": "ReportReason" }, { "id": "1518971995", "predicate": "userFull", "params": [ { "name": "user", "type": "User" }, { "name": "link", "type": "contacts.Link" }, { "name": "profile_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "blocked", "type": "Bool" }, { "name": "bot_info", "type": "BotInfo" } ], "type": "UserFull" }, { "id": "-116274796", "predicate": "contact", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual", "type": "Bool" } ], "type": "Contact" }, { "id": "-805141448", "predicate": "importedContact", "params": [ { "name": "user_id", "type": "int" }, { "name": "client_id", "type": "long" } ], "type": "ImportedContact" }, { "id": "1444661369", "predicate": "contactBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ContactBlocked" }, { "id": "1038193057", "predicate": "contactSuggested", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual_contacts", "type": "int" } ], "type": "ContactSuggested" }, { "id": "-748155807", "predicate": "contactStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "ContactStatus" }, { "id": "986597452", "predicate": "contacts.link", "params": [ { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" }, { "name": "user", "type": "User" } ], "type": "contacts.Link" }, { "id": "-1219778094", "predicate": "contacts.contactsNotModified", "params": [], "type": "contacts.Contacts" }, { "id": "1871416498", "predicate": "contacts.contacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Contacts" }, { "id": "-1387117803", "predicate": "contacts.importedContacts", "params": [ { "name": "imported", "type": "Vector" }, { "name": "retry_contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ImportedContacts" }, { "id": "471043349", "predicate": "contacts.blocked", "params": [ { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "-1878523231", "predicate": "contacts.blockedSlice", "params": [ { "name": "count", "type": "int" }, { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "1447681221", "predicate": "contacts.suggested", "params": [ { "name": "results", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Suggested" }, { "id": "364538944", "predicate": "messages.dialogs", "params": [ { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "1910543603", "predicate": "messages.dialogsSlice", "params": [ { "name": "count", "type": "int" }, { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "-1938715001", "predicate": "messages.messages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "189033187", "predicate": "messages.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "1694474197", "predicate": "messages.chats", "params": [ { "name": "chats", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "-438840932", "predicate": "messages.chatFull", "params": [ { "name": "full_chat", "type": "ChatFull" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.ChatFull" }, { "id": "-1269012015", "predicate": "messages.affectedHistory", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "1474492012", "predicate": "inputMessagesFilterEmpty", "params": [], "type": "MessagesFilter" }, { "id": "-1777752804", "predicate": "inputMessagesFilterPhotos", "params": [], "type": "MessagesFilter" }, { "id": "-1614803355", "predicate": "inputMessagesFilterVideo", "params": [], "type": "MessagesFilter" }, { "id": "1458172132", "predicate": "inputMessagesFilterPhotoVideo", "params": [], "type": "MessagesFilter" }, { "id": "-648121413", "predicate": "inputMessagesFilterPhotoVideoDocuments", "params": [], "type": "MessagesFilter" }, { "id": "-1629621880", "predicate": "inputMessagesFilterDocument", "params": [], "type": "MessagesFilter" }, { "id": "-808946398", "predicate": "inputMessagesFilterAudio", "params": [], "type": "MessagesFilter" }, { "id": "1526462308", "predicate": "inputMessagesFilterAudioDocuments", "params": [], "type": "MessagesFilter" }, { "id": "2129714567", "predicate": "inputMessagesFilterUrl", "params": [], "type": "MessagesFilter" }, { "id": "-3644025", "predicate": "inputMessagesFilterGif", "params": [], "type": "MessagesFilter" }, { "id": "522914557", "predicate": "updateNewMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1318109142", "predicate": "updateMessageID", "params": [ { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Update" }, { "id": "-1576161051", "predicate": "updateDeleteMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1548249383", "predicate": "updateUserTyping", "params": [ { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "-1704596961", "predicate": "updateChatUserTyping", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "125178264", "predicate": "updateChatParticipants", "params": [ { "name": "participants", "type": "ChatParticipants" } ], "type": "Update" }, { "id": "469489699", "predicate": "updateUserStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "Update" }, { "id": "-1489818765", "predicate": "updateUserName", "params": [ { "name": "user_id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "Update" }, { "id": "-1791935732", "predicate": "updateUserPhoto", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "previous", "type": "Bool" } ], "type": "Update" }, { "id": "628472761", "predicate": "updateContactRegistered", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1657903163", "predicate": "updateContactLink", "params": [ { "name": "user_id", "type": "int" }, { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" } ], "type": "Update" }, { "id": "-1895411046", "predicate": "updateNewAuthorization", "params": [ { "name": "auth_key_id", "type": "long" }, { "name": "date", "type": "int" }, { "name": "device", "type": "string" }, { "name": "location", "type": "string" } ], "type": "Update" }, { "id": "-1519637954", "predicate": "updates.state", "params": [ { "name": "pts", "type": "int" }, { "name": "qts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "unread_count", "type": "int" } ], "type": "updates.State" }, { "id": "1567990072", "predicate": "updates.differenceEmpty", "params": [ { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "updates.Difference" }, { "id": "16030880", "predicate": "updates.difference", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-1459938943", "predicate": "updates.differenceSlice", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "intermediate_state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-484987010", "predicate": "updatesTooLong", "params": [], "type": "Updates" }, { "id": "333766314", "predicate": "updateShortMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "via_bot_id", "type": "flags.11?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "613087842", "predicate": "updateShortChatMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "chat_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "via_bot_id", "type": "flags.11?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "2027216577", "predicate": "updateShort", "params": [ { "name": "update", "type": "Update" }, { "name": "date", "type": "int" } ], "type": "Updates" }, { "id": "1918567619", "predicate": "updatesCombined", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq_start", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "1957577280", "predicate": "updates", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "-1916114267", "predicate": "photos.photos", "params": [ { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "352657236", "predicate": "photos.photosSlice", "params": [ { "name": "count", "type": "int" }, { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "539045032", "predicate": "photos.photo", "params": [ { "name": "photo", "type": "Photo" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photo" }, { "id": "157948117", "predicate": "upload.file", "params": [ { "name": "type", "type": "storage.FileType" }, { "name": "mtime", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "upload.File" }, { "id": "98092748", "predicate": "dcOption", "params": [ { "name": "flags", "type": "#" }, { "name": "ipv6", "type": "flags.0?true" }, { "name": "media_only", "type": "flags.1?true" }, { "name": "id", "type": "int" }, { "name": "ip_address", "type": "string" }, { "name": "port", "type": "int" } ], "type": "DcOption" }, { "id": "112969208", "predicate": "config", "params": [ { "name": "date", "type": "int" }, { "name": "expires", "type": "int" }, { "name": "test_mode", "type": "Bool" }, { "name": "this_dc", "type": "int" }, { "name": "dc_options", "type": "Vector" }, { "name": "chat_size_max", "type": "int" }, { "name": "megagroup_size_max", "type": "int" }, { "name": "forwarded_count_max", "type": "int" }, { "name": "online_update_period_ms", "type": "int" }, { "name": "offline_blur_timeout_ms", "type": "int" }, { "name": "offline_idle_timeout_ms", "type": "int" }, { "name": "online_cloud_timeout_ms", "type": "int" }, { "name": "notify_cloud_delay_ms", "type": "int" }, { "name": "notify_default_delay_ms", "type": "int" }, { "name": "chat_big_size", "type": "int" }, { "name": "push_chat_period_ms", "type": "int" }, { "name": "push_chat_limit", "type": "int" }, { "name": "saved_gifs_limit", "type": "int" }, { "name": "disabled_features", "type": "Vector" } ], "type": "Config" }, { "id": "-1910892683", "predicate": "nearestDc", "params": [ { "name": "country", "type": "string" }, { "name": "this_dc", "type": "int" }, { "name": "nearest_dc", "type": "int" } ], "type": "NearestDc" }, { "id": "-1987579119", "predicate": "help.appUpdate", "params": [ { "name": "id", "type": "int" }, { "name": "critical", "type": "Bool" }, { "name": "url", "type": "string" }, { "name": "text", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "-1000708810", "predicate": "help.noAppUpdate", "params": [], "type": "help.AppUpdate" }, { "id": "415997816", "predicate": "help.inviteText", "params": [ { "name": "message", "type": "string" } ], "type": "help.InviteText" }, { "id": "1662091044", "predicate": "wallPaperSolid", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "bg_color", "type": "int" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "314359194", "predicate": "updateNewEncryptedMessage", "params": [ { "name": "message", "type": "EncryptedMessage" }, { "name": "qts", "type": "int" } ], "type": "Update" }, { "id": "386986326", "predicate": "updateEncryptedChatTyping", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Update" }, { "id": "-1264392051", "predicate": "updateEncryption", "params": [ { "name": "chat", "type": "EncryptedChat" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "956179895", "predicate": "updateEncryptedMessagesRead", "params": [ { "name": "chat_id", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1417756512", "predicate": "encryptedChatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "1006044124", "predicate": "encryptedChatWaiting", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-931638658", "predicate": "encryptedChatRequested", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "-94974410", "predicate": "encryptedChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a_or_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "332848423", "predicate": "encryptedChatDiscarded", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-247351839", "predicate": "inputEncryptedChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedChat" }, { "id": "-1038136962", "predicate": "encryptedFileEmpty", "params": [], "type": "EncryptedFile" }, { "id": "1248893260", "predicate": "encryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "EncryptedFile" }, { "id": "406307684", "predicate": "inputEncryptedFileEmpty", "params": [], "type": "InputEncryptedFile" }, { "id": "1690108678", "predicate": "inputEncryptedFileUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "md5_checksum", "type": "string" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "1511503333", "predicate": "inputEncryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedFile" }, { "id": "-182231723", "predicate": "inputEncryptedFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-317144808", "predicate": "encryptedMessage", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" }, { "name": "file", "type": "EncryptedFile" } ], "type": "EncryptedMessage" }, { "id": "594758406", "predicate": "encryptedMessageService", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "EncryptedMessage" }, { "id": "-1058912715", "predicate": "messages.dhConfigNotModified", "params": [ { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "740433629", "predicate": "messages.dhConfig", "params": [ { "name": "g", "type": "int" }, { "name": "p", "type": "bytes" }, { "name": "version", "type": "int" }, { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "1443858741", "predicate": "messages.sentEncryptedMessage", "params": [ { "name": "date", "type": "int" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1802240206", "predicate": "messages.sentEncryptedFile", "params": [ { "name": "date", "type": "int" }, { "name": "file", "type": "EncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-95482955", "predicate": "inputFileBig", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" } ], "type": "InputFile" }, { "id": "767652808", "predicate": "inputEncryptedFileBigUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "-364179876", "predicate": "updateChatParticipantAdd", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1851755554", "predicate": "updateChatParticipantDelete", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1906403213", "predicate": "updateDcOptions", "params": [ { "name": "dc_options", "type": "Vector" } ], "type": "Update" }, { "id": "1313442987", "predicate": "inputMediaUploadedAudio", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1986820223", "predicate": "inputMediaAudio", "params": [ { "name": "id", "type": "InputAudio" } ], "type": "InputMedia" }, { "id": "495530093", "predicate": "inputMediaUploadedDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-1386138479", "predicate": "inputMediaUploadedThumbDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "444068508", "predicate": "inputMediaDocument", "params": [ { "name": "id", "type": "InputDocument" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-203411800", "predicate": "messageMediaDocument", "params": [ { "name": "document", "type": "Document" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "-961117440", "predicate": "messageMediaAudio", "params": [ { "name": "audio", "type": "Audio" } ], "type": "MessageMedia" }, { "id": "-648356732", "predicate": "inputAudioEmpty", "params": [], "type": "InputAudio" }, { "id": "2010398975", "predicate": "inputAudio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputAudio" }, { "id": "1928391342", "predicate": "inputDocumentEmpty", "params": [], "type": "InputDocument" }, { "id": "410618194", "predicate": "inputDocument", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputDocument" }, { "id": "1960591437", "predicate": "inputAudioFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1313188841", "predicate": "inputDocumentFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1483311320", "predicate": "audioEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Audio" }, { "id": "-102543275", "predicate": "audio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" } ], "type": "Audio" }, { "id": "922273905", "predicate": "documentEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Document" }, { "id": "-106717361", "predicate": "document", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "attributes", "type": "Vector" } ], "type": "Document" }, { "id": "398898678", "predicate": "help.support", "params": [ { "name": "phone_number", "type": "string" }, { "name": "user", "type": "User" } ], "type": "help.Support" }, { "id": "-1613493288", "predicate": "notifyPeer", "params": [ { "name": "peer", "type": "Peer" } ], "type": "NotifyPeer" }, { "id": "-1261946036", "predicate": "notifyUsers", "params": [], "type": "NotifyPeer" }, { "id": "-1073230141", "predicate": "notifyChats", "params": [], "type": "NotifyPeer" }, { "id": "1959820384", "predicate": "notifyAll", "params": [], "type": "NotifyPeer" }, { "id": "-2131957734", "predicate": "updateUserBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "blocked", "type": "Bool" } ], "type": "Update" }, { "id": "-1094555409", "predicate": "updateNotifySettings", "params": [ { "name": "peer", "type": "NotifyPeer" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Update" }, { "id": "-484053553", "predicate": "auth.sentAppCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "381645902", "predicate": "sendMessageTypingAction", "params": [], "type": "SendMessageAction" }, { "id": "-44119819", "predicate": "sendMessageCancelAction", "params": [], "type": "SendMessageAction" }, { "id": "-1584933265", "predicate": "sendMessageRecordVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-378127636", "predicate": "sendMessageUploadVideoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-718310409", "predicate": "sendMessageRecordAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-212740181", "predicate": "sendMessageUploadAudioAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-774682074", "predicate": "sendMessageUploadPhotoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-1441998364", "predicate": "sendMessageUploadDocumentAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "393186209", "predicate": "sendMessageGeoLocationAction", "params": [], "type": "SendMessageAction" }, { "id": "1653390447", "predicate": "sendMessageChooseContactAction", "params": [], "type": "SendMessageAction" }, { "id": "446822276", "predicate": "contacts.found", "params": [ { "name": "results", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Found" }, { "id": "942527460", "predicate": "updateServiceNotification", "params": [ { "name": "type", "type": "string" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" }, { "name": "popup", "type": "Bool" } ], "type": "Update" }, { "id": "-496024847", "predicate": "userStatusRecently", "params": [], "type": "UserStatus" }, { "id": "129960444", "predicate": "userStatusLastWeek", "params": [], "type": "UserStatus" }, { "id": "2011940674", "predicate": "userStatusLastMonth", "params": [], "type": "UserStatus" }, { "id": "-298113238", "predicate": "updatePrivacy", "params": [ { "name": "key", "type": "PrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "Update" }, { "id": "1335282456", "predicate": "inputPrivacyKeyStatusTimestamp", "params": [], "type": "InputPrivacyKey" }, { "id": "-1137792208", "predicate": "privacyKeyStatusTimestamp", "params": [], "type": "PrivacyKey" }, { "id": "218751099", "predicate": "inputPrivacyValueAllowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "407582158", "predicate": "inputPrivacyValueAllowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "320652927", "predicate": "inputPrivacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "195371015", "predicate": "inputPrivacyValueDisallowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "-697604407", "predicate": "inputPrivacyValueDisallowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "-1877932953", "predicate": "inputPrivacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "-123988", "predicate": "privacyValueAllowContacts", "params": [], "type": "PrivacyRule" }, { "id": "1698855810", "predicate": "privacyValueAllowAll", "params": [], "type": "PrivacyRule" }, { "id": "1297858060", "predicate": "privacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "-125240806", "predicate": "privacyValueDisallowContacts", "params": [], "type": "PrivacyRule" }, { "id": "-1955338397", "predicate": "privacyValueDisallowAll", "params": [], "type": "PrivacyRule" }, { "id": "209668535", "predicate": "privacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "1430961007", "predicate": "account.privacyRules", "params": [ { "name": "rules", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "-1194283041", "predicate": "accountDaysTTL", "params": [ { "name": "days", "type": "int" } ], "type": "AccountDaysTTL" }, { "id": "-1527411636", "predicate": "account.sentChangePhoneCode", "params": [ { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" } ], "type": "account.SentChangePhoneCode" }, { "id": "314130811", "predicate": "updateUserPhone", "params": [ { "name": "user_id", "type": "int" }, { "name": "phone", "type": "string" } ], "type": "Update" }, { "id": "1815593308", "predicate": "documentAttributeImageSize", "params": [ { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "297109817", "predicate": "documentAttributeAnimated", "params": [], "type": "DocumentAttribute" }, { "id": "978674434", "predicate": "documentAttributeSticker", "params": [ { "name": "alt", "type": "string" }, { "name": "stickerset", "type": "InputStickerSet" } ], "type": "DocumentAttribute" }, { "id": "1494273227", "predicate": "documentAttributeVideo", "params": [ { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "-556656416", "predicate": "documentAttributeAudio", "params": [ { "name": "duration", "type": "int" }, { "name": "title", "type": "string" }, { "name": "performer", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "358154344", "predicate": "documentAttributeFilename", "params": [ { "name": "file_name", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "-244016606", "predicate": "messages.stickersNotModified", "params": [], "type": "messages.Stickers" }, { "id": "-1970352846", "predicate": "messages.stickers", "params": [ { "name": "hash", "type": "string" }, { "name": "stickers", "type": "Vector" } ], "type": "messages.Stickers" }, { "id": "313694676", "predicate": "stickerPack", "params": [ { "name": "emoticon", "type": "string" }, { "name": "documents", "type": "Vector" } ], "type": "StickerPack" }, { "id": "-395967805", "predicate": "messages.allStickersNotModified", "params": [], "type": "messages.AllStickers" }, { "id": "-302170017", "predicate": "messages.allStickers", "params": [ { "name": "hash", "type": "int" }, { "name": "sets", "type": "Vector" } ], "type": "messages.AllStickers" }, { "id": "-1369215196", "predicate": "disabledFeature", "params": [ { "name": "feature", "type": "string" }, { "name": "description", "type": "string" } ], "type": "DisabledFeature" }, { "id": "-1721631396", "predicate": "updateReadHistoryInbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "791617983", "predicate": "updateReadHistoryOutbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-2066640507", "predicate": "messages.affectedMessages", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "1599050311", "predicate": "contactLinkUnknown", "params": [], "type": "ContactLink" }, { "id": "-17968211", "predicate": "contactLinkNone", "params": [], "type": "ContactLink" }, { "id": "646922073", "predicate": "contactLinkHasPhone", "params": [], "type": "ContactLink" }, { "id": "-721239344", "predicate": "contactLinkContact", "params": [], "type": "ContactLink" }, { "id": "2139689491", "predicate": "updateWebPage", "params": [ { "name": "webpage", "type": "WebPage" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-350980120", "predicate": "webPageEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "WebPage" }, { "id": "-981018084", "predicate": "webPagePending", "params": [ { "name": "id", "type": "long" }, { "name": "date", "type": "int" } ], "type": "WebPage" }, { "id": "-897446185", "predicate": "webPage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "long" }, { "name": "url", "type": "string" }, { "name": "display_url", "type": "string" }, { "name": "type", "type": "flags.0?string" }, { "name": "site_name", "type": "flags.1?string" }, { "name": "title", "type": "flags.2?string" }, { "name": "description", "type": "flags.3?string" }, { "name": "photo", "type": "flags.4?Photo" }, { "name": "embed_url", "type": "flags.5?string" }, { "name": "embed_type", "type": "flags.5?string" }, { "name": "embed_width", "type": "flags.6?int" }, { "name": "embed_height", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "author", "type": "flags.8?string" }, { "name": "document", "type": "flags.9?Document" } ], "type": "WebPage" }, { "id": "-1557277184", "predicate": "messageMediaWebPage", "params": [ { "name": "webpage", "type": "WebPage" } ], "type": "MessageMedia" }, { "id": "2079516406", "predicate": "authorization", "params": [ { "name": "hash", "type": "long" }, { "name": "flags", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "platform", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "api_id", "type": "int" }, { "name": "app_name", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "date_created", "type": "int" }, { "name": "date_active", "type": "int" }, { "name": "ip", "type": "string" }, { "name": "country", "type": "string" }, { "name": "region", "type": "string" } ], "type": "Authorization" }, { "id": "307276766", "predicate": "account.authorizations", "params": [ { "name": "authorizations", "type": "Vector" } ], "type": "account.Authorizations" }, { "id": "-1764049896", "predicate": "account.noPassword", "params": [ { "name": "new_salt", "type": "bytes" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "2081952796", "predicate": "account.password", "params": [ { "name": "current_salt", "type": "bytes" }, { "name": "new_salt", "type": "bytes" }, { "name": "hint", "type": "string" }, { "name": "has_recovery", "type": "Bool" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "-1212732749", "predicate": "account.passwordSettings", "params": [ { "name": "email", "type": "string" } ], "type": "account.PasswordSettings" }, { "id": "-1124314324", "predicate": "account.passwordInputSettings", "params": [ { "name": "flags", "type": "#" }, { "name": "new_salt", "type": "flags.0?bytes" }, { "name": "new_password_hash", "type": "flags.0?bytes" }, { "name": "hint", "type": "flags.0?string" }, { "name": "email", "type": "flags.1?string" } ], "type": "account.PasswordInputSettings" }, { "id": "326715557", "predicate": "auth.passwordRecovery", "params": [ { "name": "email_pattern", "type": "string" } ], "type": "auth.PasswordRecovery" }, { "id": "673687578", "predicate": "inputMediaVenue", "params": [ { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "InputMedia" }, { "id": "2031269663", "predicate": "messageMediaVenue", "params": [ { "name": "geo", "type": "GeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "MessageMedia" }, { "id": "-1551583367", "predicate": "receivedNotifyMessage", "params": [ { "name": "id", "type": "int" }, { "name": "flags", "type": "int" } ], "type": "ReceivedNotifyMessage" }, { "id": "1776236393", "predicate": "chatInviteEmpty", "params": [], "type": "ExportedChatInvite" }, { "id": "-64092740", "predicate": "chatInviteExported", "params": [ { "name": "link", "type": "string" } ], "type": "ExportedChatInvite" }, { "id": "1516793212", "predicate": "chatInviteAlready", "params": [ { "name": "chat", "type": "Chat" } ], "type": "ChatInvite" }, { "id": "-1813406880", "predicate": "chatInvite", "params": [ { "name": "flags", "type": "#" }, { "name": "channel", "type": "flags.0?true" }, { "name": "broadcast", "type": "flags.1?true" }, { "name": "public", "type": "flags.2?true" }, { "name": "megagroup", "type": "flags.3?true" }, { "name": "title", "type": "string" } ], "type": "ChatInvite" }, { "id": "-123931160", "predicate": "messageActionChatJoinedByLink", "params": [ { "name": "inviter_id", "type": "int" } ], "type": "MessageAction" }, { "id": "1757493555", "predicate": "updateReadMessagesContents", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-4838507", "predicate": "inputStickerSetEmpty", "params": [], "type": "InputStickerSet" }, { "id": "-1645763991", "predicate": "inputStickerSetID", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputStickerSet" }, { "id": "-2044933984", "predicate": "inputStickerSetShortName", "params": [ { "name": "short_name", "type": "string" } ], "type": "InputStickerSet" }, { "id": "-852477119", "predicate": "stickerSet", "params": [ { "name": "flags", "type": "#" }, { "name": "installed", "type": "flags.0?true" }, { "name": "disabled", "type": "flags.1?true" }, { "name": "official", "type": "flags.2?true" }, { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "short_name", "type": "string" }, { "name": "count", "type": "int" }, { "name": "hash", "type": "int" } ], "type": "StickerSet" }, { "id": "-1240849242", "predicate": "messages.stickerSet", "params": [ { "name": "set", "type": "StickerSet" }, { "name": "packs", "type": "Vector" }, { "name": "documents", "type": "Vector" } ], "type": "messages.StickerSet" }, { "id": "-787638374", "predicate": "user", "params": [ { "name": "flags", "type": "#" }, { "name": "self", "type": "flags.10?true" }, { "name": "contact", "type": "flags.11?true" }, { "name": "mutual_contact", "type": "flags.12?true" }, { "name": "deleted", "type": "flags.13?true" }, { "name": "bot", "type": "flags.14?true" }, { "name": "bot_chat_history", "type": "flags.15?true" }, { "name": "bot_nochats", "type": "flags.16?true" }, { "name": "verified", "type": "flags.17?true" }, { "name": "restricted", "type": "flags.18?true" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "flags.0?long" }, { "name": "first_name", "type": "flags.1?string" }, { "name": "last_name", "type": "flags.2?string" }, { "name": "username", "type": "flags.3?string" }, { "name": "phone", "type": "flags.4?string" }, { "name": "photo", "type": "flags.5?UserProfilePhoto" }, { "name": "status", "type": "flags.6?UserStatus" }, { "name": "bot_info_version", "type": "flags.14?int" }, { "name": "restriction_reason", "type": "flags.18?string" }, { "name": "bot_inline_placeholder", "type": "flags.19?string" } ], "type": "User" }, { "id": "-1032140601", "predicate": "botCommand", "params": [ { "name": "command", "type": "string" }, { "name": "description", "type": "string" } ], "type": "BotCommand" }, { "id": "-1154598962", "predicate": "botInfoEmpty", "params": [], "type": "BotInfo" }, { "id": "164583517", "predicate": "botInfo", "params": [ { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" }, { "name": "share_text", "type": "string" }, { "name": "description", "type": "string" }, { "name": "commands", "type": "Vector" } ], "type": "BotInfo" }, { "id": "-1560655744", "predicate": "keyboardButton", "params": [ { "name": "text", "type": "string" } ], "type": "KeyboardButton" }, { "id": "2002815875", "predicate": "keyboardButtonRow", "params": [ { "name": "buttons", "type": "Vector" } ], "type": "KeyboardButtonRow" }, { "id": "-1606526075", "predicate": "replyKeyboardHide", "params": [ { "name": "flags", "type": "#" }, { "name": "selective", "type": "flags.2?true" } ], "type": "ReplyMarkup" }, { "id": "-200242528", "predicate": "replyKeyboardForceReply", "params": [ { "name": "flags", "type": "#" }, { "name": "single_use", "type": "flags.1?true" }, { "name": "selective", "type": "flags.2?true" } ], "type": "ReplyMarkup" }, { "id": "889353612", "predicate": "replyKeyboardMarkup", "params": [ { "name": "flags", "type": "#" }, { "name": "resize", "type": "flags.0?true" }, { "name": "single_use", "type": "flags.1?true" }, { "name": "selective", "type": "flags.2?true" }, { "name": "rows", "type": "Vector" } ], "type": "ReplyMarkup" }, { "id": "2072935910", "predicate": "inputPeerUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "-668391402", "predicate": "inputUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputUser" }, { "id": "-1350696044", "predicate": "help.appChangelogEmpty", "params": [], "type": "help.AppChangelog" }, { "id": "1181279933", "predicate": "help.appChangelog", "params": [ { "name": "text", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-1148011883", "predicate": "messageEntityUnknown", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-100378723", "predicate": "messageEntityMention", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1868782349", "predicate": "messageEntityHashtag", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1827637959", "predicate": "messageEntityBotCommand", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1859134776", "predicate": "messageEntityUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1692693954", "predicate": "messageEntityEmail", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-1117713463", "predicate": "messageEntityBold", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-2106619040", "predicate": "messageEntityItalic", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "681706865", "predicate": "messageEntityCode", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1938967520", "predicate": "messageEntityPre", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "language", "type": "string" } ], "type": "MessageEntity" }, { "id": "1990644519", "predicate": "messageEntityTextUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "url", "type": "string" } ], "type": "MessageEntity" }, { "id": "301019932", "predicate": "updateShortSentMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "-292807034", "predicate": "inputChannelEmpty", "params": [], "type": "InputChannel" }, { "id": "-1343524562", "predicate": "inputChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputChannel" }, { "id": "-1109531342", "predicate": "peerChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Peer" }, { "id": "548253432", "predicate": "inputPeerChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "1260090630", "predicate": "channel", "params": [ { "name": "flags", "type": "#" }, { "name": "creator", "type": "flags.0?true" }, { "name": "kicked", "type": "flags.1?true" }, { "name": "left", "type": "flags.2?true" }, { "name": "editor", "type": "flags.3?true" }, { "name": "moderator", "type": "flags.4?true" }, { "name": "broadcast", "type": "flags.5?true" }, { "name": "verified", "type": "flags.7?true" }, { "name": "megagroup", "type": "flags.8?true" }, { "name": "restricted", "type": "flags.9?true" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "username", "type": "flags.6?string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" }, { "name": "restriction_reason", "type": "flags.9?string" } ], "type": "Chat" }, { "id": "763724588", "predicate": "channelForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" } ], "type": "Chat" }, { "id": "2131196633", "predicate": "contacts.resolvedPeer", "params": [ { "name": "peer", "type": "Peer" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ResolvedPeer" }, { "id": "-1640751649", "predicate": "channelFull", "params": [ { "name": "flags", "type": "#" }, { "name": "can_view_participants", "type": "flags.3?true" }, { "name": "id", "type": "int" }, { "name": "about", "type": "string" }, { "name": "participants_count", "type": "flags.0?int" }, { "name": "admins_count", "type": "flags.1?int" }, { "name": "kicked_count", "type": "flags.2?int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector" }, { "name": "migrated_from_chat_id", "type": "flags.4?int" }, { "name": "migrated_from_max_id", "type": "flags.4?int" } ], "type": "ChatFull" }, { "id": "1535415986", "predicate": "dialogChannel", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "top_important_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "pts", "type": "int" } ], "type": "Dialog" }, { "id": "182649427", "predicate": "messageRange", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "MessageRange" }, { "id": "-399216813", "predicate": "messageGroup", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "count", "type": "int" }, { "name": "date", "type": "int" } ], "type": "MessageGroup" }, { "id": "-1139861572", "predicate": "messages.channelMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "pts", "type": "int" }, { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "collapsed", "type": "flags.0?Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "-1781355374", "predicate": "messageActionChannelCreate", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "1620337698", "predicate": "updateChannelTooLong", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Update" }, { "id": "-1227598250", "predicate": "updateChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Update" }, { "id": "-1016324548", "predicate": "updateChannelGroup", "params": [ { "name": "channel_id", "type": "int" }, { "name": "group", "type": "MessageGroup" } ], "type": "Update" }, { "id": "1656358105", "predicate": "updateNewChannelMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1108669311", "predicate": "updateReadChannelInbox", "params": [ { "name": "channel_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "Update" }, { "id": "-1015733815", "predicate": "updateDeleteChannelMessages", "params": [ { "name": "channel_id", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-1734268085", "predicate": "updateChannelMessageViews", "params": [ { "name": "channel_id", "type": "int" }, { "name": "id", "type": "int" }, { "name": "views", "type": "int" } ], "type": "Update" }, { "id": "1041346555", "predicate": "updates.channelDifferenceEmpty", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" } ], "type": "updates.ChannelDifference" }, { "id": "1578530374", "predicate": "updates.channelDifferenceTooLong", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "top_message", "type": "int" }, { "name": "top_important_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "updates.ChannelDifference" }, { "id": "543450958", "predicate": "updates.channelDifference", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "new_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "updates.ChannelDifference" }, { "id": "-1798033689", "predicate": "channelMessagesFilterEmpty", "params": [], "type": "ChannelMessagesFilter" }, { "id": "-847783593", "predicate": "channelMessagesFilter", "params": [ { "name": "flags", "type": "#" }, { "name": "important_only", "type": "flags.0?true" }, { "name": "exclude_new_messages", "type": "flags.1?true" }, { "name": "ranges", "type": "Vector" } ], "type": "ChannelMessagesFilter" }, { "id": "-100588754", "predicate": "channelMessagesFilterCollapsed", "params": [], "type": "ChannelMessagesFilter" }, { "id": "367766557", "predicate": "channelParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1557620115", "predicate": "channelParticipantSelf", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1861910545", "predicate": "channelParticipantModerator", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1743180447", "predicate": "channelParticipantEditor", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1933187430", "predicate": "channelParticipantKicked", "params": [ { "name": "user_id", "type": "int" }, { "name": "kicked_by", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-471670279", "predicate": "channelParticipantCreator", "params": [ { "name": "user_id", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-566281095", "predicate": "channelParticipantsRecent", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-1268741783", "predicate": "channelParticipantsAdmins", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "1010285434", "predicate": "channelParticipantsKicked", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-1299865402", "predicate": "channelRoleEmpty", "params": [], "type": "ChannelParticipantRole" }, { "id": "-1776756363", "predicate": "channelRoleModerator", "params": [], "type": "ChannelParticipantRole" }, { "id": "-2113143156", "predicate": "channelRoleEditor", "params": [], "type": "ChannelParticipantRole" }, { "id": "-177282392", "predicate": "channels.channelParticipants", "params": [ { "name": "count", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "channels.ChannelParticipants" }, { "id": "-791039645", "predicate": "channels.channelParticipant", "params": [ { "name": "participant", "type": "ChannelParticipant" }, { "name": "users", "type": "Vector" } ], "type": "channels.ChannelParticipant" }, { "id": "-636267638", "predicate": "chatParticipantCreator", "params": [ { "name": "user_id", "type": "int" } ], "type": "ChatParticipant" }, { "id": "-489233354", "predicate": "chatParticipantAdmin", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "1855224129", "predicate": "updateChatAdmins", "params": [ { "name": "chat_id", "type": "int" }, { "name": "enabled", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1232070311", "predicate": "updateChatParticipantAdmin", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "is_admin", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1371385889", "predicate": "messageActionChatMigrateTo", "params": [ { "name": "channel_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1336546578", "predicate": "messageActionChannelMigrateFrom", "params": [ { "name": "title", "type": "string" }, { "name": "chat_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1328445861", "predicate": "channelParticipantsBots", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-236044656", "predicate": "help.termsOfService", "params": [ { "name": "text", "type": "string" } ], "type": "help.TermsOfService" }, { "id": "1753886890", "predicate": "updateNewStickerSet", "params": [ { "name": "stickerset", "type": "messages.StickerSet" } ], "type": "Update" }, { "id": "-253774767", "predicate": "updateStickerSetsOrder", "params": [ { "name": "order", "type": "Vector" } ], "type": "Update" }, { "id": "1135492588", "predicate": "updateStickerSets", "params": [], "type": "Update" }, { "id": "372165663", "predicate": "foundGif", "params": [ { "name": "url", "type": "string" }, { "name": "thumb_url", "type": "string" }, { "name": "content_url", "type": "string" }, { "name": "content_type", "type": "string" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "FoundGif" }, { "id": "-1670052855", "predicate": "foundGifCached", "params": [ { "name": "url", "type": "string" }, { "name": "photo", "type": "Photo" }, { "name": "document", "type": "Document" } ], "type": "FoundGif" }, { "id": "1212395773", "predicate": "inputMediaGifExternal", "params": [ { "name": "url", "type": "string" }, { "name": "q", "type": "string" } ], "type": "InputMedia" }, { "id": "1158290442", "predicate": "messages.foundGifs", "params": [ { "name": "next_offset", "type": "int" }, { "name": "results", "type": "Vector" } ], "type": "messages.FoundGifs" }, { "id": "-402498398", "predicate": "messages.savedGifsNotModified", "params": [], "type": "messages.SavedGifs" }, { "id": "772213157", "predicate": "messages.savedGifs", "params": [ { "name": "hash", "type": "int" }, { "name": "gifs", "type": "Vector" } ], "type": "messages.SavedGifs" }, { "id": "-1821035490", "predicate": "updateSavedGifs", "params": [], "type": "Update" }, { "id": "776201607", "predicate": "inputBotInlineMessageMediaAuto", "params": [ { "name": "caption", "type": "string" } ], "type": "InputBotInlineMessage" }, { "id": "-1376723087", "predicate": "inputBotInlineMessageText", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.0?true" }, { "name": "message", "type": "string" }, { "name": "entities", "type": "flags.1?Vector" } ], "type": "InputBotInlineMessage" }, { "id": "750510426", "predicate": "inputBotInlineResult", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "string" }, { "name": "type", "type": "string" }, { "name": "title", "type": "flags.1?string" }, { "name": "description", "type": "flags.2?string" }, { "name": "url", "type": "flags.3?string" }, { "name": "thumb_url", "type": "flags.4?string" }, { "name": "content_url", "type": "flags.5?string" }, { "name": "content_type", "type": "flags.5?string" }, { "name": "w", "type": "flags.6?int" }, { "name": "h", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "send_message", "type": "InputBotInlineMessage" } ], "type": "InputBotInlineResult" }, { "id": "-61413251", "predicate": "botInlineMessageMediaAuto", "params": [ { "name": "caption", "type": "string" } ], "type": "BotInlineMessage" }, { "id": "-1520330839", "predicate": "botInlineMessageText", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.0?true" }, { "name": "message", "type": "string" }, { "name": "entities", "type": "flags.1?Vector" } ], "type": "BotInlineMessage" }, { "id": "-124267714", "predicate": "botInlineMediaResultDocument", "params": [ { "name": "id", "type": "string" }, { "name": "type", "type": "string" }, { "name": "document", "type": "Document" }, { "name": "send_message", "type": "BotInlineMessage" } ], "type": "BotInlineResult" }, { "id": "-984447609", "predicate": "botInlineMediaResultPhoto", "params": [ { "name": "id", "type": "string" }, { "name": "type", "type": "string" }, { "name": "photo", "type": "Photo" }, { "name": "send_message", "type": "BotInlineMessage" } ], "type": "BotInlineResult" }, { "id": "-1679053127", "predicate": "botInlineResult", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "string" }, { "name": "type", "type": "string" }, { "name": "title", "type": "flags.1?string" }, { "name": "description", "type": "flags.2?string" }, { "name": "url", "type": "flags.3?string" }, { "name": "thumb_url", "type": "flags.4?string" }, { "name": "content_url", "type": "flags.5?string" }, { "name": "content_type", "type": "flags.5?string" }, { "name": "w", "type": "flags.6?int" }, { "name": "h", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "send_message", "type": "BotInlineMessage" } ], "type": "BotInlineResult" }, { "id": "292597923", "predicate": "messages.botResults", "params": [ { "name": "flags", "type": "#" }, { "name": "gallery", "type": "flags.0?true" }, { "name": "query_id", "type": "long" }, { "name": "next_offset", "type": "flags.1?string" }, { "name": "results", "type": "Vector" } ], "type": "messages.BotResults" }, { "id": "-1071715832", "predicate": "updateBotInlineQuery", "params": [ { "name": "query_id", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "query", "type": "string" }, { "name": "offset", "type": "string" } ], "type": "Update" }, { "id": "258597139", "predicate": "updateBotInlineSend", "params": [ { "name": "user_id", "type": "int" }, { "name": "query", "type": "string" }, { "name": "id", "type": "string" } ], "type": "Update" } ], "methods": [ { "id": "-878758099", "method": "invokeAfterMsg", "params": [ { "name": "msg_id", "type": "long" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1036301552", "method": "invokeAfterMsgs", "params": [ { "name": "msg_ids", "type": "Vector" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1877286395", "method": "auth.checkPhone", "params": [ { "name": "phone_number", "type": "string" } ], "type": "auth.CheckedPhone" }, { "id": "1988976461", "method": "auth.sendCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "sms_type", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "auth.SentCode" }, { "id": "63247716", "method": "auth.sendCall", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "453408308", "method": "auth.signUp", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1126886015", "method": "auth.signIn", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "1461180992", "method": "auth.logOut", "params": [], "type": "Bool" }, { "id": "-1616179942", "method": "auth.resetAuthorizations", "params": [], "type": "Bool" }, { "id": "1998331287", "method": "auth.sendInvites", "params": [ { "name": "phone_numbers", "type": "Vector" }, { "name": "message", "type": "string" } ], "type": "Bool" }, { "id": "-440401971", "method": "auth.exportAuthorization", "params": [ { "name": "dc_id", "type": "int" } ], "type": "auth.ExportedAuthorization" }, { "id": "-470837741", "method": "auth.importAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-841733627", "method": "auth.bindTempAuthKey", "params": [ { "name": "perm_auth_key_id", "type": "long" }, { "name": "nonce", "type": "long" }, { "name": "expires_at", "type": "int" }, { "name": "encrypted_message", "type": "bytes" } ], "type": "Bool" }, { "id": "1147957548", "method": "account.registerDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "app_sandbox", "type": "Bool" }, { "name": "lang_code", "type": "string" } ], "type": "Bool" }, { "id": "1707432768", "method": "account.unregisterDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" } ], "type": "Bool" }, { "id": "-2067899501", "method": "account.updateNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" }, { "name": "settings", "type": "InputPeerNotifySettings" } ], "type": "Bool" }, { "id": "313765169", "method": "account.getNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" } ], "type": "PeerNotifySettings" }, { "id": "-612493497", "method": "account.resetNotifySettings", "params": [], "type": "Bool" }, { "id": "-259486360", "method": "account.updateProfile", "params": [ { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "User" }, { "id": "1713919532", "method": "account.updateStatus", "params": [ { "name": "offline", "type": "Bool" } ], "type": "Bool" }, { "id": "-1068696894", "method": "account.getWallPapers", "params": [], "type": "Vector" }, { "id": "-1374118561", "method": "account.reportPeer", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "reason", "type": "ReportReason" } ], "type": "Bool" }, { "id": "227648840", "method": "users.getUsers", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-902781519", "method": "users.getFullUser", "params": [ { "name": "id", "type": "InputUser" } ], "type": "UserFull" }, { "id": "-995929106", "method": "contacts.getStatuses", "params": [], "type": "Vector" }, { "id": "583445000", "method": "contacts.getContacts", "params": [ { "name": "hash", "type": "string" } ], "type": "contacts.Contacts" }, { "id": "-634342611", "method": "contacts.importContacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "replace", "type": "Bool" } ], "type": "contacts.ImportedContacts" }, { "id": "-847825880", "method": "contacts.getSuggested", "params": [ { "name": "limit", "type": "int" } ], "type": "contacts.Suggested" }, { "id": "-1902823612", "method": "contacts.deleteContact", "params": [ { "name": "id", "type": "InputUser" } ], "type": "contacts.Link" }, { "id": "1504393374", "method": "contacts.deleteContacts", "params": [ { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "858475004", "method": "contacts.block", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-448724803", "method": "contacts.unblock", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-176409329", "method": "contacts.getBlocked", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "contacts.Blocked" }, { "id": "-2065352905", "method": "contacts.exportCard", "params": [], "type": "Vector" }, { "id": "1340184318", "method": "contacts.importCard", "params": [ { "name": "export_card", "type": "Vector" } ], "type": "User" }, { "id": "1109588596", "method": "messages.getMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "1799878989", "method": "messages.getDialogs", "params": [ { "name": "offset_date", "type": "int" }, { "name": "offset_id", "type": "int" }, { "name": "offset_peer", "type": "InputPeer" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-1970355494", "method": "messages.getHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset_id", "type": "int" }, { "name": "add_offset", "type": "int" }, { "name": "limit", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" } ], "type": "messages.Messages" }, { "id": "-732523960", "method": "messages.search", "params": [ { "name": "flags", "type": "#" }, { "name": "important_only", "type": "flags.0?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "238054714", "method": "messages.readHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "-1212072999", "method": "messages.deleteHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-1510897371", "method": "messages.deleteMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "94983360", "method": "messages.receivedMessages", "params": [ { "name": "max_id", "type": "int" } ], "type": "Vector" }, { "id": "-1551737264", "method": "messages.setTyping", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Bool" }, { "id": "-91733382", "method": "messages.sendMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.1?true" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" }, { "name": "entities", "type": "flags.3?Vector" } ], "type": "Updates" }, { "id": "-923703407", "method": "messages.sendMedia", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "Updates" }, { "id": "1888354709", "method": "messages.forwardMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "from_peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "random_id", "type": "Vector" }, { "name": "to_peer", "type": "InputPeer" } ], "type": "Updates" }, { "id": "-820669733", "method": "messages.reportSpam", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "Bool" }, { "id": "1013621127", "method": "messages.getChats", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "998448230", "method": "messages.getFullChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "messages.ChatFull" }, { "id": "-599447467", "method": "messages.editChatTitle", "params": [ { "name": "chat_id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-900957736", "method": "messages.editChatPhoto", "params": [ { "name": "chat_id", "type": "int" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-106911223", "method": "messages.addChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "fwd_limit", "type": "int" } ], "type": "Updates" }, { "id": "-530505962", "method": "messages.deleteChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" } ], "type": "Updates" }, { "id": "164303470", "method": "messages.createChat", "params": [ { "name": "users", "type": "Vector" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-304838614", "method": "updates.getState", "params": [], "type": "updates.State" }, { "id": "168039573", "method": "updates.getDifference", "params": [ { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "qts", "type": "int" } ], "type": "updates.Difference" }, { "id": "-285902432", "method": "photos.updateProfilePhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "UserProfilePhoto" }, { "id": "-720397176", "method": "photos.uploadProfilePhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "photos.Photo" }, { "id": "-2016444625", "method": "photos.deletePhotos", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-1291540959", "method": "upload.saveFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "-475607115", "method": "upload.getFile", "params": [ { "name": "location", "type": "InputFileLocation" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "upload.File" }, { "id": "-990308245", "method": "help.getConfig", "params": [], "type": "Config" }, { "id": "531836966", "method": "help.getNearestDc", "params": [], "type": "NearestDc" }, { "id": "-938300290", "method": "help.getAppUpdate", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "1862465352", "method": "help.saveAppLog", "params": [ { "name": "events", "type": "Vector" } ], "type": "Bool" }, { "id": "-1532407418", "method": "help.getInviteText", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.InviteText" }, { "id": "-1848823128", "method": "photos.getUserPhotos", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "long" }, { "name": "limit", "type": "int" } ], "type": "photos.Photos" }, { "id": "865483769", "method": "messages.forwardMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Updates" }, { "id": "-1082919718", "method": "messages.sendBroadcast", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "random_id", "type": "Vector" }, { "name": "message", "type": "string" }, { "name": "media", "type": "InputMedia" } ], "type": "Updates" }, { "id": "651135312", "method": "messages.getDhConfig", "params": [ { "name": "version", "type": "int" }, { "name": "random_length", "type": "int" } ], "type": "messages.DhConfig" }, { "id": "-162681021", "method": "messages.requestEncryption", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "random_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "1035731989", "method": "messages.acceptEncryption", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "g_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "-304536635", "method": "messages.discardEncryption", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Bool" }, { "id": "2031374829", "method": "messages.setEncryptedTyping", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "2135648522", "method": "messages.readEncryptedHistory", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "max_date", "type": "int" } ], "type": "Bool" }, { "id": "-1451792525", "method": "messages.sendEncrypted", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1701831834", "method": "messages.sendEncryptedFile", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" }, { "name": "file", "type": "InputEncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "852769188", "method": "messages.sendEncryptedService", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "1436924774", "method": "messages.receivedQueue", "params": [ { "name": "max_qts", "type": "int" } ], "type": "Vector" }, { "id": "-562337987", "method": "upload.saveBigFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "file_total_parts", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "1769565673", "method": "initConnection", "params": [ { "name": "api_id", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-1663104819", "method": "help.getSupport", "params": [], "type": "help.Support" }, { "id": "229241832", "method": "auth.sendSms", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "916930423", "method": "messages.readMessageContents", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "655677548", "method": "account.checkUsername", "params": [ { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "1040964988", "method": "account.updateUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "301470424", "method": "contacts.search", "params": [ { "name": "q", "type": "string" }, { "name": "limit", "type": "int" } ], "type": "contacts.Found" }, { "id": "-623130288", "method": "account.getPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" } ], "type": "account.PrivacyRules" }, { "id": "-906486552", "method": "account.setPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "1099779595", "method": "account.deleteAccount", "params": [ { "name": "reason", "type": "string" } ], "type": "Bool" }, { "id": "150761757", "method": "account.getAccountTTL", "params": [], "type": "AccountDaysTTL" }, { "id": "608323678", "method": "account.setAccountTTL", "params": [ { "name": "ttl", "type": "AccountDaysTTL" } ], "type": "Bool" }, { "id": "-627372787", "method": "invokeWithLayer", "params": [ { "name": "layer", "type": "int" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-113456221", "method": "contacts.resolveUsername", "params": [ { "name": "username", "type": "string" } ], "type": "contacts.ResolvedPeer" }, { "id": "-1543001868", "method": "account.sendChangePhoneCode", "params": [ { "name": "phone_number", "type": "string" } ], "type": "account.SentChangePhoneCode" }, { "id": "1891839707", "method": "account.changePhone", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "User" }, { "id": "-1373446075", "method": "messages.getStickers", "params": [ { "name": "emoticon", "type": "string" }, { "name": "hash", "type": "string" } ], "type": "messages.Stickers" }, { "id": "479598769", "method": "messages.getAllStickers", "params": [ { "name": "hash", "type": "int" } ], "type": "messages.AllStickers" }, { "id": "954152242", "method": "account.updateDeviceLocked", "params": [ { "name": "period", "type": "int" } ], "type": "Bool" }, { "id": "1738800940", "method": "auth.importBotAuthorization", "params": [ { "name": "flags", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "bot_auth_token", "type": "string" } ], "type": "auth.Authorization" }, { "id": "623001124", "method": "messages.getWebPagePreview", "params": [ { "name": "message", "type": "string" } ], "type": "MessageMedia" }, { "id": "-484392616", "method": "account.getAuthorizations", "params": [], "type": "account.Authorizations" }, { "id": "-545786948", "method": "account.resetAuthorization", "params": [ { "name": "hash", "type": "long" } ], "type": "Bool" }, { "id": "1418342645", "method": "account.getPassword", "params": [], "type": "account.Password" }, { "id": "-1131605573", "method": "account.getPasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" } ], "type": "account.PasswordSettings" }, { "id": "-92517498", "method": "account.updatePasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" }, { "name": "new_settings", "type": "account.PasswordInputSettings" } ], "type": "Bool" }, { "id": "174260510", "method": "auth.checkPassword", "params": [ { "name": "password_hash", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-661144474", "method": "auth.requestPasswordRecovery", "params": [], "type": "auth.PasswordRecovery" }, { "id": "1319464594", "method": "auth.recoverPassword", "params": [ { "name": "code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1080796745", "method": "invokeWithoutUpdates", "params": [ { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "2106086025", "method": "messages.exportChatInvite", "params": [ { "name": "chat_id", "type": "int" } ], "type": "ExportedChatInvite" }, { "id": "1051570619", "method": "messages.checkChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "ChatInvite" }, { "id": "1817183516", "method": "messages.importChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "Updates" }, { "id": "639215886", "method": "messages.getStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "messages.StickerSet" }, { "id": "2066793382", "method": "messages.installStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" }, { "name": "disabled", "type": "Bool" } ], "type": "Bool" }, { "id": "-110209570", "method": "messages.uninstallStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "Bool" }, { "id": "-421563528", "method": "messages.startBot", "params": [ { "name": "bot", "type": "InputUser" }, { "name": "peer", "type": "InputPeer" }, { "name": "random_id", "type": "long" }, { "name": "start_param", "type": "string" } ], "type": "Updates" }, { "id": "1537966002", "method": "help.getAppChangelog", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-993483427", "method": "messages.getMessagesViews", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "increment", "type": "Bool" } ], "type": "Vector" }, { "id": "-1445735863", "method": "channels.getDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-575067701", "method": "channels.getImportantHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "offset_id", "type": "int" }, { "name": "add_offset", "type": "int" }, { "name": "limit", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" } ], "type": "messages.Messages" }, { "id": "-871347913", "method": "channels.readHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "max_id", "type": "int" } ], "type": "Bool" }, { "id": "-2067661490", "method": "channels.deleteMessages", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "-787622117", "method": "channels.deleteUserHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" } ], "type": "messages.AffectedHistory" }, { "id": "-32999408", "method": "channels.reportSpam", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "-1814580409", "method": "channels.getMessages", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "618237842", "method": "channels.getParticipants", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "filter", "type": "ChannelParticipantsFilter" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "channels.ChannelParticipants" }, { "id": "1416484774", "method": "channels.getParticipant", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" } ], "type": "channels.ChannelParticipant" }, { "id": "176122811", "method": "channels.getChannels", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "141781513", "method": "channels.getFullChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "messages.ChatFull" }, { "id": "-192332417", "method": "channels.createChannel", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.0?true" }, { "name": "megagroup", "type": "flags.1?true" }, { "name": "title", "type": "string" }, { "name": "about", "type": "string" } ], "type": "Updates" }, { "id": "333610782", "method": "channels.editAbout", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "about", "type": "string" } ], "type": "Bool" }, { "id": "-344583728", "method": "channels.editAdmin", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "role", "type": "ChannelParticipantRole" } ], "type": "Updates" }, { "id": "1450044624", "method": "channels.editTitle", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-248621111", "method": "channels.editPhoto", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-1432183160", "method": "channels.toggleComments", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "283557164", "method": "channels.checkUsername", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "890549214", "method": "channels.updateUsername", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "615851205", "method": "channels.joinChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "-130635115", "method": "channels.leaveChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "429865580", "method": "channels.inviteToChannel", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "users", "type": "Vector" } ], "type": "Updates" }, { "id": "-1502421484", "method": "channels.kickFromChannel", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "kicked", "type": "Bool" } ], "type": "Updates" }, { "id": "-950663035", "method": "channels.exportInvite", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "ExportedChatInvite" }, { "id": "-1072619549", "method": "channels.deleteChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "-1154295872", "method": "updates.getChannelDifference", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "filter", "type": "ChannelMessagesFilter" }, { "name": "pts", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "updates.ChannelDifference" }, { "id": "-326379039", "method": "messages.toggleChatAdmins", "params": [ { "name": "chat_id", "type": "int" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "-1444503762", "method": "messages.editChatAdmin", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "is_admin", "type": "Bool" } ], "type": "Bool" }, { "id": "363051235", "method": "messages.migrateChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Updates" }, { "id": "-1640190800", "method": "messages.searchGlobal", "params": [ { "name": "q", "type": "string" }, { "name": "offset_date", "type": "int" }, { "name": "offset_peer", "type": "InputPeer" }, { "name": "offset_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "936873859", "method": "help.getTermsOfService", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.TermsOfService" }, { "id": "-1613775824", "method": "messages.reorderStickerSets", "params": [ { "name": "order", "type": "Vector" } ], "type": "Bool" }, { "id": "864953444", "method": "messages.getDocumentByHash", "params": [ { "name": "sha256", "type": "bytes" }, { "name": "size", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "Document" }, { "id": "-1080395925", "method": "messages.searchGifs", "params": [ { "name": "q", "type": "string" }, { "name": "offset", "type": "int" } ], "type": "messages.FoundGifs" }, { "id": "-2084618926", "method": "messages.getSavedGifs", "params": [ { "name": "hash", "type": "int" } ], "type": "messages.SavedGifs" }, { "id": "846868683", "method": "messages.saveGif", "params": [ { "name": "id", "type": "InputDocument" }, { "name": "unsave", "type": "Bool" } ], "type": "Bool" }, { "id": "-1826332659", "method": "messages.getInlineBotResults", "params": [ { "name": "bot", "type": "InputUser" }, { "name": "query", "type": "string" }, { "name": "offset", "type": "string" } ], "type": "messages.BotResults" }, { "id": "1059318802", "method": "messages.setInlineBotResults", "params": [ { "name": "flags", "type": "#" }, { "name": "gallery", "type": "flags.0?true" }, { "name": "private", "type": "flags.1?true" }, { "name": "query_id", "type": "long" }, { "name": "results", "type": "Vector" }, { "name": "cache_time", "type": "int" }, { "name": "next_offset", "type": "flags.2?string" } ], "type": "Bool" }, { "id": "-1318189314", "method": "messages.sendInlineBotResult", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "random_id", "type": "long" }, { "name": "query_id", "type": "long" }, { "name": "id", "type": "string" } ], "type": "Updates" } ] }---types--- ipPort#d433ad73 ipv4:int port:int = IpPort; ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort; accessPointRule#4679b65f phone_prefix_rules:string dc_id:int ips:vector = AccessPointRule; help.configSimple#5a592a6c date:int expires:int rules:vector = help.ConfigSimple; boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaPhoto#b3ba0635 flags:# id:InputPhoto ttl_seconds:flags.0?int = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaDocument#23ab23d2 flags:# id:InputDocument ttl_seconds:flags.0?int = InputMedia; inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = InputMedia; inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia; inputMediaGeoLive#7b1a118f geo_point:InputGeoPoint period:int = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#fb95c6c4 id:long access_hash:long = InputPhoto; inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#430f0724 id:long access_hash:long version:int = InputFileLocation; inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation; inputTakeoutFileLocation#29be5899 = InputFileLocation; inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation; userEmpty#200250ba id:int = User; user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#c88974ac flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights participants_count:flags.17?int = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; channelFull#76af5481 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#44f9b43d flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#9cb070d7 flags:# document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia; messageMediaGeoLive#7c3c2609 geo:GeoPoint period:int = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction; messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; messageActionScreenshotTaken#4792929b = MessageAction; messageActionCustomAction#fae69f56 message:string = MessageAction; messageActionBotAllowed#abe9affe domain:string = MessageAction; messageActionSecureValuesSentMe#1b287353 values:Vector credentials:SecureCredentialsEncrypted = MessageAction; messageActionSecureValuesSent#d95c6154 types:Vector = MessageAction; dialog#e4def5db flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#2049d70c long:double lat:double = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#38faab5f flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int terms_of_service:flags.3?help.TermsOfService = auth.SentCode; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputPeerNotifySettings#9c3d198e flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = InputPeerNotifySettings; peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = PeerNotifySettings; peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; userFull#f220f3f flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#eae87e42 contacts:Vector saved_count:int users:Vector = contacts.Contacts; contacts.importedContacts#77d01c3b imported:Vector popular_invites:Vector retry_contacts:Vector users:Vector = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector users:Vector = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector users:Vector = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#99262e37 flags:# pts:int count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesNotModified#74535f21 count:int = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; messages.chatsSlice#9cd81144 count:int chats:Vector = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector users:Vector = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter; inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter; inputMessagesFilterGeo#e7026d0d = MessagesFilter; inputMessagesFilterContacts#e062db83 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updateDialogPinned#19d27f3c flags:# pinned:flags.0?true peer:DialogPeer = Update; updatePinnedDialogs#ea4cb65b flags:# order:flags.0?Vector = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updateLangPackTooLong#10c2404b = Update; updateLangPack#56022f4d difference:LangPackDifference = Update; updateFavedStickers#e511996d = Update; updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector = Update; updateContactsReset#7084a7be = Update; updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector intermediate_state:updates.State = updates.Difference; updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector = upload.File; dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption; config#eb7bb160 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string suggested_lang_code:flags.2?string lang_pack_version:flags.2?int = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#8987f311 id:int critical:Bool url:string text:string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#18798952 id:long access_hash:long = InputDocument; documentEmpty#36f8c871 id:long = Document; document#87232bc7 id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int version:int attributes:Vector = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; sendMessageRecordRoundAction#88f27fbc = SendMessageAction; sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; contacts.found#b3134d9d my_results:Vector results:Vector chats:Vector users:Vector = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector = PrivacyRule; account.privacyRules#554abb6f rules:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true supports_streaming:flags.1?true duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#e4599bbd hash:int stickers:Vector = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector = messages.AllStickers; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector = account.Authorizations; account.noPassword#5ea182f6 new_salt:bytes new_secure_salt:bytes secure_random:bytes email_unconfirmed_pattern:string = account.Password; account.password#ca39b447 flags:# has_recovery:flags.0?true has_secure_values:flags.1?true current_salt:bytes new_salt:bytes new_secure_salt:bytes secure_random:bytes hint:string email_unconfirmed_pattern:string = account.Password; account.passwordSettings#7bd9c3f1 email:string secure_salt:bytes secure_secret:bytes secure_secret_id:long = account.PasswordSettings; account.passwordInputSettings#21ffa60d flags:# new_salt:flags.0?bytes new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string new_secure_salt:flags.2?bytes new_secure_secret:flags.2?bytes new_secure_secret_id:flags.2?long = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#5585a139 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#98e81d3a user_id:int description:string commands:Vector = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector = ReplyMarkup; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; messageEntityPhone#9b69e34b offset:int length:int = MessageEntity; messageEntityCashtag#4c4e743f offset:int length:int = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector users:Vector = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#6a9d7b35 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int messages:Vector chats:Vector users:Vector = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector other_updates:Vector chats:Vector users:Vector = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantAdmin#a82fa898 flags:# can_edit:flags.0?true user_id:int inviter_id:int promoted_by:int date:int admin_rights:ChannelAdminRights = ChannelParticipant; channelParticipantBanned#222c1886 flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChannelBannedRights = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter; channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter; channels.channelParticipants#f56ee2a8 count:int participants:Vector users:Vector = channels.ChannelParticipants; channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector = channels.ChannelParticipant; help.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector min_age_confirm:flags.1?int = help.wTermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector = messages.SavedGifs; inputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#c1b15d65 flags:# geo_point:InputGeoPoint period:int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#2daf01a7 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#b722de65 flags:# geo:GeoPoint period:int reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector cache_time:int users:Vector = messages.BotResults; exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink; messageFwdHeader#559ebe6d flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; messages.peerDialogs#3371c354 dialogs:Vector messages:Vector chats:Vector users:Vector state:updates.State = messages.PeerDialogs; topPeer#edcdc05b peer:Peer rating:double = TopPeer; topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; topPeerCategoryBotsInline#148677e2 = TopPeerCategory; topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector chats:Vector users:Vector = contacts.TopPeers; draftMessageEmpty#ba4baec5 = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; messages.featuredStickers#f89d88e5 hash:int sets:Vector unread:Vector = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#22f3afb3 hash:int packs:Vector stickers:Vector dates:Vector = messages.RecentStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector = messages.ArchivedStickers; messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector = messages.StickerSetInstallResult; stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector users:Vector = messages.HighScores; textEmpty#dc3d824f = RichText; textPlain#744694e0 text:string = RichText; textBold#6724abc4 text:RichText = RichText; textItalic#d912a59c text:RichText = RichText; textUnderline#c12622c4 text:RichText = RichText; textStrike#9bf8bb95 text:RichText = RichText; textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; pageBlockHeader#bfd064ec text:RichText = PageBlock; pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; pageBlockParagraph#467a0766 text:RichText = PageBlock; pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; pageBlockList#3a58c7f4 ordered:Bool items:Vector = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; pageBlockVideo#d9d71866 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:RichText = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; pageBlockEmbed#cde200d1 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:int h:int caption:RichText = PageBlock; pageBlockEmbedPost#292c7be9 url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:RichText = PageBlock; pageBlockCollage#8b31c4f items:Vector caption:RichText = PageBlock; pageBlockSlideshow#130c8963 items:Vector caption:RichText = PageBlock; pageBlockChannel#ef1751b5 channel:Chat = PageBlock; pageBlockAudio#31b81a7f audio_id:long caption:RichText = PageBlock; pagePart#8e3f9ebe blocks:Vector photos:Vector documents:Vector = Page; pageFull#556ec7aa blocks:Vector photos:Vector documents:Vector = Page; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; webDocument#c61acbd8 url:string access_hash:long size:int mime_type:string attributes:Vector dc_id:int = WebDocument; webDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector = payments.PaymentReceipt; payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsAndroidPay#ca05d50e payment_token:DataJSON google_transaction_id:string = InputPaymentCredentials; account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; shippingOption#b6213cdf id:string title:string prices:Vector = ShippingOption; inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCall#ffe6ab67 id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector = phone.PhoneCall; upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey; cdnConfig#5725e40a public_keys:Vector = CdnConfig; langPackString#cad181f6 key:string value:string = LangPackString; langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString; langPackStringDeleted#2979eeb2 key:string = LangPackString; langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector = LangPackDifference; langPackLanguage#117698f1 name:string native_name:string lang_code:string = LangPackLanguage; channelAdminRights#5d7ceba5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true invite_link:flags.6?true pin_messages:flags.7?true add_admins:flags.9?true manage_call:flags.10?true = ChannelAdminRights; channelBannedRights#58cf4249 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true until_date:int = ChannelBannedRights; channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangePhoto#b82f55c3 prev_photo:ChatPhoto new_photo:ChatPhoto = ChannelAdminLogEventAction; channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers; messages.favedStickers#f37f2f16 hash:int packs:Vector stickers:Vector = messages.FavedStickers; recentMeUrlUnknown#46e1d13d url:string = RecentMeUrl; recentMeUrlUser#8dbc3336 url:string user_id:int = RecentMeUrl; recentMeUrlChat#a01b22f9 url:string chat_id:int = RecentMeUrl; recentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl; recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl; help.recentMeUrls#e0310d7 urls:Vector chats:Vector users:Vector = help.RecentMeUrls; inputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector = InputSingleMedia; webAuthorization#cac943f2 hash:long bot_id:int domain:string browser:string platform:string date_created:int date_active:int ip:string region:string = WebAuthorization; account.webAuthorizations#ed56c9fc authorizations:Vector users:Vector = account.WebAuthorizations; inputMessageID#a676a322 id:int = InputMessage; inputMessageReplyTo#bad88395 id:int = InputMessage; inputMessagePinned#86872538 = InputMessage; inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer; dialogPeer#e56dbf05 peer:Peer = DialogPeer; messages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets; messages.foundStickerSets#5108d648 hash:int sets:Vector = messages.FoundStickerSets; fileHash#6242c773 offset:int limit:int hash:bytes = FileHash; inputClientProxy#75588b3f address:string port:int = InputClientProxy; help.proxyDataEmpty#e09e1fb8 expires:int = help.ProxyData; help.proxyDataPromo#2bf7ee23 expires:int peer:Peer chats:Vector users:Vector = help.ProxyData; help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate; help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate; inputSecureFileUploaded#3334b0f0 id:long parts:int md5_checksum:string file_hash:bytes secret:bytes = InputSecureFile; inputSecureFile#5367e5be id:long access_hash:long = InputSecureFile; secureFileEmpty#64199744 = SecureFile; secureFile#e0277a62 id:long access_hash:long size:int dc_id:int date:int file_hash:bytes secret:bytes = SecureFile; secureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData; securePlainPhone#7d6099dd phone:string = SecurePlainData; securePlainEmail#21ec5a5f email:string = SecurePlainData; secureValueTypePersonalDetails#9d2a81e3 = SecureValueType; secureValueTypePassport#3dac6a00 = SecureValueType; secureValueTypeDriverLicense#6e425c4 = SecureValueType; secureValueTypeIdentityCard#a0d0744b = SecureValueType; secureValueTypeInternalPassport#99a48f23 = SecureValueType; secureValueTypeAddress#cbe31e26 = SecureValueType; secureValueTypeUtilityBill#fc36954e = SecureValueType; secureValueTypeBankStatement#89137c0d = SecureValueType; secureValueTypeRentalAgreement#8b883488 = SecureValueType; secureValueTypePassportRegistration#99e3806a = SecureValueType; secureValueTypeTemporaryRegistration#ea02ec33 = SecureValueType; secureValueTypePhone#b320aadb = SecureValueType; secureValueTypeEmail#8e3ca7ee = SecureValueType; secureValue#b4b4b699 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile files:flags.4?Vector plain_data:flags.5?SecurePlainData hash:bytes = SecureValue; inputSecureValue#67872e8 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?InputSecureFile reverse_side:flags.2?InputSecureFile selfie:flags.3?InputSecureFile files:flags.4?Vector plain_data:flags.5?SecurePlainData = InputSecureValue; secureValueHash#ed1ecdb0 type:SecureValueType hash:bytes = SecureValueHash; secureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError; secureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector text:string = SecureValueError; secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted; account.authorizationForm#cb976d53 flags:# selfie_required:flags.1?true required_types:Vector values:Vector errors:Vector users:Vector privacy_policy_url:flags.0?string = account.AuthorizationForm; account.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode; help.deepLinkInfoEmpty#66afa166 = help.DeepLinkInfo; help.deepLinkInfo#6a4ee832 flags:# update_app:flags.0?true message:string entities:flags.1?Vector = help.DeepLinkInfo; savedPhoneContact#1142bd56 phone:string first_name:string last_name:string date:int = SavedContact; account.takeout#4dba4501 id:long = account.Takeout; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X; initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X; invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X; auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector = Bool; account.registerDevice#5cbea590 token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector = Bool; account.unregisterDevice#3076c4bf token_type:int token:string other_uids:Vector = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; account.getTmpPassword#4a82327e password_hash:bytes period:int = account.TmpPassword; account.getWebAuthorizations#182e6d6f = account.WebAuthorizations; account.resetWebAuthorization#2d01b9ef hash:long = Bool; account.resetWebAuthorizations#682d2594 = Bool; account.getAllSecureValues#b288bc7d = Vector; account.getSecureValue#73665bc2 types:Vector = Vector; account.saveSecureValue#899fe31d value:InputSecureValue secure_secret_id:long = SecureValue; account.deleteSecureValue#b880bc4b types:Vector = Bool; account.getAuthorizationForm#b86ba8e1 bot_id:int scope:string public_key:string = account.AuthorizationForm; account.acceptAuthorization#e7027c94 bot_id:int scope:string public_key:string value_hashes:Vector credentials:SecureCredentialsEncrypted = Bool; account.sendVerifyPhoneCode#823380b4 flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool; account.sendVerifyEmailCode#7011509f email:string = account.SentEmailCode; account.verifyEmail#ecba39db email:string code:string = Bool; account.initTakeoutSession#f05b4804 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?int = account.Takeout; account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector = Bool; contacts.getStatuses#c4a353ee = Vector; contacts.getContacts#c023849f hash:int = contacts.Contacts; contacts.importContacts#2c800be5 contacts:Vector = contacts.ImportedContacts; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector; contacts.importCard#4fe196fe export_card:Vector = User; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; contacts.resetSaved#879537f1 = Bool; contacts.getSaved#82f1e39f = Vector; messages.getMessages#63c66506 id:Vector = messages.Messages; messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs; messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.search#8614ef68 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.sendMedia#b8d1262b flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true grouped:flags.9?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.report#bd82b658 peer:InputPeer id:Vector reason:ReportReason = Bool; messages.getChats#3c6aa187 id:Vector = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector title:string = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; messages.getStickers#43d4f2c emoticon:string hash:int = messages.Stickers; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#8b68b0cc flags:# message:string entities:flags.3?Vector = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#c000e4c8 flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector geo_point:flags.13?InputGeoPoint = Updates; messages.editInlineBotMessage#adc3e828 flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector geo_point:flags.13?InputGeoPoint = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#e470bcfd peers:Vector = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector = Bool; messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; messages.reorderPinnedDialogs#5b51d63f flags:# force:flags.0?true order:Vector = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia; messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates; messages.getFavedStickers#21ce0b0e hash:int = messages.FavedStickers; messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool; messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory; messages.getRecentLocations#bbc45b09 peer:InputPeer limit:int hash:int = messages.Messages; messages.sendMultiMedia#2095512f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; messages.searchStickerSets#c2b7d08b flags:# exclude_featured:flags.0?true q:string hash:int = messages.FoundStickerSets; messages.getSplitRanges#1cff7e08 = Vector; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector = Vector; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; upload.reuploadCdnFile#9b2754a8 file_token:bytes request_token:bytes = Vector; upload.getCdnFileHashes#4da54231 file_token:bytes offset:int = Vector; upload.getFileHashes#c7025931 location:InputFileLocation offset:int = Vector; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#ae2de196 = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector = Bool; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#9010ef6f prev_app_version:string = Updates; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls; help.getProxyData#3d7758e1 = help.ProxyData; help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate; help.acceptTermsOfService#ee72f79a id:DataJSON = Bool; help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector = Bool; channels.getMessages#ad8c9a23 channel:InputChannel id:Vector = messages.Messages; channels.getParticipants#123e05e9 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#20b88214 channel:InputChannel user_id:InputUser admin_rights:ChannelAdminRights = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; channels.exportMessageLink#ceb77163 channel:InputChannel id:int grouped:Bool = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; channels.editBanned#bfd915cd channel:InputChannel user_id:InputUser banned_rights:ChannelBannedRights = Updates; channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector max_id:long min_id:long limit:int = channels.AdminLogResults; channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool; channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector = Bool; channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool; channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates; channels.getLeftChannels#8341ecc0 offset:int = messages.Chats; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm; payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt; payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult; payments.getSavedInfo#227d824b = payments.SavedInfo; payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet; stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; phone.getCallConfig#55451fa9 = DataJSON; phone.requestCall#5b95b3d4 user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = Updates; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; langpack.getLangPack#9ab5c58e lang_code:string = LangPackDifference; langpack.getStrings#2e1ee318 lang_code:string keys:Vector = Vector; langpack.getDifference#b2e4d7d from_version:int = LangPackDifference; langpack.getLanguages#800fd57d = Vector; // LAYER 81 . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; /** * Manages serialization of the MadelineProto instance. */ class Absolute { public static function absolute($file) { if (($file[0] !== '/') && ($file[1] !== ':') && !in_array(substr($file, 0, 4), ['phar', 'http'])) { $file = getcwd().'/'.$file; } return $file; } } //@description Object of this type may be returned on every function call in case of the error //@code Error code, maybe changed in the future. If code == 406, error message should not be processed in any way and shouldn't be showed to the user //@message Error message, may be changed in the future error code:int message:string = Error; //@description Object of this type returns on successful function call for some functions ok = Ok; //@class AuthCodeType @description Provides information about the way an authentication code is delivered to the user //@description Code is delivered through private Telegram message, which can be viewed in the other client @length Length of the code authCodeTypeMessage length:int = AuthCodeType; //@description Code is delivered by SMS to the specified phone number @length Length of the code authCodeTypeSms length:int = AuthCodeType; //@description Code is delivered by phone call to the specified phone number @length Length of the code authCodeTypeCall length:int = AuthCodeType; //@description Code is delivered by the immediately cancelled call to the specified phone number. Number from which the call was done is the code @pattern Pattern of the phone number from which the call will be done authCodeTypeFlashCall pattern:string = AuthCodeType; //@class AuthState @description Represents current authorization state of the Client //@description TDLib needs user's phone number to authorize authStateWaitPhoneNumber = AuthState; //@description TDLib needs user authentication code to finish authorization @is_registered True, if user is already registered @code_type Describes the way, code was sent to the user @next_code_type Describes the way, next code will be sent to the user, nullable @timeout Timeout in seconds before code should be resent by calling resendAuthCode authStateWaitCode is_registered:Bool code_type:AuthCodeType next_code_type:AuthCodeType timeout:int = AuthState; //@description User is authorized but he needs to enter its password to begin to use application @password_hint Hint on password, can be empty @has_recovery_email Is recovery email set up //@recovery_email_pattern Pattern of email to which recovery mail was sent, empty before recovery email was sent authStateWaitPassword password_hint:string has_recovery_email:Bool recovery_email_pattern:string = AuthState; //@description User is successfully authorized. TDLib can answer queries authStateOk = AuthState; //@description User is currently logging out authStateLoggingOut = AuthState; //@description Represents current state of the two-step verification @has_password Is password set up @password_hint Hint on password, can be empty @has_recovery_email Is recovery email set up @unconfirmed_recovery_email_pattern Pattern of email to which confirmation mail was sent passwordState has_password:Bool password_hint:string has_recovery_email:Bool unconfirmed_recovery_email_pattern:string = PasswordState; //@description Contains information available to the user after requesting password recovery @recovery_email_pattern Pattern of email to which recovery mail was sent passwordRecoveryInfo recovery_email_pattern:string = PasswordRecoveryInfo; //@description Contains information about set up recovery email @recovery_email Recovery email recoveryEmail recovery_email:string = RecoveryEmail; //@description Returns information about availability of temporary password, which should be used for payments @has_password True, if we have temporary password @valid_for Time left before temporary password expires, seconds temporaryPasswordState has_password:Bool valid_for:int = TemporaryPasswordState; //@description Represents a file //@id Unique file identifier //@persistent_id Persistent file identifier, if exists. Can be used across application restarts or even other devices for current logged user. If begins with "http://" or "https://", it is HTTP URL of the file. Currently, TDLib is unable to download files if only they URL is known.-If downloadFile is called on a such file or it is sended to a secret chat TDLib starts file generation process by sending to the client updateFileGenerationStart with HTTP URL in the original_path and "#url#" as conversion string. Client supposed to generate the file by downloading it to the specified location //@size File size, 0 if unknown //@is_being_downloaded True, if the file is currently being downloaded //@local_size Size of locally available part of the file. If size != 0 && local_size == size, full file is available locally //@is_being_uploaded True, if the file is currently being uploaded //@remote_size Size of remotely available part of the file. If size != 0 && remote_size == size, the file is available remotely //@path Local path to the available file part, may be empty file id:int persistent_id:string size:int is_being_downloaded:Bool local_size:int is_being_uploaded:Bool remote_size:int path:string = File; //@class InputFile @description Points to some file //@description File defined by its id @id Unique file identifier inputFileId id:int = InputFile; //@description File defined by its persistent id @persistent_id Persistent file identifier inputFilePersistentId persistent_id:string = InputFile; //@description File deifned by local path @path Local path to the file inputFileLocal path:string = InputFile; //@description File generated by the client @original_path Local path to a file from which the file is generated, may be empty if there is no such file @conversion String specifying conversion applied to the original file, should be persistent across application restart @expected_size Expected size of the generated file, 0 if unknown inputFileGenerated original_path:string conversion:string expected_size:int = InputFile; //@description Photo description @type Thumbnail type (see https://core.telegram.org/constructor/photoSize) @photo Information about photo file @width Photo width @height Photo height photoSize type:string photo:file width:int height:int = PhotoSize; //@description Position on a photo where a mask should be placed @point Part of a face relative to which the mask should be placed. 0 - forehead, 1 - eyes, 2 - mouth, 3 - chin //@x_shift Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position //@y_shift Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position. //@scale Mask scaling coefficient. For example, 2.0 means double size maskPosition point:int x_shift:double y_shift:double scale:double = MaskPosition; //@description Represent part of the text which needs to be formatted in some unusual way @offset Offset of the entity in UTF-16 code points @length Length of the entity in UTF-16 code points @type Type of the entity textEntity offset:int length:int type:TextEntityType = TextEntity; //@description Describes animation file. Animation should be encoded in gif or mp4 format @duration Duration of the animation in seconds as defined by sender @width Width of the animation @height Height of the animation //@file_name Original name of a file as defined by sender @mime_type MIME type of a file, usually "image/gif" or "video/mp4" @thumb Animation thumb, nullable @animation File with the animation animation duration:int width:int height:int file_name:string mime_type:string thumb:photoSize animation:file = Animation; //@description Describes audio file. Audio is usually in mp3 format @duration Duration of the audio in seconds as defined by sender @title Title of the audio as defined by sender @performer Performer of the audio as defined by sender //@file_name Original name of a file as defined by sender @mime_type MIME type of a file as defined by sender @album_cover_thumb Thumb of the album's cover as defined by sender. Full size thumb should be extracted from the downloaded file, nullable @audio File with the audio audio duration:int title:string performer:string file_name:string mime_type:string album_cover_thumb:photoSize audio:file = Audio; //@description Describes document of any type @file_name Original name of a file as defined by sender @mime_type MIME type of file as defined by sender //@thumb Document thumb as defined by sender, nullable @document File with document document file_name:string mime_type:string thumb:photoSize document:file = Document; //@description Describes photo @id Photo identifier, 0 for deleted photo @has_stickers True, if some stickers was added to the photo @sizes Available variants of photo of different sizes photo id:int64 has_stickers:Bool sizes:vector = Photo; //@description Describes sticker @set_id Identifier of sticker set to which the sticker belongs or 0 if none @width Sticker width as defined by sender @height Sticker height as defined by sender //@emoji Emoji corresponding to the sticker @is_mask True, if the sticker is a mask @mask_position Position where the mask should be placed, nullable @thumb Sticker thumb in webp or jpeg format, nullable @sticker File with sticker sticker set_id:int64 width:int height:int emoji:string is_mask:Bool mask_position:maskPosition thumb:photoSize sticker:file = Sticker; //@description Describes video file @duration Duration of the video in seconds as defined by sender @width Video width as defined by sender @height Video height as defined by sender //@file_name Original name of a file as defined by sender @mime_type MIME type of a file as defined by sender @has_stickers True, if some stickers was added to the photo @thumb Video thumb as defined by sender, nullable @video File with the video video duration:int width:int height:int file_name:string mime_type:string has_stickers:Bool thumb:photoSize video:file = Video; //@description Describes video note. Video must have equal width and height, cropped to circle and stored in mpeg4 format @duration Duration of the video in seconds as defined by sender @length Video width and height as defined by sender @thumb Video thumb as defined by sender, nullable @video File with the video videoNote duration:int length:int thumb:photoSize video:file = VideoNote; //@description Describes voice note. Voice must be encoded with Opus codec and must be stored inside Ogg container @duration Duration of the voice record in seconds as defined by sender //@waveform Waveform representation of the voice in 5-bit format @mime_type MIME type of a file as defined by sender @voice File with the voice record voice duration:int waveform:bytes mime_type:string voice:file = Voice; //@description Describes user contact @phone_number User's phone number @first_name User first name, 1-255 characters @last_name User last name @user_id User identifier if known, 0 otherwise contact phone_number:string first_name:string last_name:string user_id:int = Contact; //@description Describes location on Earth @latitude Latitude of location in degrees as defined by sender @longitude Longitude of location in degrees as defined by sender location latitude:double longitude:double = Location; //@description Describes venue @location Venue location as defined by sender @title Venue name as defined by sender @address Venue address as defined by sender @provider Provider of venue database as defined by sender. Only "foursquare" need to be supported currently //@id Identifier of the venue in provider database as defined by sender venue location:location title:string address:string provider:string id:string = Venue; //@description Describes a game @id Game id @short_name Game short name, to share a game use a URL https://t.me/{bot_username}?game={game_short_name} @title Game title @text Game text, usually containing game scoreboards //@text_entities Entities contained in the text @param_description Game description @photo Game photo @animation Game animation, nullable game id:int64 short_name:string title:string text:string text_entities:vector description:string photo:photo animation:animation = Game; //@description Describes user profile photo @id Photo identifier, 0 for empty photo. Can be used to find photo in list of userProfilePhotos //@small Small (160x160) user profile photo @big Big (640x640) user profile photo profilePhoto id:int64 small:file big:file = ProfilePhoto; //@description Describes chat photo @small Small (160x160) chat photo @big Big (640x640) chat photo chatPhoto small:file big:file = ChatPhoto; //@class LinkState @description Represents ordered relationship between two users //@description Other user's phone number doesn't known linkStateNone = LinkState; //@description Other user's phone number is known but user not in contacts list linkStateKnowsPhoneNumber = LinkState; //@description Other user is in contacts list, particularly its phone number is known linkStateContact = LinkState; //@class UserType @description Allows to distinguish different kinds of users: general users, deleted users and bots //@description General user userTypeGeneral = UserType; //@description Deleted user or deleted bot. There is no any information about it except user_id. None of active action can be performed with deleted user userTypeDeleted = UserType; //@description Bot (see https://core.telegram.org/bots) @can_join_group_chats If true, bot can be invited to group and supergroup chats //@can_read_all_group_chat_messages If true, bot can read all group or supergroup chat messages, not only addressed to him. In private chats bot always can read all messages //@is_inline True, if bot supports inline queries @inline_query_placeholder Placeholder for inline query @need_location If true, user location should be sent with every inline query to this bot userTypeBot can_join_group_chats:Bool can_read_all_group_chat_messages:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool = UserType; //@description Currently there is no any information about the user except user_id. It can happens very-very rarely. None of active action can be performed with unknown user userTypeUnknown = UserType; //@description Represents command supported by bot @command Text of the bot command @param_description Description of the bot command botCommand command:string description:string = BotCommand; //@description Provides information about bot and command supported by him @param_description Big description shown in user info page @commands List of commands cupported by bot botInfo description:string commands:vector = BotInfo; //@description Represents user @id User identifier @first_name User first name @last_name User last name @username User username //@phone_number User's phone number @status User's online status @profile_photo User profile photo, nullable //@my_link Relationships from me to other user @foreign_link Relationships from other user to me @is_verified True, if user is verified @restriction_reason If non-empty, contains the reason, why access to this user must be restricted. Format of the string is "{type}: {description}". -{type} contains type of the restriction and at least one of the suffixes "-all", "-ios", "-android", "-wp", which describes platforms on which access should be restricted. For example, "terms-ios-android". {description} contains human-readable description of the restriction, which can be showed to the user //@have_access If false, the user is inaccessible and the only known information about it is inside this class. It can't be passed to any method except GetUser. Currently it can be false only for inaccessible authors of the channel posts @type Type of the user @language_code Bots only. IETF language tag of users language user id:int first_name:string last_name:string username:string phone_number:string status:UserStatus profile_photo:profilePhoto my_link:LinkState foreign_link:LinkState is_verified:Bool restriction_reason:string have_access:Bool type:UserType language_code:string = User; //@description Gives full information about a user (except full list of profile photos) @is_blocked Is user blacklisted by the current user @can_be_called True, if the user can be called @has_private_calls True, if the user can't be called only because of his privacy settings //@about Short user bio or bot share text @common_chat_count Number of common chats between the user and current user, 0 for the current user @bot_info Information about bot if user is a bot, nullable userFull is_blocked:Bool can_be_called:Bool has_private_calls:Bool about:string common_chat_count:int bot_info:botInfo = UserFull; //@description Contains part of the list of user photos @total_count Total number of user profile photos @photos List of photos userProfilePhotos total_count:int photos:vector = UserProfilePhotos; //@description Represents list of users @total_count Approximate total count of found users @user_ids List of user identifiers users total_count:int user_ids:vector = Users; //@class ChatMemberStatus @description Provides information about status of a member in the chat //@description User is creator of the chat which has all administrator priviledges chatMemberStatusCreator = ChatMemberStatus; //@description User is a chat member with some additional priviledges. In groups, administrators can edit and delete other messages, add new members and ban unpriviledged members //@can_be_edited True, if current user has rights to edit administrator privileges of that user //@can_change_info True, if the administrator can change chat title, photo and other settings //@can_post_messages True, if the administrator can create channel posts, broadcast channels only //@can_edit_messages True, if the administrator can edit messages of other users, broadcast channels only //@can_delete_messages True, if the administrator can delete messages of other users //@can_invite_users True, if the administrator can invite new users to the chat //@can_restrict_members True, if the administrator can restrict, ban or unban chat members //@can_pin_messages True, if the administrator can pin messages, supergroup channels only //@can_promote_members True, if the administrator can add new administrators with a subset of his own privileges or demote administrators directly or indirectly promoted by him chatMemberStatusAdministrator can_be_edited:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_promote_members:Bool = ChatMemberStatus; //@description User is a member of the chat, but have no any additional privileges or restrictions chatMemberStatusMember = ChatMemberStatus; //@description User has some additional restrictions in the chat. Unsupported in group chats and broadcast channels //@is_member True, if user is chat member //@restricted_until_date Date when the user will be unrestricted, 0 if never. Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time it considered to be restricted forever //@can_send_messages True, if the user can send text messages, contacts, locations and venues //@can_send_media_messages True, if the user can send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages //@can_send_other_messages True, if the user can send animations, games, stickers and use inline bots, implies can_send_media_messages //@can_add_web_page_previews True, if user may add web page preview to his messages, implies can_send_messages chatMemberStatusRestricted is_member:Bool restricted_until_date:int can_send_messages:Bool can_send_media_messages:Bool can_send_other_messages:Bool can_add_web_page_previews:Bool = ChatMemberStatus; //@description User is not a chat member chatMemberStatusLeft = ChatMemberStatus; //@description User was banned (and obviously is not a chat member) and can't return to the chat or view messages //@banned_until_date Date when the user will be unbanned, 0 if never. Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time it considered to be banned forever chatMemberStatusBanned banned_until_date:int = ChatMemberStatus; //@description User with information about its chat joining/leaving @user_id User identifier of the chat member @inviter_user_id Identifier of a user invited/promoted/banned this member in the chat, 0 if unknown //@join_date Date the user has joined a chat, unix time @status Status of the member in the chat @bot_info Information about bot if user is a bot, nullable. Can be null even for bot if bot is not a chat member chatMember user_id:int inviter_user_id:int join_date:int status:ChatMemberStatus bot_info:botInfo = ChatMember; //@description Contains list of chat members @total_count Approximate total count of found chat members @members List of members chatMembers total_count:int members:vector = ChatMembers; //@class ChannelMembersFilter @description Specifies kind of chat users to return in getChannelMembers //@description Return recently active users in reverse chronological order channelMembersFilterRecent = ChannelMembersFilter; //@description Return creator and administrators channelMembersFilterAdministrators = ChannelMembersFilter; //@description Searches for channel members using specified query @query Query to search for channelMembersFilterSearch query:string = ChannelMembersFilter; //@description Return restricted channel members, administrators only @query Query to search for channelMembersFilterRestricted query:string = ChannelMembersFilter; //@description Return banned from the channel users, administrators only @query Query to search for channelMembersFilterBanned query:string = ChannelMembersFilter; //@description Return bot members of the channel channelMembersFilterBots = ChannelMembersFilter; //@description Represents a group of zero or more other users @id Group identifier //@member_count Group member count //@status Status of the current user in the group //@everyone_is_administrator True, if all members granted administrator rights in the group //@is_active True, if group is active //@migrated_to_channel_id Identifier of channel (supergroup) to which this group was migrated or 0 if none group id:int member_count:int status:ChatMemberStatus everyone_is_administrator:Bool is_active:Bool migrated_to_channel_id:int = Group; //@description Gives full information about a group @creator_user_id User identifier of the group creator, 0 if unknown @members Group members @invite_link Invite link for this group, available only for group creator and only after it is generated at least once groupFull creator_user_id:int members:vector invite_link:string = GroupFull; //@description Represents a channel with zero or more subscribers. There two different kinds of channels: supergroups and broadcast channels //@id Channel identifier //@username Channel username, empty for private channels //@date Date when current user has joined the channel or date when channel was created, if user is not a member. Unix time //@status Status of the current user in the channel //@anyone_can_invite True, if any member of the supergroup can invite other members. If the channel is not a supergroup, the field is meaningless //@sign_messages True, if messages sent to the channel should content information about the sender. If the channel is a supergroup, the field is meaningless //@is_supergroup True, if channel is a supergroup and is not a broadcast //@is_verified True, if the channel is verified //@restriction_reason If non-empty, contains the reason, why access to this channel must be restricted. Format of the string is "{type}: {description}". {type} contains type of the restriction and at least one of the suffixes "-all", "-ios", "-android", "-wp", which describes platforms on which access should be restricted. For example, "terms-ios-android". {description} contains human-readable description of the restriction, which can be showed to the user channel id:int username:string date:int status:ChatMemberStatus anyone_can_invite:Bool sign_messages:Bool is_supergroup:Bool is_verified:Bool restriction_reason:string = Channel; //@description Gives full information about a channel //@param_description Channel description //@member_count Channel member count, 0 if unknown //@administrator_count Number of privileged users in the channel, 0 if unknown //@restricted_count Number of restricted users in the channel, 0 if unknown //@banned_count Number of users banned from the channel, 0 if unknown //@can_get_members True, if members of the channel can be retrieved //@can_set_username True, if the channel can be made public //@can_set_sticker_set True, if the channel sticker set can be changed //@sticker_set_id Identifier of channel sticker set, or 0 if none //@invite_link Invite link for this channel //@pinned_message_id Identifier of the pinned message in the channel chat, or 0 if none //@migrated_from_group_id Identifier of the group, this supergroup migrated from, or 0 if none //@migrated_from_max_message_id Identifier of last message in the group chat migrated from, or 0 if none channelFull description:string member_count:int administrator_count:int restricted_count:int banned_count:int can_get_members:Bool can_set_username:Bool can_set_sticker_set:Bool sticker_set_id:int64 invite_link:string pinned_message_id:int53 migrated_from_group_id:int migrated_from_max_message_id:int53 = ChannelFull; //@description Represents a secret chat //@id Secret chat identifier //@user_id Identifier of the interlocutor //@state State of the secret chat, 0 - yet not created, 1 - active, 2 - closed //@is_outbound True if chat was created by the current logged in user, false otherwise //@ttl Current message TTL setting for the chat in seconds //@key_hash Hash of the current used key for comparison with the hash of the interlocutor's key. String of 36 bytes, which should be used to make a 12x12 square image with a color depth of 4. First 16 bytes should be used to make a central 8 * 8 square, left 20 bytes should be used to construct a border of width 2 around that square. Alternatively first 32 bytes of the hash can be converted to hex and printed as 32 2-digit hex numbers //@layer Secret chat layer, determining features supported by other client. Video notes are supported if layer >= 66 secretChat id:int user_id:int state:int is_outbound:Bool ttl:int key_hash:bytes layer:int = SecretChat; //@description Contains chat invite link @invite_link Chat invite link chatInviteLink invite_link:string = ChatInviteLink; //@description Contains information about chat invite link @chat_id Chat identifier of the invite link or 0 if user is not a member of this chat @title Title of the chat @photo Chat photo, nullable @member_count Total member count @member_user_ids User identifiers of some chat members that may be known to the current user //@is_group True, if the chat is a group chat @is_channel True, if the chat is a channel chat @is_public_channel True, if the chat is a channel chat with set up username @is_supergroup_channel True, if the chat is a supergroup channel chat chatInviteLinkInfo chat_id:int53 title:string photo:chatPhoto member_count:int member_user_ids:vector is_group:Bool is_channel:Bool is_public_channel:Bool is_supergroup_channel:Bool = ChatInviteLinkInfo; //@class MessageForwardInfo @description Contains information about initial sender of forwarded message //@description Message is originally written by known user @sender_user_id Identifier of a user, who originally sent this message @date Date when message was originally sent messageForwardedFromUser sender_user_id:int date:int = MessageForwardInfo; //@description Message is orifinally a channel post @chat_id Identifier of a chat from which message is forwarded @author_signature Post author signature //@date Date when message was originally sent @message_id Message identifier of the message from which the message is forwarded, 0 if unknown messageForwardedPost chat_id:int53 author_signature:string date:int message_id:int53 = MessageForwardInfo; //@class MessageSendState @description Contains information about sending state of the message //@description Message is incoming messageIsIncoming = MessageSendState; //@description Message is outgoing but is yet not delivered to the server messageIsBeingSent = MessageSendState; //@description Message was synchronized with the server messageIsSuccessfullySent = MessageSendState; //@description Message is failed to send messageIsFailedToSend = MessageSendState; //@description Describes message //@id Unique message identifier //@sender_user_id Identifier of the user who sent the message, 0 if unknown. It is unknown for channel posts //@chat_id Chat identifier //@send_state Information about sending state of the message //@can_be_edited True, if message can be edited //@can_be_forwarded True, if message can be forwarded //@can_be_deleted_only_for_self True, if message can be deleted only for self, other users will continue to see it //@can_be_deleted_for_everyone True, if message can be deleted for everyone //@is_post True, if message is channel post. All messages to broadcast channels are posts, all other messages are not posts //@contains_unread_mention True, if message contains unread mention of the current user //@date Date when message was sent, unix time //@edit_date Date when message was edited last time, unix time //@forward_info Information about initial message sender, nullable //@reply_to_message_id If non-zero, identifier of the message this message replies to, can be identifier of deleted message //@ttl Message TTL in seconds, 0 if none. TDLib will send updateDeleteMessages or updateMessageContent when TTL expires //@ttl_expires_in Time left for message TTL to expire in seconds //@via_bot_user_id If non-zero, user identifier of the bot this message is sent via //@author_signature For channel posts, optional author signature //@views Number of times this message was viewed //@content Content of the message //@reply_markup Reply markup for the message, nullable message id:int53 sender_user_id:int chat_id:int53 send_state:MessageSendState can_be_edited:Bool can_be_forwarded:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_everyone:Bool is_post:Bool contains_unread_mention:Bool date:int edit_date:int forward_info:MessageForwardInfo reply_to_message_id:int53 ttl:int ttl_expires_in:double via_bot_user_id:int author_signature:string views:int content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains list of messages @total_count Approximate total count of found messages @messages List of messages messages total_count:int messages:vector = Messages; //@description Contains list of found by search messages @messages List of messages @next_from_search_id Value to pass as from_search_id to get more results foundMessages messages:vector next_from_search_id:int64 = FoundMessages; //@class NotificationSettingsScope @description Describes kinds of chat for which notification settings are applied //@description Notification settings applied to particular chat @chat_id Chat identifier notificationSettingsScopeChat chat_id:int53 = NotificationSettingsScope; //@description Notification settings applied to all private chats notificationSettingsScopePrivateChats = NotificationSettingsScope; //@description Notification settings applied to all group and broadcast channel chats (supergroup channels have no common settings) notificationSettingsScopeGroupChats = NotificationSettingsScope; //@description Notification settings applied to all chats notificationSettingsScopeAllChats = NotificationSettingsScope; //@description Contains information about notification settings for chat or chats @mute_for Time left before notifications will be unmuted, seconds @sound Audio file name for notifications, iPhone apps only @show_preview Display message text/media in notification notificationSettings mute_for:int sound:string show_preview:Bool = NotificationSettings; //@description Contains information about draft of a message @reply_to_message_id Identifier of a message to reply to or 0 @input_message_text Content of a draft message, always should be of a type inputMessageText draftMessage reply_to_message_id:int53 input_message_text:InputMessageContent = DraftMessage; //@class ChatType @description Describes type of a chat //@description Ordinary chat with a user @user_id User identifier chatTypePrivate user_id:int = ChatType; //@description Chat with zero or more other users @group_id Group identifier chatTypeGroup group_id:int = ChatType; //@description Chat with unlimited number of members @channel_id Channel identifier @is_supergroup True, if the channel is a supergroup and is not a broadcast chatTypeChannel channel_id:int is_supergroup:Bool = ChatType; //@description Secret chat with a user @secret_chat_id Secret chat identifier @user_id User identifier of the peer chatTypeSecret secret_chat_id:int user_id:int = ChatType; //@description Chat (private chat or group chat or channel chat) //@id Chat unique identifier //@type Information about type of the chat //@title Chat title //@photo Chat photo, nullable //@top_message Last message in the chat, nullable //@order Parameter by descending of which chats are sorted in the chat list. If order of two chats is equal, then they need to be sorted by id also in descending order. If order == 0, position of the chat in the list is undetermined //@is_pinned True, if the chat is pinned //@unread_count Count of unread messages in the chat //@last_read_inbox_message_id Identifier of last read incoming message //@last_read_outbox_message_id Identifier of last read outgoing message //@unread_mention_count Count of unread messages with mention/reply in the chat //@notification_settings Notification settings for this chat //@reply_markup_message_id Identifier of the message from which reply markup need to be used or 0 if there is no default custom reply markup in the chat //@draft_message Draft of a message in the chat, nullable. parse_mode in input_message_text always will be null //@client_data Client specified data, associated with the chat. For example, chat position or local chat notification settings may be stored here. Persistent if message db is used chat id:int53 type:ChatType title:string photo:chatPhoto top_message:message order:int64 is_pinned:Bool unread_count:int last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int notification_settings:notificationSettings reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; //@description Represents list of chats @chat_ids List of chat identifiers chats chat_ids:vector = Chats; //@class KeyboardButtonType @description Describes type of the keyboard button //@description Simple button with a text, which should be sent when the button is pressed keyboardButtonTypeText = KeyboardButtonType; //@description A button which sends user's phone number when pressed, available only in private chats keyboardButtonTypeRequestPhoneNumber = KeyboardButtonType; //@description A button which sends user location when pressed, available only in private chats keyboardButtonTypeRequestLocation = KeyboardButtonType; //@description Represents one button of the bot keyboard @text Text of the button @type Type of the button keyboardButton text:string type:KeyboardButtonType = KeyboardButton; //@class InlineKeyboardButtonType @description Describes type of the inline keyboard button //@description A button which opens the specified URL @url URL to open inlineKeyboardButtonTypeUrl url:string = InlineKeyboardButtonType; //@description A button which sends to the bot special callback query @data Data to be sent to the bot through a callack query inlineKeyboardButtonTypeCallback data:bytes = InlineKeyboardButtonType; //@description A button with a game which sends to the bot special callback query, must be in the first column and row of the keyboard, can be attached only to a message with content of the type messageGame inlineKeyboardButtonTypeCallbackGame = InlineKeyboardButtonType; //@description A button which forces inline query to the bot to be substitued in the input field @query Inline query to be sent to the bot @in_current_chat True, if the inline query should be sent from the current chat inlineKeyboardButtonTypeSwitchInline query:string in_current_chat:Bool = InlineKeyboardButtonType; //@description A button for buying, must be in the first column and row of the keyboard, can be attached only to a message with content of the type messageInvoice inlineKeyboardButtonTypeBuy = InlineKeyboardButtonType; //@description Represents one button of the inline keyboard @text Text of the button @type Type of the button inlineKeyboardButton text:string type:InlineKeyboardButtonType = InlineKeyboardButton; //@class ReplyMarkup @description Contains description of custom keyboard and actions with it for fast reply to bots //@description Instruct clients to remove keyboard after receiving this message. This kind of keyboard can't be received. Instead UpdateChatReplyMarkup with message_id == 0 will be send //@personal Keyboard is removed only for mentioned users or replied to user replyMarkupRemoveKeyboard personal:Bool = ReplyMarkup; //@description Instruct clients to force reply to this message @personal Forced reply is used automatically only for mentioned users or replied to chat user, for incoming messages it is true if and only if forced reply needs to be automatically showed to the current user replyMarkupForceReply personal:Bool = ReplyMarkup; //@description Contains custom keyboard layout for fast reply to bot //@rows List of rows of bot keyboard buttons //@resize_keyboard Do clients need to resize keyboard vertically //@one_time Do clients need to hide keyboard after use //@personal Keyboard is showed automatically only for mentioned users or replied to user, for incoming messages it is true if and only if keyboard needs to be automatically showed to current user replyMarkupShowKeyboard rows:vector> resize_keyboard:Bool one_time:Bool personal:Bool = ReplyMarkup; //@description Contains inline keyboard layout //@rows List of rows of inline keyboard buttons replyMarkupInlineKeyboard rows:vector> = ReplyMarkup; //@class RichText @description Describes a text inside web page instant view //@description Plain text @text The text richTextPlain text:string = RichText; //@description Bold rich text @text The text richTextBold text:RichText = RichText; //@description Italicized rich text @text The text richTextItalic text:RichText = RichText; //@description Underlined rich text @text The text richTextUnderline text:RichText = RichText; //@description Striked through rich text @text The text richTextStrikethrough text:RichText = RichText; //@description Fixed width rich text @text The text richTextFixed text:RichText = RichText; //@description Rich text URL link @text The text @url The URL richTextUrl text:RichText url:string = RichText; //@description Rich text email link @text The text @email The email richTextEmail text:RichText email:string = RichText; //@description Concatenation of rich texts @texts The texts richTextConcatenation texts:vector = RichText; //@class PageBlock @description Describes a block of web page instant view //@description Title of a page @title The title pageBlockTitle title:RichText = PageBlock; //@description Subtitle of a page @subtitle The subtitle pageBlockSubtitle subtitle:RichText = PageBlock; //@description Author and publish date of a page @author The author @publish_date Date of article publish, unix time. 0 if unknown pageBlockAuthorDate author:RichText publish_date:int = PageBlock; //@description A header @header The header pageBlockHeader header:RichText = PageBlock; //@description A subheader @subheader The subheader pageBlockSubheader subheader:RichText = PageBlock; //@description A text paragraph @text Paragraph text pageBlockParagraph text:RichText = PageBlock; //@description Preformatted text paragraph @text Paragraph text @language Programming language for which the text should be formatted pageBlockPreformatted text:RichText language:string = PageBlock; //@description Footer of a page @footer The footer pageBlockFooter footer:RichText = PageBlock; //@description An empty block separating parts of a page pageBlockDivider = PageBlock; //@description Invisible anchor on a page which can be used in a URL to open a page from the specified anchor @name Name of the anchor pageBlockAnchor name:string = PageBlock; //@description List of texts @items Texts @is_ordered True, if items should be marked with numbers pageBlockList items:vector is_ordered:Bool = PageBlock; //@description Block quote @text Quote text @caption Quote caption pageBlockBlockQuote text:RichText caption:RichText = PageBlock; //@description Pull quote @text Quote text @caption Quote caption pageBlockPullQuote text:RichText caption:RichText = PageBlock; //@description An animation @animation The animation, nullable @caption Animation caption @need_autoplay True, if the animation should be autoplayed pageBlockAnimation animation:animation caption:RichText need_autoplay:Bool = PageBlock; //@description An audio @audio The audio, nullable @caption Audio caption pageBlockAudio audio:audio caption:RichText = PageBlock; //@description A photo @photo The photo, nullable @caption Photo caption pageBlockPhoto photo:photo caption:RichText = PageBlock; //@description A video @video The video, nullable @caption Video caption @need_autoplay True, if the video should be autoplayed @is_looped True, if the video is looped pageBlockVideo video:video caption:RichText need_autoplay:Bool is_looped:Bool = PageBlock; //@description Page cover @cover The cover pageBlockCover cover:PageBlock = PageBlock; //@description Embedded web page @url Web page URL, if available @html HTML-markup of the embedded page @poster_photo Poster photo if available, nullable @width Block width @height Block height @caption Block caption @is_full_width True, if the block should be full width @allow_scrolling True, if scrolling should be allowed pageBlockEmbedded url:string html:string poster_photo:photo width:int height:int caption:RichText is_full_width:Bool allow_scrolling:Bool = PageBlock; //@description Embedded post @url Web page URL @author Post author @author_photo Post author photo @date Post date, unix time. 0 if unknown @page_blocks Post content @caption Post caption pageBlockEmbeddedPost url:string author:string author_photo:photo date:int page_blocks:vector caption:RichText = PageBlock; //@description A collage @page_blocks Collage item contents @caption Block caption pageBlockCollage page_blocks:vector caption:RichText = PageBlock; //@description A slideshow @page_blocks Slideshow item contents @caption Block caption pageBlockSlideshow page_blocks:vector caption:RichText = PageBlock; //@description A link to a chat @title Chat title @photo Chat photo, nullable @username Chat username by which all other information about the chat should be resolved pageBlockChatLink title:string photo:chatPhoto username:string = PageBlock; //@description Describes instant view of a web page @page_blocks Content of the web page @is_full True, if instant view contains full page. Network request may be needed to get full web page instant view webPageInstantView page_blocks:vector is_full:Bool = WebPageInstantView; //@description Describes web page preview @url Original URL of link @display_url URL to display //@type Type of web page: article, photo, audio, video, document, profile, app or something other //@site_name Short name of the site (i.e. Google Docs or App Store) @title Title of the content @param_description Description of the content //@photo Image representing the content, nullable //@embed_url Url to show embedded preview //@embed_type MIME type of embedded preview, i.e. text/html or video/mp4 //@embed_width Width of embedded preview //@embed_height Height of embedded preview //@duration Duration of the content in seconds //@author Author of the content //@animation Preview as an Animation if available, nullable //@audio Preview as an Audio if available, nullable //@document Preview as a Document if available (currently only for small pdf files and zip archives), nullable //@sticker Preview as a Sticker for small .webp files if available, nullable //@video Preview as a Video if available, nullable //@video_note Preview as a VideoNote if available, nullable //@voice Preview as a Voice if available, nullable //@has_instant_view True if web page has instant view webPage url:string display_url:string type:string site_name:string title:string description:string photo:photo embed_url:string embed_type:string embed_width:int embed_height:int duration:int author:string animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice:voice has_instant_view:Bool = WebPage; //@description Goods price portion @label Portion label @amount Currency amount in minimal quantity of the currency labeledPrice label:string amount:int53 = LabeledPrice; //@description Goods invoice @currency ISO 4217 currency code @prices List of objects used to calculate total price @is_test True, if payment is test @need_name True, if user's name is needed for payment @need_phone_number True, if user's phone number is needed for payment @need_email True, if user's email is needed for payment //@need_shipping_address True, if user's shipping address is needed for payment @is_flexible True, if total price depends on shipping method invoice currency:string prices:vector is_test:Bool need_name:Bool need_phone_number:Bool need_email:Bool need_shipping_address:Bool is_flexible:Bool = Invoice; //@description Describes shipping address @country_code Two letter ISO 3166-1 alpha-2 country code @state State if applicable @city City @street_line1 First line for the address @street_line2 Second line for the address @post_code Address post code shippingAddress country_code:string state:string city:string street_line1:string street_line2:string post_code:string = ShippingAddress; //@description Order information @name User name @phone_number User's phone number @email User email @shipping_address User shipping address, nullable orderInfo name:string phone_number:string email:string shipping_address:shippingAddress = OrderInfo; //@description One shipping option @id Shipping option identifier @title Option title @prices List of objects used to calculate total shipping price shippingOption id:string title:string prices:vector = ShippingOption; //@description Information about saved card credentials @id Unique identifier of the saved credentials @title Title of the saved credentials savedCredentials id:string title:string = SavedCredentials; //@class InputCredentials @description Contains information about payment method chosen by user //@description User chooses previosly saved payment credentials. To use previously saved credentials user should have valid temporary password @saved_credentials_id Identifier of saved credentials inputCredentialsSaved saved_credentials_id:string = InputCredentials; //@description User enters new credentials on payment provider web site @data JSON-encoded data with credentials identifier from the payment provider @allow_save True, if credentials identifier can be saved server-side inputCredentialsNew data:string allow_save:Bool = InputCredentials; //@description Stripe payments provider @publishable_key Stripe API publishable key @need_country True, if user country should be entered @need_zip True, if user zip code should be entered @need_cardholder_name True, if cardholder name should be entered paymentsProviderStripe publishable_key:string need_country:Bool need_zip:Bool need_cardholder_name:Bool = PaymentsProviderStripe; //@description Information about invoice payment form @invoice Full information about the invoice @url Payment form URL @payments_provider Information about payment provider if available, to support it natively without opening the URL, nullable //@saved_order_info Saved server-side order information, nullable @saved_credentials Information about saved card credentials, nullable @can_save_credentials True, if the user can choose to save credentials @need_password True, if the user will be able to save credentials if he set up a password paymentForm invoice:invoice url:string payments_provider:paymentsProviderStripe saved_order_info:orderInfo saved_credentials:savedCredentials can_save_credentials:Bool need_password:Bool = PaymentForm; //@description Contains temporary identifier of validated order information stored for an hour and available shipping options @order_info_id Temporary identifier of order information @shipping_options Available shipping options validatedOrderInfo order_info_id:string shipping_options:vector = ValidatedOrderInfo; //@description Contains result of a payment query @success True, if payment request was successful. If false, verification_url will be not empty @verification_url Url for additional payments credentials verification paymentResult success:Bool verification_url:string = PaymentResult; //@description Contains information about successful payment @date Payment date, unix time @payments_provider_user_id User identifier of payments provider bot @invoice Information about the invoice //@order_info Order information, nullable @shipping_option Chosen shipping option, nullable @credentials_title Title of the saved credentials paymentReceipt date:int payments_provider_user_id:int invoice:invoice order_info:orderInfo shipping_option:shippingOption credentials_title:string = PaymentReceipt; //@class MessageContent @description Content of a message //@description Text message @text Text of the message @entities Entities contained in the text @web_page Preview of a web page mentioned in the text, nullable messageText text:string entities:vector web_page:webPage = MessageContent; //@description Animation message @animation Message content @caption Animation caption messageAnimation animation:animation caption:string = MessageContent; //@description Audio message @audio Message content @caption Audio caption messageAudio audio:audio caption:string = MessageContent; //@description Document message @document Message content @caption Document caption messageDocument document:document caption:string = MessageContent; //@description Photo message @photo Message content @caption Photo caption messagePhoto photo:photo caption:string = MessageContent; //@description Photo message expired by TTL messageExpiredPhoto = MessageContent; //@description Sticker message @sticker Message content messageSticker sticker:sticker = MessageContent; //@description Video message @video Message content @caption Video caption messageVideo video:video caption:string = MessageContent; //@description Video message expired by TTL messageExpiredVideo = MessageContent; //@description Video note message @video_note Message content @is_viewed True, if the video note message was viewed messageVideoNote video_note:videoNote is_viewed:Bool = MessageContent; //@description Voice message @voice Message content @caption Voice caption @is_listened True, if the voice message was listened to messageVoice voice:voice caption:string is_listened:Bool = MessageContent; //@description Message with location @location Message content messageLocation location:location = MessageContent; //@description Message with information about venue @venue Message content messageVenue venue:venue = MessageContent; //@description User contact message @contact Message content messageContact contact:contact = MessageContent; //@description Message with a game @game The game messageGame game:game = MessageContent; //@description Message with an invoice from a bot @title Goods title @param_description Goods description @photo Goods photo, nullable @currency Currency for goods price @total_amount Goods total price in minimal quantity of the currency //@start_parameter Unique invoice bot start_parameter. To share an invoice use a URL https://t.me/{bot_username}?start={start_parameter} @is_test True, if invoice is test //@need_shipping_address True, if shipping address should be specified @receipt_message_id Identifier of message with receipt after the goods are paid messageInvoice title:string description:string photo:photo currency:string total_amount:int53 start_parameter:string is_test:Bool need_shipping_address:Bool receipt_message_id:int53 = MessageContent; //@description Message with an information about ended call @discard_reason Call discard reason @duration Call duration in seconds messageCall discard_reason:CallDiscardReason duration:int = MessageContent; //@description New group chat created @title Title of created group chat @member_user_ids User identifiers of members of created group chat messageGroupChatCreate title:string member_user_ids:vector = MessageContent; //@description New channel chat created @title Title of created channel chat messageChannelChatCreate title:string = MessageContent; //@description Chat title changed @title New chat title messageChatChangeTitle title:string = MessageContent; //@description Chat photo changed @photo New chat photo messageChatChangePhoto photo:photo = MessageContent; //@description Chat photo deleted messageChatDeletePhoto = MessageContent; //@description Chat members added @member_user_ids User identifiers of new chat members messageChatAddMembers member_user_ids:vector = MessageContent; //@description Chat member joined by invite link messageChatJoinByLink = MessageContent; //@description Chat member deleted @user_id User identifier of deleted chat memeber messageChatDeleteMember user_id:int = MessageContent; //@description Group chat is migrated to supergroup channel and deactivated @channel_id Identifier of the channel it is migrated to messageChatMigrateTo channel_id:int = MessageContent; //@description Supergroup channel is created from group chat @title Title of created channel chat @group_id Identifier of the group it is migrated from messageChatMigrateFrom title:string group_id:int = MessageContent; //@description Some message was pinned @message_id Identifier of the pinned message, can be identifier of the deleted message messagePinMessage message_id:int53 = MessageContent; //@description Screenshot of messages in the chat was taken messageScreenshotTaken = MessageContent; //@description Messages ttl setting in secret chat has changed @ttl New ttl messageChatSetTtl ttl:int = MessageContent; //@description New high score was achieved in a game @game_message_id Identifier of the message with the game, can be identifier of the deleted message @game_id Identifier of the game, may be different from the games presented in the message with the game @score New score messageGameScore game_message_id:int53 game_id:int64 score:int = MessageContent; //@description Payment completed @currency Currency for goods price @total_amount Goods total price in minimal quantity of the currency messagePaymentSuccessful currency:string total_amount:int53 = MessageContent; //@description Bots only. Payment completed @currency Currency for goods price @total_amount Goods total price in minimal quantity of the currency @invoice_payload Invoice payload @shipping_option_id Identifier of a choosed by user shipping option, may be empty if not applicable @order_info Information about the order, nullable //@telegram_payment_charge_id Telegram payment identifier @provider_payment_charge_id Provider payment identifier messagePaymentSuccessfulBot currency:string total_amount:int53 invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent; //@description Contact has registered messageContactRegistered = MessageContent; //@description Unsupported message content messageUnsupported = MessageContent; //@class TextEntityType @description Represent part of the text which needs to be formatted in some unusual way //@description Mention of the user by his username textEntityTypeMention = TextEntityType; //@description Hashtag beginning with # textEntityTypeHashtag = TextEntityType; //@description Bot command beginning with /. It shouldn't be highlighted if there is no bots in the chat textEntityTypeBotCommand = TextEntityType; //@description Url beginning with http textEntityTypeUrl = TextEntityType; //@description Email textEntityTypeEmail = TextEntityType; //@description Bold text textEntityTypeBold = TextEntityType; //@description Italic text textEntityTypeItalic = TextEntityType; //@description Text needs to be formatted as inside of code HTML tag textEntityTypeCode = TextEntityType; //@description Text needs to be formatted as inside of pre HTML tag textEntityTypePre = TextEntityType; //@description Text needs to be formatted as inside of pre and code HTML tags @language Language of code as defined by sender textEntityTypePreCode language:string = TextEntityType; //@description Text description showed instead of the url @url Url to be opened after link will be clicked textEntityTypeTextUrl url:string = TextEntityType; //@description Mention of the user by some text @user_id Identifier of the mentioned user textEntityTypeMentionName user_id:int = TextEntityType; //@class TextParseMode @description Describes a way text should be parsed for MessageEntities, by default text is treated as is //@description Text should be parsed in markdown-style way textParseModeMarkdown = TextParseMode; //@description Text should be parsed in the HTML-style way textParseModeHTML = TextParseMode; //@description Contains a list ot text entities @entities The entities textEntities entities:vector = TextEntities; //@description Thumb to send along with a file, should be in jpeg format or webp format for stickers and less than 200KB in size @thumb Thumb file to send, sending thumbs by file_id is currently not supported //@width Thumb width, usually shouldn't excceed 90. Use 0 if unknown @height Thumb height, usually shouldn't excceed 90. Use 0 if unknown inputThumb thumb:InputFile width:int height:int = InputThumb; //@class InputMessageContent @description Content of a message to send //@description Text message @text Text to send @disable_web_page_preview Pass true to disable rich preview for link in the message text @clear_draft Pass true if chat draft message should be deleted //@entities Bold, Italic, Code, Pre, PreCode and TextUrl entities contained in the text. Non-bot users can't use TextUrl entities. Can't be used with non-null parse_mode @parse_mode Text parse mode, nullable. Can't be used along with enitities inputMessageText text:string disable_web_page_preview:Bool clear_draft:Bool entities:vector parse_mode:TextParseMode = InputMessageContent; //@description Animation message @animation Animation file to send @thumb Animation thumb, if available @duration Duration of the animation in seconds @width Width of the animation, may be replaced by the server @height Height of the animation, may be replaced by the server @caption Animation caption, 0-200 characters inputMessageAnimation animation:InputFile thumb:inputThumb duration:int width:int height:int caption:string = InputMessageContent; //@description Audio message @audio Audio file to send @album_cover_thumb Thumb of the album's cover, if available @duration Duration of the audio in seconds, may be replaced by the server @title Title of the audio, 0-64 characters, may be replaced by the server //@performer Performer of the audio, 0-64 characters, may be replaced by the server @caption Audio caption, 0-200 characters inputMessageAudio audio:InputFile album_cover_thumb:inputThumb duration:int title:string performer:string caption:string = InputMessageContent; //@description Document message @document Document to send @thumb Document thumb, if available @caption Document caption, 0-200 characters inputMessageDocument document:InputFile thumb:inputThumb caption:string = InputMessageContent; //@description Photo message @photo Photo to send @thumb Photo thumb to send, is sent to the other party in secret chats only @added_sticker_file_ids File identifiers of stickers added onto the photo @width Photo width @height Photo height @caption Photo caption, 0-200 characters //@ttl Photo TTL in seconds, 0-60. Non-zero TTL can be only specified in private chats inputMessagePhoto photo:InputFile thumb:inputThumb added_sticker_file_ids:vector width:int height:int caption:string ttl:int = InputMessageContent; //@description Sticker message @sticker Sticker to send @thumb Sticker thumb, if available @width Sticker width @height Sticker height inputMessageSticker sticker:InputFile thumb:inputThumb width:int height:int = InputMessageContent; //@description Video message @video Video to send @thumb Video thumb, if available @added_sticker_file_ids File identifiers of stickers added onto the video @duration Duration of the video in seconds @width Video width @height Video height @caption Video caption, 0-200 characters //@ttl Video TTL in seconds, 0-60. Non-zero TTL can be only specified in private chats inputMessageVideo video:InputFile thumb:inputThumb added_sticker_file_ids:vector duration:int width:int height:int caption:string ttl:int = InputMessageContent; //@description Video note message @video_note Video note to send @thumb Video thumb, if available @duration Duration of the video in seconds @length Video width and height, should be positive and not greater than 640 inputMessageVideoNote video_note:InputFile thumb:inputThumb duration:int length:int = InputMessageContent; //@description Voice message @voice Voice file to send @duration Duration of the voice in seconds @waveform Waveform representation of the voice in 5-bit format @caption Voice caption, 0-200 characters inputMessageVoice voice:InputFile duration:int waveform:bytes caption:string = InputMessageContent; //@description Message with location @location Location to send inputMessageLocation location:location = InputMessageContent; //@description Message with information about venue @venue Venue to send inputMessageVenue venue:venue = InputMessageContent; //@description User contact message @contact Contact to send inputMessageContact contact:contact = InputMessageContent; //@description Message with a game, can't be used in broadcast channels and secret chats @bot_user_id User identifier of a bot owned the game @game_short_name Game short name inputMessageGame bot_user_id:int game_short_name:string = InputMessageContent; //@description Message with an invoice, can be used only by bots and in private chats only @invoice The invoice @title Product title, 1-32 characters @param_description Product description, 0-255 characters @photo_url Goods photo URL, optional @photo_size Goods photo size @photo_width Goods photo width @photo_height Goods photo height //@payload Invoice payload @provider_token Payments provider token @start_parameter Unique invoice bot start_parameter for generation of this invoice inputMessageInvoice invoice:invoice title:string description:string photo_url:string photo_size:int photo_width:int photo_height:int payload:bytes provider_token:string start_parameter:string = InputMessageContent; //@description Forwarded message @from_chat_id Chat identifier of the message to forward @message_id Identifier of the message to forward @in_game_share Pass true to share a game message within a launched game, for Game messages only inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool = InputMessageContent; //@class SearchMessagesFilter @description Represents filter for content of searched messages //@description Return all found messages searchMessagesFilterEmpty = SearchMessagesFilter; //@description Return only animation messages searchMessagesFilterAnimation = SearchMessagesFilter; //@description Return only audio messages searchMessagesFilterAudio = SearchMessagesFilter; //@description Return only document messages searchMessagesFilterDocument = SearchMessagesFilter; //@description Return only photo messages searchMessagesFilterPhoto = SearchMessagesFilter; //@description Return only video messages searchMessagesFilterVideo = SearchMessagesFilter; //@description Return only voice messages searchMessagesFilterVoice = SearchMessagesFilter; //@description Return only photo and video messages searchMessagesFilterPhotoAndVideo = SearchMessagesFilter; //@description Return only messages containing url searchMessagesFilterUrl = SearchMessagesFilter; //@description Return only messages containing chat photos searchMessagesFilterChatPhoto = SearchMessagesFilter; //@description Return only call messages searchMessagesFilterCall = SearchMessagesFilter; //@description Return only incoming call messages with missed/declined discard reason searchMessagesFilterMissedCall = SearchMessagesFilter; //@description Return only video note messages searchMessagesFilterVideoNote = SearchMessagesFilter; //@description Return only voice and video note messages searchMessagesFilterVoiceAndVideoNote = SearchMessagesFilter; //@description Return only messages with mentions of current logged in user or which are replies to his messages searchMessagesFilterMention = SearchMessagesFilter; //@description Return only messages with unread mentions of current logged in user or which are replies to his messages. When this filter is used result can't be additionally filtered by a query or a sender user searchMessagesFilterUnreadMention = SearchMessagesFilter; //@class ChatAction @description Describes different types of activity in a chat //@description User typing a message chatActionTyping = ChatAction; //@description User records a video chatActionRecordingVideo = ChatAction; //@description User uploads a video @progress Upload progress in percents chatActionUploadingVideo progress:int = ChatAction; //@description User records voice message chatActionRecordingVoice = ChatAction; //@description User uploads voice message @progress Upload progress in percents chatActionUploadingVoice progress:int = ChatAction; //@description User uploads a photo @progress Upload progress in percents chatActionUploadingPhoto progress:int = ChatAction; //@description User uploads a document @progress Upload progress in percents chatActionUploadingDocument progress:int = ChatAction; //@description User chooses location or venue to send chatActionChoosingLocation = ChatAction; //@description User chooses contact to send chatActionChoosingContact = ChatAction; //@description User starts to play a game chatActionStartPlayingGame = ChatAction; //@description User records video note chatActionRecordingVideoNote = ChatAction; //@description User uploads a video note @progress Upload progress in percents chatActionUploadingVideoNote progress:int = ChatAction; //@description User cancels previous action chatActionCancel = ChatAction; //@class UserStatus @description Describes last time user was online //@description User status was newer changed userStatusEmpty = UserStatus; //@description User is online @expires Unix time when user's online status will expire userStatusOnline expires:int = UserStatus; //@description User is offline @was_online Unix time user was online last time userStatusOffline was_online:int = UserStatus; //@description User was online recently userStatusRecently = UserStatus; //@description User is offline, but was online last week userStatusLastWeek = UserStatus; //@description User is offline, but was online last month userStatusLastMonth = UserStatus; //@description Represents list of stickers @stickers Stickers stickers stickers:vector = Stickers; //@description Represents list of all emojis corresponding to a sticker in a sticker set. The list is only for informational purposes because sticker is always sent with a fixed emoji from the corresponding Sticker object @emojis List of emojis stickerEmojis emojis:vector = StickerEmojis; //@description Represents sticker set @id Sticker set identifier @title Title of the sticker set @name Name of the sticker set @is_installed True if sticker set is installed by logged in user //@is_archived True if sticker set is archived. A sticker set can't be installed and archived simultaneously @is_official True if sticker set is official @is_masks True if stickers in the set are masks //@is_viewed True for viewed trending sticker set @stickers List of stickers in this set @emojis Lists of emojis corresponding to the stickers in the same order stickerSet id:int64 title:string name:string is_installed:Bool is_archived:Bool is_official:Bool is_masks:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; //@description Represents short information about sticker set @id Sticker set identifier @title Title of the sticker set @name Name of the sticker set @is_installed True if sticker set is installed by logged in user //@is_archived True if sticker set is archived. A sticker set can't be installed and archived simultaneously @is_official True if sticker set is official @is_masks True if stickers in the set are masks //@is_viewed True for viewed trending sticker set @size Total number of stickers in the set @covers Up to 5 first stickers from the set depending on the context. If client needs more stickers it should request full sticker set stickerSetInfo id:int64 title:string name:string is_installed:Bool is_archived:Bool is_official:Bool is_masks:Bool is_viewed:Bool size:int covers:vector = StickerSetInfo; //@description Represents list of sticker sets @total_count Approximate total count of found sticker sets @sets List of sticker sets stickerSets total_count:int sets:vector = StickerSets; //@class CallDiscardReason @description Describes reason a call was discarded //@description Call wasn't discarded or the reason is unknown callDiscardReasonEmpty = CallDiscardReason; //@description Call has ended before conversation begins. It was cancelled by the caller or was missed by the callee callDiscardReasonMissed = CallDiscardReason; //@description Call has ended before conversation begins. It was declined by the callee callDiscardReasonDeclined = CallDiscardReason; //@description Call has ended during conversation because users was disconnected callDiscardReasonDisconnected = CallDiscardReason; //@description Call was hung up by the caller or by the callee callDiscardReasonHungUp = CallDiscardReason; //@description Specifies supported call protocols @udp_p2p True, if UDP peer to peer connections are supported @udp_reflector True, if connection through UDP reflectors are supported @min_layer Minimum supported layer, use 65 @max_layer Maximum supported layer, use 65 callProtocol udp_p2p:Bool udp_reflector:Bool min_layer:int max_layer:int = CallProtocol; //@description Describes address of UDP reflectors @id Reflector identifier @ip IPv4 reflector address @ipv6 IPv6 reflector address @port Reflector port @peer_tag Connection peer tag callConnection id:int64 ip:string ipv6:string port:int peer_tag:bytes = CallConnection; //@description Contains call identifier @id Call identifier callId id:int = CallId; //@class CallState @description Describes current call state //@description Call is pending for acception by a user @is_created True, if the call is already created by the server @is_received True, if the call is already received by the other party callStatePending is_created:Bool is_received:Bool = CallState; //@description Call is answered and encryption keys are exchanged callStateExchangingKeys = CallState; //@description Call is ready to use @protocol Call protocols supported by the peer @connections Available UDP reflectors @config JSON-encoded call config @encryption_key Call encryption key @emojis Encryption key emojis fingerprint callStateReady protocol:callProtocol connections:vector config:string encryption_key:bytes emojis:vector = CallState; //@description Call is hanging up after discardCall is called callStateHangingUp = CallState; //@description Call has ended successfully @reason A reason, why call has ended @need_rating If true, call rating should be sent to the server @need_debug If true, call debug should be sent to the server callStateDiscarded reason:CallDiscardReason need_rating:Bool need_debug:Bool = CallState; //@description Call has ended with an error @error The error. Error with the code 4005000 returned if an outgoing call is missed because of expired timeout callStateError error:error = CallState; //@description Describes a call @id Call identifier, not persistent @user_id Peer user identifier @is_outgoing True, if the call is outgoing @state Call state call id:int user_id:int is_outgoing:Bool state:CallState = Call; //@description Represents list of animations @animations Animations animations animations:vector = Animations; //@description Represent result for ImportContacts request @user_ids User identifiers of imported contacts in the same order as they was specified in the request. 0 if contact is not yet registered //@importer_count Number of users which imported corresponding contact. 0 for already registered users or if unavailable importedContacts user_ids:vector importer_count:vector = ImportedContacts; //@class InputInlineQueryResult @description Represents one result of the inline query received from the bot //@description Represents link to an animated gif @id Unique identifier of this result @title Title of the result @thumb_url Url of the static result thumb (jpeg or gif), if exists //@gif_url Url of the gif-file (file size must not exceed 1MB) @gif_duration Duration of the gif in seconds @gif_width Width of the gif @gif_height Height of the gif //@reply_markup Message reply markup, should be of type replyMarkupInlineKeyboard or null //@input_message_content Content of the message to be sent, should be of type inputMessageText or inputMessageAnimation or InputMessageLocation or InputMessageVenue or InputMessageContact inputInlineQueryResultAnimatedGif id:string title:string thumb_url:string gif_url:string gif_duration:int gif_width:int gif_height:int reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@description Represents link to an animated (i.e. without sound) H.264/MPEG-4 AVC video @id Unique identifier of this result @title Title of the result @thumb_url Url of the static result thumb (jpeg or gif), if exists //@mpeg4_url Url of the mp4-file (file size must not exceed 1MB) @mpeg4_duration Duration of the video in seconds @mpeg4_width Width of the video @mpeg4_height Height of the video //@reply_markup Message reply markup, should be of type replyMarkupInlineKeyboard or null //@input_message_content Content of the message to be sent, should be of type inputMessageText or inputMessageAnimation or InputMessageLocation or InputMessageVenue or InputMessageContact inputInlineQueryResultAnimatedMpeg4 id:string title:string thumb_url:string mpeg4_url:string mpeg4_duration:int mpeg4_width:int mpeg4_height:int reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@description Represents link to an article or web page @id Unique identifier of this result @url Url of the result, if exists @hide_url True, if url must be not shown @title Title of the result //@param_description Short description of the result @thumb_url Url of the result thumb, if exists @thumb_width Thumb width, if known @thumb_height Thumb height, if known //@reply_markup Message reply markup, should be of type replyMarkupInlineKeyboard or null //@input_message_content Content of the message to be sent, should be of type inputMessageText or InputMessageLocation or InputMessageVenue or InputMessageContact inputInlineQueryResultArticle id:string url:string hide_url:Bool title:string description:string thumb_url:string thumb_width:int thumb_height:int reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@description Represents link to a mp3 audio file @id Unique identifier of this result @title Title of the audio @performer Performer of the audio //@audio_url Url of the audio file @audio_duration Audio duration in seconds //@reply_markup Message reply markup, should be of type replyMarkupInlineKeyboard or null //@input_message_content Content of the message to be sent, should be of type inputMessageText or inputMessageAudio or InputMessageLocation or InputMessageVenue or InputMessageContact inputInlineQueryResultAudio id:string title:string performer:string audio_url:string audio_duration:int reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@description Represents user contact @id Unique identifier of this result @contact User contact @thumb_url Url of the result thumb, if exists @thumb_width Thumb width, if known @thumb_height Thumb height, if known //@reply_markup Message reply markup, should be of type replyMarkupInlineKeyboard or null //@input_message_content Content of the message to be sent, should be of type inputMessageText or InputMessageLocation or InputMessageVenue or InputMessageContact inputInlineQueryResultContact id:string contact:contact thumb_url:string thumb_width:int thumb_height:int reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@description Represents link to a file @id Unique identifier of this result @title Title of the result @param_description Short description of the result, if known @document_url Url of the file @mime_type MIME type of the file content, only “application/pdf” and “application/zip” are allowed now //@thumb_url Url of the file thumb, if exists @thumb_width Width of the thumb @thumb_height Height of the thumb //@reply_markup Message reply markup, should be of type replyMarkupInlineKeyboard or null //@input_message_content Content of the message to be sent, should be of type inputMessageText or inputMessageDocument or InputMessageLocation or InputMessageVenue or InputMessageContact inputInlineQueryResultDocument id:string title:string description:string document_url:string mime_type:string thumb_url:string thumb_width:int thumb_height:int reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@description Represents a game @id Unique identifier of this result @game_short_name Game short name @reply_markup Message reply markup, should be of type replyMarkupInlineKeyboard or null inputInlineQueryResultGame id:string game_short_name:string reply_markup:ReplyMarkup = InputInlineQueryResult; //@description Represents a point on the map @id Unique identifier of this result @location Result @title Title of the result @thumb_url Url of the result thumb, if exists @thumb_width Thumb width, if known @thumb_height Thumb height, if known //@reply_markup Message reply markup, should be of type replyMarkupInlineKeyboard or null //@input_message_content Content of the message to be sent, should be of type inputMessageText or InputMessageLocation or InputMessageVenue or InputMessageContact inputInlineQueryResultLocation id:string location:location title:string thumb_url:string thumb_width:int thumb_height:int reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@description Represents link to a jpeg photo @id Unique identifier of this result @title Title of the result, if known @param_description Short description of the result, if known @thumb_url Url of the photo thumb, if exists //@photo_url Url of the jpeg photo (photo must not exceed 5MB) @photo_width Width of the photo @photo_height Height of the photo //@reply_markup Message reply markup, should be of type replyMarkupInlineKeyboard or null //@input_message_content Content of the message to be sent, should be of type inputMessageText or inputMessagePhoto or InputMessageLocation or InputMessageVenue or InputMessageContact inputInlineQueryResultPhoto id:string title:string description:string thumb_url:string photo_url:string photo_width:int photo_height:int reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@description Represents link to a webp sticker @id Unique identifier of this result @thumb_url Url of the sticker thumb, if exists //@sticker_url Url of the webp sticker (file with a sticker must not exceed 5MB) @sticker_width Width of the sticker @sticker_height Height of the sticker //@reply_markup Message reply markup, should be of type replyMarkupInlineKeyboard or null //@input_message_content Content of the message to be sent, should be of type inputMessageText or inputMessageSticker or InputMessageLocation or InputMessageVenue or InputMessageContact inputInlineQueryResultSticker id:string thumb_url:string sticker_url:string sticker_width:int sticker_height:int reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@description Represents information about a venue @id Unique identifier of this result @venue Result @thumb_url Url of the result thumb, if exists @thumb_width Thumb width, if known @thumb_height Thumb height, if known //@reply_markup Message reply markup, should be of type replyMarkupInlineKeyboard or null //@input_message_content Content of the message to be sent, should be of type inputMessageText or InputMessageLocation or InputMessageVenue or InputMessageContact inputInlineQueryResultVenue id:string venue:venue thumb_url:string thumb_width:int thumb_height:int reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@description Represents link to a page containing an embedded video player or a video file @id Unique identifier of this result @title Title of the result @param_description Short description of the result, if known //@thumb_url Url of the video thumb (jpeg), if exists @video_url Url of the embedded video player or video file @mime_type MIME type of the content of video url, only "text/html" or "video/mp4" are allowed now //@video_width Video width @video_height Video height @video_duration Video duration in seconds //@reply_markup Message reply markup, should be of type replyMarkupInlineKeyboard or null //@input_message_content Content of the message to be sent, should be of type inputMessageText or inputMessageVideo or InputMessageLocation or InputMessageVenue or InputMessageContact inputInlineQueryResultVideo id:string title:string description:string thumb_url:string video_url:string mime_type:string video_width:int video_height:int video_duration:int reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@description Represents link to a opus encoded audio file in ogg container @id Unique identifier of this result @title Title of the voice file //@voice_url Url of the voice file @voice_duration Voice duration in seconds //@reply_markup Message reply markup, should be of type replyMarkupInlineKeyboard or null //@input_message_content Content of the message to be sent, should be of type inputMessageText or inputMessageVoice or InputMessageLocation or InputMessageVenue or InputMessageContact inputInlineQueryResultVoice id:string title:string voice_url:string voice_duration:int reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@class InlineQueryResult @description Represents one result of the inline query //@description Represents link to an article or web page @id Unique identifier of this result @url Url of the result, if exists @hide_url True, if url must be not shown @title Title of the result //@param_description Short description of the result @thumb Result thumb, nullable inlineQueryResultArticle id:string url:string hide_url:Bool title:string description:string thumb:photoSize = InlineQueryResult; //@description Represents user contact @id Unique identifier of this result @contact User contact @thumb Result thumb, nullable inlineQueryResultContact id:string contact:contact thumb:photoSize = InlineQueryResult; //@description Represents a point on the map @id Unique identifier of this result @location The result @title Title of the result @thumb Result thumb, nullable inlineQueryResultLocation id:string location:location title:string thumb:photoSize = InlineQueryResult; //@description Represents information about a venue @id Unique identifier of this result @venue The result @thumb Result thumb, nullable inlineQueryResultVenue id:string venue:venue thumb:photoSize = InlineQueryResult; //@description Represents information about a game @id Unique identifier of this result @game The result inlineQueryResultGame id:string game:game = InlineQueryResult; //@description Represents an animation cached on the telegram server @id Unique identifier of this result @animation The animation @title Animation title inlineQueryResultAnimation id:string animation:animation title:string = InlineQueryResult; //@description Represents an audio cached on the telegram server @id Unique identifier of this result @audio The audio inlineQueryResultAudio id:string audio:audio = InlineQueryResult; //@description Represents a document cached on the telegram server @id Unique identifier of this result @document The document @title Document title @param_description Document description inlineQueryResultDocument id:string document:document title:string description:string = InlineQueryResult; //@description Represents a photo cached on the telegram server @id Unique identifier of this result @photo The photo @title Title of the result, if known @param_description Short description of the result, if known inlineQueryResultPhoto id:string photo:photo title:string description:string = InlineQueryResult; //@description Represents a sticker cached on the telegram server @id Unique identifier of this result @sticker The sticker inlineQueryResultSticker id:string sticker:sticker = InlineQueryResult; //@description Represents a video cached on the telegram server @id Unique identifier of this result @video The video @title Title of the video @param_description Description of the video inlineQueryResultVideo id:string video:video title:string description:string = InlineQueryResult; //@description Represents a voice cached on the telegram server @id Unique identifier of this result @voice The voice @title Title of the voice file inlineQueryResultVoice id:string voice:voice title:string = InlineQueryResult; //@description Represents results of the inline query. Use sendInlineQueryResultMessage to send the result of the query @inline_query_id Unique identifier of the inline query @next_offset Offset for the next request. If it is empty, there is no more results @results Results of the query //@switch_pm_text If non-empty, this text should be shown on the button, which opens private chat with the bot and sends bot start message with parameter switch_pm_parameter @switch_pm_parameter Parameter for the bot start message inlineQueryResults inline_query_id:int64 next_offset:string results:vector switch_pm_text:string switch_pm_parameter:string = InlineQueryResults; //@class CallbackQueryPayload @description Represents payload of a callback query //@description Payload from a general callback button @data Data that was attached to the callback button callbackQueryPayloadData data:bytes = CallbackQueryPayload; //@description Payload from a game callback button @game_short_name Short name of the game that was attached to the callback button callbackQueryPayloadGame game_short_name:string = CallbackQueryPayload; //@description Contains answer of a bot to a callback query @text Text of the answer @show_alert If true, an alert should be shown to the user instead of a toast @url URL to be open callbackQueryAnswer text:string show_alert:Bool url:string = CallbackQueryAnswer; //@description Contains result of a custom request @result JSON-serialized result customRequestResult result:string = CustomRequestResult; //@description Contains one row of the game high scores table @position Position in the high score table @user_id User identifier @score User score gameHighScore position:int user_id:int score:int = GameHighScore; //@description Contains list of game high scores @scores List of game high scores gameHighScores scores:vector = GameHighScores; //@class ChatEventAction @description Represents a chat event //@description A message was edited @old_message Message before edit @new_message Message after edit chatEventMessageEdited old_message:message new_message:message = ChatEventAction; //@description A message was deleted @message Deleted message chatEventMessageDeleted message:message = ChatEventAction; //@description A message was pinned @message Pinned message chatEventMessagePinned message:message = ChatEventAction; //@description A message was unpinned chatEventMessageUnpinned = ChatEventAction; //@description New chat member joined chatEventMemberJoined = ChatEventAction; //@description A chat member left chatEventMemberLeft = ChatEventAction; //@description New chat member invited @user_id New chat member user identifier @status New chat member status chatEventMemberInvited user_id:int status:ChatMemberStatus = ChatEventAction; //@description A chat member promoted to/demoted from administrators @user_id Chat member user identifier @old_status Old chat member status @new_status New chat member status chatEventMemberPromoted user_id:int old_status:ChatMemberStatus new_status:ChatMemberStatus = ChatEventAction; //@description A chat member restricted/unrestircted or banned/unbanned @user_id Chat member user identifier @old_status Old chat member status @new_status New chat member status chatEventMemberRestricted user_id:int old_status:ChatMemberStatus new_status:ChatMemberStatus = ChatEventAction; //@description Chat title was changed @old_title Old title value @new_title New title value chatEventTitleChanged old_title:string new_title:string = ChatEventAction; //@description Chat description was changed @old_description Old description value @new_description New description value chatEventDescriptionChanged old_description:string new_description:string = ChatEventAction; //@description Chat username was changed @old_username Old username value @new_username New username value chatEventUsernameChanged old_username:string new_username:string = ChatEventAction; //@description Chat photo was changed @old_photo Old photo value, nullable @new_photo New photo value, nullable chatEventPhotoChanged old_photo:chatPhoto new_photo:chatPhoto = ChatEventAction; //@description Supergroup channel chat anyone_can_invite setting was toggled @anyone_can_invite New value of anyone_can_invite chatEventInvitesToggled anyone_can_invite:Bool = ChatEventAction; //@description Broadcast channel chat sign_messages setting was toggled @sign_messages New value of sign_messages chatEventSignMessagesToggled sign_messages:Bool = ChatEventAction; //@description Supergroup sticker set was changed @old_sticker_set_id Old identifier of chat sticker set, 0 if none @new_sticker_set_id New identifier of chat sticker set, 0 if none chatEventStickerSetChanged old_sticker_set_id:int64 new_sticker_set_id:int64 = ChatEventAction; //@description Represents a chat event @id Chat event identifier @date Date of the event, unix time @user_id Identifier of a user who made the action @action Action done by the user chatEvent id:int64 date:int user_id:int action:ChatEventAction = ChatEvent; //@description Contains list of chat events @events The events chatEvents events:vector = ChatEvents; //@description Represents a set of filters used to obtain a chat event log //@message_edits True, if message edits should be returned //@message_deletions True, if message deletions should be returned //@message_pins True, if message pins should be returned //@member_joins True, if chat member joins should be returned //@member_leaves True, if chat member leaves should be returned //@member_invites True, if chat member invites should be returned //@member_promotions True, if chat member promotions/demotions should be returned //@member_restrictions True, if chat member restrictions/unrestrictions including bans/unbans should be returned //@info_changes True, if changes of chat information should be returned //@setting_changes True, if changes of chat settings should be returned chatEventLogFilters message_edits:Bool message_deletions:Bool message_pins:Bool member_joins:Bool member_leaves:Bool member_invites:Bool member_promotions:Bool member_restrictions:Bool info_changes:Bool setting_changes:Bool = ChatEventLogFilters; //@class DeviceToken @description Represents a token for push notifications //@description Token for APNS @token The token, may be empty to unregister device deviceTokenApns token:string = DeviceToken; //@description Token for GCM @token The token, may be empty to unregister device deviceTokenGcm token:string = DeviceToken; //@description Token for MPNS @token The token, may be empty to unregister device deviceTokenMpns token:string = DeviceToken; //@description Token for simple push @token The token, may be empty to unregister device deviceTokenSimplePush token:string = DeviceToken; //@description Token for Ubuntu Push Service @token The token, may be empty to unregister device deviceTokenUbuntuPhone token:string = DeviceToken; //@description Token for Blackberry Push Service @token The token, may be empty to unregister device deviceTokenBlackberry token:string = DeviceToken; //@description Contains information about one wallpaper @id Unique persistent wallpaper identifier @sizes Available variants of wallpaper of different sizes. These photos can be only downloaded and can't be sent in a message @color Main color of wallpaper in RGB24, should be treated as background color if no photos are specified wallpaper id:int sizes:vector color:int = Wallpaper; //@description Contains list of wallpapers @wallpapers List of wallpapers wallpapers wallpapers:vector = Wallpapers; //@description Contatins list of hashtags @hashtags List of hashtags hashtags hashtags:vector = Hashtags; //@class OptionValue @description Represents value of an option //@description Boolean option @value Value of an option optionValueBoolean value:Bool = OptionValue; //@description Unknown option or option having default value optionValueEmpty = OptionValue; //@description Integer option @value Value of an option optionValueInteger value:int = OptionValue; //@description String option @value Value of an option optionValueString value:string = OptionValue; //@class PrivacyRule @description Represents one rule for managing privacy settings //@description Rule to allow all users privacyRuleAllowAll = PrivacyRule; //@description Rule to allow all user contacts privacyRuleAllowContacts = PrivacyRule; //@description Rule to allow specified users @user_ids User identifiers privacyRuleAllowUsers user_ids:vector = PrivacyRule; //@description Rule to disallow all users privacyRuleDisallowAll = PrivacyRule; //@description Rule to disallow all user contacts privacyRuleDisallowContacts = PrivacyRule; //@description Rule to disallow all specified users @user_ids User identifiers privacyRuleDisallowUsers user_ids:vector = PrivacyRule; //@description List of privacy rules. Rules are matched in the specified order. First matched rule defines privacy setting for a given user. If no rule matches action is not allowed @rules List of rules privacyRules rules:vector = PrivacyRules; //@class PrivacyKey @description Describes available privacy settings //@description Privacy key for managing visibility of the user status privacyKeyUserStatus = PrivacyKey; //@description Privacy key for managing ability of invitation of the user to chats privacyKeyChatInvite = PrivacyKey; //@description Privacy key for managing ability to call the user privacyKeyCall = PrivacyKey; //@description Contains information about period of inactivity, after which the account of currently logged in user will be automatically deleted @days Number of days of inactivity before account deletion, should be from 30 and up to 366 accountTtl days:int = AccountTtl; //@description Contains information about one session in some application used by the user @id Session identifier @is_current True, if it is current session @app_id Application identifier, provided by the application @app_name Name of the application, provided by the application //@app_version Version of the application, provided by the application @is_official_app True, if the application is an official application or uses the app_id of some official application @device_model Model of a device application is runned on, provided by the application @platform Operating system application is runned on, provided by the application //@system_version Version of operating system application is runned on, provided by the application @log_in_date Date the user has logged in, unix time @last_active_date Date the session was used last time, unix time @ip An ip address from which session was created in a human-readable format //@country Two-letter country code from which session was created based on the ip @region Region code from which session was created based on the ip session id:int64 is_current:Bool app_id:int app_name:string app_version:string is_official_app:Bool device_model:string platform:string system_version:string log_in_date:int last_active_date:int ip:string country:string region:string = Session; //@description Contains list of sessions @sessions List of sessions sessions sessions:vector = Sessions; //@description Contains information about chat report spam state @can_report_spam If true, prompt with "Report spam" action should be shown to the user chatReportSpamState can_report_spam:Bool = ChatReportSpamState; //@class ChatReportReason @description Describes a reason, why a chat is reported //@description The chat contains spam messages chatReportReasonSpam = ChatReportReason; //@description The chat contains violent messages chatReportReasonViolence = ChatReportReason; //@description The chat contains pornography messages chatReportReasonPornography = ChatReportReason; //@description Other reason provided by the user @text Report text chatReportReasonOther text:string = ChatReportReason; //@description Contains public HTTPS link to a message in a public channel @url The link publicMessageLink url:string = PublicMessageLink; //@class FileType @description Represents type of a file //@description Data is not a file fileTypeNone = FileType; //@description File is an animation fileTypeAnimation = FileType; //@description File is an audio fileTypeAudio = FileType; //@description File is a document fileTypeDocument = FileType; //@description File is a photo fileTypePhoto = FileType; //@description File is a profile photo fileTypeProfilePhoto = FileType; //@description File sent to a secret chat fileTypeSecret = FileType; //@description File is a sticker fileTypeSticker = FileType; //@description File is a thumbnail of another file fileTypeThumb = FileType; //@description File type is yet unknown fileTypeUnknown = FileType; //@description File is a video fileTypeVideo = FileType; //@description File is a video note fileTypeVideoNote = FileType; //@description File is a voice audio fileTypeVoice = FileType; //@description File is a wallpaper fileTypeWallpaper = FileType; //@description File is a thumbnail of a file from a secret chat fileTypeSecretThumb = FileType; //@description Contains storage usage statistics for the specific file type @file_type The file type @size Total size of files @count Total number of files storageStatisticsByFileType file_type:FileType size:int53 count:int = StorageStatisticsByFileType; //@description Contains storage usage statistics for the specific chat @chat_id Chat identifier, 0 if none @size Total size of files @count Total number of files @by_file_type Statistics splitted by file types storageStatisticsByChat chat_id:int53 size:int53 count:int by_file_type:vector = StorageStatisticsByChat; //@description Contains exact storage usage statistics splitted by chats and file types @size Total size of files @count Total number of files @by_chat Statistics splitted by chats storageStatistics size:int53 count:int by_chat:vector = StorageStatistics; //@description Contains approximate storage usage statistics, not containing files of Unknown type @files_size Approximate total size of files @files_count Approximate number of files @database_size Size of database storageStatisticsFast files_size:int53 files_count:int database_size:int53 = StorageStatisticsFast; //@class NetworkType @description Represents type of a network //@description Network is not available networkTypeNone = NetworkType; //@description Mobile network networkTypeMobile = NetworkType; //@description Mobile roaming network networkTypeMobileRoaming = NetworkType; //@description Wi-Fi network networkTypeWiFi = NetworkType; //@description Other network type, for example, Ethernet network networkTypeOther = NetworkType; //@class NetworkStatisticsEntry @description Contains statistics about network usage //@description Contains information about total received and sent files data @file_type Type of a file the data is part of @network_type Type of a network the data was sent through. Call setNetworkType to maintain actual network type //@sent_bytes Total number of sent bytes @received_bytes Total number of received bytes networkStatisticsEntryFile file_type:FileType network_type:NetworkType sent_bytes:int53 received_bytes:int53 = NetworkStatisticsEntry; //@description Contains information about total received and sent calls data @network_type Type of a network the data was sent through. Call setNetworkType to maintain actual network type //@sent_bytes Total number of sent bytes @received_bytes Total number of received bytes @duration Total calls duration in seconds networkStatisticsEntryCall network_type:NetworkType sent_bytes:int53 received_bytes:int53 duration:double = NetworkStatisticsEntry; //@description Full list of available network statistics entries @since_date Date since which statistics are collected, unix time @entries Network statistics entries networkStatistics since_date:int entries:vector = NetworkStatistics; //@class ConnectionState @description Describes current state of the connection to Telegram servers //@description Waiting for network to be available. Use SetNetworkType to change available network type connectionStateWaitingForNetwork = ConnectionState; //@description Establishing connection to set up proxy server connectionStateConnectingToProxy = ConnectionState; //@description Establishing connection to Telegram servers connectionStateConnecting = ConnectionState; //@description Downloading date received, while client was offline connectionStateUpdating = ConnectionState; //@description There is a working connection to the Telegram servers connectionStateReady = ConnectionState; //@class TopChatCategory @description Represents categories of chats for which list of frequently used chats can be retrieved //@description The category containing private chats with non-bot users topChatCategoryUsers = TopChatCategory; //@description The category containing private chats with bot users topChatCategoryBots = TopChatCategory; //@description The category containing group chats and supergroup channel chats topChatCategoryGroups = TopChatCategory; //@description The category containing broadcast channel chats topChatCategoryChannels = TopChatCategory; //@description The category containing chats with inline bots sorted by their usage in the inline mode topChatCategoryInlineBots = TopChatCategory; //@description The category containing chats frequently used for calls topChatCategoryCalls = TopChatCategory; //@description Contains some count @count The count count count:int = Count; //@description Contains some text @text The text text text:string = Text; //@class Proxy @description Contains information about a proxy server //@description An empty proxy proxyEmpty = Proxy; //@description A SOCKS5 proxy @server Proxy server ip address @port Proxy server port @username Username to log in @password Password to log in proxySocks5 server:string port:int username:string password:string = Proxy; //@description Description of a sticker which should be added to a sticker set @png_sticker Png image with the sticker, must be up to 512 kilobytes in size and fit in 512x512 square @emojis Emojis corresponding to the sticker @mask_position Position where the mask should be placed, nullable inputSticker png_sticker:InputFile emojis:string mask_position:maskPosition = InputSticker; //@class Update @description Contains notifications about data changes //@description User authorization state has changed @auth_state New authorization state updateAuthState auth_state:AuthState = Update; //@description New message received, maybe outcoming message sent from other device @message New message @disable_notification If true, notification about the message should be disabled @contains_mention True, if the message contains mention of the current user updateNewMessage message:message disable_notification:Bool contains_mention:Bool = Update; //@description Message send request has reached Telegram server. It doesn't mean that message send will be successful or even that message send request will be processed. Update will not come, unless option "use_quick_ack" is set to true. The update may come many times for the same message //@chat_id Chat identifier of sent message @message_id Temporary message identifier updateMessageSendAcknowledged chat_id:int53 message_id:int53 = Update; //@description Message is successfully sent @message Information about sent message. Usually only message identifier, date and content are changed, but almost any other fields can also change @old_message_id Previous temporary message identifier updateMessageSendSucceeded message:message old_message_id:int53 = Update; //@description Message fails to send. Be aware that some being sent messages can be irrecoverably deleted and updateDeleteMessages will come instead of this update //@message Information about failed to send message @old_message_id Previous temporary message identifier @error_code Error code @error_message Error message updateMessageSendFailed message:message old_message_id:int53 error_code:int error_message:string = Update; //@description Message content has changed @chat_id Chat identifier @message_id Message identifier @new_content New message content updateMessageContent chat_id:int53 message_id:int53 new_content:MessageContent = Update; //@description Message was edited. Changes in the message content will come in a separate updateMessageContent @chat_id Chat identifier @message_id Message identifier @edit_date Date the message was edited, unix time @reply_markup New message reply markup, nullable updateMessageEdited chat_id:int53 message_id:int53 edit_date:int reply_markup:ReplyMarkup = Update; //@description View count of the message has changed @chat_id Chat identifier @message_id Message identifier @views New value of view count updateMessageViews chat_id:int53 message_id:int53 views:int = Update; //@description Message content was opened. It makes voice messages listened, video note messages viewed and runs ttl timer @chat_id Chat identifier @message_id Message identifier updateOpenMessageContent chat_id:int53 message_id:int53 = Update; //@description Message with an unread mention was read @chat_id Chat identifier @message_id Message identifier @unread_mention_count New number of unread mention messages left in the chat updateMessageMentionRead chat_id:int53 message_id:int53 unread_mention_count:int = Update; //@description New chat has been loaded/created. This update is guaranteed to come before chat identifier is returned to the client. Chat field changes will be reported through separate updates @chat The chat updateNewChat chat:chat = Update; //@description Title of the chat was changed @chat_id Chat identifier @title New chat title updateChatTitle chat_id:int53 title:string = Update; //@description Chat photo was changed @chat_id Chat identifier @photo New chat photo, nullable updateChatPhoto chat_id:int53 photo:chatPhoto = Update; //@description Top message of the chat has changed. If top_message is null then top message in the chat became unknown. Some new unknown messages might be added to the chat in that case @chat_id Chat identifier @top_message New top message of the chat, nullable @order New value of the chat order updateChatTopMessage chat_id:int53 top_message:message order:int64 = Update; //@description Order of the chat in the chat list has changed. Instead of that update updateChatTopMessage, updateChatIsPinned or updateChatDraftMessage may be sent @chat_id Chat identifier @order New value of the order updateChatOrder chat_id:int53 order:int64 = Update; //@description Chat was pinned or unpinned @chat_id Chat identifier @is_pinned New value of is_pinned @order New value of the chat order updateChatIsPinned chat_id:int53 is_pinned:Bool order:int64 = Update; //@description Some incoming messages was read @chat_id Chat identifier @last_read_inbox_message_id Identifier of last read incoming message @unread_count Number of unread messages left in the chat updateChatReadInbox chat_id:int53 last_read_inbox_message_id:int53 unread_count:int = Update; //@description Some outcoming messages was read @chat_id Chat identifier @last_read_outbox_message_id Identifier of last read outgoing message updateChatReadOutbox chat_id:int53 last_read_outbox_message_id:int53 = Update; //@description Chat unread_mention_count has changed @chat_id Chat identifier @unread_mention_count Number of unread mention messages left in the chat updateChatUnreadMentionCount chat_id:int53 unread_mention_count:int = Update; //@description Notification settings for some chats was updated @scope Kinds of chats for which notification settings was updated @notification_settings New notification settings updateNotificationSettings scope:NotificationSettingsScope notification_settings:notificationSettings = Update; //@description Default chat reply markup has changed. It can happen because new message with reply markup has come or old reply markup was hidden by user //@chat_id Chat identifier @reply_markup_message_id Identifier of the message from which reply markup need to be used or 0 if there is no default custom reply markup in the chat updateChatReplyMarkup chat_id:int53 reply_markup_message_id:int53 = Update; //@description Chat draft has changed. Be aware that the update may come in the currently open chat with the old content of the draft. If the user has changed the content of the draft, the update shouldn't be applied @chat_id Chat identifier @draft_message New chat draft_message, nullable @order New value of the chat order updateChatDraftMessage chat_id:int53 draft_message:draftMessage order:int64 = Update; //@description Some messages was deleted @chat_id Chat identifier @message_ids Identifiers of deleted message updateDeleteMessages chat_id:int53 message_ids:vector = Update; //@description User activity in the chat has changed @chat_id Chat identifier @user_id Identifier of user doing action @action Action description updateUserChatAction chat_id:int53 user_id:int action:ChatAction = Update; //@description User went online/offline @user_id User identifier @status New user status updateUserStatus user_id:int status:UserStatus = Update; //@description Some data about a user has been changed. This update is guaranteed to come before user identifier is returned to the client, if library knows anything about the user @user New data about the user updateUser user:user = Update; //@description Some data about a group has been changed. This update is guaranteed to come before group identifier is returned to the client, if library knows anything about the group @group New data about the group updateGroup group:group = Update; //@description Some data about a channel has been changed. This update is guaranteed to come before channel identifier is returned to the client, if library knows anything about the channel @channel New data about the channel updateChannel channel:channel = Update; //@description Some data about a secret chat has been changed. This update is guaranteed to come before secret chat identifier is returned to the client, if library knows anything about the secret chat @secret_chat New data about the secret chat updateSecretChat secret_chat:secretChat = Update; //@description Some data from userFull has been changed @user_id User identifier @user_full New full information about the user updateUserFull user_id:int user_full:userFull = Update; //@description Some data from groupFull has been changed @group_id Group identifier @group_full New full information about the group updateGroupFull group_id:int group_full:groupFull = Update; //@description Some data from channelFull has been changed @channel_id Channel identifier @channel_full New full information about the channel updateChannelFull channel_id:int channel_full:channelFull = Update; //@description Service notification from the server. Upon receiving client should show popup with content of the notification @type Type of the notification @content Notification content updateServiceNotification type:string content:MessageContent = Update; //@description DEPRECATED. Use updateFile instead. File is partly downloaded/uploaded @file_id File identifier @size Total file size (0 means unknown) @ready Number of bytes already downloaded/uploaded. Negative number means that download/upload has failed and was terminated updateFileProgress file_id:int size:int ready:int = Update; //@description Information about a file was updated @file New data about a file updateFile file:file = Update; //@description File generation process need to be started by the client @generation_id Unique identifier for the generation process @original_path Path to a file from which new file is generated, may be empty //@destination_path Path to a file which should be created and to which new file should be generated @conversion String specifying conversion applied to the original file updateFileGenerationStart generation_id:int64 original_path:string destination_path:string conversion:string = Update; //@description Informs that a file is being generated @file_id File identifier @size Expected size of the generated file @ready Number of bytes already generated. Negative number means that generation has failed and was terminated updateFileGenerationProgress file_id:int size:int ready:int = Update; //@description DEPRECATED. Use updateFile instead. File generation is finished @file Generated file updateFileGenerationFinish file:file = Update; //@description Information about a call was updated @call New data about a call updateCall call:call = Update; //@description Some privacy settings has changed @key Privacy key @rules New privacy rules updatePrivacy key:PrivacyKey rules:privacyRules = Update; //@description Some option changed its value @name Option name @value New option value updateOption name:string value:OptionValue = Update; //@description List of installed sticker sets was updated @is_masks True, if list of installed mask sticker sets was updated @sticker_set_ids New list of installed ordinary sticker sets updateInstalledStickerSets is_masks:Bool sticker_set_ids:vector = Update; //@description List of trending sticker sets was updated or some of them was viewed @sticker_sets New list of trending sticker sets updateTrendingStickerSets sticker_sets:stickerSets = Update; //@description List of recently used stickers was updated @is_attached True, if the list of stickers attached to photo or video files was updated, otherwise the list of sent stickers is updated @sticker_ids New list of file identifiers of recently used stickers updateRecentStickers is_attached:Bool sticker_ids:vector = Update; //@description List of favorite stickers was updated @sticker_ids New list of file identifiers of favorite stickers updateFavoriteStickers sticker_ids:vector = Update; //@description List of saved animations was updated @animation_ids New list of file identifiers of saved animations updateSavedAnimations animation_ids:vector = Update; //@description Connection state has changed @state New connection state updateConnectionState state:ConnectionState = Update; //@description Bots only. New incoming inline query @id Unique query identifier @sender_user_id Identifier of the user who sent the query @user_location User location, provided by the client, nullable @query Text of the query @offset Offset of the first entry to return updateNewInlineQuery id:int64 sender_user_id:int user_location:location query:string offset:string = Update; //@description Bots only. User has chosen a result of the inline query @sender_user_id Identifier of the user who sent the query @user_location User location, provided by the client, nullable @query Text of the query @result_id Identifier of the chosen result @inline_message_id Identifier of the sent inline message, if known updateNewChosenInlineResult sender_user_id:int user_location:location query:string result_id:string inline_message_id:string = Update; //@description Bots only. New incoming callback query @id Unique query identifier @sender_user_id Identifier of the user who sent the query @chat_id Identifier of the chat, in which the query was sent //@message_id Identifier of the message, from which the query is originated @chat_instance Identifier, uniquely corresponding to the chat a message was sent to @payload Query payload updateNewCallbackQuery id:int64 sender_user_id:int chat_id:int53 message_id:int53 chat_instance:int64 payload:CallbackQueryPayload = Update; //@description Bots only. New incoming callback query from message sent via bot @id Unique query identifier @sender_user_id Identifier of the user who sent the query @inline_message_id Identifier of the inline message, from which the query is originated //@chat_instance Identifier, uniquely corresponding to the chat a message was sent to @payload Query payload updateNewInlineCallbackQuery id:int64 sender_user_id:int inline_message_id:string chat_instance:int64 payload:CallbackQueryPayload = Update; //@description Bots only. New incoming shipping query. Only for invoices with flexible price @id Unique query identifier @sender_user_id Identifier of the user who sent the query @invoice_payload Invoice payload @shipping_address User shipping address updateNewShippingQuery id:int64 sender_user_id:int invoice_payload:string shipping_address:shippingAddress = Update; //@description Bots only. New incoming pre-checkout query. Contains full information about checkout @id Unique query identifier @sender_user_id Identifier of the user who sent the query @currency Currency for goods price @total_amount Goods total price in minimal quantity of the currency //@invoice_payload Invoice payload @shipping_option_id Identifier of a choosed by user shipping option, may be empty if not applicable @order_info Information about the order, nullable updateNewPreCheckoutQuery id:int64 sender_user_id:int currency:string total_amount:int53 invoice_payload:bytes shipping_option_id:string order_info:orderInfo = Update; //@description Bots only. New incoming event @event JSON-serialized event updateNewCustomEvent event:string = Update; //@description Bots only. New incoming query @id Query identifier @data JSON-serialized query data @timeout Query timeout updateNewCustomQuery id:int64 data:string timeout:int = Update; //@description Tests only. A simple object containing just a number @value The number testInt value:int = TestInt; //@description Tests only. A simple object containing just a string @value The string testString value:string = TestString; //@description Tests only. A simple object containing just a bytes @value The bytes testBytes value:bytes = TestBytes; //@description Tests only. A simple object containing just a vector of numbers @value The vector of numbers testVectorInt value:vector = TestVectorInt; //@description Tests only. A simple object containing just a vector of objects containing a number @value The vector of objects testVectorIntObject value:vector = TestVectorIntObject; //@description Tests only. A simple object containing just a vector of strings @value The vector of strings testVectorString value:vector = TestVectorString; //@description Tests only. A simple object containing just a vector of objects containing a string @value The vector of objects testVectorStringObject value:vector = TestVectorStringObject; ---functions--- //@description Returns current authorization state, offline request getAuthState = AuthState; //@description Sets user's phone number and sends authentication code to the user. Works only when getAuthState returns authStateWaitPhoneNumber. If phone number is not recognized or another error has happened, returns an error. Otherwise returns authStateWaitCode //@phone_number User's phone number in any reasonable format @allow_flash_call Pass True, if code can be sent via flash call to the specified phone number @is_current_phone_number Pass true, if the phone number is used on the current device. Ignored if allow_flash_call is False setAuthPhoneNumber phone_number:string allow_flash_call:Bool is_current_phone_number:Bool = AuthState; //@description Resends authentication code to the user. Works only when getAuthState returns authStateWaitCode and next_code_type of result is not null. Returns authStateWaitCode on success resendAuthCode = AuthState; //@description Checks authentication code. Works only when getAuthState returns authStateWaitCode. Returns authStateWaitPassword or authStateOk on success @code Verification code from SMS, Telegram message, phone call or flash call //@first_name User first name, if user is yet not registered, 1-255 characters @last_name Optional user last name, if user is yet not registered, 0-255 characters checkAuthCode code:string first_name:string last_name:string = AuthState; //@description Checks password for correctness. Works only when getAuthState returns authStateWaitPassword. Returns authStateOk on success @password Password to check checkAuthPassword password:string = AuthState; //@description Requests to send password recovery code to email. Works only when getAuthState returns authStateWaitPassword. Returns authStateWaitPassword on success requestAuthPasswordRecovery = AuthState; //@description Recovers password with recovery code sent to email. Works only when getAuthState returns authStateWaitPassword. Returns authStateOk on success @recovery_code Recovery code to check recoverAuthPassword recovery_code:string = AuthState; //@description Logs out user. If force == false, begins to perform soft log out, returns authStateLoggingOut after completion. If force == true then succeeds almost immediately without cleaning anything at the server, but returns error with code 401 and description "Unauthorized" //@force If true, just delete all local data. Session will remain in list of active sessions resetAuth force:Bool = AuthState; //@description Check bot's authentication token to log in as a bot. Works only when getAuthState returns authStateWaitPhoneNumber. Can be used instead of setAuthPhoneNumber and checkAuthCode to log in. Returns authStateOk on success @token Bot token checkAuthBotToken token:string = AuthState; //@description Returns current state of two-step verification getPasswordState = PasswordState; //@description Changes user password. If new recovery email is specified, then error EMAIL_UNCONFIRMED is returned and password change will not be applied until email confirmation. Application should call getPasswordState from time to time to check if email is already confirmed //@old_password Old user password @new_password New user password, may be empty to remove the password @new_hint New password hint, can be empty @set_recovery_email Pass True, if recovery email should be changed @new_recovery_email New recovery email, may be empty setPassword old_password:string new_password:string new_hint:string set_recovery_email:Bool new_recovery_email:string = PasswordState; //@description Returns set up recovery email. This method can be used to verify a password provided by the user @password Current user password getRecoveryEmail password:string = RecoveryEmail; //@description Changes user recovery email. If new recovery email is specified, then error EMAIL_UNCONFIRMED is returned and email will not be changed until email confirmation. Application should call getPasswordState from time to time to check if email is already confirmed. -If new_recovery_email coincides with the current set up email succeeds immediately and aborts all other requests waiting for email confirmation @password Current user password @new_recovery_email New recovery email setRecoveryEmail password:string new_recovery_email:string = PasswordState; //@description Requests to send password recovery code to email requestPasswordRecovery = PasswordRecoveryInfo; //@description Recovers password with recovery code sent to email @recovery_code Recovery code to check recoverPassword recovery_code:string = PasswordState; //@description Creates new temporary password for payments processing @password Persistent user password @valid_for Time before temporary password will expire, seconds. Should be between 60 and 86400 createTemporaryPassword password:string valid_for:int = TemporaryPasswordState; //@description Returns information about current temporary password getTemporaryPasswordState = TemporaryPasswordState; //@description Handles DC_UPDATE push service notification. Can be called before authorization @dc Value of 'dc' paramater of the notification @addr Value of 'addr' parameter of the notification processDcUpdate dc:string addr:string = Ok; //@description Returns current logged in user getMe = User; //@description Returns information about a user by its identifier, offline request if current user is not a bot @user_id User identifier getUser user_id:int = User; //@description Returns full information about a user by its identifier @user_id User identifier getUserFull user_id:int = UserFull; //@description Returns information about a group by its identifier, offline request if current user is not a bot @group_id Group identifier getGroup group_id:int = Group; //@description Returns full information about a group by its identifier @group_id Group identifier getGroupFull group_id:int = GroupFull; //@description Returns information about a channel by its identifier, offline request if current user is not a bot @channel_id Channel identifier getChannel channel_id:int = Channel; //@description Returns full information about a channel by its identifier, cached for at most 1 minute @channel_id Channel identifier getChannelFull channel_id:int = ChannelFull; //@description Returns information about a secret chat by its identifier, offline request @secret_chat_id Secret chat identifier getSecretChat secret_chat_id:int = SecretChat; //@description Returns information about a chat by its identifier, offline request if current user is not a bot @chat_id Chat identifier getChat chat_id:int53 = Chat; //@description Returns information about a message @chat_id Identifier of the chat, message belongs to @message_id Identifier of the message to get getMessage chat_id:int53 message_id:int53 = Message; //@description Returns information about messages. If message is not found, returns null on the corresponding position of the result @chat_id Identifier of the chat, messages belongs to @message_ids Identifiers of the messages to get getMessages chat_id:int53 message_ids:vector = Messages; //@description Returns information about a file, offline request @file_id Identifier of the file to get getFile file_id:int = File; //@description Returns information about a file by its persistent id, offline request. May be used to register a URL as a file for further uploading or sending as message @persistent_file_id Persistent identifier of the file to get @file_type File type, if known getFilePersistent persistent_file_id:string file_type:FileType = File; //@description Returns list of chats in the right order, chats are sorted by (order, chat_id) in decreasing order. For example, to get list of chats from the beginning, the offset_order should be equal 2^63 - 1 @offset_order Chat order to return chats from @offset_chat_id Chat identifier to return chats from //@limit Maximum number of chats to be returned. There may be less than limit chats returned even the end of the list is not reached getChats offset_order:int64 offset_chat_id:int53 limit:int = Chats; //@description Searches public chat by its username. Currently only private and channel chats can be public. Returns chat if found, otherwise some error is returned @username Username to be resolved searchPublicChat username:string = Chat; //@description Searches public chats by prefix of their username. Currently only private and channel (including supergroup) chats can be public. Returns meaningful number of results. Returns nothing if length of the searched username prefix is less than 5. Excludes private chats with contacts from the results @username_prefix Prefix of the username to search searchPublicChats username_prefix:string = Chats; //@description Searches for specified query in the title and username of known chats, offline request. Returns chats in the order of them in the chat list @query Query to search for, if query is empty, returns up to 20 recently found chats @limit Maximum number of chats to be returned searchChats query:string limit:int = Chats; //@description Returns a list of frequently used chats. Supported only if chat info database is enabled @category Category of chats to return @limit Maximum number of chats to be returned, at most 30 getTopChats category:TopChatCategory limit:int = Chats; //@description Delete a chat from a list of frequently used chats. Supported only if chat info database is enabled @category Category of frequently used chats @chat_id Chat identifier deleteTopChat category:TopChatCategory chat_id:int53 = Ok; //@description Adds chat to the list of recently found chats. The chat is added to the beginning of the list. If the chat is already in the list, at first it is removed from the list @chat_id Identifier of the chat to add addRecentlyFoundChat chat_id:int53 = Ok; //@description Deletes chat from the list of recently found chats @chat_id Identifier of the chat to delete deleteRecentlyFoundChat chat_id:int53 = Ok; //@description Clears list of recently found chats deleteRecentlyFoundChats = Ok; //@description Returns list of common chats with an other given user. Chats are sorted by their type and creation date @user_id User identifier @offset_chat_id Chat identifier to return chats from, use 0 for the first request @limit Maximum number of chats to be returned, up to 100 getCommonChats user_id:int offset_chat_id:int53 limit:int = Chats; //@description Returns list of created public chats getCreatedPublicChats = Chats; //@description Returns messages in a chat. Returns result in reverse chronological order, i.e. in order of decreasing message.message_id. Offline request if only_local is true @chat_id Chat identifier //@from_message_id Identifier of the message near which we need a history, you can use 0 to get results from the beginning, i.e. from oldest to newest //@offset Specify 0 to get results exactly from from_message_id or negative offset to get specified message and some newer messages //@limit Maximum number of messages to be returned, should be positive and can't be greater than 100. If offset is negative, limit must be greater than -offset. There may be less than limit messages returned even the end of the history is not reached //@only_local Return only locally available messages without sending network requests getChatHistory chat_id:int53 from_message_id:int53 offset:int limit:int only_local:Bool = Messages; //@description Deletes all messages in the chat. Can't be used for channel chats @chat_id Chat identifier @remove_from_chat_list Pass true, if chat should be removed from the chat list deleteChatHistory chat_id:int53 remove_from_chat_list:Bool = Ok; //@description Searches for messages with given words in the chat. Returns result in reverse chronological order, i. e. in order of decreasing message_id. Doesn't work in secret chats with non-empty query (searchSecretMessages should be used instead) or without enabled message database @chat_id Chat identifier to search messages in //@query Query to search for //@sender_user_id If not 0, only messages sent by the specified user will be returned. Doesn't supported in secret chats //@from_message_id Identifier of the message from which we need a history, you can use 0 to get results from the beginning //@offset Specify 0 to get results exactly from from_message_id or negative offset to get specified message and some newer messages //@limit Maximum number of messages to be returned, should be positive and can't be greater than 100. If offset is negative, limit must be greater than -offset. There may be less than limit messages returned even the end of the history is not reached //@filter Filter for content of the searched messages searchChatMessages chat_id:int53 query:string sender_user_id:int from_message_id:int53 offset:int limit:int filter:SearchMessagesFilter = Messages; //@description Searches for messages in all chats except secret chats. Returns result in reverse chronological order, i. e. in order of decreasing (date, chat_id, message_id) //@query Query to search for //@offset_date Date of the message to search from, you can use 0 or any date in the future to get results from the beginning //@offset_chat_id Chat identifier of the last found message or 0 for the first request //@offset_message_id Message identifier of the last found message or 0 for the first request //@limit Maximum number of messages to be returned, at most 100 searchMessages query:string offset_date:int offset_chat_id:int53 offset_message_id:int53 limit:int = Messages; //@description Searches for messages in secret chats. Returns result in reverse chronological order @chat_id Identifier of a chat to search in. Specify 0 to search in all secret chats @query Query to search for. If empty, searchChatMessages should be used instead //@from_search_id Identifier from the result of previous request, use 0 to get results from the beginning @limit Maximum number of messages to be returned, can't be greater than 100 @filter Filter for content of searched messages searchSecretMessages chat_id:int53 query:string from_search_id:int64 limit:int filter:SearchMessagesFilter = FoundMessages; //@description Searches for call messages. Returns result in reverse chronological order, i. e. in order of decreasing message_id @from_message_id Identifier of the message from which to search, you can use 0 to get results from beginning //@limit Maximum number of messages to be returned, can't be greater than 100. There may be less than limit messages returned even the end of the history is not reached filter @only_missed If true, return only messages with missed calls searchCallMessages from_message_id:int53 limit:int only_missed:Bool = Messages; //@description Returns public HTTPS link to a message. Available only for messages in public channels @chat_id Identifier of the chat, message belongs to @message_id Identifier of the message getPublicMessageLink chat_id:int53 message_id:int53 = PublicMessageLink; //@description Sends a message. Returns sent message @chat_id Chat to send message @reply_to_message_id Identifier of a message to reply to or 0 //@disable_notification Pass true, to disable notification about the message, doesn't works in secret chats @from_background Pass true, if the message is sent from background //@reply_markup Bots only. Markup for replying to message @input_message_content Content of a message to send sendMessage chat_id:int53 reply_to_message_id:int53 disable_notification:Bool from_background:Bool reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; //@description Invites bot to a chat (if it is not in the chat) and send /start to it. Bot can't be invited to a private chat other than chat with the bot. Bots can't be invited to broadcast channel chats and secret chats. Returns sent message //@bot_user_id Identifier of the bot @chat_id Identifier of the chat @parameter Hidden parameter sent to bot for deep linking (https://api.telegram.org/bots#deep-linking) sendBotStartMessage bot_user_id:int chat_id:int53 parameter:string = Message; //@description Sends result of the inline query as a message. Returns sent message. Always clears chat draft message @chat_id Chat to send message @reply_to_message_id Identifier of a message to reply to or 0 //@disable_notification Pass true, to disable notification about the message, doesn't works in secret chats @from_background Pass true, if the message is sent from background //@query_id Identifier of the inline query @result_id Identifier of the inline result sendInlineQueryResultMessage chat_id:int53 reply_to_message_id:int53 disable_notification:Bool from_background:Bool query_id:int64 result_id:string = Message; //@description Forwards previously sent messages. Returns forwarded messages in the same order as message identifiers passed in message_ids. If message can't be forwarded, null will be returned instead of the message //@chat_id Identifier of a chat to forward messages @from_chat_id Identifier of a chat to forward from @message_ids Identifiers of messages to forward //@disable_notification Pass true, to disable notification about the message, doesn't works if messages are forwarded to secret chat @from_background Pass true, if the message is sent from background forwardMessages chat_id:int53 from_chat_id:int53 message_ids:vector disable_notification:Bool from_background:Bool = Messages; //@description Changes current ttl setting in a secret chat and sends corresponding message @chat_id Chat identifier @ttl New value of ttl in seconds sendChatSetTtlMessage chat_id:int53 ttl:int = Message; //@description Sends notification about screenshot taken in a chat. Works only in private and secret chats @chat_id Chat identifier sendChatScreenshotTakenNotification chat_id:int53 = Ok; //@description Deletes messages @chat_id Chat identifier @message_ids Identifiers of messages to delete @revoke Pass true to try to delete sent messages for all chat members (may fail if messages are too old). Is always true for Channels and SecretChats deleteMessages chat_id:int53 message_ids:vector revoke:Bool = Ok; //@description Deletes all messages in the chat sent by the specified user. Works only in supergroup channel chats, needs can_delete_messages administrator privileges @chat_id Chat identifier @user_id User identifier deleteMessagesFromUser chat_id:int53 user_id:int = Ok; //@description Edits text of text or game message. Non-bots can edit message in a limited period of time. Returns edited message after edit is complete server side //@chat_id Chat the message belongs to @message_id Identifier of the message @reply_markup Bots only. New message reply markup @input_message_content New text content of the message. Should be of type InputMessageText editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; //@description Edits message content caption. Non-bots can edit message in a limited period of time. Returns edited message after edit is complete server side //@chat_id Chat the message belongs to @message_id Identifier of the message @reply_markup Bots only. New message reply markup @caption New message content caption, 0-200 characters editMessageCaption chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:string = Message; //@description Bots only. Edits message reply markup. Returns edited message after edit is complete server side //@chat_id Chat the message belongs to @message_id Identifier of the message @reply_markup New message reply markup editMessageReplyMarkup chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Message; //@description Bots only. Edits text of an inline text or game message sent via bot @inline_message_id Inline message identifier @reply_markup New message reply markup @input_message_content New text content of the message. Should be of type InputMessageText editInlineMessageText inline_message_id:string reply_markup:ReplyMarkup input_message_content:InputMessageContent = Ok; //@description Bots only. Edits caption of an inline message content sent via bot @inline_message_id Inline message identifier @reply_markup New message reply markup @caption New message content caption, 0-200 characters editInlineMessageCaption inline_message_id:string reply_markup:ReplyMarkup caption:string = Ok; //@description Bots only. Edits reply markup of an inline message sent via bot @inline_message_id Inline message identifier @reply_markup New message reply markup editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup = Ok; //@description Returns all mentions, hashtags, bot commands, URLs and emails contained in the text. Offline method. Can be called before authorization. Can be called synchronously @text Text to find entites in getTextEntities text:string = TextEntities; //@description Returns file's mime type guessing only by its extension. Returns empty string on failure. Offline method. Can be called before authorization. Can be called synchronously @file_name Name of the file or path to the file getFileMimeType file_name:string = Text; //@description Returns file's extension guessing only by its mime type. Returns empty string on failure. Offline method. Can be called before authorization. Can be called synchronously @mime_type Mime type of the file getFileExtension mime_type:string = Text; //@description Sends inline query to a bot and returns its results. Returns error with code 502 if bot fails to answer the query before query timeout expires. Unavailable for bots @bot_user_id Identifier of the bot send query to //@chat_id Identifier of the chat, where the query is sent @user_location User location, only if needed @query Text of the query @offset Offset of the first entry to return getInlineQueryResults bot_user_id:int chat_id:int53 user_location:location query:string offset:string = InlineQueryResults; //@description Bots only. Sets result of an inline query @inline_query_id Identifier of the inline query @is_personal Does result of the query can be cached only for specified user //@results Results of the query @cache_time Allowed time to cache results of the query in seconds @next_offset Offset for the next inline query, pass empty string if there is no more results //@switch_pm_text If non-empty, this text should be shown on the button, which opens private chat with the bot and sends bot start message with parameter switch_pm_parameter @switch_pm_parameter Parameter for the bot start message answerInlineQuery inline_query_id:int64 is_personal:Bool results:vector cache_time:int next_offset:string switch_pm_text:string switch_pm_parameter:string = Ok; //@description Sends callback query to a bot and returns answer to it. Returns error with code 502 if bot fails to answer the query before query timeout expires. Unavailable for bots @chat_id Identifier of the chat with a message @message_id Identifier of the message, from which the query is originated @payload Query payload getCallbackQueryAnswer chat_id:int53 message_id:int53 payload:CallbackQueryPayload = CallbackQueryAnswer; //@description Bots only. Sets result of a callback query @callback_query_id Identifier of the callback query @text Text of the answer @show_alert If true, an alert should be shown to the user instead of a toast @url Url to be opened @cache_time Allowed time to cache result of the query in seconds answerCallbackQuery callback_query_id:int64 text:string show_alert:Bool url:string cache_time:int = Ok; //@description Bots only. Sets result of a shipping query @shipping_query_id Identifier of the shipping query @shipping_options Available shipping options @error_message Error message, empty on success answerShippingQuery shipping_query_id:int64 shipping_options:vector error_message:string = Ok; //@description Bots only. Sets result of a pre checkout query @pre_checkout_query_id Identifier of the pre-checkout query @error_message Error message, empty on success answerPreCheckoutQuery pre_checkout_query_id:int64 error_message:string = Ok; //@description Bots only. Updates game score of the specified user in the game @chat_id Chat a message with the game belongs to @message_id Identifier of the message @edit_message True, if message should be edited @user_id User identifier @score New score //@force Pass True to update the score even if it decreases. If score is 0, user will be deleted from the high scores table setGameScore chat_id:int53 message_id:int53 edit_message:Bool user_id:int score:int force:Bool = Message; //@description Bots only. Updates game score of the specified user in the game @inline_message_id Inline message identifier @edit_message True, if message should be edited @user_id User identifier @score New score //@force Pass True to update the score even if it decreases. If score is 0, user will be deleted from the high scores table setInlineGameScore inline_message_id:string edit_message:Bool user_id:int score:int force:Bool = Ok; //@description Bots only. Returns game high scores and some part of the score table around of the specified user in the game @chat_id Chat a message with the game belongs to @message_id Identifier of the message @user_id User identifie getGameHighScores chat_id:int53 message_id:int53 user_id:int = GameHighScores; //@description Bots only. Returns game high scores and some part of the score table around of the specified user in the game @inline_message_id Inline message identifier @user_id User identifier getInlineGameHighScores inline_message_id:string user_id:int = GameHighScores; //@description Deletes default reply markup from chat. This method needs to be called after one-time keyboard or ForceReply reply markup has been used. UpdateChatReplyMarkup will be send if reply markup will be changed @chat_id Chat identifier //@message_id Message identifier of used keyboard deleteChatReplyMarkup chat_id:int53 message_id:int53 = Ok; //@description Sends notification about user activity in a chat @chat_id Chat identifier @action Action description sendChatAction chat_id:int53 action:ChatAction = Ok; //@description Chat is opened by the user. Many useful activities depends on chat being opened or closed. For example, in channels all updates are received only for opened chats @chat_id Chat identifier openChat chat_id:int53 = Ok; //@description Chat is closed by the user. Many useful activities depends on chat being opened or closed. @chat_id Chat identifier closeChat chat_id:int53 = Ok; //@description Messages are viewed by the user. Many useful activities depends on message being viewed. For example, marking messages as read, incrementing of view counter, updating of view counter, removing of deleted messages in channels @chat_id Chat identifier @message_ids Identifiers of viewed messages viewMessages chat_id:int53 message_ids:vector = Ok; //@description Message content is opened, for example the user has opened a photo, a video, a document, a location or a venue or have listened to an audio or a voice message. You will receive updateOpenMessageContent if something has changed @chat_id Chat identifier of the message @message_id Identifier of the message with opened content openMessageContent chat_id:int53 message_id:int53 = Ok; //@description Returns existing chat corresponding to the given user @user_id User identifier createPrivateChat user_id:int = Chat; //@description Returns existing chat corresponding to the known group @group_id Group identifier createGroupChat group_id:int = Chat; //@description Returns existing chat corresponding to the known channel @channel_id Channel identifier createChannelChat channel_id:int = Chat; //@description Returns existing chat corresponding to the known secret chat @secret_chat_id SecretChat identifier createSecretChat secret_chat_id:int = Chat; //@description Creates new group chat and send corresponding messageGroupChatCreate, returns created chat @user_ids Identifiers of users to add to the group @title Title of new group chat, 1-255 characters createNewGroupChat user_ids:vector title:string = Chat; //@description Creates new channel chat and send corresponding messageChannelChatCreate, returns created chat @title Title of new channel chat, 1-255 characters @is_supergroup True, if supergroup chat should be created @param_description Channel description, 0-255 characters createNewChannelChat title:string is_supergroup:Bool description:string = Chat; //@description Creates new secret chat, returns created chat @user_id Identifier of a user to create secret chat with createNewSecretChat user_id:int = Chat; //@description Creates new channel supergroup chat from existing group chat and send corresponding messageChatMigrateTo and messageChatMigrateFrom. Deactivates group @chat_id Group chat identifier migrateGroupChatToChannelChat chat_id:int53 = Chat; //@description Changes chat title. Works only for group and channel chats. Requires administrator rights in groups and appropriate administrator right in channels. Title will not change before request to the server completes //@chat_id Chat identifier @title New title of the chat, 1-255 characters changeChatTitle chat_id:int53 title:string = Ok; //@description Changes chat photo. Works only for group and channel chats. Requires administrator rights in groups and appropriate administrator right in channels. Photo will not change before request to the server completes //@chat_id Chat identifier @photo New chat photo. You can use zero InputFileId to delete chat photo. Files accessible only by HTTP URL are not acceptable changeChatPhoto chat_id:int53 photo:InputFile = Ok; //@description Changes chat draft message @chat_id Chat identifier @draft_message New draft message, nullable changeChatDraftMessage chat_id:int53 draft_message:draftMessage = Ok; //@description Changes chat pinned state. You can pin up to getOption("pinned_chat_count_max") non-secret chats and the same number of secret chats @chat_id Chat identifier @is_pinned New value of is_pinned toggleChatIsPinned chat_id:int53 is_pinned:Bool = Ok; //@description Changes client data associated with a chat @chat_id Chat identifier @client_data New value of client_data setChatClientData chat_id:int53 client_data:string = Ok; //@description Adds new member to chat. Members can't be added to private or secret chats. Member will not be added until chat state will be synchronized with the server //@chat_id Chat identifier @user_id Identifier of the user to add @forward_limit Number of previous messages from chat to forward to new member, ignored for channel chats. Can't be greater than 300 addChatMember chat_id:int53 user_id:int forward_limit:int = Ok; //@description Adds many new members to the chat. Currently, available only for channels. Can't be used to join the channel. Members can't be added to broadcast channel if it has more than 200 members. Members will not be added until chat state will be synchronized with the server //@chat_id Chat identifier @user_ids Identifiers of the users to add addChatMembers chat_id:int53 user_ids:vector = Ok; //@description Changes status of the chat member, need appropriate privileges. This function is currently not suitable for adding new members to the chat, use addChatMember instead. Status will not be changed until chat state will be synchronized with the server //@chat_id Chat identifier @user_id Identifier of the user to edit status @status New status of the member in the chat changeChatMemberStatus chat_id:int53 user_id:int status:ChatMemberStatus = Ok; //@description Returns information about one participant of the chat @chat_id Chat identifier @user_id User identifier getChatMember chat_id:int53 user_id:int = ChatMember; //@description Searches for the specified query in the first name, last name and username among members of the specified chat. Requires administrator rights in broadcast channels @chat_id Chat identifier @query Query to search for @limit Maximum number of users to be returned searchChatMembers chat_id:int53 query:string limit:int = ChatMembers; //@description Changes list or order of pinned chats @chat_ids New list of pinned chats setPinnedChats chat_ids:vector = Ok; //@description Asynchronously downloads file from cloud. Updates updateFile will notify about download progress and successful download @file_id Identifier of file to download //@priority Priority of download, 1-32. The higher priority, the earlier file will be downloaded. If priorities of two files are equal then the last one for which downloadFile is called will be downloaded first downloadFile file_id:int priority:int = Ok; //@description Stops file downloading. If file is already downloaded, does nothing @file_id Identifier of file to cancel download cancelDownloadFile file_id:int = Ok; //@description Asynchronously uploads file to the cloud without sending it in a message. Updates updateFile will notify about upload progress and successful upload. The file will not have persistent identifier until it will be sent in a message @file File to upload @file_type File type //@priority Priority of upload, 1-32. The higher priority, the earlier file will be uploaded. If priorities of two files are equal then the first one for which uploadFile is called will be uploaded first uploadFile file:InputFile file_type:FileType priority:int = File; //@description Stops file uploading. Works only for files uploaded using uploadFile. For other files the behavior is undefined @file_id Identifier of file to cancel upload cancelUploadFile file_id:int = Ok; //@description Next part of a file was generated //@generation_id Identifier of the generation process //@size Full size of file in bytes, 0 if unknown. //@local_size Number of bytes already generated. Negative number means that generation has failed and should be terminated setFileGenerationProgress generation_id:int64 size:int local_size:int = Ok; //@description Finishes file generation @generation_id Identifier of the generation process finishFileGeneration generation_id:int64 = Ok; //@description Deletes a file from TDLib file cache @file_id Identifier of the file to delete deleteFile file_id:int = Ok; //@description Generates new chat invite link, previously generated link is revoked. Available for group and channel chats. In groups can be called only by creator, in channels requires appropriate rights @chat_id Chat identifier exportChatInviteLink chat_id:int53 = ChatInviteLink; //@description Checks chat invite link for validness and returns information about the corresponding chat @invite_link Invite link to check. Should begin with "https://t.me/joinchat/", "https://telegram.me/joinchat/" or "https://telegram.dog/joinchat/" checkChatInviteLink invite_link:string = ChatInviteLinkInfo; //@description Imports chat invite link, adds current user to a chat if possible. Member will not be added until chat state will be synchronized with the server //@invite_link Invite link to import. Should begin with "https://t.me/joinchat/", "https://telegram.me/joinchat/" or "https://telegram.dog/joinchat/" importChatInviteLink invite_link:string = Ok; //@description Creates new call @user_id Identifier of user to call @protocol Description of supported by the client call protocols createCall user_id:int protocol:callProtocol = CallId; //@description Accepts incoming call @call_id Call identifier @protocol Description of supported by the client call protocols acceptCall call_id:int protocol:callProtocol = Ok; //@description Discards a call @call_id Call identifier @is_disconnected True, if users was disconnected @duration Call duration in seconds @connection_id Identifier of a connection used during the call discardCall call_id:int is_disconnected:Bool duration:int connection_id:int64 = Ok; //@description Sends call rating @call_id Call identifier @rating Call rating, 1-5 @comment Optional user comment if rating is less than 5 rateCall call_id:int rating:int comment:string = Ok; //@description Sends call debug information @call_id Call identifier @debug Debug information in application specific format debugCall call_id:int debug:string = Ok; //@description Adds user to black list @user_id User identifier blockUser user_id:int = Ok; //@description Removes user from black list @user_id User identifier unblockUser user_id:int = Ok; //@description Returns users blocked by the current user @offset Number of users to skip in result, must be non-negative @limit Maximum number of users to return, can't be greater than 100 getBlockedUsers offset:int limit:int = Users; //@description Adds new contacts/edits existing contacts, contacts user identifiers are ignored @contacts List of contacts to import/edit importContacts contacts:vector = ImportedContacts; //@description Searches for specified query in the first name, last name and username of the known user contacts @query Query to search for, can be empty to return all contacts @limit Maximum number of users to be returned searchContacts query:string limit:int = Users; //@description Deletes users from contacts list @user_ids Identifiers of users to be deleted deleteContacts user_ids:vector = Ok; //@description Returns total number of imported contacts getImportedContactCount = Count; //@description Deletes all imported contacts deleteImportedContacts = Ok; //@description Returns profile photos of the user. Result of this query may be outdated: some photos may be already deleted @user_id User identifier @offset Photos to skip, must be non-negative @limit Maximum number of photos to be returned, can't be greater than 100 getUserProfilePhotos user_id:int offset:int limit:int = UserProfilePhotos; //@description Returns stickers from installed ordinary sticker sets corresponding to the given emoji. If emoji is not empty, elso favorite and recently used stickers may be returned @emoji String representation of emoji. If empty, returns all known stickers @limit Maximum number of stickers to return getStickers emoji:string limit:int = Stickers; //@description Returns list of installed sticker sets @is_masks Pass true to return mask sticker sets, pass false to return ordinary sticker sets getInstalledStickerSets is_masks:Bool = StickerSets; //@description Returns list of archived sticker sets @is_masks Pass true to return mask stickers sets, pass false to return ordinary sticker sets @offset_sticker_set_id Identifier of the sticker set from which return the result @limit Maximum number of sticker sets to return getArchivedStickerSets is_masks:Bool offset_sticker_set_id:int64 limit:int = StickerSets; //@description Returns list of trending sticker sets getTrendingStickerSets = StickerSets; //@description Returns list of sticker sets attached to a file, currently only photos and videos can have attached sticker sets @file_id File identifier getAttachedStickerSets file_id:int = StickerSets; //@description Returns information about sticker set by its identifier @set_id Identifier of the sticker set getStickerSet set_id:int64 = StickerSet; //@description Searches sticker set by its short name @name Name of the sticker set searchStickerSet name:string = StickerSet; //@description Installs/uninstalls or enables/archives sticker set @set_id Identifier of the sticker set @is_installed New value of is_installed @is_archived New value of is_archived. A sticker set can't be installed and archived simultaneously changeStickerSet set_id:int64 is_installed:Bool is_archived:Bool = Ok; //@description Informs that some trending sticker sets are viewed by the user @sticker_set_ids Identifiers of viewed trending sticker sets viewTrendingStickerSets sticker_set_ids:vector = Ok; //@description Changes the order of installed sticker sets @is_masks Pass true to change mask sticker sets order, pass false to change ordinary sticker sets order @sticker_set_ids Identifiers of installed sticker sets in the new right order reorderInstalledStickerSets is_masks:Bool sticker_set_ids:vector = Ok; //@description Returns list of recently used stickers @is_attached Pass true to return stickers and masks recently attached to photo or video files, pass false to return recently sent stickers getRecentStickers is_attached:Bool = Stickers; //@description Manually adds new sticker to the list of recently used stickers. New sticker is added to the beginning of the list. If the sticker is already in the list, at first it is removed from the list. Only stickers belonging to a sticker set can be added to the list //@is_attached Pass true to add the sticker to the list of stickers recently attached to photo or video files, pass false to add the sticker to the list of recently sent stickers @sticker Sticker file to add addRecentSticker is_attached:Bool sticker:InputFile = Stickers; //@description Removes a sticker from the list of recently used stickers @is_attached Pass true to remove the sticker from the list of stickers recently attached to photo or video files, pass false to remove the sticker from the list of recently sent stickers @sticker Sticker file to delete deleteRecentSticker is_attached:Bool sticker:InputFile = Ok; //@description Clears list of recently used stickers @is_attached Pass true to clear list of stickers recently attached to photo or video files, pass false to clear the list of recently sent stickers clearRecentStickers is_attached:Bool = Ok; //@description Returns favorite stickers getFavoriteStickers = Stickers; //@description Adds new sticker to the list of favorite stickers. New sticker is added to the beginning of the list. If the sticker is already in the list, at first it is removed from the list. Only stickers belonging to a sticker set can be added to the list //@sticker Sticker file to add addFavoriteSticker sticker:InputFile = Ok; //@description Removes a sticker from the list of favorite stickers @sticker Sticker file to delete from the list deleteFavoriteSticker sticker:InputFile = Ok; //@description Returns emojis corresponding to a sticker @sticker Sticker file identifier getStickerEmojis sticker:InputFile = StickerEmojis; //@description Returns saved animations getSavedAnimations = Animations; //@description Manually adds new animation to the list of saved animations. New animation is added to the beginning of the list. If the animation is already in the list, at first it is removed from the list. Only non-secret video animations with MIME type "video/mp4" can be added to the list //@animation Animation file to add. Only known to server animations (i. e. successfully sent via message) can be added to the list addSavedAnimation animation:InputFile = Ok; //@description Removes an animation from the list of saved animations @animation Animation file to delete deleteSavedAnimation animation:InputFile = Ok; //@description Returns up to 20 recently used inline bots in the order of the last usage getRecentInlineBots = Users; //@description Searches for recently used hashtags by their prefix @prefix Hashtag prefix to search for @limit Maximum number of hashtags to return searchHashtags prefix:string limit:int = Hashtags; //@description Deletes a hashtag from the list of recently used hashtags @hashtag The hashtag to delete deleteRecentHashtag hashtag:string = Ok; //@description Returns web page preview by text of the message. Do not call this function to often. Returns error 404 if web page has no preview @message_text Message text getWebPagePreview message_text:string = WebPage; //@description Returns web page instant view if available. Returns error 404 if web page has no instant view @url Web page URL @force_full If true, full web page instant view will be returned getWebPageInstantView url:string force_full:Bool = WebPageInstantView; //@description Returns notification settings for a given scope @scope Scope to return information about notification settings getNotificationSettings scope:NotificationSettingsScope = NotificationSettings; //@description Changes notification settings for a given scope @scope Scope to change notification settings //@notification_settings New notification settings for given scope setNotificationSettings scope:NotificationSettingsScope notification_settings:notificationSettings = Ok; //@description Resets all notification settings to the default value. By default the only muted chats are supergroups, sound is set to 'default' and message previews are showed resetAllNotificationSettings = Ok; //@description Uploads new profile photo for logged in user. If something changes, updateUser will be sent @photo Profile photo to set. inputFileId and inputFilePersistentId may be unsupported setProfilePhoto photo:InputFile = Ok; //@description Deletes profile photo. If something changes, updateUser will be sent @profile_photo_id Identifier of profile photo to delete deleteProfilePhoto profile_photo_id:int64 = Ok; //@description Changes first and last names of logged in user. If something changes, updateUser will be sent @first_name New value of user first name, 1-255 characters @last_name New value of optional user last name, 0-255 characters changeName first_name:string last_name:string = Ok; //@description Changes about information of logged in user @about New value of userFull.about, 0-70 characters without line feeds changeAbout about:string = Ok; //@description Changes username of logged in user. If something changes, updateUser will be sent @username New value of username. Use empty string to remove username changeUsername username:string = Ok; //@description Changes user's phone number and sends authentication code to the new user's phone number. Returns authStateWaitCode with information about sent code on success //@phone_number New user's phone number in any reasonable format @allow_flash_call Pass True, if code can be sent via flash call to the specified phone number @is_current_phone_number Pass true, if the phone number is used on the current device. Ignored if allow_flash_call is False changePhoneNumber phone_number:string allow_flash_call:Bool is_current_phone_number:Bool = AuthState; //@description Resends authentication code sent to change user's phone number. Wotks only if in previously received authStateWaitCode next_code_type was not null. Returns authStateWaitCode on success resendChangePhoneNumberCode = AuthState; //@description Checks authentication code sent to change user's phone number. Returns authStateOk on success @code Verification code from SMS, phone call or flash call checkChangePhoneNumberCode code:string = AuthState; //@description Returns all active sessions of logged in user getActiveSessions = Sessions; //@description Terminates another session of logged in user @session_id Session identifier terminateSession session_id:int64 = Ok; //@description Terminates all other sessions of logged in user terminateAllOtherSessions = Ok; //@description Gives or revokes all members of the group administrator rights. Needs creator privileges in the group @group_id Identifier of the group @everyone_is_administrator New value of everyone_is_administrator toggleGroupAdministrators group_id:int everyone_is_administrator:Bool = Ok; //@description Changes username of the channel. Needs creator privileges in the channel @channel_id Identifier of the channel @username New value of username. Use empty string to remove username changeChannelUsername channel_id:int username:string = Ok; //@description Changes sticker set of the channel. Needs appropriate rights in the channel @channel_id Identifier of the channel @sticker_set_id New value of channel sticker set identifier. Use 0 to remove channel sticker set setChannelStickerSet channel_id:int sticker_set_id:int64 = Ok; //@description Gives or revokes right to invite new members to all current members of the channel. Needs appropriate rights in the channel. Available only for supergroups @channel_id Identifier of the channel @anyone_can_invite New value of anyone_can_invite toggleChannelInvites channel_id:int anyone_can_invite:Bool = Ok; //@description Enables or disables sender signature on sent messages in the channel. Needs appropriate rights in the channel. Not available for supergroups @channel_id Identifier of the channel @sign_messages New value of sign_messages toggleChannelSignMessages channel_id:int sign_messages:Bool = Ok; //@description Changes information about the channel. Needs appropriate rights in the channel @channel_id Identifier of the channel @param_description New channel description, 0-255 characters changeChannelDescription channel_id:int description:string = Ok; //@description Pins a message in a supergroup channel chat. Needs appropriate rights in the channel @channel_id Identifier of the channel @message_id Identifier of the new pinned message @disable_notification True, if there should be no notification about the pinned message pinChannelMessage channel_id:int message_id:int53 disable_notification:Bool = Ok; //@description Removes pinned message in the supergroup channel. Needs appropriate rights in the channel @channel_id Identifier of the channel unpinChannelMessage channel_id:int = Ok; //@description Reports some supergroup channel messages from a user as spam messages @channel_id Channel identifier @user_id User identifier @message_ids Identifiers of messages sent in the supergroup by the user, the list should be non-empty reportChannelSpam channel_id:int user_id:int message_ids:vector = Ok; //@description Returns information about channel members or banned users. Can be used only if channel_full->can_get_members == true. Administrator privileges may be additionally needed for some filters @channel_id Identifier of the channel //@filter Kind of channel users to return, defaults to channelMembersRecent @offset Number of channel users to skip @limit Maximum number of users be returned, can't be greater than 200 getChannelMembers channel_id:int filter:ChannelMembersFilter offset:int limit:int = ChatMembers; //@description Deletes channel along with all messages in corresponding chat. Releases channel username and removes all members. Needs creator privileges in the channel. Channels with more than 1000 members can't be deleted @channel_id Identifier of the channel deleteChannel channel_id:int = Ok; //@description Closes secret chat, effectively transfering its state to "Closed" @secret_chat_id Secret chat identifier closeSecretChat secret_chat_id:int = Ok; //@description Returns list of service actions taken by chat members and administrators in the last 48 hours, available only in channels. Requires administrator rights. Returns result in reverse chronological order, i. e. in order of decreasing event_id //@chat_id Chat identifier @query Search query to filter events @from_event_id Identifier of an event from which to return result, you can use 0 to get results from the latest events @limit Maximum number of events to return, can't be greater than 100 //@filters Types of events to return, defaults to all @user_ids User identifiers, which events to return, defaults to all users getChatEventLog chat_id:int53 query:string from_event_id:int64 limit:int filters:chatEventLogFilters user_ids:vector = ChatEvents; //@description Returns invoice payment form. The method should be called when user presses inlineKeyboardButtonBuy @chat_id Chat identifier of the Invoice message @message_id Message identifier getPaymentForm chat_id:int53 message_id:int53 = PaymentForm; //@description Validates order information provided by the user and returns available shipping options for flexible invoice @chat_id Chat identifier of the Invoice message @message_id Message identifier @order_info Order information, provided by the user @allow_save True, if order information can be saved validateOrderInfo chat_id:int53 message_id:int53 order_info:orderInfo allow_save:Bool = ValidatedOrderInfo; //@description Sends filled payment form to the bot for the final verification @chat_id Chat identifier of the Invoice message @message_id Message identifier @order_info_id Identifier returned by ValidateOrderInfo or empty string @shipping_option_id Identifier of a chosen shipping option, if applicable //@credentials Credentials choosed by user for payment sendPaymentForm chat_id:int53 message_id:int53 order_info_id:string shipping_option_id:string credentials:InputCredentials = PaymentResult; //@description Returns information about successful payment @chat_id Chat identifier of the PaymentSuccessful message @message_id Message identifier getPaymentReceipt chat_id:int53 message_id:int53 = PaymentReceipt; //@description Returns saved order info if any getSavedOrderInfo = OrderInfo; //@description Deletes saved order info deleteSavedOrderInfo = Ok; //@description Deletes saved credentials for all payments provider bots deleteSavedCredentials = Ok; //@description Returns user that can be contacted to get support getSupportUser = User; //@description Returns background wallpapers getWallpapers = Wallpapers; //@description Registers current used device for receiving push notifications @device_token Device token registerDevice device_token:DeviceToken = Ok; //@description Changes privacy settings @key Privacy key @rules New privacy rules setPrivacy key:PrivacyKey rules:privacyRules = Ok; //@description Returns current privacy settings @key Privacy key getPrivacy key:PrivacyKey = PrivacyRules; //@description Returns value of an option by its name. See list of available options on https://core.telegram.org/tdlib/options. Can be called before authorization //@name Name of the option getOption name:string = OptionValue; //@description Sets value of an option. See list of available options on https://core.telegram.org/tdlib/options. Only writable options can be set. Can be called before authorization //@name Name of the option @value New value of the option setOption name:string value:OptionValue = Ok; //@description Changes period of inactivity, after which the account of currently logged in user will be automatically deleted @ttl New account TTL changeAccountTtl ttl:accountTtl = Ok; //@description Returns period of inactivity, after which the account of currently logged in user will be automatically deleted getAccountTtl = AccountTtl; //@description Deletes the account of currently logged in user, deleting from the server all information associated with it. Account's phone number can be used to create new account, but only once in two weeks @reason Optional reason of account deletion deleteAccount reason:string = Ok; //@description Returns current chat report spam state @chat_id Chat identifier getChatReportSpamState chat_id:int53 = ChatReportSpamState; //@description Reports chat as a spam chat or as not a spam chat. Can be used only if ChatReportSpamState.can_report_spam is true. After this request ChatReportSpamState.can_report_spam became false forever @chat_id Chat identifier @is_spam_chat If true, chat will be reported as a spam chat, otherwise it will be marked as not a spam chat changeChatReportSpamState chat_id:int53 is_spam_chat:Bool = Ok; //@description Reports chat to Telegram moderators. Can be used only for a channel chat or a private chat with a bot, because all other chats can't be checked by moderators @chat_id Chat identifier @reason Reason, the chat is reported reportChat chat_id:int53 reason:ChatReportReason = Ok; //@description Returns storage usage statistics @chat_limit Maximum number of chats with biggest storage usage for which separate statistics should be returned. All other chats will be grouped in entries with chat_id == 0. If chat info database is not used, chat_limit is ignored and is always set to 0 getStorageStatistics chat_limit:int = StorageStatistics; //@description Quickly returns approximate storage usage statistics getStorageStatisticsFast = StorageStatisticsFast; //@description Optimizes storage usage, i.e. deletes some files and return new storage usage statistics. Secret thumbnails can't be deleted //@size Limit on total size of files after deletion. Pass -1 to use default limit //@ttl Limit on time passed since last access time (or creation time on some filesystems) to a file. Pass -1 to use default limit //@count Limit on total count of files after deletion. Pass -1 to use default limit //@immunity_delay Number of seconds after creation of a file, it can't be delited. Pass -1 to use default value //@file_types If not empty, only files with given types are considered. By default, all types except thumbnails, profile photos, stickers and wallpapers are deleted //@chat_ids If not empty, only files from the given chats are considered. Use 0 as chat identifier to delete files not belonging to any chat, for example profile photos //@exclude_chat_ids If not empty, files from the given chats are exluded. Use 0 as chat identifier to exclude all files not belonging to any chat, for example profile photos //@chat_limit Same as in getStorageStatistics. Affects only returned statistics optimizeStorage size:int53 ttl:int count:int immunity_delay:int file_types:vector chat_ids:vector exclude_chat_ids:vector chat_limit:int = StorageStatistics; //@description Sets current network type. Can be called before authorization. Call to this method forces reopening of all network connections mitigating delay in switching between different networks, so it should be called whenever network is changed even network type remains the same. -Network type is used to check if library can use network at all and for collecting detailed network data usage statistics @type New network type, defaults to networkTypeNone setNetworkType type:NetworkType = Ok; //@description Returns network data usage statistics. Can be called before authorization @only_current If true, returns only data for the current library launch getNetworkStatistics only_current:Bool = NetworkStatistics; //@description Adds specified data to data usage statistics. Can be called before authorization @entry Network statistics entry with a data to add to statistics addNetworkStatistics entry:NetworkStatisticsEntry = Ok; //@description Resets all network data usage statistics to zero. Can be called before authorization resetNetworkStatistics = Ok; //@description Bots only. Informs server about number of pending bot updates if they aren't processed for a long time @pending_update_count Number of pending updates @error_message Last error's message setBotUpdatesStatus pending_update_count:int error_message:string = Ok; //@description Bots only. Uploads a png image with a sticker. Returns uploaded file @user_id Sticker file owner @png_sticker Png image with the sticker, must be up to 512 kilobytes in size and fit in 512x512 square uploadStickerFile user_id:int png_sticker:InputFile = File; //@description Bots only. Creates new sticker set. Returns created sticker set @user_id Sticker set owner @title Sticker set title, 1-64 characters @name Sticker set name. Can contain only english letters, digits and underscores. Should end on *"_by_"*. ** is case insensitive, 1-64 characters //@is_masks True, is stickers are masks @stickers List of stickers to add to the set createNewStickerSet user_id:int title:string name:string is_masks:Bool stickers:vector = StickerSet; //@description Bots only. Adds new sticker to a set. Returns the sticker set @user_id Sticker set owner @name Sticker set name @sticker Sticker to add to the set addStickerToSet user_id:int name:string sticker:inputSticker = StickerSet; //@description Bots only. Changes position of a sticker in the set it belongs to. Sticker set should be created by the bot @sticker The sticker @position New sticker position in the set, zero-based setStickerPositionInSet sticker:InputFile position:int = Ok; //@description Bots only. Deletes a sticker from the set it belongs to. Sticker set should be created by the bot @sticker The sticker deleteStickerFromSet sticker:InputFile = Ok; //@description Bots only. Sends custom request @method Method name @parameters JSON-serialized method parameters sendCustomRequest method:string parameters:string = CustomRequestResult; //@description Bots only. Answers a custom query @custom_query_id Identifier of a custom query @data JSON-serialized answer to the query answerCustomQuery custom_query_id:int64 data:string = Ok; //@description Returns Ok after specified amount of the time passed. Can be called before authorization @seconds Number of seconds before that function returns setAlarm seconds:double = Ok; //@description Returns invite text for invitation of new users getInviteText = Text; //@description Returns terms of service. Can be called before authorization getTermsOfService = Text; //@description Sets proxy server for network requests. Can be called before authorization @proxy The proxy to use. You can specify null to remove proxy server setProxy proxy:Proxy = Ok; //@description Returns current set up proxy. Can be called before authorization getProxy = Proxy; //@description Test request. Does nothing testCallEmpty = Ok; //@description Test request. Returns back received string @x String to return testCallString x:string = TestString; //@description Test request. Returns back received bytes @x Bytes to return testCallBytes x:bytes = TestBytes; //@description Test request. Returns back received vector of numbers @x Vector of numbers to return testCallVectorInt x:vector = TestVectorInt; //@description Test request. Returns back received vector of objects containing a number @x Vector of objects to return testCallVectorIntObject x:vector = TestVectorIntObject; //@description Test request. Returns back received vector of strings @x Vector of strings to return testCallVectorString x:vector = TestVectorString; //@description Test request. Returns back received vector of objects containing a string @x Vector of objects to return testCallVectorStringObject x:vector = TestVectorStringObject; //@description Test request. Returns squared received number @x Number to square testSquareInt x:int = TestInt; //@description Test request. Sends simple network request to telegram servers testNetwork = Ok; //@description Test request. Forces updates.getDifference call to telegram servers testGetDifference = Ok; //@description Test request. Does nothing, ensures that the Update object is used testUseUpdate = Update; //@description Test request. Does nothing, ensures that the Error object is used testUseError = Error; { "constructors": [ { "id": "-1132882121", "predicate": "boolFalse", "params": [], "type": "Bool" }, { "id": "-1720552011", "predicate": "boolTrue", "params": [], "type": "Bool" }, { "id": "481674261", "predicate": "vector", "params": [], "type": "Vector t" }, { "id": "-994444869", "predicate": "error", "params": [ { "name": "code", "type": "int" }, { "name": "text", "type": "string" } ], "type": "Error" }, { "id": "1450380236", "predicate": "null", "params": [], "type": "Null" }, { "id": "2134579434", "predicate": "inputPeerEmpty", "params": [], "type": "InputPeer" }, { "id": "2107670217", "predicate": "inputPeerSelf", "params": [], "type": "InputPeer" }, { "id": "270785512", "predicate": "inputPeerContact", "params": [ { "name": "user_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1690012891", "predicate": "inputPeerForeign", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "396093539", "predicate": "inputPeerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1182234929", "predicate": "inputUserEmpty", "params": [], "type": "InputUser" }, { "id": "-138301121", "predicate": "inputUserSelf", "params": [], "type": "InputUser" }, { "id": "-2031530139", "predicate": "inputUserContact", "params": [ { "name": "user_id", "type": "int" } ], "type": "InputUser" }, { "id": "1700689151", "predicate": "inputUserForeign", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputUser" }, { "id": "-208488460", "predicate": "inputPhoneContact", "params": [ { "name": "client_id", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputContact" }, { "id": "-181407105", "predicate": "inputFile", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" }, { "name": "md5_checksum", "type": "string" } ], "type": "InputFile" }, { "id": "-1771768449", "predicate": "inputMediaEmpty", "params": [], "type": "InputMedia" }, { "id": "767900285", "predicate": "inputMediaUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" } ], "type": "InputMedia" }, { "id": "-1893027092", "predicate": "inputMediaPhoto", "params": [ { "name": "id", "type": "InputPhoto" } ], "type": "InputMedia" }, { "id": "-104578748", "predicate": "inputMediaGeoPoint", "params": [ { "name": "geo_point", "type": "InputGeoPoint" } ], "type": "InputMedia" }, { "id": "-1494984313", "predicate": "inputMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputMedia" }, { "id": "322623222", "predicate": "inputMediaUploadedVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1726817601", "predicate": "inputMediaUploadedThumbVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "2130852582", "predicate": "inputMediaVideo", "params": [ { "name": "id", "type": "InputVideo" } ], "type": "InputMedia" }, { "id": "480546647", "predicate": "inputChatPhotoEmpty", "params": [], "type": "InputChatPhoto" }, { "id": "-1809496270", "predicate": "inputChatUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-1293828344", "predicate": "inputChatPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-457104426", "predicate": "inputGeoPointEmpty", "params": [], "type": "InputGeoPoint" }, { "id": "-206066487", "predicate": "inputGeoPoint", "params": [ { "name": "lat", "type": "double" }, { "name": "long", "type": "double" } ], "type": "InputGeoPoint" }, { "id": "483901197", "predicate": "inputPhotoEmpty", "params": [], "type": "InputPhoto" }, { "id": "-74070332", "predicate": "inputPhoto", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputPhoto" }, { "id": "1426648181", "predicate": "inputVideoEmpty", "params": [], "type": "InputVideo" }, { "id": "-296249774", "predicate": "inputVideo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputVideo" }, { "id": "342061462", "predicate": "inputFileLocation", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1023632620", "predicate": "inputVideoFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-1377390588", "predicate": "inputPhotoCropAuto", "params": [], "type": "InputPhotoCrop" }, { "id": "-644787419", "predicate": "inputPhotoCrop", "params": [ { "name": "crop_left", "type": "double" }, { "name": "crop_top", "type": "double" }, { "name": "crop_width", "type": "double" } ], "type": "InputPhotoCrop" }, { "id": "1996904104", "predicate": "inputAppEvent", "params": [ { "name": "time", "type": "double" }, { "name": "type", "type": "string" }, { "name": "peer", "type": "long" }, { "name": "data", "type": "string" } ], "type": "InputAppEvent" }, { "id": "-1649296275", "predicate": "peerUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "Peer" }, { "id": "-1160714821", "predicate": "peerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Peer" }, { "id": "-1432995067", "predicate": "storage.fileUnknown", "params": [], "type": "storage.FileType" }, { "id": "8322574", "predicate": "storage.fileJpeg", "params": [], "type": "storage.FileType" }, { "id": "-891180321", "predicate": "storage.fileGif", "params": [], "type": "storage.FileType" }, { "id": "172975040", "predicate": "storage.filePng", "params": [], "type": "storage.FileType" }, { "id": "-1373745011", "predicate": "storage.filePdf", "params": [], "type": "storage.FileType" }, { "id": "1384777335", "predicate": "storage.fileMp3", "params": [], "type": "storage.FileType" }, { "id": "1258941372", "predicate": "storage.fileMov", "params": [], "type": "storage.FileType" }, { "id": "1086091090", "predicate": "storage.filePartial", "params": [], "type": "storage.FileType" }, { "id": "-1278304028", "predicate": "storage.fileMp4", "params": [], "type": "storage.FileType" }, { "id": "276907596", "predicate": "storage.fileWebp", "params": [], "type": "storage.FileType" }, { "id": "2086234950", "predicate": "fileLocationUnavailable", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "1406570614", "predicate": "fileLocation", "params": [ { "name": "dc_id", "type": "int" }, { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "537022650", "predicate": "userEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "User" }, { "id": "476112392", "predicate": "userSelf", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "phone", "type": "string" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" } ], "type": "User" }, { "id": "-894214632", "predicate": "userContact", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "access_hash", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" } ], "type": "User" }, { "id": "-640891665", "predicate": "userRequest", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "access_hash", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" } ], "type": "User" }, { "id": "123533224", "predicate": "userForeign", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "access_hash", "type": "long" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" } ], "type": "User" }, { "id": "-704549510", "predicate": "userDeleted", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "User" }, { "id": "1326562017", "predicate": "userProfilePhotoEmpty", "params": [], "type": "UserProfilePhoto" }, { "id": "-715532088", "predicate": "userProfilePhoto", "params": [ { "name": "photo_id", "type": "long" }, { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "UserProfilePhoto" }, { "id": "164646985", "predicate": "userStatusEmpty", "params": [], "type": "UserStatus" }, { "id": "-306628279", "predicate": "userStatusOnline", "params": [ { "name": "expires", "type": "int" } ], "type": "UserStatus" }, { "id": "9203775", "predicate": "userStatusOffline", "params": [ { "name": "was_online", "type": "int" } ], "type": "UserStatus" }, { "id": "-1683826688", "predicate": "chatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Chat" }, { "id": "1855757255", "predicate": "chat", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "left", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Chat" }, { "id": "-83047359", "predicate": "chatForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "date", "type": "int" } ], "type": "Chat" }, { "id": "1661886910", "predicate": "chatFull", "params": [ { "name": "id", "type": "int" }, { "name": "participants", "type": "ChatParticipants" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "ChatFull" }, { "id": "-925415106", "predicate": "chatParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "265468810", "predicate": "chatParticipantsForbidden", "params": [ { "name": "chat_id", "type": "int" } ], "type": "ChatParticipants" }, { "id": "2017571861", "predicate": "chatParticipants", "params": [ { "name": "chat_id", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "version", "type": "int" } ], "type": "ChatParticipants" }, { "id": "935395612", "predicate": "chatPhotoEmpty", "params": [], "type": "ChatPhoto" }, { "id": "1632839530", "predicate": "chatPhoto", "params": [ { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "ChatPhoto" }, { "id": "-2082087340", "predicate": "messageEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Message" }, { "id": "-1481959023", "predicate": "message", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "to_id", "type": "Peer" }, { "name": "fwd_from_id", "type": "flags.2?int" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" } ], "type": "Message" }, { "id": "495384334", "predicate": "messageService", "params": [ { "name": "flags", "type": "int" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "Message" }, { "id": "1038967584", "predicate": "messageMediaEmpty", "params": [], "type": "MessageMedia" }, { "id": "-926655958", "predicate": "messageMediaPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageMedia" }, { "id": "-1563278704", "predicate": "messageMediaVideo", "params": [ { "name": "video", "type": "Video" } ], "type": "MessageMedia" }, { "id": "1457575028", "predicate": "messageMediaGeo", "params": [ { "name": "geo", "type": "GeoPoint" } ], "type": "MessageMedia" }, { "id": "1585262393", "predicate": "messageMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "user_id", "type": "int" } ], "type": "MessageMedia" }, { "id": "-1618676578", "predicate": "messageMediaUnsupported", "params": [], "type": "MessageMedia" }, { "id": "-1230047312", "predicate": "messageActionEmpty", "params": [], "type": "MessageAction" }, { "id": "-1503425638", "predicate": "messageActionChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "users", "type": "Vector" } ], "type": "MessageAction" }, { "id": "-1247687078", "predicate": "messageActionChatEditTitle", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "2144015272", "predicate": "messageActionChatEditPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageAction" }, { "id": "-1780220945", "predicate": "messageActionChatDeletePhoto", "params": [], "type": "MessageAction" }, { "id": "1581055051", "predicate": "messageActionChatAddUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1297179892", "predicate": "messageActionChatDeleteUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1042448310", "predicate": "dialog", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Dialog" }, { "id": "590459437", "predicate": "photoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Photo" }, { "id": "582313809", "predicate": "photo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "caption", "type": "string" }, { "name": "geo", "type": "GeoPoint" }, { "name": "sizes", "type": "Vector" } ], "type": "Photo" }, { "id": "236446268", "predicate": "photoSizeEmpty", "params": [ { "name": "type", "type": "string" } ], "type": "PhotoSize" }, { "id": "2009052699", "predicate": "photoSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "size", "type": "int" } ], "type": "PhotoSize" }, { "id": "-374917894", "predicate": "photoCachedSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "PhotoSize" }, { "id": "-1056548696", "predicate": "videoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Video" }, { "id": "948937617", "predicate": "video", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "caption", "type": "string" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "Video" }, { "id": "286776671", "predicate": "geoPointEmpty", "params": [], "type": "GeoPoint" }, { "id": "541710092", "predicate": "geoPoint", "params": [ { "name": "long", "type": "double" }, { "name": "lat", "type": "double" } ], "type": "GeoPoint" }, { "id": "-2128698738", "predicate": "auth.checkedPhone", "params": [ { "name": "phone_registered", "type": "Bool" } ], "type": "auth.CheckedPhone" }, { "id": "-269659687", "predicate": "auth.sentCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "-155815004", "predicate": "auth.authorization", "params": [ { "name": "expires", "type": "int" }, { "name": "user", "type": "User" } ], "type": "auth.Authorization" }, { "id": "-543777747", "predicate": "auth.exportedAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.ExportedAuthorization" }, { "id": "-1195615476", "predicate": "inputNotifyPeer", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "InputNotifyPeer" }, { "id": "423314455", "predicate": "inputNotifyUsers", "params": [], "type": "InputNotifyPeer" }, { "id": "1251338318", "predicate": "inputNotifyChats", "params": [], "type": "InputNotifyPeer" }, { "id": "-1540769658", "predicate": "inputNotifyAll", "params": [], "type": "InputNotifyPeer" }, { "id": "-265263912", "predicate": "inputPeerNotifyEventsEmpty", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "-395694988", "predicate": "inputPeerNotifyEventsAll", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "1185074840", "predicate": "inputPeerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "InputPeerNotifySettings" }, { "id": "-1378534221", "predicate": "peerNotifyEventsEmpty", "params": [], "type": "PeerNotifyEvents" }, { "id": "1830677896", "predicate": "peerNotifyEventsAll", "params": [], "type": "PeerNotifyEvents" }, { "id": "1889961234", "predicate": "peerNotifySettingsEmpty", "params": [], "type": "PeerNotifySettings" }, { "id": "-1923214866", "predicate": "peerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "PeerNotifySettings" }, { "id": "-860866985", "predicate": "wallPaper", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "sizes", "type": "Vector" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "1997575642", "predicate": "userFull", "params": [ { "name": "user", "type": "User" }, { "name": "link", "type": "contacts.Link" }, { "name": "profile_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "blocked", "type": "Bool" }, { "name": "real_first_name", "type": "string" }, { "name": "real_last_name", "type": "string" } ], "type": "UserFull" }, { "id": "-116274796", "predicate": "contact", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual", "type": "Bool" } ], "type": "Contact" }, { "id": "-805141448", "predicate": "importedContact", "params": [ { "name": "user_id", "type": "int" }, { "name": "client_id", "type": "long" } ], "type": "ImportedContact" }, { "id": "1444661369", "predicate": "contactBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ContactBlocked" }, { "id": "1038193057", "predicate": "contactSuggested", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual_contacts", "type": "int" } ], "type": "ContactSuggested" }, { "id": "-748155807", "predicate": "contactStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "ContactStatus" }, { "id": "909233996", "predicate": "chatLocated", "params": [ { "name": "chat_id", "type": "int" }, { "name": "distance", "type": "int" } ], "type": "ChatLocated" }, { "id": "986597452", "predicate": "contacts.link", "params": [ { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" }, { "name": "user", "type": "User" } ], "type": "contacts.Link" }, { "id": "-1219778094", "predicate": "contacts.contactsNotModified", "params": [], "type": "contacts.Contacts" }, { "id": "1871416498", "predicate": "contacts.contacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Contacts" }, { "id": "-1387117803", "predicate": "contacts.importedContacts", "params": [ { "name": "imported", "type": "Vector" }, { "name": "retry_contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ImportedContacts" }, { "id": "471043349", "predicate": "contacts.blocked", "params": [ { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "-1878523231", "predicate": "contacts.blockedSlice", "params": [ { "name": "count", "type": "int" }, { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "1447681221", "predicate": "contacts.suggested", "params": [ { "name": "results", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Suggested" }, { "id": "364538944", "predicate": "messages.dialogs", "params": [ { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "1910543603", "predicate": "messages.dialogsSlice", "params": [ { "name": "count", "type": "int" }, { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "-1938715001", "predicate": "messages.messages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "189033187", "predicate": "messages.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "1062078024", "predicate": "messages.messageEmpty", "params": [], "type": "messages.Message" }, { "id": "131615560", "predicate": "messages.statedMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.StatedMessages" }, { "id": "-1776022422", "predicate": "messages.statedMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.StatedMessage" }, { "id": "-1878086592", "predicate": "messages.sentMessage", "params": [ { "name": "id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.SentMessage" }, { "id": "1694474197", "predicate": "messages.chats", "params": [ { "name": "chats", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "-438840932", "predicate": "messages.chatFull", "params": [ { "name": "full_chat", "type": "ChatFull" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.ChatFull" }, { "id": "-1269012015", "predicate": "messages.affectedHistory", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "1474492012", "predicate": "inputMessagesFilterEmpty", "params": [], "type": "MessagesFilter" }, { "id": "-1777752804", "predicate": "inputMessagesFilterPhotos", "params": [], "type": "MessagesFilter" }, { "id": "-1614803355", "predicate": "inputMessagesFilterVideo", "params": [], "type": "MessagesFilter" }, { "id": "1458172132", "predicate": "inputMessagesFilterPhotoVideo", "params": [], "type": "MessagesFilter" }, { "id": "-648121413", "predicate": "inputMessagesFilterPhotoVideoDocuments", "params": [], "type": "MessagesFilter" }, { "id": "-1629621880", "predicate": "inputMessagesFilterDocument", "params": [], "type": "MessagesFilter" }, { "id": "-808946398", "predicate": "inputMessagesFilterAudio", "params": [], "type": "MessagesFilter" }, { "id": "522914557", "predicate": "updateNewMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1318109142", "predicate": "updateMessageID", "params": [ { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Update" }, { "id": "777696872", "predicate": "updateReadMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-1576161051", "predicate": "updateDeleteMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1548249383", "predicate": "updateUserTyping", "params": [ { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "-1704596961", "predicate": "updateChatUserTyping", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "125178264", "predicate": "updateChatParticipants", "params": [ { "name": "participants", "type": "ChatParticipants" } ], "type": "Update" }, { "id": "469489699", "predicate": "updateUserStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "Update" }, { "id": "-1489818765", "predicate": "updateUserName", "params": [ { "name": "user_id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "Update" }, { "id": "-1791935732", "predicate": "updateUserPhoto", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "previous", "type": "Bool" } ], "type": "Update" }, { "id": "628472761", "predicate": "updateContactRegistered", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1657903163", "predicate": "updateContactLink", "params": [ { "name": "user_id", "type": "int" }, { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" } ], "type": "Update" }, { "id": "-1895411046", "predicate": "updateNewAuthorization", "params": [ { "name": "auth_key_id", "type": "long" }, { "name": "date", "type": "int" }, { "name": "device", "type": "string" }, { "name": "location", "type": "string" } ], "type": "Update" }, { "id": "-1519637954", "predicate": "updates.state", "params": [ { "name": "pts", "type": "int" }, { "name": "qts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "unread_count", "type": "int" } ], "type": "updates.State" }, { "id": "1567990072", "predicate": "updates.differenceEmpty", "params": [ { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "updates.Difference" }, { "id": "16030880", "predicate": "updates.difference", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-1459938943", "predicate": "updates.differenceSlice", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "intermediate_state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-484987010", "predicate": "updatesTooLong", "params": [], "type": "Updates" }, { "id": "-312729305", "predicate": "updateShortMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?int" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" } ], "type": "Updates" }, { "id": "1378061116", "predicate": "updateShortChatMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "chat_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?int" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" } ], "type": "Updates" }, { "id": "2027216577", "predicate": "updateShort", "params": [ { "name": "update", "type": "Update" }, { "name": "date", "type": "int" } ], "type": "Updates" }, { "id": "1918567619", "predicate": "updatesCombined", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq_start", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "1957577280", "predicate": "updates", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "-1916114267", "predicate": "photos.photos", "params": [ { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "352657236", "predicate": "photos.photosSlice", "params": [ { "name": "count", "type": "int" }, { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "539045032", "predicate": "photos.photo", "params": [ { "name": "photo", "type": "Photo" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photo" }, { "id": "157948117", "predicate": "upload.file", "params": [ { "name": "type", "type": "storage.FileType" }, { "name": "mtime", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "upload.File" }, { "id": "784507964", "predicate": "dcOption", "params": [ { "name": "id", "type": "int" }, { "name": "hostname", "type": "string" }, { "name": "ip_address", "type": "string" }, { "name": "port", "type": "int" } ], "type": "DcOption" }, { "id": "1047491370", "predicate": "config", "params": [ { "name": "date", "type": "int" }, { "name": "expires", "type": "int" }, { "name": "test_mode", "type": "Bool" }, { "name": "this_dc", "type": "int" }, { "name": "dc_options", "type": "Vector" }, { "name": "chat_size_max", "type": "int" }, { "name": "broadcast_size_max", "type": "int" }, { "name": "online_update_period_ms", "type": "int" }, { "name": "offline_blur_timeout_ms", "type": "int" }, { "name": "offline_idle_timeout_ms", "type": "int" }, { "name": "online_cloud_timeout_ms", "type": "int" }, { "name": "notify_cloud_delay_ms", "type": "int" }, { "name": "notify_default_delay_ms", "type": "int" }, { "name": "chat_big_size", "type": "int" }, { "name": "disabled_features", "type": "Vector" } ], "type": "Config" }, { "id": "-1910892683", "predicate": "nearestDc", "params": [ { "name": "country", "type": "string" }, { "name": "this_dc", "type": "int" }, { "name": "nearest_dc", "type": "int" } ], "type": "NearestDc" }, { "id": "-1987579119", "predicate": "help.appUpdate", "params": [ { "name": "id", "type": "int" }, { "name": "critical", "type": "Bool" }, { "name": "url", "type": "string" }, { "name": "text", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "-1000708810", "predicate": "help.noAppUpdate", "params": [], "type": "help.AppUpdate" }, { "id": "415997816", "predicate": "help.inviteText", "params": [ { "name": "message", "type": "string" } ], "type": "help.InviteText" }, { "id": "1371430169", "predicate": "messages.statedMessagesLinks", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "links", "type": "Vector" }, { "name": "seq", "type": "int" } ], "type": "messages.StatedMessages" }, { "id": "155755144", "predicate": "messages.statedMessageLink", "params": [ { "name": "message", "type": "Message" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "links", "type": "Vector" }, { "name": "seq", "type": "int" } ], "type": "messages.StatedMessage" }, { "id": "-383565811", "predicate": "messages.sentMessageLink", "params": [ { "name": "id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "links", "type": "Vector" }, { "name": "seq", "type": "int" } ], "type": "messages.SentMessage" }, { "id": "1960072954", "predicate": "inputGeoChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputGeoChat" }, { "id": "1301143240", "predicate": "inputNotifyGeoChatPeer", "params": [ { "name": "peer", "type": "InputGeoChat" } ], "type": "InputNotifyPeer" }, { "id": "1978329690", "predicate": "geoChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "venue", "type": "string" }, { "name": "geo", "type": "GeoPoint" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "checked_in", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Chat" }, { "id": "1613830811", "predicate": "geoChatMessageEmpty", "params": [ { "name": "chat_id", "type": "int" }, { "name": "id", "type": "int" } ], "type": "GeoChatMessage" }, { "id": "1158019297", "predicate": "geoChatMessage", "params": [ { "name": "chat_id", "type": "int" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" } ], "type": "GeoChatMessage" }, { "id": "-749755826", "predicate": "geoChatMessageService", "params": [ { "name": "chat_id", "type": "int" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "GeoChatMessage" }, { "id": "397498251", "predicate": "geochats.statedMessage", "params": [ { "name": "message", "type": "GeoChatMessage" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "seq", "type": "int" } ], "type": "geochats.StatedMessage" }, { "id": "1224651367", "predicate": "geochats.located", "params": [ { "name": "results", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "geochats.Located" }, { "id": "-783127119", "predicate": "geochats.messages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "geochats.Messages" }, { "id": "-1135057944", "predicate": "geochats.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "geochats.Messages" }, { "id": "1862504124", "predicate": "messageActionGeoChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "address", "type": "string" } ], "type": "MessageAction" }, { "id": "209540062", "predicate": "messageActionGeoChatCheckin", "params": [], "type": "MessageAction" }, { "id": "1516823543", "predicate": "updateNewGeoChatMessage", "params": [ { "name": "message", "type": "GeoChatMessage" } ], "type": "Update" }, { "id": "1662091044", "predicate": "wallPaperSolid", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "bg_color", "type": "int" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "314359194", "predicate": "updateNewEncryptedMessage", "params": [ { "name": "message", "type": "EncryptedMessage" }, { "name": "qts", "type": "int" } ], "type": "Update" }, { "id": "386986326", "predicate": "updateEncryptedChatTyping", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Update" }, { "id": "-1264392051", "predicate": "updateEncryption", "params": [ { "name": "chat", "type": "EncryptedChat" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "956179895", "predicate": "updateEncryptedMessagesRead", "params": [ { "name": "chat_id", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1417756512", "predicate": "encryptedChatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "1006044124", "predicate": "encryptedChatWaiting", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-931638658", "predicate": "encryptedChatRequested", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "-94974410", "predicate": "encryptedChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a_or_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "332848423", "predicate": "encryptedChatDiscarded", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-247351839", "predicate": "inputEncryptedChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedChat" }, { "id": "-1038136962", "predicate": "encryptedFileEmpty", "params": [], "type": "EncryptedFile" }, { "id": "1248893260", "predicate": "encryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "EncryptedFile" }, { "id": "406307684", "predicate": "inputEncryptedFileEmpty", "params": [], "type": "InputEncryptedFile" }, { "id": "1690108678", "predicate": "inputEncryptedFileUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "md5_checksum", "type": "string" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "1511503333", "predicate": "inputEncryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedFile" }, { "id": "-182231723", "predicate": "inputEncryptedFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-317144808", "predicate": "encryptedMessage", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" }, { "name": "file", "type": "EncryptedFile" } ], "type": "EncryptedMessage" }, { "id": "594758406", "predicate": "encryptedMessageService", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "EncryptedMessage" }, { "id": "-1058912715", "predicate": "messages.dhConfigNotModified", "params": [ { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "740433629", "predicate": "messages.dhConfig", "params": [ { "name": "g", "type": "int" }, { "name": "p", "type": "bytes" }, { "name": "version", "type": "int" }, { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "1443858741", "predicate": "messages.sentEncryptedMessage", "params": [ { "name": "date", "type": "int" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1802240206", "predicate": "messages.sentEncryptedFile", "params": [ { "name": "date", "type": "int" }, { "name": "file", "type": "EncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-95482955", "predicate": "inputFileBig", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" } ], "type": "InputFile" }, { "id": "767652808", "predicate": "inputEncryptedFileBigUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "974056226", "predicate": "updateChatParticipantAdd", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1851755554", "predicate": "updateChatParticipantDelete", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1906403213", "predicate": "updateDcOptions", "params": [ { "name": "dc_options", "type": "Vector" } ], "type": "Update" }, { "id": "1313442987", "predicate": "inputMediaUploadedAudio", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1986820223", "predicate": "inputMediaAudio", "params": [ { "name": "id", "type": "InputAudio" } ], "type": "InputMedia" }, { "id": "-1610888", "predicate": "inputMediaUploadedDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "1095242886", "predicate": "inputMediaUploadedThumbDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "-779818943", "predicate": "inputMediaDocument", "params": [ { "name": "id", "type": "InputDocument" } ], "type": "InputMedia" }, { "id": "802824708", "predicate": "messageMediaDocument", "params": [ { "name": "document", "type": "Document" } ], "type": "MessageMedia" }, { "id": "-961117440", "predicate": "messageMediaAudio", "params": [ { "name": "audio", "type": "Audio" } ], "type": "MessageMedia" }, { "id": "-648356732", "predicate": "inputAudioEmpty", "params": [], "type": "InputAudio" }, { "id": "2010398975", "predicate": "inputAudio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputAudio" }, { "id": "1928391342", "predicate": "inputDocumentEmpty", "params": [], "type": "InputDocument" }, { "id": "410618194", "predicate": "inputDocument", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputDocument" }, { "id": "1960591437", "predicate": "inputAudioFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1313188841", "predicate": "inputDocumentFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1483311320", "predicate": "audioEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Audio" }, { "id": "-945003370", "predicate": "audio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" } ], "type": "Audio" }, { "id": "922273905", "predicate": "documentEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Document" }, { "id": "-106717361", "predicate": "document", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "attributes", "type": "Vector" } ], "type": "Document" }, { "id": "398898678", "predicate": "help.support", "params": [ { "name": "phone_number", "type": "string" }, { "name": "user", "type": "User" } ], "type": "help.Support" }, { "id": "-1613493288", "predicate": "notifyPeer", "params": [ { "name": "peer", "type": "Peer" } ], "type": "NotifyPeer" }, { "id": "-1261946036", "predicate": "notifyUsers", "params": [], "type": "NotifyPeer" }, { "id": "-1073230141", "predicate": "notifyChats", "params": [], "type": "NotifyPeer" }, { "id": "1959820384", "predicate": "notifyAll", "params": [], "type": "NotifyPeer" }, { "id": "-2131957734", "predicate": "updateUserBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "blocked", "type": "Bool" } ], "type": "Update" }, { "id": "-1094555409", "predicate": "updateNotifySettings", "params": [ { "name": "peer", "type": "NotifyPeer" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Update" }, { "id": "-484053553", "predicate": "auth.sentAppCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "381645902", "predicate": "sendMessageTypingAction", "params": [], "type": "SendMessageAction" }, { "id": "-44119819", "predicate": "sendMessageCancelAction", "params": [], "type": "SendMessageAction" }, { "id": "-1584933265", "predicate": "sendMessageRecordVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-1845219337", "predicate": "sendMessageUploadVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-718310409", "predicate": "sendMessageRecordAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-424899985", "predicate": "sendMessageUploadAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-1727382502", "predicate": "sendMessageUploadPhotoAction", "params": [], "type": "SendMessageAction" }, { "id": "-1884362354", "predicate": "sendMessageUploadDocumentAction", "params": [], "type": "SendMessageAction" }, { "id": "393186209", "predicate": "sendMessageGeoLocationAction", "params": [], "type": "SendMessageAction" }, { "id": "1653390447", "predicate": "sendMessageChooseContactAction", "params": [], "type": "SendMessageAction" }, { "id": "-360210539", "predicate": "contactFound", "params": [ { "name": "user_id", "type": "int" } ], "type": "ContactFound" }, { "id": "90570766", "predicate": "contacts.found", "params": [ { "name": "results", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Found" }, { "id": "942527460", "predicate": "updateServiceNotification", "params": [ { "name": "type", "type": "string" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" }, { "name": "popup", "type": "Bool" } ], "type": "Update" }, { "id": "-496024847", "predicate": "userStatusRecently", "params": [], "type": "UserStatus" }, { "id": "129960444", "predicate": "userStatusLastWeek", "params": [], "type": "UserStatus" }, { "id": "2011940674", "predicate": "userStatusLastMonth", "params": [], "type": "UserStatus" }, { "id": "-298113238", "predicate": "updatePrivacy", "params": [ { "name": "key", "type": "PrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "Update" }, { "id": "1335282456", "predicate": "inputPrivacyKeyStatusTimestamp", "params": [], "type": "InputPrivacyKey" }, { "id": "-1137792208", "predicate": "privacyKeyStatusTimestamp", "params": [], "type": "PrivacyKey" }, { "id": "218751099", "predicate": "inputPrivacyValueAllowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "407582158", "predicate": "inputPrivacyValueAllowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "320652927", "predicate": "inputPrivacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "195371015", "predicate": "inputPrivacyValueDisallowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "-697604407", "predicate": "inputPrivacyValueDisallowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "-1877932953", "predicate": "inputPrivacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "-123988", "predicate": "privacyValueAllowContacts", "params": [], "type": "PrivacyRule" }, { "id": "1698855810", "predicate": "privacyValueAllowAll", "params": [], "type": "PrivacyRule" }, { "id": "1297858060", "predicate": "privacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "-125240806", "predicate": "privacyValueDisallowContacts", "params": [], "type": "PrivacyRule" }, { "id": "-1955338397", "predicate": "privacyValueDisallowAll", "params": [], "type": "PrivacyRule" }, { "id": "209668535", "predicate": "privacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "1430961007", "predicate": "account.privacyRules", "params": [ { "name": "rules", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "-1194283041", "predicate": "accountDaysTTL", "params": [ { "name": "days", "type": "int" } ], "type": "AccountDaysTTL" }, { "id": "-1527411636", "predicate": "account.sentChangePhoneCode", "params": [ { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" } ], "type": "account.SentChangePhoneCode" }, { "id": "314130811", "predicate": "updateUserPhone", "params": [ { "name": "user_id", "type": "int" }, { "name": "phone", "type": "string" } ], "type": "Update" }, { "id": "1467017129", "predicate": "account.noPassword", "params": [ { "name": "new_salt", "type": "bytes" } ], "type": "account.Password" }, { "id": "1939758962", "predicate": "account.password", "params": [ { "name": "current_salt", "type": "bytes" }, { "name": "new_salt", "type": "bytes" }, { "name": "hint", "type": "string" } ], "type": "account.Password" }, { "id": "1815593308", "predicate": "documentAttributeImageSize", "params": [ { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "297109817", "predicate": "documentAttributeAnimated", "params": [], "type": "DocumentAttribute" }, { "id": "-1723033470", "predicate": "documentAttributeSticker", "params": [ { "name": "alt", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "1494273227", "predicate": "documentAttributeVideo", "params": [ { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "85215461", "predicate": "documentAttributeAudio", "params": [ { "name": "duration", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "358154344", "predicate": "documentAttributeFilename", "params": [ { "name": "file_name", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "-244016606", "predicate": "messages.stickersNotModified", "params": [], "type": "messages.Stickers" }, { "id": "-1970352846", "predicate": "messages.stickers", "params": [ { "name": "hash", "type": "string" }, { "name": "stickers", "type": "Vector" } ], "type": "messages.Stickers" }, { "id": "313694676", "predicate": "stickerPack", "params": [ { "name": "emoticon", "type": "string" }, { "name": "documents", "type": "Vector" } ], "type": "StickerPack" }, { "id": "-395967805", "predicate": "messages.allStickersNotModified", "params": [], "type": "messages.AllStickers" }, { "id": "-588304126", "predicate": "messages.allStickers", "params": [ { "name": "hash", "type": "string" }, { "name": "packs", "type": "Vector" }, { "name": "documents", "type": "Vector" } ], "type": "messages.AllStickers" }, { "id": "-1369215196", "predicate": "disabledFeature", "params": [ { "name": "feature", "type": "string" }, { "name": "description", "type": "string" } ], "type": "DisabledFeature" }, { "id": "-1721631396", "predicate": "updateReadHistoryInbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "791617983", "predicate": "updateReadHistoryOutbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-2066640507", "predicate": "messages.affectedMessages", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "1599050311", "predicate": "contactLinkUnknown", "params": [], "type": "ContactLink" }, { "id": "-17968211", "predicate": "contactLinkNone", "params": [], "type": "ContactLink" }, { "id": "646922073", "predicate": "contactLinkHasPhone", "params": [], "type": "ContactLink" }, { "id": "-721239344", "predicate": "contactLinkContact", "params": [], "type": "ContactLink" } ], "methods": [ { "id": "-878758099", "method": "invokeAfterMsg", "params": [ { "name": "msg_id", "type": "long" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1036301552", "method": "invokeAfterMsgs", "params": [ { "name": "msg_ids", "type": "Vector" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1877286395", "method": "auth.checkPhone", "params": [ { "name": "phone_number", "type": "string" } ], "type": "auth.CheckedPhone" }, { "id": "1988976461", "method": "auth.sendCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "sms_type", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "auth.SentCode" }, { "id": "63247716", "method": "auth.sendCall", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "453408308", "method": "auth.signUp", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1126886015", "method": "auth.signIn", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "1461180992", "method": "auth.logOut", "params": [], "type": "Bool" }, { "id": "-1616179942", "method": "auth.resetAuthorizations", "params": [], "type": "Bool" }, { "id": "1998331287", "method": "auth.sendInvites", "params": [ { "name": "phone_numbers", "type": "Vector" }, { "name": "message", "type": "string" } ], "type": "Bool" }, { "id": "-440401971", "method": "auth.exportAuthorization", "params": [ { "name": "dc_id", "type": "int" } ], "type": "auth.ExportedAuthorization" }, { "id": "-470837741", "method": "auth.importAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-841733627", "method": "auth.bindTempAuthKey", "params": [ { "name": "perm_auth_key_id", "type": "long" }, { "name": "nonce", "type": "long" }, { "name": "expires_at", "type": "int" }, { "name": "encrypted_message", "type": "bytes" } ], "type": "Bool" }, { "id": "1147957548", "method": "account.registerDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "app_sandbox", "type": "Bool" }, { "name": "lang_code", "type": "string" } ], "type": "Bool" }, { "id": "1707432768", "method": "account.unregisterDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" } ], "type": "Bool" }, { "id": "-2067899501", "method": "account.updateNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" }, { "name": "settings", "type": "InputPeerNotifySettings" } ], "type": "Bool" }, { "id": "313765169", "method": "account.getNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" } ], "type": "PeerNotifySettings" }, { "id": "-612493497", "method": "account.resetNotifySettings", "params": [], "type": "Bool" }, { "id": "-259486360", "method": "account.updateProfile", "params": [ { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "User" }, { "id": "1713919532", "method": "account.updateStatus", "params": [ { "name": "offline", "type": "Bool" } ], "type": "Bool" }, { "id": "-1068696894", "method": "account.getWallPapers", "params": [], "type": "Vector" }, { "id": "227648840", "method": "users.getUsers", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-902781519", "method": "users.getFullUser", "params": [ { "name": "id", "type": "InputUser" } ], "type": "UserFull" }, { "id": "-995929106", "method": "contacts.getStatuses", "params": [], "type": "Vector" }, { "id": "583445000", "method": "contacts.getContacts", "params": [ { "name": "hash", "type": "string" } ], "type": "contacts.Contacts" }, { "id": "-634342611", "method": "contacts.importContacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "replace", "type": "Bool" } ], "type": "contacts.ImportedContacts" }, { "id": "-847825880", "method": "contacts.getSuggested", "params": [ { "name": "limit", "type": "int" } ], "type": "contacts.Suggested" }, { "id": "-1902823612", "method": "contacts.deleteContact", "params": [ { "name": "id", "type": "InputUser" } ], "type": "contacts.Link" }, { "id": "1504393374", "method": "contacts.deleteContacts", "params": [ { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "858475004", "method": "contacts.block", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-448724803", "method": "contacts.unblock", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-176409329", "method": "contacts.getBlocked", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "contacts.Blocked" }, { "id": "-2065352905", "method": "contacts.exportCard", "params": [], "type": "Vector" }, { "id": "1340184318", "method": "contacts.importCard", "params": [ { "name": "export_card", "type": "Vector" } ], "type": "User" }, { "id": "1109588596", "method": "messages.getMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "-321970698", "method": "messages.getDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-1834885329", "method": "messages.getHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "132772523", "method": "messages.search", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "-1336990448", "method": "messages.readHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-185009311", "method": "messages.deleteHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-1510897371", "method": "messages.deleteMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "682347368", "method": "messages.receivedMessages", "params": [ { "name": "max_id", "type": "int" } ], "type": "Vector" }, { "id": "-1551737264", "method": "messages.setTyping", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Bool" }, { "id": "480793249", "method": "messages.sendMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" } ], "type": "messages.SentMessage" }, { "id": "-51478592", "method": "messages.sendMedia", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "int" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" } ], "type": "messages.StatedMessage" }, { "id": "-556523451", "method": "messages.forwardMessages", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "random_id", "type": "Vector" } ], "type": "messages.StatedMessages" }, { "id": "1013621127", "method": "messages.getChats", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "998448230", "method": "messages.getFullChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "messages.ChatFull" }, { "id": "-1262720843", "method": "messages.editChatTitle", "params": [ { "name": "chat_id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "messages.StatedMessage" }, { "id": "-662601187", "method": "messages.editChatPhoto", "params": [ { "name": "chat_id", "type": "int" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "messages.StatedMessage" }, { "id": "787082910", "method": "messages.addChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "fwd_limit", "type": "int" } ], "type": "messages.StatedMessage" }, { "id": "-1010447069", "method": "messages.deleteChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" } ], "type": "messages.StatedMessage" }, { "id": "1100847854", "method": "messages.createChat", "params": [ { "name": "users", "type": "Vector" }, { "name": "title", "type": "string" } ], "type": "messages.StatedMessage" }, { "id": "-304838614", "method": "updates.getState", "params": [], "type": "updates.State" }, { "id": "168039573", "method": "updates.getDifference", "params": [ { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "qts", "type": "int" } ], "type": "updates.Difference" }, { "id": "-285902432", "method": "photos.updateProfilePhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "UserProfilePhoto" }, { "id": "-720397176", "method": "photos.uploadProfilePhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "photos.Photo" }, { "id": "-2016444625", "method": "photos.deletePhotos", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-1291540959", "method": "upload.saveFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "-475607115", "method": "upload.getFile", "params": [ { "name": "location", "type": "InputFileLocation" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "upload.File" }, { "id": "-990308245", "method": "help.getConfig", "params": [], "type": "Config" }, { "id": "531836966", "method": "help.getNearestDc", "params": [], "type": "NearestDc" }, { "id": "-938300290", "method": "help.getAppUpdate", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "1862465352", "method": "help.saveAppLog", "params": [ { "name": "events", "type": "Vector" } ], "type": "Bool" }, { "id": "-1532407418", "method": "help.getInviteText", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.InviteText" }, { "id": "-1209117380", "method": "photos.getUserPhotos", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "photos.Photos" }, { "id": "66319602", "method": "messages.forwardMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "messages.StatedMessage" }, { "id": "1102776690", "method": "messages.sendBroadcast", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "message", "type": "string" }, { "name": "media", "type": "InputMedia" } ], "type": "messages.StatedMessages" }, { "id": "2132356495", "method": "geochats.getLocated", "params": [ { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "radius", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "geochats.Located" }, { "id": "-515735953", "method": "geochats.getRecents", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "geochats.Messages" }, { "id": "1437853947", "method": "geochats.checkin", "params": [ { "name": "peer", "type": "InputGeoChat" } ], "type": "geochats.StatedMessage" }, { "id": "1730338159", "method": "geochats.getFullChat", "params": [ { "name": "peer", "type": "InputGeoChat" } ], "type": "messages.ChatFull" }, { "id": "1284383347", "method": "geochats.editChatTitle", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" } ], "type": "geochats.StatedMessage" }, { "id": "903355029", "method": "geochats.editChatPhoto", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "geochats.StatedMessage" }, { "id": "-808598451", "method": "geochats.search", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "geochats.Messages" }, { "id": "-1254131096", "method": "geochats.getHistory", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "geochats.Messages" }, { "id": "146319145", "method": "geochats.setTyping", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "102432836", "method": "geochats.sendMessage", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" } ], "type": "geochats.StatedMessage" }, { "id": "-1192173825", "method": "geochats.sendMedia", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" } ], "type": "geochats.StatedMessage" }, { "id": "235482646", "method": "geochats.createGeoChat", "params": [ { "name": "title", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "address", "type": "string" }, { "name": "venue", "type": "string" } ], "type": "geochats.StatedMessage" }, { "id": "651135312", "method": "messages.getDhConfig", "params": [ { "name": "version", "type": "int" }, { "name": "random_length", "type": "int" } ], "type": "messages.DhConfig" }, { "id": "-162681021", "method": "messages.requestEncryption", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "random_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "1035731989", "method": "messages.acceptEncryption", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "g_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "-304536635", "method": "messages.discardEncryption", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Bool" }, { "id": "2031374829", "method": "messages.setEncryptedTyping", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "2135648522", "method": "messages.readEncryptedHistory", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "max_date", "type": "int" } ], "type": "Bool" }, { "id": "-1451792525", "method": "messages.sendEncrypted", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1701831834", "method": "messages.sendEncryptedFile", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" }, { "name": "file", "type": "InputEncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "852769188", "method": "messages.sendEncryptedService", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "1436924774", "method": "messages.receivedQueue", "params": [ { "name": "max_qts", "type": "int" } ], "type": "Vector" }, { "id": "-562337987", "method": "upload.saveBigFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "file_total_parts", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "1769565673", "method": "initConnection", "params": [ { "name": "api_id", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-1663104819", "method": "help.getSupport", "params": [], "type": "help.Support" }, { "id": "229241832", "method": "auth.sendSms", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "916930423", "method": "messages.readMessageContents", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "655677548", "method": "account.checkUsername", "params": [ { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "1040964988", "method": "account.updateUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "301470424", "method": "contacts.search", "params": [ { "name": "q", "type": "string" }, { "name": "limit", "type": "int" } ], "type": "contacts.Found" }, { "id": "-623130288", "method": "account.getPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" } ], "type": "account.PrivacyRules" }, { "id": "-906486552", "method": "account.setPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "1099779595", "method": "account.deleteAccount", "params": [ { "name": "reason", "type": "string" } ], "type": "Bool" }, { "id": "150761757", "method": "account.getAccountTTL", "params": [], "type": "AccountDaysTTL" }, { "id": "608323678", "method": "account.setAccountTTL", "params": [ { "name": "ttl", "type": "AccountDaysTTL" } ], "type": "Bool" }, { "id": "-627372787", "method": "invokeWithLayer", "params": [ { "name": "layer", "type": "int" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "200282908", "method": "contacts.resolveUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "-1543001868", "method": "account.sendChangePhoneCode", "params": [ { "name": "phone_number", "type": "string" } ], "type": "account.SentChangePhoneCode" }, { "id": "1891839707", "method": "account.changePhone", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "User" }, { "id": "1418342645", "method": "account.getPassword", "params": [], "type": "account.Password" }, { "id": "-584430193", "method": "account.setPassword", "params": [ { "name": "current_password_hash", "type": "bytes" }, { "name": "new_salt", "type": "bytes" }, { "name": "new_password_hash", "type": "bytes" }, { "name": "hint", "type": "string" } ], "type": "Bool" }, { "id": "174260510", "method": "auth.checkPassword", "params": [ { "name": "password_hash", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-1373446075", "method": "messages.getStickers", "params": [ { "name": "emoticon", "type": "string" }, { "name": "hash", "type": "string" } ], "type": "messages.Stickers" }, { "id": "-1438922648", "method": "messages.getAllStickers", "params": [ { "name": "hash", "type": "string" } ], "type": "messages.AllStickers" }, { "id": "954152242", "method": "account.updateDeviceLocked", "params": [ { "name": "period", "type": "int" } ], "type": "Bool" } ] }int ?= Int; long ?= Long; double ?= Double; string ?= String; bytes string = Bytes; int128 long long = Int128; int256 long long long long = Int256; boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#f7aff1c0 file:InputFile caption:string = InputMedia; inputMediaPhoto#e9bfb4f3 id:InputPhoto caption:string = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; inputMediaUploadedVideo#82713fdf file:InputFile duration:int w:int h:int mime_type:string caption:string = InputMedia; inputMediaUploadedThumbVideo#7780ddf9 file:InputFile thumb:InputFile duration:int w:int h:int mime_type:string caption:string = InputMedia; inputMediaVideo#936a4ebd video:InputVideo caption:string = InputMedia; inputMediaUploadedAudio#4e498cab file:InputFile duration:int mime_type:string = InputMedia; inputMediaAudio#89938781 audio:InputAudio = InputMedia; inputMediaUploadedDocument#1d89306d file:InputFile mime_type:string attributes:Vector caption:string = InputMedia; inputMediaUploadedThumbDocument#ad613491 file:InputFile thumb:InputFile mime_type:string attributes:Vector caption:string = InputMedia; inputMediaDocument#1a77f29c document_id:InputDocument caption:string = InputMedia; inputMediaVenue#2827a81a geo_point:InputGeoPoint title:string address:string provider:string venue_id:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#94254732 file:InputFile crop:InputPhotoCrop = InputChatPhoto; inputChatPhoto#b2e1bf08 id:InputPhoto crop:InputPhotoCrop = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 latitude:double longitude:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#fb95c6c4 id:long access_hash:long = InputPhoto; inputVideoEmpty#5508ec75 = InputVideo; inputVideo#ee579652 id:long access_hash:long = InputVideo; inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation; inputVideoFileLocation#3d0364ec id:long access_hash:long = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputAudioFileLocation#74dc404d id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#4e45abe9 id:long access_hash:long = InputFileLocation; inputPhotoCropAuto#ade6b004 = InputPhotoCrop; inputPhotoCrop#d9915325 crop_left:double crop_top:double crop_width:double = InputPhotoCrop; inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation; userEmpty#200250ba id:int = User; user#d10d979a flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#4b1b7506 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true editor:flags.3?true moderator:flags.4?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true id:int access_hash:long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string = Chat; channelForbidden#2d85832c id:int access_hash:long title:string = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; channelFull#9e341ddf flags:# can_view_participants:flags.3?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int read_inbox_max_id:int unread_count:int unread_important_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#c992e15c flags:# unread:flags.0?true out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true id:int from_id:flags.8?int to_id:Peer fwd_from_id:flags.2?Peer fwd_date:flags.2?int via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int = Message; messageService#c06b9607 flags:# unread:flags.0?true out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true id:int from_id:flags.8?int to_id:Peer date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#3d8ce53d photo:Photo caption:string = MessageMedia; messageMediaVideo#5bcf1675 video:Video caption:string = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#f3e02ea8 document:Document caption:string = MessageMedia; messageMediaAudio#c6b68300 audio:Audio = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#7912b71f geo:GeoPoint title:string address:string provider:string venue_id:string = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; dialog#c1dd804a peer:Peer top_message:int read_inbox_max_id:int unread_count:int notify_settings:PeerNotifySettings = Dialog; dialogChannel#5b8496b2 peer:Peer top_message:int top_important_message:int read_inbox_max_id:int unread_count:int unread_important_count:int notify_settings:PeerNotifySettings pts:int = Dialog; photoEmpty#2331b22d id:long = Photo; photo#cded42fe id:long access_hash:long date:int sizes:Vector = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; videoEmpty#c10658a8 id:long = Video; video#f72887d3 id:long access_hash:long date:int duration:int mime_type:string size:int thumb:PhotoSize dc_id:int w:int h:int = Video; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#2049d70c longitude:double latitude:double = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#efed51d9 phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode; auth.sentAppCode#e325edcf phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode; auth.authorization#ff036af1 user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyAll#a429b886 = InputNotifyPeer; inputPeerNotifyEventsEmpty#f03064d8 = InputPeerNotifyEvents; inputPeerNotifyEventsAll#e86a2c74 = InputPeerNotifyEvents; inputPeerNotifySettings#46a2ce98 mute_until:int sound:string show_previews:Bool events_mask:int = InputPeerNotifySettings; peerNotifyEventsEmpty#add53cb3 = PeerNotifyEvents; peerNotifyEventsAll#6d1ded88 = PeerNotifyEvents; peerNotifySettingsEmpty#70a68512 = PeerNotifySettings; peerNotifySettings#8d5e11ee mute_until:int sound:string show_previews:Bool events_mask:int = PeerNotifySettings; wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; userFull#5a89ac5b user:User link:contacts.Link profile_photo:Photo notify_settings:PeerNotifySettings blocked:Bool bot_info:BotInfo = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactSuggested#3de191a1 user_id:int mutual_contacts:int = ContactSuggested; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#6f8b8cb2 contacts:Vector users:Vector = contacts.Contacts; contacts.importedContacts#ad524315 imported:Vector retry_contacts:Vector users:Vector = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector users:Vector = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector users:Vector = contacts.Blocked; contacts.suggested#5649dcc5 results:Vector users:Vector = contacts.Suggested; messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#bc0f17bc flags:# pts:int count:int messages:Vector collapsed:flags.0?Vector chats:Vector users:Vector = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector users:Vector = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterPhotoVideoDocuments#d95e73bb = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterAudio#cfc87522 = MessagesFilter; inputMessagesFilterAudioDocuments#5afbf764 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewAuthorization#8f06529a auth_key_id:long date:int device:string location:string = Update; updateNewEncryptedMessage#12bcbd9a encr_message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d encr_chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef notify_peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#382dd3e4 type:string message_text:string media:MessageMedia popup:Bool = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; updateChannelTooLong#60946422 channel_id:int = Update; updateChannel#b6d45656 channel_id:int = Update; updateChannelGroup#c36c1e3c channel_id:int group:MessageGroup = Update; updateNewChannelMessage#62ba04d9 message:Message channel_pts:int channel_pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector channel_pts:int channel_pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#f0dfb451 order:Vector = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#c01eea08 query_id:long user_id:int query:string offset:string = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector intermediate_state:updates.State = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#13e4deaa flags:# unread:flags.0?true out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from_id:flags.2?Peer fwd_date:flags.2?int via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShortChatMessage#248afa62 flags:# unread:flags.0?true out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from_id:flags.2?Peer fwd_date:flags.2?int via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# unread:flags.0?true out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; dcOption#5d8c6cc flags:# ipv6:flags.0?true media_only:flags.1?true id:int ip_address:string port:int = DcOption; config#6bbc5f8 date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int disabled_features:Vector = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#8987f311 id:int critical:Bool url:string text:string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputAudioEmpty#d95adc84 = InputAudio; inputAudio#77d440ff id:long access_hash:long = InputAudio; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#18798952 id:long access_hash:long = InputDocument; audioEmpty#586988d8 id:long = Audio; audio#f9e35055 id:long access_hash:long date:int duration:int mime_type:string size:int dc_id:int = Audio; documentEmpty#36f8c871 id:long = Document; document#f9a39f4f id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int attributes:Vector = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyAll#74d07c60 = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; contacts.found#1aa1f784 results:Vector chats:Vector users:Vector = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector = PrivacyRule; account.privacyRules#554abb6f rules:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; account.sentChangePhoneCode#a4f58c4c phone_code_hash:string send_call_timeout:int = account.SentChangePhoneCode; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#3a556302 alt:string stickerset:InputStickerSet = DocumentAttribute; documentAttributeVideo#5910cccb duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#ded218e0 duration:int title:string performer:string = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#8a8ecd32 hash:string stickers:Vector = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector = messages.AllStickers; disabledFeature#ae636f24 feature:string description:string = DisabledFeature; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#ca820ed7 flags:# id:long url:string display_url:string type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document = WebPage; authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector = account.Authorizations; account.noPassword#96dabc18 new_salt:bytes email_unconfirmed_pattern:string = account.Password; account.password#7c18141c current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = account.Password; account.passwordSettings#b7b72ab3 email:string = account.PasswordSettings; account.passwordInputSettings#bcfc532c flags:# new_salt:flags.0?bytes new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#93e99b60 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#cd303b41 flags:# installed:flags.0?true disabled:flags.1?true official:flags.2?true id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfoEmpty#bb2e37ce = BotInfo; botInfo#9cf585d user_id:int version:int share_text:string description:string commands:Vector = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector = ReplyMarkup; help.appChangelogEmpty#af7e0394 = help.AppChangelog; help.appChangelog#4668e6bd text:string = help.AppChangelog; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector users:Vector = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; messageGroup#e8346f53 min_id:int max_id:int count:int date:int = MessageGroup; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true channel_pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#5e167646 flags:# final:flags.0?true channel_pts:int timeout:flags.1?int top_message:int top_important_message:int read_inbox_max_id:int unread_count:int unread_important_count:int messages:Vector chats:Vector users:Vector = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true channel_pts:int timeout:flags.1?int new_messages:Vector other_updates:Vector chats:Vector users:Vector = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# important_only:flags.0?true exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; channelMessagesFilterCollapsed#fa01232e = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantModerator#91057fef user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantEditor#98192d61 user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantKicked#8cc5e69a user_id:int kicked_by:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#3c37bb7a = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelRoleEmpty#b285a0c6 = ChannelParticipantRole; channelRoleModerator#9618d975 = ChannelParticipantRole; channelRoleEditor#820bfe8c = ChannelParticipantRole; channels.channelParticipants#f56ee2a8 count:int participants:Vector users:Vector = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector = channels.ChannelParticipant; help.termsOfService#f1ee3e90 text:string = help.TermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector = messages.SavedGifs; inputBotInlineMessageMediaAuto#2e43e587 caption:string = InputBotInlineMessage; inputBotInlineMessageText#adf0df71 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector = InputBotInlineMessage; inputBotInlineResult#2cbbe15a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#fc56e87d caption:string = BotInlineMessage; botInlineMessageText#a56197a9 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector = BotInlineMessage; botInlineMediaResultDocument#f897d33e id:string type:string document:Document send_message:BotInlineMessage = BotInlineResult; botInlineMediaResultPhoto#c5528587 id:string type:string photo:Photo send_message:BotInlineMessage = BotInlineResult; botInlineResult#9bebaeb9 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:BotInlineMessage = BotInlineResult; messages.botResults#1170b0a3 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string results:Vector = messages.BotResults; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X; initConnection#69796de9 {X:Type} api_id:int device_model:string system_version:string app_version:string lang_code:string query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone; auth.sendCode#768d5f4d phone_number:string sms_type:int api_id:int api_hash:string lang_code:string = auth.SentCode; auth.sendCall#3c51564 phone_number:string phone_code_hash:string = Bool; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.sendInvites#771c1d97 phone_numbers:Vector message:string = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.sendSms#da9f3e8 phone_number:string phone_code_hash:string = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; account.registerDevice#446c712c token_type:int token:string device_model:string system_version:string app_version:string app_sandbox:Bool lang_code:string = Bool; account.unregisterDevice#65c55b40 token_type:int token:string = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#f0888d68 first_name:string last_name:string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#a407a8f4 phone_number:string = account.SentChangePhoneCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; contacts.getStatuses#c4a353ee = Vector; contacts.getContacts#22c6aa08 hash:string = contacts.Contacts; contacts.importContacts#da30b32d contacts:Vector replace:Bool = contacts.ImportedContacts; contacts.getSuggested#cd773428 limit:int = contacts.Suggested; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector; contacts.importCard#4fe196fe export_card:Vector = User; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; messages.getMessages#4222fa74 id:Vector = messages.Messages; messages.getDialogs#6b47f94d offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs; messages.getHistory#8a8ec2da peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.search#d4569248 flags:# important_only:flags.0?true peer:InputPeer q:string filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#b7c13bd9 peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#a5f18925 id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true broadcast:flags.4?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.sendMedia#c8f16791 flags:# broadcast:flags.4?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; messages.forwardMessages#708e0195 flags:# broadcast:flags.4?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.getChats#3c6aa187 id:Vector = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector title:string = Updates; messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates; messages.sendBroadcast#bf73f4da contacts:Vector random_id:Vector message:string media:InputMedia = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; messages.getStickers#ae22e045 emoticon:string hash:string = messages.Stickers; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#25223e24 message:string = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#7b30c3a6 stickerset:InputStickerSet disabled:Bool = Bool; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#9fcfbc30 order:Vector = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#9324600d bot:InputUser query:string offset:string = messages.BotResults; messages.setInlineBotResults#3f23ec12 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string = Bool; messages.sendInlineBotResult#b16e06fe flags:# broadcast:flags.4?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; updates.getState#edd4882a = updates.State; updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference; updates.getChannelDifference#bb32d7c0 channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#eef579a0 id:InputPhoto crop:InputPhotoCrop = UserProfilePhoto; photos.uploadProfilePhoto#d50f9c88 file:InputFile caption:string geo_point:InputGeoPoint crop:InputPhotoCrop = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector = Vector; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#c812ac7e device_model:string system_version:string app_version:string lang_code:string = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector = Bool; help.getInviteText#a4a95186 lang_code:string = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#5bab7fb2 device_model:string system_version:string app_version:string lang_code:string = help.AppChangelog; help.getTermsOfService#37d78f83 lang_code:string = help.TermsOfService; channels.getDialogs#a9d3d249 offset:int limit:int = messages.Dialogs; channels.getImportantHistory#ddb929cb channel:InputChannel offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector = Bool; channels.getMessages#93d7b347 channel:InputChannel id:Vector = messages.Messages; channels.getParticipants#24d98f92 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#eb7611d0 channel:InputChannel user_id:InputUser role:ChannelParticipantRole = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.toggleComments#aaa29e88 channel:InputChannel enabled:Bool = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector = Updates; channels.kickFromChannel#a672de14 channel:InputChannel user_id:InputUser kicked:Bool = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; { "constructors": [ { "id": "-1132882121", "predicate": "boolFalse", "params": [], "type": "Bool" }, { "id": "-1720552011", "predicate": "boolTrue", "params": [], "type": "Bool" }, { "id": "481674261", "predicate": "vector", "params": [], "type": "Vector t" }, { "id": "-994444869", "predicate": "error", "params": [ { "name": "code", "type": "int" }, { "name": "text", "type": "string" } ], "type": "Error" }, { "id": "1450380236", "predicate": "null", "params": [], "type": "Null" }, { "id": "2134579434", "predicate": "inputPeerEmpty", "params": [], "type": "InputPeer" }, { "id": "2107670217", "predicate": "inputPeerSelf", "params": [], "type": "InputPeer" }, { "id": "270785512", "predicate": "inputPeerContact", "params": [ { "name": "user_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1690012891", "predicate": "inputPeerForeign", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "396093539", "predicate": "inputPeerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1182234929", "predicate": "inputUserEmpty", "params": [], "type": "InputUser" }, { "id": "-138301121", "predicate": "inputUserSelf", "params": [], "type": "InputUser" }, { "id": "-2031530139", "predicate": "inputUserContact", "params": [ { "name": "user_id", "type": "int" } ], "type": "InputUser" }, { "id": "1700689151", "predicate": "inputUserForeign", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputUser" }, { "id": "-208488460", "predicate": "inputPhoneContact", "params": [ { "name": "client_id", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputContact" }, { "id": "-181407105", "predicate": "inputFile", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" }, { "name": "md5_checksum", "type": "string" } ], "type": "InputFile" }, { "id": "-1771768449", "predicate": "inputMediaEmpty", "params": [], "type": "InputMedia" }, { "id": "767900285", "predicate": "inputMediaUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" } ], "type": "InputMedia" }, { "id": "-1893027092", "predicate": "inputMediaPhoto", "params": [ { "name": "id", "type": "InputPhoto" } ], "type": "InputMedia" }, { "id": "-104578748", "predicate": "inputMediaGeoPoint", "params": [ { "name": "geo_point", "type": "InputGeoPoint" } ], "type": "InputMedia" }, { "id": "-1494984313", "predicate": "inputMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputMedia" }, { "id": "322623222", "predicate": "inputMediaUploadedVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1726817601", "predicate": "inputMediaUploadedThumbVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "2130852582", "predicate": "inputMediaVideo", "params": [ { "name": "id", "type": "InputVideo" } ], "type": "InputMedia" }, { "id": "480546647", "predicate": "inputChatPhotoEmpty", "params": [], "type": "InputChatPhoto" }, { "id": "-1809496270", "predicate": "inputChatUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-1293828344", "predicate": "inputChatPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-457104426", "predicate": "inputGeoPointEmpty", "params": [], "type": "InputGeoPoint" }, { "id": "-206066487", "predicate": "inputGeoPoint", "params": [ { "name": "lat", "type": "double" }, { "name": "long", "type": "double" } ], "type": "InputGeoPoint" }, { "id": "483901197", "predicate": "inputPhotoEmpty", "params": [], "type": "InputPhoto" }, { "id": "-74070332", "predicate": "inputPhoto", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputPhoto" }, { "id": "1426648181", "predicate": "inputVideoEmpty", "params": [], "type": "InputVideo" }, { "id": "-296249774", "predicate": "inputVideo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputVideo" }, { "id": "342061462", "predicate": "inputFileLocation", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1023632620", "predicate": "inputVideoFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-1377390588", "predicate": "inputPhotoCropAuto", "params": [], "type": "InputPhotoCrop" }, { "id": "-644787419", "predicate": "inputPhotoCrop", "params": [ { "name": "crop_left", "type": "double" }, { "name": "crop_top", "type": "double" }, { "name": "crop_width", "type": "double" } ], "type": "InputPhotoCrop" }, { "id": "1996904104", "predicate": "inputAppEvent", "params": [ { "name": "time", "type": "double" }, { "name": "type", "type": "string" }, { "name": "peer", "type": "long" }, { "name": "data", "type": "string" } ], "type": "InputAppEvent" }, { "id": "-1649296275", "predicate": "peerUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "Peer" }, { "id": "-1160714821", "predicate": "peerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Peer" }, { "id": "-1432995067", "predicate": "storage.fileUnknown", "params": [], "type": "storage.FileType" }, { "id": "8322574", "predicate": "storage.fileJpeg", "params": [], "type": "storage.FileType" }, { "id": "-891180321", "predicate": "storage.fileGif", "params": [], "type": "storage.FileType" }, { "id": "172975040", "predicate": "storage.filePng", "params": [], "type": "storage.FileType" }, { "id": "-1373745011", "predicate": "storage.filePdf", "params": [], "type": "storage.FileType" }, { "id": "1384777335", "predicate": "storage.fileMp3", "params": [], "type": "storage.FileType" }, { "id": "1258941372", "predicate": "storage.fileMov", "params": [], "type": "storage.FileType" }, { "id": "1086091090", "predicate": "storage.filePartial", "params": [], "type": "storage.FileType" }, { "id": "-1278304028", "predicate": "storage.fileMp4", "params": [], "type": "storage.FileType" }, { "id": "276907596", "predicate": "storage.fileWebp", "params": [], "type": "storage.FileType" }, { "id": "2086234950", "predicate": "fileLocationUnavailable", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "1406570614", "predicate": "fileLocation", "params": [ { "name": "dc_id", "type": "int" }, { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "537022650", "predicate": "userEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "User" }, { "id": "476112392", "predicate": "userSelf", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "phone", "type": "string" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" } ], "type": "User" }, { "id": "-894214632", "predicate": "userContact", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "access_hash", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" } ], "type": "User" }, { "id": "-640891665", "predicate": "userRequest", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "access_hash", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" } ], "type": "User" }, { "id": "123533224", "predicate": "userForeign", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "access_hash", "type": "long" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" } ], "type": "User" }, { "id": "-704549510", "predicate": "userDeleted", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "User" }, { "id": "1326562017", "predicate": "userProfilePhotoEmpty", "params": [], "type": "UserProfilePhoto" }, { "id": "-715532088", "predicate": "userProfilePhoto", "params": [ { "name": "photo_id", "type": "long" }, { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "UserProfilePhoto" }, { "id": "164646985", "predicate": "userStatusEmpty", "params": [], "type": "UserStatus" }, { "id": "-306628279", "predicate": "userStatusOnline", "params": [ { "name": "expires", "type": "int" } ], "type": "UserStatus" }, { "id": "9203775", "predicate": "userStatusOffline", "params": [ { "name": "was_online", "type": "int" } ], "type": "UserStatus" }, { "id": "-1683826688", "predicate": "chatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Chat" }, { "id": "1855757255", "predicate": "chat", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "left", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Chat" }, { "id": "-83047359", "predicate": "chatForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "date", "type": "int" } ], "type": "Chat" }, { "id": "1661886910", "predicate": "chatFull", "params": [ { "name": "id", "type": "int" }, { "name": "participants", "type": "ChatParticipants" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "ChatFull" }, { "id": "-925415106", "predicate": "chatParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "265468810", "predicate": "chatParticipantsForbidden", "params": [ { "name": "chat_id", "type": "int" } ], "type": "ChatParticipants" }, { "id": "2017571861", "predicate": "chatParticipants", "params": [ { "name": "chat_id", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "version", "type": "int" } ], "type": "ChatParticipants" }, { "id": "935395612", "predicate": "chatPhotoEmpty", "params": [], "type": "ChatPhoto" }, { "id": "1632839530", "predicate": "chatPhoto", "params": [ { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "ChatPhoto" }, { "id": "-2082087340", "predicate": "messageEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Message" }, { "id": "-1481959023", "predicate": "message", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "to_id", "type": "Peer" }, { "name": "fwd_from_id", "type": "flags.2?int" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" } ], "type": "Message" }, { "id": "495384334", "predicate": "messageService", "params": [ { "name": "flags", "type": "int" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "Message" }, { "id": "1038967584", "predicate": "messageMediaEmpty", "params": [], "type": "MessageMedia" }, { "id": "-926655958", "predicate": "messageMediaPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageMedia" }, { "id": "-1563278704", "predicate": "messageMediaVideo", "params": [ { "name": "video", "type": "Video" } ], "type": "MessageMedia" }, { "id": "1457575028", "predicate": "messageMediaGeo", "params": [ { "name": "geo", "type": "GeoPoint" } ], "type": "MessageMedia" }, { "id": "1585262393", "predicate": "messageMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "user_id", "type": "int" } ], "type": "MessageMedia" }, { "id": "-1618676578", "predicate": "messageMediaUnsupported", "params": [], "type": "MessageMedia" }, { "id": "-1230047312", "predicate": "messageActionEmpty", "params": [], "type": "MessageAction" }, { "id": "-1503425638", "predicate": "messageActionChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "users", "type": "Vector" } ], "type": "MessageAction" }, { "id": "-1247687078", "predicate": "messageActionChatEditTitle", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "2144015272", "predicate": "messageActionChatEditPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageAction" }, { "id": "-1780220945", "predicate": "messageActionChatDeletePhoto", "params": [], "type": "MessageAction" }, { "id": "1581055051", "predicate": "messageActionChatAddUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1297179892", "predicate": "messageActionChatDeleteUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1042448310", "predicate": "dialog", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Dialog" }, { "id": "590459437", "predicate": "photoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Photo" }, { "id": "582313809", "predicate": "photo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "caption", "type": "string" }, { "name": "geo", "type": "GeoPoint" }, { "name": "sizes", "type": "Vector" } ], "type": "Photo" }, { "id": "236446268", "predicate": "photoSizeEmpty", "params": [ { "name": "type", "type": "string" } ], "type": "PhotoSize" }, { "id": "2009052699", "predicate": "photoSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "size", "type": "int" } ], "type": "PhotoSize" }, { "id": "-374917894", "predicate": "photoCachedSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "PhotoSize" }, { "id": "-1056548696", "predicate": "videoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Video" }, { "id": "948937617", "predicate": "video", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "caption", "type": "string" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "Video" }, { "id": "286776671", "predicate": "geoPointEmpty", "params": [], "type": "GeoPoint" }, { "id": "541710092", "predicate": "geoPoint", "params": [ { "name": "long", "type": "double" }, { "name": "lat", "type": "double" } ], "type": "GeoPoint" }, { "id": "-2128698738", "predicate": "auth.checkedPhone", "params": [ { "name": "phone_registered", "type": "Bool" } ], "type": "auth.CheckedPhone" }, { "id": "-269659687", "predicate": "auth.sentCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "-155815004", "predicate": "auth.authorization", "params": [ { "name": "expires", "type": "int" }, { "name": "user", "type": "User" } ], "type": "auth.Authorization" }, { "id": "-543777747", "predicate": "auth.exportedAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.ExportedAuthorization" }, { "id": "-1195615476", "predicate": "inputNotifyPeer", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "InputNotifyPeer" }, { "id": "423314455", "predicate": "inputNotifyUsers", "params": [], "type": "InputNotifyPeer" }, { "id": "1251338318", "predicate": "inputNotifyChats", "params": [], "type": "InputNotifyPeer" }, { "id": "-1540769658", "predicate": "inputNotifyAll", "params": [], "type": "InputNotifyPeer" }, { "id": "-265263912", "predicate": "inputPeerNotifyEventsEmpty", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "-395694988", "predicate": "inputPeerNotifyEventsAll", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "1185074840", "predicate": "inputPeerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "InputPeerNotifySettings" }, { "id": "-1378534221", "predicate": "peerNotifyEventsEmpty", "params": [], "type": "PeerNotifyEvents" }, { "id": "1830677896", "predicate": "peerNotifyEventsAll", "params": [], "type": "PeerNotifyEvents" }, { "id": "1889961234", "predicate": "peerNotifySettingsEmpty", "params": [], "type": "PeerNotifySettings" }, { "id": "-1923214866", "predicate": "peerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "PeerNotifySettings" }, { "id": "-860866985", "predicate": "wallPaper", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "sizes", "type": "Vector" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "1997575642", "predicate": "userFull", "params": [ { "name": "user", "type": "User" }, { "name": "link", "type": "contacts.Link" }, { "name": "profile_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "blocked", "type": "Bool" }, { "name": "real_first_name", "type": "string" }, { "name": "real_last_name", "type": "string" } ], "type": "UserFull" }, { "id": "-116274796", "predicate": "contact", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual", "type": "Bool" } ], "type": "Contact" }, { "id": "-805141448", "predicate": "importedContact", "params": [ { "name": "user_id", "type": "int" }, { "name": "client_id", "type": "long" } ], "type": "ImportedContact" }, { "id": "1444661369", "predicate": "contactBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ContactBlocked" }, { "id": "1038193057", "predicate": "contactSuggested", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual_contacts", "type": "int" } ], "type": "ContactSuggested" }, { "id": "-748155807", "predicate": "contactStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "ContactStatus" }, { "id": "909233996", "predicate": "chatLocated", "params": [ { "name": "chat_id", "type": "int" }, { "name": "distance", "type": "int" } ], "type": "ChatLocated" }, { "id": "986597452", "predicate": "contacts.link", "params": [ { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" }, { "name": "user", "type": "User" } ], "type": "contacts.Link" }, { "id": "-1219778094", "predicate": "contacts.contactsNotModified", "params": [], "type": "contacts.Contacts" }, { "id": "1871416498", "predicate": "contacts.contacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Contacts" }, { "id": "-1387117803", "predicate": "contacts.importedContacts", "params": [ { "name": "imported", "type": "Vector" }, { "name": "retry_contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ImportedContacts" }, { "id": "471043349", "predicate": "contacts.blocked", "params": [ { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "-1878523231", "predicate": "contacts.blockedSlice", "params": [ { "name": "count", "type": "int" }, { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "1447681221", "predicate": "contacts.suggested", "params": [ { "name": "results", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Suggested" }, { "id": "364538944", "predicate": "messages.dialogs", "params": [ { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "1910543603", "predicate": "messages.dialogsSlice", "params": [ { "name": "count", "type": "int" }, { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "-1938715001", "predicate": "messages.messages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "189033187", "predicate": "messages.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "1062078024", "predicate": "messages.messageEmpty", "params": [], "type": "messages.Message" }, { "id": "1279084531", "predicate": "messages.sentMessage", "params": [ { "name": "id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "media", "type": "MessageMedia" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.SentMessage" }, { "id": "1694474197", "predicate": "messages.chats", "params": [ { "name": "chats", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "-438840932", "predicate": "messages.chatFull", "params": [ { "name": "full_chat", "type": "ChatFull" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.ChatFull" }, { "id": "-1269012015", "predicate": "messages.affectedHistory", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "1474492012", "predicate": "inputMessagesFilterEmpty", "params": [], "type": "MessagesFilter" }, { "id": "-1777752804", "predicate": "inputMessagesFilterPhotos", "params": [], "type": "MessagesFilter" }, { "id": "-1614803355", "predicate": "inputMessagesFilterVideo", "params": [], "type": "MessagesFilter" }, { "id": "1458172132", "predicate": "inputMessagesFilterPhotoVideo", "params": [], "type": "MessagesFilter" }, { "id": "-648121413", "predicate": "inputMessagesFilterPhotoVideoDocuments", "params": [], "type": "MessagesFilter" }, { "id": "-1629621880", "predicate": "inputMessagesFilterDocument", "params": [], "type": "MessagesFilter" }, { "id": "-808946398", "predicate": "inputMessagesFilterAudio", "params": [], "type": "MessagesFilter" }, { "id": "522914557", "predicate": "updateNewMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1318109142", "predicate": "updateMessageID", "params": [ { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Update" }, { "id": "777696872", "predicate": "updateReadMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-1576161051", "predicate": "updateDeleteMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1548249383", "predicate": "updateUserTyping", "params": [ { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "-1704596961", "predicate": "updateChatUserTyping", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "125178264", "predicate": "updateChatParticipants", "params": [ { "name": "participants", "type": "ChatParticipants" } ], "type": "Update" }, { "id": "469489699", "predicate": "updateUserStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "Update" }, { "id": "-1489818765", "predicate": "updateUserName", "params": [ { "name": "user_id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "Update" }, { "id": "-1791935732", "predicate": "updateUserPhoto", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "previous", "type": "Bool" } ], "type": "Update" }, { "id": "628472761", "predicate": "updateContactRegistered", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1657903163", "predicate": "updateContactLink", "params": [ { "name": "user_id", "type": "int" }, { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" } ], "type": "Update" }, { "id": "-1895411046", "predicate": "updateNewAuthorization", "params": [ { "name": "auth_key_id", "type": "long" }, { "name": "date", "type": "int" }, { "name": "device", "type": "string" }, { "name": "location", "type": "string" } ], "type": "Update" }, { "id": "-1519637954", "predicate": "updates.state", "params": [ { "name": "pts", "type": "int" }, { "name": "qts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "unread_count", "type": "int" } ], "type": "updates.State" }, { "id": "1567990072", "predicate": "updates.differenceEmpty", "params": [ { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "updates.Difference" }, { "id": "16030880", "predicate": "updates.difference", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-1459938943", "predicate": "updates.differenceSlice", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "intermediate_state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-484987010", "predicate": "updatesTooLong", "params": [], "type": "Updates" }, { "id": "-312729305", "predicate": "updateShortMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?int" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" } ], "type": "Updates" }, { "id": "1378061116", "predicate": "updateShortChatMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "chat_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?int" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" } ], "type": "Updates" }, { "id": "2027216577", "predicate": "updateShort", "params": [ { "name": "update", "type": "Update" }, { "name": "date", "type": "int" } ], "type": "Updates" }, { "id": "1918567619", "predicate": "updatesCombined", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq_start", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "1957577280", "predicate": "updates", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "-1916114267", "predicate": "photos.photos", "params": [ { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "352657236", "predicate": "photos.photosSlice", "params": [ { "name": "count", "type": "int" }, { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "539045032", "predicate": "photos.photo", "params": [ { "name": "photo", "type": "Photo" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photo" }, { "id": "157948117", "predicate": "upload.file", "params": [ { "name": "type", "type": "storage.FileType" }, { "name": "mtime", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "upload.File" }, { "id": "784507964", "predicate": "dcOption", "params": [ { "name": "id", "type": "int" }, { "name": "hostname", "type": "string" }, { "name": "ip_address", "type": "string" }, { "name": "port", "type": "int" } ], "type": "DcOption" }, { "id": "1757069895", "predicate": "config", "params": [ { "name": "date", "type": "int" }, { "name": "expires", "type": "int" }, { "name": "test_mode", "type": "Bool" }, { "name": "this_dc", "type": "int" }, { "name": "dc_options", "type": "Vector" }, { "name": "chat_size_max", "type": "int" }, { "name": "broadcast_size_max", "type": "int" }, { "name": "forwarded_count_max", "type": "int" }, { "name": "online_update_period_ms", "type": "int" }, { "name": "offline_blur_timeout_ms", "type": "int" }, { "name": "offline_idle_timeout_ms", "type": "int" }, { "name": "online_cloud_timeout_ms", "type": "int" }, { "name": "notify_cloud_delay_ms", "type": "int" }, { "name": "notify_default_delay_ms", "type": "int" }, { "name": "chat_big_size", "type": "int" }, { "name": "disabled_features", "type": "Vector" } ], "type": "Config" }, { "id": "-1910892683", "predicate": "nearestDc", "params": [ { "name": "country", "type": "string" }, { "name": "this_dc", "type": "int" }, { "name": "nearest_dc", "type": "int" } ], "type": "NearestDc" }, { "id": "-1987579119", "predicate": "help.appUpdate", "params": [ { "name": "id", "type": "int" }, { "name": "critical", "type": "Bool" }, { "name": "url", "type": "string" }, { "name": "text", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "-1000708810", "predicate": "help.noAppUpdate", "params": [], "type": "help.AppUpdate" }, { "id": "415997816", "predicate": "help.inviteText", "params": [ { "name": "message", "type": "string" } ], "type": "help.InviteText" }, { "id": "899786339", "predicate": "messages.sentMessageLink", "params": [ { "name": "id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "media", "type": "MessageMedia" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "links", "type": "Vector" }, { "name": "seq", "type": "int" } ], "type": "messages.SentMessage" }, { "id": "1960072954", "predicate": "inputGeoChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputGeoChat" }, { "id": "1301143240", "predicate": "inputNotifyGeoChatPeer", "params": [ { "name": "peer", "type": "InputGeoChat" } ], "type": "InputNotifyPeer" }, { "id": "1978329690", "predicate": "geoChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "venue", "type": "string" }, { "name": "geo", "type": "GeoPoint" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "checked_in", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Chat" }, { "id": "1613830811", "predicate": "geoChatMessageEmpty", "params": [ { "name": "chat_id", "type": "int" }, { "name": "id", "type": "int" } ], "type": "GeoChatMessage" }, { "id": "1158019297", "predicate": "geoChatMessage", "params": [ { "name": "chat_id", "type": "int" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" } ], "type": "GeoChatMessage" }, { "id": "-749755826", "predicate": "geoChatMessageService", "params": [ { "name": "chat_id", "type": "int" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "GeoChatMessage" }, { "id": "397498251", "predicate": "geochats.statedMessage", "params": [ { "name": "message", "type": "GeoChatMessage" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "seq", "type": "int" } ], "type": "geochats.StatedMessage" }, { "id": "1224651367", "predicate": "geochats.located", "params": [ { "name": "results", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "geochats.Located" }, { "id": "-783127119", "predicate": "geochats.messages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "geochats.Messages" }, { "id": "-1135057944", "predicate": "geochats.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "geochats.Messages" }, { "id": "1862504124", "predicate": "messageActionGeoChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "address", "type": "string" } ], "type": "MessageAction" }, { "id": "209540062", "predicate": "messageActionGeoChatCheckin", "params": [], "type": "MessageAction" }, { "id": "1516823543", "predicate": "updateNewGeoChatMessage", "params": [ { "name": "message", "type": "GeoChatMessage" } ], "type": "Update" }, { "id": "1662091044", "predicate": "wallPaperSolid", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "bg_color", "type": "int" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "314359194", "predicate": "updateNewEncryptedMessage", "params": [ { "name": "message", "type": "EncryptedMessage" }, { "name": "qts", "type": "int" } ], "type": "Update" }, { "id": "386986326", "predicate": "updateEncryptedChatTyping", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Update" }, { "id": "-1264392051", "predicate": "updateEncryption", "params": [ { "name": "chat", "type": "EncryptedChat" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "956179895", "predicate": "updateEncryptedMessagesRead", "params": [ { "name": "chat_id", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1417756512", "predicate": "encryptedChatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "1006044124", "predicate": "encryptedChatWaiting", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-931638658", "predicate": "encryptedChatRequested", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "-94974410", "predicate": "encryptedChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a_or_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "332848423", "predicate": "encryptedChatDiscarded", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-247351839", "predicate": "inputEncryptedChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedChat" }, { "id": "-1038136962", "predicate": "encryptedFileEmpty", "params": [], "type": "EncryptedFile" }, { "id": "1248893260", "predicate": "encryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "EncryptedFile" }, { "id": "406307684", "predicate": "inputEncryptedFileEmpty", "params": [], "type": "InputEncryptedFile" }, { "id": "1690108678", "predicate": "inputEncryptedFileUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "md5_checksum", "type": "string" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "1511503333", "predicate": "inputEncryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedFile" }, { "id": "-182231723", "predicate": "inputEncryptedFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-317144808", "predicate": "encryptedMessage", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" }, { "name": "file", "type": "EncryptedFile" } ], "type": "EncryptedMessage" }, { "id": "594758406", "predicate": "encryptedMessageService", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "EncryptedMessage" }, { "id": "-1058912715", "predicate": "messages.dhConfigNotModified", "params": [ { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "740433629", "predicate": "messages.dhConfig", "params": [ { "name": "g", "type": "int" }, { "name": "p", "type": "bytes" }, { "name": "version", "type": "int" }, { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "1443858741", "predicate": "messages.sentEncryptedMessage", "params": [ { "name": "date", "type": "int" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1802240206", "predicate": "messages.sentEncryptedFile", "params": [ { "name": "date", "type": "int" }, { "name": "file", "type": "EncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-95482955", "predicate": "inputFileBig", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" } ], "type": "InputFile" }, { "id": "767652808", "predicate": "inputEncryptedFileBigUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "974056226", "predicate": "updateChatParticipantAdd", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1851755554", "predicate": "updateChatParticipantDelete", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1906403213", "predicate": "updateDcOptions", "params": [ { "name": "dc_options", "type": "Vector" } ], "type": "Update" }, { "id": "1313442987", "predicate": "inputMediaUploadedAudio", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1986820223", "predicate": "inputMediaAudio", "params": [ { "name": "id", "type": "InputAudio" } ], "type": "InputMedia" }, { "id": "-1610888", "predicate": "inputMediaUploadedDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "1095242886", "predicate": "inputMediaUploadedThumbDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "-779818943", "predicate": "inputMediaDocument", "params": [ { "name": "id", "type": "InputDocument" } ], "type": "InputMedia" }, { "id": "802824708", "predicate": "messageMediaDocument", "params": [ { "name": "document", "type": "Document" } ], "type": "MessageMedia" }, { "id": "-961117440", "predicate": "messageMediaAudio", "params": [ { "name": "audio", "type": "Audio" } ], "type": "MessageMedia" }, { "id": "-648356732", "predicate": "inputAudioEmpty", "params": [], "type": "InputAudio" }, { "id": "2010398975", "predicate": "inputAudio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputAudio" }, { "id": "1928391342", "predicate": "inputDocumentEmpty", "params": [], "type": "InputDocument" }, { "id": "410618194", "predicate": "inputDocument", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputDocument" }, { "id": "1960591437", "predicate": "inputAudioFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1313188841", "predicate": "inputDocumentFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1483311320", "predicate": "audioEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Audio" }, { "id": "-945003370", "predicate": "audio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" } ], "type": "Audio" }, { "id": "922273905", "predicate": "documentEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Document" }, { "id": "-106717361", "predicate": "document", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "attributes", "type": "Vector" } ], "type": "Document" }, { "id": "398898678", "predicate": "help.support", "params": [ { "name": "phone_number", "type": "string" }, { "name": "user", "type": "User" } ], "type": "help.Support" }, { "id": "-1613493288", "predicate": "notifyPeer", "params": [ { "name": "peer", "type": "Peer" } ], "type": "NotifyPeer" }, { "id": "-1261946036", "predicate": "notifyUsers", "params": [], "type": "NotifyPeer" }, { "id": "-1073230141", "predicate": "notifyChats", "params": [], "type": "NotifyPeer" }, { "id": "1959820384", "predicate": "notifyAll", "params": [], "type": "NotifyPeer" }, { "id": "-2131957734", "predicate": "updateUserBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "blocked", "type": "Bool" } ], "type": "Update" }, { "id": "-1094555409", "predicate": "updateNotifySettings", "params": [ { "name": "peer", "type": "NotifyPeer" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Update" }, { "id": "-484053553", "predicate": "auth.sentAppCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "381645902", "predicate": "sendMessageTypingAction", "params": [], "type": "SendMessageAction" }, { "id": "-44119819", "predicate": "sendMessageCancelAction", "params": [], "type": "SendMessageAction" }, { "id": "-1584933265", "predicate": "sendMessageRecordVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-1845219337", "predicate": "sendMessageUploadVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-718310409", "predicate": "sendMessageRecordAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-424899985", "predicate": "sendMessageUploadAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-1727382502", "predicate": "sendMessageUploadPhotoAction", "params": [], "type": "SendMessageAction" }, { "id": "-1884362354", "predicate": "sendMessageUploadDocumentAction", "params": [], "type": "SendMessageAction" }, { "id": "393186209", "predicate": "sendMessageGeoLocationAction", "params": [], "type": "SendMessageAction" }, { "id": "1653390447", "predicate": "sendMessageChooseContactAction", "params": [], "type": "SendMessageAction" }, { "id": "-360210539", "predicate": "contactFound", "params": [ { "name": "user_id", "type": "int" } ], "type": "ContactFound" }, { "id": "90570766", "predicate": "contacts.found", "params": [ { "name": "results", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Found" }, { "id": "942527460", "predicate": "updateServiceNotification", "params": [ { "name": "type", "type": "string" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" }, { "name": "popup", "type": "Bool" } ], "type": "Update" }, { "id": "-496024847", "predicate": "userStatusRecently", "params": [], "type": "UserStatus" }, { "id": "129960444", "predicate": "userStatusLastWeek", "params": [], "type": "UserStatus" }, { "id": "2011940674", "predicate": "userStatusLastMonth", "params": [], "type": "UserStatus" }, { "id": "-298113238", "predicate": "updatePrivacy", "params": [ { "name": "key", "type": "PrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "Update" }, { "id": "1335282456", "predicate": "inputPrivacyKeyStatusTimestamp", "params": [], "type": "InputPrivacyKey" }, { "id": "-1137792208", "predicate": "privacyKeyStatusTimestamp", "params": [], "type": "PrivacyKey" }, { "id": "218751099", "predicate": "inputPrivacyValueAllowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "407582158", "predicate": "inputPrivacyValueAllowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "320652927", "predicate": "inputPrivacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "195371015", "predicate": "inputPrivacyValueDisallowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "-697604407", "predicate": "inputPrivacyValueDisallowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "-1877932953", "predicate": "inputPrivacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "-123988", "predicate": "privacyValueAllowContacts", "params": [], "type": "PrivacyRule" }, { "id": "1698855810", "predicate": "privacyValueAllowAll", "params": [], "type": "PrivacyRule" }, { "id": "1297858060", "predicate": "privacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "-125240806", "predicate": "privacyValueDisallowContacts", "params": [], "type": "PrivacyRule" }, { "id": "-1955338397", "predicate": "privacyValueDisallowAll", "params": [], "type": "PrivacyRule" }, { "id": "209668535", "predicate": "privacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "1430961007", "predicate": "account.privacyRules", "params": [ { "name": "rules", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "-1194283041", "predicate": "accountDaysTTL", "params": [ { "name": "days", "type": "int" } ], "type": "AccountDaysTTL" }, { "id": "-1527411636", "predicate": "account.sentChangePhoneCode", "params": [ { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" } ], "type": "account.SentChangePhoneCode" }, { "id": "314130811", "predicate": "updateUserPhone", "params": [ { "name": "user_id", "type": "int" }, { "name": "phone", "type": "string" } ], "type": "Update" }, { "id": "1815593308", "predicate": "documentAttributeImageSize", "params": [ { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "297109817", "predicate": "documentAttributeAnimated", "params": [], "type": "DocumentAttribute" }, { "id": "-1723033470", "predicate": "documentAttributeSticker", "params": [ { "name": "alt", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "1494273227", "predicate": "documentAttributeVideo", "params": [ { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "85215461", "predicate": "documentAttributeAudio", "params": [ { "name": "duration", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "358154344", "predicate": "documentAttributeFilename", "params": [ { "name": "file_name", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "-244016606", "predicate": "messages.stickersNotModified", "params": [], "type": "messages.Stickers" }, { "id": "-1970352846", "predicate": "messages.stickers", "params": [ { "name": "hash", "type": "string" }, { "name": "stickers", "type": "Vector" } ], "type": "messages.Stickers" }, { "id": "313694676", "predicate": "stickerPack", "params": [ { "name": "emoticon", "type": "string" }, { "name": "documents", "type": "Vector" } ], "type": "StickerPack" }, { "id": "-395967805", "predicate": "messages.allStickersNotModified", "params": [], "type": "messages.AllStickers" }, { "id": "-588304126", "predicate": "messages.allStickers", "params": [ { "name": "hash", "type": "string" }, { "name": "packs", "type": "Vector" }, { "name": "documents", "type": "Vector" } ], "type": "messages.AllStickers" }, { "id": "-1369215196", "predicate": "disabledFeature", "params": [ { "name": "feature", "type": "string" }, { "name": "description", "type": "string" } ], "type": "DisabledFeature" }, { "id": "-1721631396", "predicate": "updateReadHistoryInbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "791617983", "predicate": "updateReadHistoryOutbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-2066640507", "predicate": "messages.affectedMessages", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "1599050311", "predicate": "contactLinkUnknown", "params": [], "type": "ContactLink" }, { "id": "-17968211", "predicate": "contactLinkNone", "params": [], "type": "ContactLink" }, { "id": "646922073", "predicate": "contactLinkHasPhone", "params": [], "type": "ContactLink" }, { "id": "-721239344", "predicate": "contactLinkContact", "params": [], "type": "ContactLink" }, { "id": "751004017", "predicate": "updateWebPage", "params": [ { "name": "webpage", "type": "WebPage" } ], "type": "Update" }, { "id": "-350980120", "predicate": "webPageEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "WebPage" }, { "id": "-981018084", "predicate": "webPagePending", "params": [ { "name": "id", "type": "long" }, { "name": "date", "type": "int" } ], "type": "WebPage" }, { "id": "-1558273867", "predicate": "webPage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "long" }, { "name": "url", "type": "string" }, { "name": "display_url", "type": "string" }, { "name": "type", "type": "flags.0?string" }, { "name": "site_name", "type": "flags.1?string" }, { "name": "title", "type": "flags.2?string" }, { "name": "description", "type": "flags.3?string" }, { "name": "photo", "type": "flags.4?Photo" }, { "name": "embed_url", "type": "flags.5?string" }, { "name": "embed_type", "type": "flags.5?string" }, { "name": "embed_width", "type": "flags.6?int" }, { "name": "embed_height", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "author", "type": "flags.8?string" } ], "type": "WebPage" }, { "id": "-1557277184", "predicate": "messageMediaWebPage", "params": [ { "name": "webpage", "type": "WebPage" } ], "type": "MessageMedia" }, { "id": "2079516406", "predicate": "authorization", "params": [ { "name": "hash", "type": "long" }, { "name": "flags", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "platform", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "api_id", "type": "int" }, { "name": "app_name", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "date_created", "type": "int" }, { "name": "date_active", "type": "int" }, { "name": "ip", "type": "string" }, { "name": "country", "type": "string" }, { "name": "region", "type": "string" } ], "type": "Authorization" }, { "id": "307276766", "predicate": "account.authorizations", "params": [ { "name": "authorizations", "type": "Vector" } ], "type": "account.Authorizations" }, { "id": "-1764049896", "predicate": "account.noPassword", "params": [ { "name": "new_salt", "type": "bytes" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "2081952796", "predicate": "account.password", "params": [ { "name": "current_salt", "type": "bytes" }, { "name": "new_salt", "type": "bytes" }, { "name": "hint", "type": "string" }, { "name": "has_recovery", "type": "Bool" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "-1212732749", "predicate": "account.passwordSettings", "params": [ { "name": "email", "type": "string" } ], "type": "account.PasswordSettings" }, { "id": "-1124314324", "predicate": "account.passwordInputSettings", "params": [ { "name": "flags", "type": "#" }, { "name": "new_salt", "type": "flags.0?bytes" }, { "name": "new_password_hash", "type": "flags.0?bytes" }, { "name": "hint", "type": "flags.0?string" }, { "name": "email", "type": "flags.1?string" } ], "type": "account.PasswordInputSettings" }, { "id": "326715557", "predicate": "auth.passwordRecovery", "params": [ { "name": "email_pattern", "type": "string" } ], "type": "auth.PasswordRecovery" } ], "methods": [ { "id": "-878758099", "method": "invokeAfterMsg", "params": [ { "name": "msg_id", "type": "long" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1036301552", "method": "invokeAfterMsgs", "params": [ { "name": "msg_ids", "type": "Vector" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1877286395", "method": "auth.checkPhone", "params": [ { "name": "phone_number", "type": "string" } ], "type": "auth.CheckedPhone" }, { "id": "1988976461", "method": "auth.sendCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "sms_type", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "auth.SentCode" }, { "id": "63247716", "method": "auth.sendCall", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "453408308", "method": "auth.signUp", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1126886015", "method": "auth.signIn", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "1461180992", "method": "auth.logOut", "params": [], "type": "Bool" }, { "id": "-1616179942", "method": "auth.resetAuthorizations", "params": [], "type": "Bool" }, { "id": "1998331287", "method": "auth.sendInvites", "params": [ { "name": "phone_numbers", "type": "Vector" }, { "name": "message", "type": "string" } ], "type": "Bool" }, { "id": "-440401971", "method": "auth.exportAuthorization", "params": [ { "name": "dc_id", "type": "int" } ], "type": "auth.ExportedAuthorization" }, { "id": "-470837741", "method": "auth.importAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-841733627", "method": "auth.bindTempAuthKey", "params": [ { "name": "perm_auth_key_id", "type": "long" }, { "name": "nonce", "type": "long" }, { "name": "expires_at", "type": "int" }, { "name": "encrypted_message", "type": "bytes" } ], "type": "Bool" }, { "id": "1147957548", "method": "account.registerDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "app_sandbox", "type": "Bool" }, { "name": "lang_code", "type": "string" } ], "type": "Bool" }, { "id": "1707432768", "method": "account.unregisterDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" } ], "type": "Bool" }, { "id": "-2067899501", "method": "account.updateNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" }, { "name": "settings", "type": "InputPeerNotifySettings" } ], "type": "Bool" }, { "id": "313765169", "method": "account.getNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" } ], "type": "PeerNotifySettings" }, { "id": "-612493497", "method": "account.resetNotifySettings", "params": [], "type": "Bool" }, { "id": "-259486360", "method": "account.updateProfile", "params": [ { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "User" }, { "id": "1713919532", "method": "account.updateStatus", "params": [ { "name": "offline", "type": "Bool" } ], "type": "Bool" }, { "id": "-1068696894", "method": "account.getWallPapers", "params": [], "type": "Vector" }, { "id": "227648840", "method": "users.getUsers", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-902781519", "method": "users.getFullUser", "params": [ { "name": "id", "type": "InputUser" } ], "type": "UserFull" }, { "id": "-995929106", "method": "contacts.getStatuses", "params": [], "type": "Vector" }, { "id": "583445000", "method": "contacts.getContacts", "params": [ { "name": "hash", "type": "string" } ], "type": "contacts.Contacts" }, { "id": "-634342611", "method": "contacts.importContacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "replace", "type": "Bool" } ], "type": "contacts.ImportedContacts" }, { "id": "-847825880", "method": "contacts.getSuggested", "params": [ { "name": "limit", "type": "int" } ], "type": "contacts.Suggested" }, { "id": "-1902823612", "method": "contacts.deleteContact", "params": [ { "name": "id", "type": "InputUser" } ], "type": "contacts.Link" }, { "id": "1504393374", "method": "contacts.deleteContacts", "params": [ { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "858475004", "method": "contacts.block", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-448724803", "method": "contacts.unblock", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-176409329", "method": "contacts.getBlocked", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "contacts.Blocked" }, { "id": "-2065352905", "method": "contacts.exportCard", "params": [], "type": "Vector" }, { "id": "1340184318", "method": "contacts.importCard", "params": [ { "name": "export_card", "type": "Vector" } ], "type": "User" }, { "id": "1109588596", "method": "messages.getMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "-321970698", "method": "messages.getDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-1834885329", "method": "messages.getHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "132772523", "method": "messages.search", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "-1336990448", "method": "messages.readHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-185009311", "method": "messages.deleteHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-1510897371", "method": "messages.deleteMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "682347368", "method": "messages.receivedMessages", "params": [ { "name": "max_id", "type": "int" } ], "type": "Vector" }, { "id": "-1551737264", "method": "messages.setTyping", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Bool" }, { "id": "-1696755930", "method": "messages.sendMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" } ], "type": "messages.SentMessage" }, { "id": "762913713", "method": "messages.sendMedia", "params": [ { "name": "flags", "type": "#" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" } ], "type": "Updates" }, { "id": "1440838285", "method": "messages.forwardMessages", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "random_id", "type": "Vector" } ], "type": "Updates" }, { "id": "1013621127", "method": "messages.getChats", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "998448230", "method": "messages.getFullChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "messages.ChatFull" }, { "id": "-599447467", "method": "messages.editChatTitle", "params": [ { "name": "chat_id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-900957736", "method": "messages.editChatPhoto", "params": [ { "name": "chat_id", "type": "int" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-106911223", "method": "messages.addChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "fwd_limit", "type": "int" } ], "type": "Updates" }, { "id": "-530505962", "method": "messages.deleteChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" } ], "type": "Updates" }, { "id": "164303470", "method": "messages.createChat", "params": [ { "name": "users", "type": "Vector" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-304838614", "method": "updates.getState", "params": [], "type": "updates.State" }, { "id": "168039573", "method": "updates.getDifference", "params": [ { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "qts", "type": "int" } ], "type": "updates.Difference" }, { "id": "-285902432", "method": "photos.updateProfilePhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "UserProfilePhoto" }, { "id": "-720397176", "method": "photos.uploadProfilePhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "photos.Photo" }, { "id": "-2016444625", "method": "photos.deletePhotos", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-1291540959", "method": "upload.saveFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "-475607115", "method": "upload.getFile", "params": [ { "name": "location", "type": "InputFileLocation" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "upload.File" }, { "id": "-990308245", "method": "help.getConfig", "params": [], "type": "Config" }, { "id": "531836966", "method": "help.getNearestDc", "params": [], "type": "NearestDc" }, { "id": "-938300290", "method": "help.getAppUpdate", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "1862465352", "method": "help.saveAppLog", "params": [ { "name": "events", "type": "Vector" } ], "type": "Bool" }, { "id": "-1532407418", "method": "help.getInviteText", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.InviteText" }, { "id": "-1209117380", "method": "photos.getUserPhotos", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "photos.Photos" }, { "id": "865483769", "method": "messages.forwardMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Updates" }, { "id": "-1082919718", "method": "messages.sendBroadcast", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "random_id", "type": "Vector" }, { "name": "message", "type": "string" }, { "name": "media", "type": "InputMedia" } ], "type": "Updates" }, { "id": "2132356495", "method": "geochats.getLocated", "params": [ { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "radius", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "geochats.Located" }, { "id": "-515735953", "method": "geochats.getRecents", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "geochats.Messages" }, { "id": "1437853947", "method": "geochats.checkin", "params": [ { "name": "peer", "type": "InputGeoChat" } ], "type": "geochats.StatedMessage" }, { "id": "1730338159", "method": "geochats.getFullChat", "params": [ { "name": "peer", "type": "InputGeoChat" } ], "type": "messages.ChatFull" }, { "id": "1284383347", "method": "geochats.editChatTitle", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" } ], "type": "geochats.StatedMessage" }, { "id": "903355029", "method": "geochats.editChatPhoto", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "geochats.StatedMessage" }, { "id": "-808598451", "method": "geochats.search", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "geochats.Messages" }, { "id": "-1254131096", "method": "geochats.getHistory", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "geochats.Messages" }, { "id": "146319145", "method": "geochats.setTyping", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "102432836", "method": "geochats.sendMessage", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" } ], "type": "geochats.StatedMessage" }, { "id": "-1192173825", "method": "geochats.sendMedia", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" } ], "type": "geochats.StatedMessage" }, { "id": "235482646", "method": "geochats.createGeoChat", "params": [ { "name": "title", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "address", "type": "string" }, { "name": "venue", "type": "string" } ], "type": "geochats.StatedMessage" }, { "id": "651135312", "method": "messages.getDhConfig", "params": [ { "name": "version", "type": "int" }, { "name": "random_length", "type": "int" } ], "type": "messages.DhConfig" }, { "id": "-162681021", "method": "messages.requestEncryption", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "random_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "1035731989", "method": "messages.acceptEncryption", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "g_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "-304536635", "method": "messages.discardEncryption", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Bool" }, { "id": "2031374829", "method": "messages.setEncryptedTyping", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "2135648522", "method": "messages.readEncryptedHistory", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "max_date", "type": "int" } ], "type": "Bool" }, { "id": "-1451792525", "method": "messages.sendEncrypted", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1701831834", "method": "messages.sendEncryptedFile", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" }, { "name": "file", "type": "InputEncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "852769188", "method": "messages.sendEncryptedService", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "1436924774", "method": "messages.receivedQueue", "params": [ { "name": "max_qts", "type": "int" } ], "type": "Vector" }, { "id": "-562337987", "method": "upload.saveBigFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "file_total_parts", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "1769565673", "method": "initConnection", "params": [ { "name": "api_id", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-1663104819", "method": "help.getSupport", "params": [], "type": "help.Support" }, { "id": "229241832", "method": "auth.sendSms", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "916930423", "method": "messages.readMessageContents", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "655677548", "method": "account.checkUsername", "params": [ { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "1040964988", "method": "account.updateUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "301470424", "method": "contacts.search", "params": [ { "name": "q", "type": "string" }, { "name": "limit", "type": "int" } ], "type": "contacts.Found" }, { "id": "-623130288", "method": "account.getPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" } ], "type": "account.PrivacyRules" }, { "id": "-906486552", "method": "account.setPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "1099779595", "method": "account.deleteAccount", "params": [ { "name": "reason", "type": "string" } ], "type": "Bool" }, { "id": "150761757", "method": "account.getAccountTTL", "params": [], "type": "AccountDaysTTL" }, { "id": "608323678", "method": "account.setAccountTTL", "params": [ { "name": "ttl", "type": "AccountDaysTTL" } ], "type": "Bool" }, { "id": "-627372787", "method": "invokeWithLayer", "params": [ { "name": "layer", "type": "int" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "200282908", "method": "contacts.resolveUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "-1543001868", "method": "account.sendChangePhoneCode", "params": [ { "name": "phone_number", "type": "string" } ], "type": "account.SentChangePhoneCode" }, { "id": "1891839707", "method": "account.changePhone", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "User" }, { "id": "-1373446075", "method": "messages.getStickers", "params": [ { "name": "emoticon", "type": "string" }, { "name": "hash", "type": "string" } ], "type": "messages.Stickers" }, { "id": "-1438922648", "method": "messages.getAllStickers", "params": [ { "name": "hash", "type": "string" } ], "type": "messages.AllStickers" }, { "id": "954152242", "method": "account.updateDeviceLocked", "params": [ { "name": "period", "type": "int" } ], "type": "Bool" }, { "id": "623001124", "method": "messages.getWebPagePreview", "params": [ { "name": "message", "type": "string" } ], "type": "MessageMedia" }, { "id": "-484392616", "method": "account.getAuthorizations", "params": [], "type": "account.Authorizations" }, { "id": "-545786948", "method": "account.resetAuthorization", "params": [ { "name": "hash", "type": "long" } ], "type": "Bool" }, { "id": "1418342645", "method": "account.getPassword", "params": [], "type": "account.Password" }, { "id": "-1131605573", "method": "account.getPasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" } ], "type": "account.PasswordSettings" }, { "id": "-92517498", "method": "account.updatePasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" }, { "name": "new_settings", "type": "account.PasswordInputSettings" } ], "type": "Bool" }, { "id": "174260510", "method": "auth.checkPassword", "params": [ { "name": "password_hash", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-661144474", "method": "auth.requestPasswordRecovery", "params": [], "type": "auth.PasswordRecovery" }, { "id": "1319464594", "method": "auth.recoverPassword", "params": [ { "name": "code", "type": "string" } ], "type": "auth.Authorization" } ] }. * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; interface Proxy { public function __construct(int $domain, int $type, int $protocol); public function setOption(int $level, int $name, $value); public function getOption(int $level, int $name); public function setBlocking(bool $blocking); public function bind(string $address, int $port = 0); public function listen(int $backlog = 0); public function accept(); public function connect(string $address, int $port = 0); public function read(int $length, int $flags = 0); public function write(string $buffer, int $length = -1); public function send(string $data, int $length, int $flags); public function close(); public function getPeerName(bool $port = true); public function getSockName(bool $port = true); public function getProxyHeaders(); public function setExtra(array $extra = []); public function getResource(); } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Async; use Amp\Success; /** * Async parameters class. * * Manages asynchronous generation of method parameters * * @author Daniil Gentili */ class AsyncParameters extends Parameters { private $callable; private $refetchable = true; public function __construct(callable $callable, bool $refetchable = true) { $this->callable = $callable; $this->refetchable = $refetchable; } public function setRefetchable(bool $refetchable) { $this->refetchable = $refetchable; } public function setCallable(callable $callable) { $this->callable = $callable; } public function isRefetchable(): bool { return $this->refetchable; } public function getParameters(): \Generator { $callable = $this->callable; $params = $callable(); if ($params instanceof \Generator) { $params = yield coroutine($params); } else { $params = yield new Success($params); } return $params; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Async; use Amp\Promise; use function Amp\call; /** * Parameters module. * * Manages asynchronous generation of method parameters * * @author Daniil Gentili */ abstract class Parameters { private $fetched = false; private $params = []; /** * Fetch parameters asynchronously. * * @return Promise */ public function fetchParameters(): Promise { return call([$this, 'fetchParametersAsync']); } /** * Fetch parameters asynchronously. * * @return \Generator */ public function fetchParametersAsync(): \Generator { $refetchable = $this->isRefetchable(); if ($this->fetched && !$refetchable) { return $this->params; } $params = yield call([$this, 'getParameters']); if (!$refetchable) { $this->params = $params; } return $params; } /** * Check if the parameters can be fetched more than once. * * @return bool */ abstract public function isRefetchable(): bool; /** * Gets the parameters asynchronously. * * @return \Generator */ abstract public function getParameters(): \Generator; } // Core types (no need to gen) //vector#1cb5c415 {t:Type} # [ t ] = Vector t; /////////////////////////////// /////////////////// Layer cons /////////////////////////////// //invokeAfterMsg#cb9f372d msg_id:long query:!X = X; //invokeAfterMsgs#3dc4b4f0 msg_ids:Vector query:!X = X; //invokeWithLayer1#53835315 query:!X = X; //invokeWithLayer2#289dd1f6 query:!X = X; //invokeWithLayer3#b7475268 query:!X = X; //invokeWithLayer4#dea0d430 query:!X = X; //invokeWithLayer5#417a57ae query:!X = X; //invokeWithLayer6#3a64d54d query:!X = X; //invokeWithLayer7#a5be56d3 query:!X = X; //invokeWithLayer8#e9abd9fd query:!X = X; //invokeWithLayer9#76715a63 query:!X = X; //invokeWithLayer10#39620c41 query:!X = X; //invokeWithLayer11#a6b88fdf query:!X = X; //invokeWithLayer12#dda60d3c query:!X = X; //invokeWithLayer13#427c8ea2 query:!X = X; //invokeWithLayer14#2b9b08fa query:!X = X; //invokeWithLayer15#b4418b64 query:!X = X; //invokeWithLayer16#cf5f0987 query:!X = X; //invokeWithLayer17#50858a19 query:!X = X; //invokeWithLayer18#1c900537 query:!X = X; //invokeWithLayer#da9b0d0d layer:int query:!X = X; // after 18 layer /////////////////////////////// /// Authorization key creation /////////////////////////////// resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector = ResPQ; p_q_inner_data#83c95aec pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data; server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params; server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params; server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data; client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data; dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer; dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer; dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer; destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes; destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes; destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes; ---functions--- req_pq#60469778 nonce:int128 = ResPQ; req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params; set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer; destroy_auth_key#d1435160 = DestroyAuthKeyRes; /////////////////////////////// ////////////// System messages /////////////////////////////// ---types--- msgs_ack#62d6b459 msg_ids:Vector = MsgsAck; bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification; bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification; msgs_state_req#da69fb52 msg_ids:Vector = MsgsStateReq; msgs_state_info#04deb57d req_msg_id:long info:string = MsgsStateInfo; msgs_all_info#8cc0d131 msg_ids:Vector info:string = MsgsAllInfo; msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo; msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo; msg_resend_req#7d861a08 msg_ids:Vector = MsgResendReq; //rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult; // parsed manually rpc_error#2144ca19 error_code:int error_message:string = RpcError; rpc_answer_unknown#5e2ad36e = RpcDropAnswer; rpc_answer_dropped_running#cd78e586 = RpcDropAnswer; rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer; future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt; future_salts#ae500895 req_msg_id:long now:int salts:vector = FutureSalts; pong#347773c5 msg_id:long ping_id:long = Pong; destroy_session_ok#e22045fc session_id:long = DestroySessionRes; destroy_session_none#62d350c9 session_id:long = DestroySessionRes; new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession; //message msg_id:long seqno:int bytes:int body:Object = Message; // parsed manually //msg_container#73f1f8dc messages:vector = MessageContainer; // parsed manually //msg_copy#e06046b2 orig_message:Message = MessageCopy; // parsed manually, not used - use msg_container //gzip_packed#3072cfa1 packed_data:string = Object; // parsed manually http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait; ipPort ipv4:int port:int = IpPort; help.configSimple#d997c3c5 date:int expires:int dc_id:int ip_port_list:Vector = help.ConfigSimple; ---functions--- rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer; get_future_salts#b921bd04 num:int = FutureSalts; ping#7abe77ec ping_id:long = Pong; ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong; destroy_session#e7512126 session_id:long = DestroySessionRes; contest.saveDeveloperInfo#9a5f6e95 vk_id:int name:string phone_number:string age:int city:string = Bool; /////////////////////////////// ///////// Main application API /////////////////////////////// ---types--- boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#2f37e231 flags:# file:InputFile caption:string stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaPhoto#81fa373a flags:# id:InputPhoto caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; inputMediaUploadedDocument#e39621fd flags:# file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector caption:string stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaDocument#5acb668e flags:# id:InputDocument caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaVenue#2827a81a geo_point:InputGeoPoint title:string address:string provider:string venue_id:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#922aec1 flags:# url:string caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaDocumentExternal#b6f74335 flags:# url:string caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputMediaInvoice#92153685 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string start_param:string = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#fb95c6c4 id:long access_hash:long = InputPhoto; inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#430f0724 id:long access_hash:long version:int = InputFileLocation; inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation; userEmpty#200250ba id:int = User; user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#cb44b1c flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; channelFull#95cb5f57 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#90dddc11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int post_author:flags.16?string = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#b5223b0f flags:# photo:flags.0?Photo caption:flags.1?string ttl_seconds:flags.2?int = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#7c4414d3 flags:# document:flags.0?Document caption:flags.1?string ttl_seconds:flags.2?int = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#7912b71f geo:GeoPoint title:string address:string provider:string venue_id:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction; messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; messageActionScreenshotTaken#4792929b = MessageAction; dialog#66ffba14 flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#2049d70c long:double lat:double = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#5e002502 flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyAll#a429b886 = InputNotifyPeer; inputPeerNotifyEventsEmpty#f03064d8 = InputPeerNotifyEvents; inputPeerNotifyEventsAll#e86a2c74 = InputPeerNotifyEvents; inputPeerNotifySettings#38935eb2 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = InputPeerNotifySettings; peerNotifyEventsEmpty#add53cb3 = PeerNotifyEvents; peerNotifyEventsAll#6d1ded88 = PeerNotifyEvents; peerNotifySettingsEmpty#70a68512 = PeerNotifySettings; peerNotifySettings#9acda4c0 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = PeerNotifySettings; peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; userFull#f220f3f flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#6f8b8cb2 contacts:Vector users:Vector = contacts.Contacts; contacts.importedContacts#77d01c3b imported:Vector popular_invites:Vector retry_contacts:Vector users:Vector = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector users:Vector = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector users:Vector = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#99262e37 flags:# pts:int count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; messages.chatsSlice#9cd81144 count:int chats:Vector = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector users:Vector = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterPhotoVideoDocuments#d95e73bb = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter; inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updateDialogPinned#d711a2cc flags:# pinned:flags.0?true peer:Peer = Update; updatePinnedDialogs#d8caf68d flags:# order:flags.0?Vector = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updateLangPackTooLong#10c2404b = Update; updateLangPack#56022f4d difference:LangPackDifference = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector intermediate_state:updates.State = updates.Difference; updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; upload.fileCdnRedirect#ea52fe5a dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes cdn_file_hashes:Vector = upload.File; dcOption#5d8c6cc flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int = DcOption; config#7feec888 flags:# phonecalls_enabled:flags.1?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int rating_e_decay:int stickers_recent_limit:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string suggested_lang_code:flags.2?string lang_pack_version:flags.2?int disabled_features:Vector = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#8987f311 id:int critical:Bool url:string text:string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#18798952 id:long access_hash:long = InputDocument; documentEmpty#36f8c871 id:long = Document; document#87232bc7 id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int version:int attributes:Vector = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyAll#74d07c60 = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; sendMessageRecordRoundAction#88f27fbc = SendMessageAction; sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; contacts.found#1aa1f784 results:Vector chats:Vector users:Vector = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector = PrivacyRule; account.privacyRules#554abb6f rules:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#8a8ecd32 hash:string stickers:Vector = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector = messages.AllStickers; disabledFeature#ae636f24 feature:string description:string = DisabledFeature; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector = account.Authorizations; account.noPassword#96dabc18 new_salt:bytes email_unconfirmed_pattern:string = account.Password; account.password#7c18141c current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = account.Password; account.passwordSettings#b7b72ab3 email:string = account.PasswordSettings; account.passwordInputSettings#86916deb flags:# new_salt:flags.0?bytes new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#cd303b41 flags:# installed:flags.0?true archived:flags.1?true official:flags.2?true masks:flags.3?true id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#98e81d3a user_id:int description:string commands:Vector = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector = ReplyMarkup; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector users:Vector = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#410dee07 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int messages:Vector chats:Vector users:Vector = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector other_updates:Vector chats:Vector users:Vector = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantAdmin#a82fa898 flags:# can_edit:flags.0?true user_id:int inviter_id:int promoted_by:int date:int admin_rights:ChannelAdminRights = ChannelParticipant; channelParticipantBanned#222c1886 flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChannelBannedRights = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter; channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter; channels.channelParticipants#f56ee2a8 count:int participants:Vector users:Vector = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector = channels.ChannelParticipant; help.termsOfService#f1ee3e90 text:string = help.TermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector = messages.SavedGifs; inputBotInlineMessageMediaAuto#292fed13 flags:# caption:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#f4a59de1 flags:# geo_point:InputGeoPoint reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#aaafadc8 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#2daf01a7 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#2cbbe15a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#a74b15b flags:# caption:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#3a8fd8b8 flags:# geo:GeoPoint reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#4366232e flags:# geo:GeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#9bebaeb9 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; messages.botResults#ccd3563d flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector cache_time:int = messages.BotResults; exportedMessageLink#1f486803 link:string = ExportedMessageLink; messageFwdHeader#fadff4ac flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; messages.peerDialogs#3371c354 dialogs:Vector messages:Vector chats:Vector users:Vector state:updates.State = messages.PeerDialogs; topPeer#edcdc05b peer:Peer rating:double = TopPeer; topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; topPeerCategoryBotsInline#148677e2 = TopPeerCategory; topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector chats:Vector users:Vector = contacts.TopPeers; draftMessageEmpty#ba4baec5 = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; messages.featuredStickers#f89d88e5 hash:int sets:Vector unread:Vector = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#5ce20970 hash:int stickers:Vector = messages.RecentStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector = messages.ArchivedStickers; messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector = messages.StickerSetInstallResult; stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector users:Vector = messages.HighScores; textEmpty#dc3d824f = RichText; textPlain#744694e0 text:string = RichText; textBold#6724abc4 text:RichText = RichText; textItalic#d912a59c text:RichText = RichText; textUnderline#c12622c4 text:RichText = RichText; textStrike#9bf8bb95 text:RichText = RichText; textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; pageBlockHeader#bfd064ec text:RichText = PageBlock; pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; pageBlockParagraph#467a0766 text:RichText = PageBlock; pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; pageBlockList#3a58c7f4 ordered:Bool items:Vector = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; pageBlockVideo#d9d71866 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:RichText = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; pageBlockEmbed#cde200d1 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:int h:int caption:RichText = PageBlock; pageBlockEmbedPost#292c7be9 url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:RichText = PageBlock; pageBlockCollage#8b31c4f items:Vector caption:RichText = PageBlock; pageBlockSlideshow#130c8963 items:Vector caption:RichText = PageBlock; pageBlockChannel#ef1751b5 channel:Chat = PageBlock; pageBlockAudio#31b81a7f audio_id:long caption:RichText = PageBlock; pagePart#8e3f9ebe blocks:Vector photos:Vector documents:Vector = Page; pageFull#556ec7aa blocks:Vector photos:Vector documents:Vector = Page; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true currency:string prices:Vector = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; webDocument#c61acbd8 url:string access_hash:long size:int mime_type:string attributes:Vector dc_id:int = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector = payments.PaymentReceipt; payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; shippingOption#b6213cdf id:string title:string prices:Vector = ShippingOption; inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCall#ffe6ab67 id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector = phone.PhoneCall; upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey; cdnConfig#5725e40a public_keys:Vector = CdnConfig; langPackString#cad181f6 key:string value:string = LangPackString; langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString; langPackStringDeleted#2979eeb2 key:string = LangPackString; langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector = LangPackDifference; langPackLanguage#117698f1 name:string native_name:string lang_code:string = LangPackLanguage; channelAdminRights#5d7ceba5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true invite_link:flags.6?true pin_messages:flags.7?true add_admins:flags.9?true = ChannelAdminRights; channelBannedRights#58cf4249 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true until_date:int = ChannelBannedRights; channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangePhoto#b82f55c3 prev_photo:ChatPhoto new_photo:ChatPhoto = ChannelAdminLogEventAction; channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; cdnFileHash#77eec38f offset:int limit:int hash:bytes = CdnFileHash; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X; initConnection#c7481da6 {X:Type} api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone; auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.sendInvites#771c1d97 phone_numbers:Vector message:string = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector = Bool; account.registerDevice#637ea878 token_type:int token:string = Bool; account.unregisterDevice#65c55b40 token_type:int token:string = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; account.getTmpPassword#4a82327e password_hash:bytes period:int = account.TmpPassword; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; contacts.getStatuses#c4a353ee = Vector; contacts.getContacts#22c6aa08 hash:string = contacts.Contacts; contacts.importContacts#da30b32d contacts:Vector replace:Bool = contacts.ImportedContacts; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector; contacts.importCard#4fe196fe export_card:Vector = User; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; messages.getMessages#4222fa74 id:Vector = messages.Messages; messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs; messages.getHistory#afa92846 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.search#f288a275 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.sendMedia#c8f16791 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.getChats#3c6aa187 id:Vector = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector title:string = Updates; messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#25223e24 message:string = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#ce91e4ca flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.editInlineBotMessage#130c2c85 flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#2d9776b9 peers:Vector = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector = Bool; messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#3289be6a flags:# pinned:flags.0?true peer:InputPeer = Bool; messages.reorderPinnedDialogs#959ff644 flags:# force:flags.0?true order:Vector = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia; messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector = Vector; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; upload.reuploadCdnFile#1af91c09 file_token:bytes request_token:bytes = Vector; upload.getCdnFileHashes#f715c87b file_token:bytes offset:int = Vector; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#ae2de196 = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector = Bool; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#9010ef6f prev_app_version:string = Updates; help.getTermsOfService#350170f3 = help.TermsOfService; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector = Bool; channels.getMessages#93d7b347 channel:InputChannel id:Vector = messages.Messages; channels.getParticipants#24d98f92 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#20b88214 channel:InputChannel user_id:InputUser admin_rights:ChannelAdminRights = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; channels.exportMessageLink#c846d22d channel:InputChannel id:int = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; channels.editBanned#bfd915cd channel:InputChannel user_id:InputUser banned_rights:ChannelBannedRights = Updates; channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector max_id:long min_id:long limit:int = channels.AdminLogResults; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm; payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt; payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult; payments.getSavedInfo#227d824b = payments.SavedInfo; payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet; stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; phone.getCallConfig#55451fa9 = DataJSON; phone.requestCall#5b95b3d4 user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = Updates; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; langpack.getLangPack#9ab5c58e lang_code:string = LangPackDifference; langpack.getStrings#2e1ee318 lang_code:string keys:Vector = Vector; langpack.getDifference#b2e4d7d from_version:int = LangPackDifference; langpack.getLanguages#800fd57d = Vector; // LAYER 70 . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class SecurityException extends \Exception { } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class EventHandler extends APIFactory { public function __construct($MadelineProto) { $this->API = $MadelineProto->API; $this->async = $MadelineProto->async; $this->methods = $MadelineProto->methods; foreach ($this->API->get_method_namespaces() as $namespace) { $this->{$namespace} = new APIFactory($namespace, $this->API); $this->{$namespace}->async = $MadelineProto->async; } } public function &__get($name) { if ($name === 'settings') { $this->API->setdem = true; return $this->API->settings; } return $this->API->storage[$name]; } public function __set($name, $value) { if ($name === 'settings') { if (Magic::is_fork() && !Magic::$processed_fork) { \danog\MadelineProto\Logger::log('Detected fork'); $this->API->reset_session(); foreach ($this->API->datacenter->sockets as $datacenter) { $datacenter->close_and_reopen(); } Magic::$processed_fork = true; } return $this->API->__construct(array_replace_recursive($this->API->settings, $value)); } return $this->API->storage[$name] = $value; } public function __isset($name) { return isset($this->API->storage[$name]); } public function __unset($name) { unset($this->API->storage[$name]); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class RPCErrorException extends \Exception { use TL\PrettyException; private $fetched = false; public static $rollbar = true; public function getMess() { if ($this->fetched === false) { $res = json_decode(@file_get_contents('https://rpc.pwrtelegram.xyz/?method='.$additional[0].'&code='.$code.'&error='.$this->rpc), true); if (isset($res['ok']) && $res['ok']) { $this->message = $res['result']; } } return $this->message; } public function __toString() { $result = sprintf(\danog\MadelineProto\Lang::$current_lang['rpc_tg_error'], $this->getMess(), $this->rpc, $this->file, $this->line.PHP_EOL.PHP_EOL).PHP_EOL.\danog\MadelineProto\Magic::$revision.PHP_EOL.$this->getTLTrace().PHP_EOL; if (php_sapi_name() !== 'cli') { $result = str_replace(PHP_EOL, '
'.PHP_EOL, $result); } return $result; } public function __construct($message = null, $code = 0, Exception $previous = null) { $this->rpc = $message; switch ($message) { case 'RPC_MCGET_FAIL': case 'RPC_CALL_FAIL': $message = 'Telegram is having internal issues, please try again later.'; break; case 'USER_PRIVACY_RESTRICTED': $message = "The user's privacy settings do not allow you to do this"; break; case 'CHANNEL_PRIVATE': $message = "You haven't joined this channel/supergroup"; break; case 'FLOOD_WAIT_666': $message = 'Spooky af m8'; break; case 'USER_IS_BOT': $message = "Bots can't send messages to other bots"; break; case 'BOT_METHOD_INVALID': $message = 'This method cannot be run by a bot'; break; case 'PHONE_CODE_EXPIRED': $message = 'The phone code you provided has expired, this may happen if it was sent to any chat on telegram (if the code is sent through a telegram chat (not the official account) to avoid it append or prepend to the code some chars)'; break; case 'USERNAME_INVALID': $message = 'The provided username is not valid'; break; case 'ACCESS_TOKEN_INVALID': $message = 'The provided token is not valid'; break; case 'ACTIVE_USER_REQUIRED': $message = 'The method is only available to already activated users'; break; case 'FIRSTNAME_INVALID': $message = 'The first name is invalid'; break; case 'LASTNAME_INVALID': $message = 'The last name is invalid'; break; case 'PHONE_NUMBER_INVALID': $message = 'The phone number is invalid'; break; case 'PHONE_CODE_HASH_EMPTY': $message = 'phone_code_hash is missing'; break; case 'PHONE_CODE_EMPTY': $message = 'phone_code is missing'; break; case 'PHONE_CODE_EXPIRED': $message = 'The confirmation code has expired'; break; case 'API_ID_INVALID': $message = 'The api_id/api_hash combination is invalid'; break; case 'PHONE_NUMBER_OCCUPIED': $message = 'The phone number is already in use'; break; case 'PHONE_NUMBER_UNOCCUPIED': $message = 'The phone number is not yet being used'; break; case 'USERS_TOO_FEW': $message = 'Not enough users (to create a chat, for example)'; break; case 'USERS_TOO_MUCH': $message = 'The maximum number of users has been exceeded (to create a chat, for example)'; break; case 'TYPE_CONSTRUCTOR_INVALID': $message = 'The type constructor is invalid'; break; case 'FILE_PART_INVALID': $message = 'The file part number is invalid'; break; case 'FILE_PARTS_INVALID': $message = 'The number of file parts is invalid'; break; case 'MD5_CHECKSUM_INVALID': $message = 'The MD5 checksums do not match'; break; case 'PHOTO_INVALID_DIMENSIONS': $message = 'The photo dimensions are invalid'; break; case 'FIELD_NAME_INVALID': $message = 'The field with the name FIELD_NAME is invalid'; break; case 'FIELD_NAME_EMPTY': $message = 'The field with the name FIELD_NAME is missing'; break; case 'MSG_WAIT_FAILED': $message = 'A waiting call returned an error'; break; case 'USERNAME_NOT_OCCUPIED': $message = 'The provided username is not occupied'; break; case 'PHONE_NUMBER_BANNED': $message = 'The provided phone number is banned from telegram'; break; case 'AUTH_KEY_UNREGISTERED': $message = 'The authorization key has expired'; break; case 'INVITE_HASH_EXPIRED': $message = 'The invite link has expired'; break; case 'USER_DEACTIVATED': $message = 'The user was deactivated'; break; case 'USER_ALREADY_PARTICIPANT': $message = 'The user is already in the group'; break; case 'MESSAGE_ID_INVALID': $message = 'The provided message id is invalid'; break; case 'PEER_ID_INVALID': $message = 'The provided peer id is invalid'; break; case 'CHAT_ID_INVALID': $message = 'The provided chat id is invalid'; break; case 'MESSAGE_DELETE_FORBIDDEN': $message = "You can't delete one of the messages you tried to delete, most likely because it is a service message."; break; case 'CHAT_ADMIN_REQUIRED': $message = 'You must be an admin in this chat to do this'; break; case -429: case 'PEER_FLOOD': $message = 'Too many requests'; break; } parent::__construct($message, $code, $previous); $this->prettify_tl(); $additional = []; foreach ($this->getTrace() as $level) { if (isset($level['function']) && $level['function'] === 'method_call') { $this->line = $level['line']; $this->file = $level['file']; $additional = $level['args']; break; } } if ($this->rpc !== $message) { $this->fetched = true; } if (!self::$rollbar) { return; } if (in_array($this->rpc, ['CHANNEL_PRIVATE', -404, -429, 'USERNAME_NOT_OCCUPIED', 'ACCESS_TOKEN_INVALID', 'AUTH_KEY_UNREGISTERED', 'SESSION_PASSWORD_NEEDED', 'PHONE_NUMBER_UNOCCUPIED', 'PEER_ID_INVALID', 'CHAT_ID_INVALID', 'USERNAME_INVALID', 'CHAT_WRITE_FORBIDDEN', 'CHAT_ADMIN_REQUIRED', 'PEER_FLOOD'])) { return; } if (strpos($this->rpc, 'FLOOD_WAIT_') !== false) { return; } $message === 'Telegram is having internal issues, please try again later.' ? \Rollbar\Rollbar::log(\Rollbar\Payload\Level::critical(), $message) : \Rollbar\Rollbar::log(\Rollbar\Payload\Level::error(), $this, $additional); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; use Amp\Promise; class APIFactory { /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var langpack */ public $langpack; /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var phone */ public $phone; /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var stickers */ public $stickers; /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var payments */ public $payments; /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var bots */ public $bots; /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var channels */ public $channels; /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var help */ public $help; /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var upload */ public $upload; /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var photos */ public $photos; /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var updates */ public $updates; /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var messages */ public $messages; /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var contacts */ public $contacts; /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var users */ public $users; /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var account */ public $account; /** * @internal this is a internal property generated by build_docs.php, don't change manually * * @var auth */ public $auth; use Tools; public $namespace = ''; public $API; public $lua = false; public $async = false; protected $methods = []; public function __construct($namespace, $API) { $this->namespace = $namespace.'.'; $this->API = $API; } public function __call($name, $arguments) { if (Magic::is_fork() && !Magic::$processed_fork) { \danog\MadelineProto\Logger::log('Detected fork'); $this->API->reset_session(); foreach ($this->API->datacenter->sockets as $datacenter) { $datacenter->close_and_reopen(); } Magic::$processed_fork = true; } if ($this->API->setdem) { $this->API->setdem = false; $this->API->__construct($this->API->settings); } $this->API->get_config([], ['datacenter' => $this->API->datacenter->curdc]); if (isset($this->session) && !is_null($this->session) && time() - $this->serialized > $this->API->settings['serialization']['serialization_interval']) { Logger::log("Didn't serialize in a while, doing that now..."); $this->serialize($this->session); } if ($name !== 'accept_tos' && $name !== 'decline_tos') { $this->API->check_tos(); } $lower_name = strtolower($name); if ($this->lua === false) { return $this->namespace !== '' || !isset($this->methods[$lower_name]) ? $this->__mtproto_call($this->namespace.$name, $arguments) : $this->__api_call($lower_name, $arguments); } try { $deserialized = $this->namespace !== '' || !isset($this->methods[$lower_name]) ? $this->__mtproto_call($this->namespace.$name, $arguments) : $this->__api_call($lower_name, $arguments); Lua::convert_objects($deserialized); return $deserialized; } catch (\danog\MadelineProto\Exception $e) { return ['error_code' => $e->getCode(), 'error' => $e->getMessage()]; } catch (\danog\MadelineProto\RPCErrorException $e) { return ['error_code' => $e->getCode(), 'error' => $e->getMessage()]; } catch (\danog\MadelineProto\TL\Exception $e) { return ['error_code' => $e->getCode(), 'error' => $e->getMessage()]; } catch (\danog\MadelineProto\NothingInTheSocketException $e) { return ['error_code' => $e->getCode(), 'error' => $e->getMessage()]; } catch (\danog\MadelineProto\PTSException $e) { return ['error_code' => $e->getCode(), 'error' => $e->getMessage()]; } catch (\danog\MadelineProto\SecurityException $e) { return ['error_code' => $e->getCode(), 'error' => $e->getMessage()]; } catch (\danog\MadelineProto\TL\Conversion\Exception $e) { return ['error_code' => $e->getCode(), 'error' => $e->getMessage()]; } } public function __api_call($name, $arguments) { $result = $this->methods[$name](...$arguments); if (is_object($result) && ($result instanceof \Generator || $result instanceof Promise)) { $async = isset(end($arguments)['async']) ? end($arguments)['async'] : $this->async; if ($async && ($name !== 'loop' || isset(end($arguments)['async']))) { return $result; } else { return $this->wait($result); } } return $result; } public function __mtproto_call($name, $arguments) { if (array_key_exists($name, \danog\MadelineProto\MTProto::DISALLOWED_METHODS)) { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\MTProto::DISALLOWED_METHODS[$name], 0, null, 'MadelineProto', 1); } $aargs = isset($arguments[1]) && is_array($arguments[1]) ? $arguments[1] : []; $aargs['datacenter'] = $this->API->datacenter->curdc; $aargs['apifactory'] = true; $args = isset($arguments[0]) && is_array($arguments[0]) ? $arguments[0] : []; $async = isset(end($arguments)['async']) ? end($arguments)['async'] : $this->async; $res = $this->API->method_call_async_read($name, $args, $aargs); if ($async) { return $res; } else { return $this->wait($res); } } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class RSA { use \danog\MadelineProto\TL\TL; use \danog\MadelineProto\Tools; use \danog\Serializable; public $e; public $n; public $fp; public function __magic_construct($rsa_key) { \danog\MadelineProto\Logger::log(\danog\MadelineProto\Lang::$current_lang['rsa_init'], Logger::ULTRA_VERBOSE); $key = new \phpseclib\Crypt\RSA(); \danog\MadelineProto\Logger::log(\danog\MadelineProto\Lang::$current_lang['loading_key'], Logger::ULTRA_VERBOSE); $key->load($rsa_key); $this->n = \phpseclib\Common\Functions\Objects::getVar($key, 'modulus'); $this->e = \phpseclib\Common\Functions\Objects::getVar($key, 'exponent'); \danog\MadelineProto\Logger::log(\danog\MadelineProto\Lang::$current_lang['computing_fingerprint'], Logger::ULTRA_VERBOSE); $this->fp = substr(sha1($this->serialize_object(['type' => 'bytes'], $this->n->toBytes(), 'key').$this->serialize_object(['type' => 'bytes'], $this->e->toBytes(), 'key'), true), -8); return true; } public function __sleep() { return ['e', 'n', 'fp']; } public function encrypt($data) { \danog\MadelineProto\Logger::log(\danog\MadelineProto\Lang::$current_lang['rsa_encrypting'], Logger::VERBOSE); return (new \phpseclib\Math\BigInteger($data, 256))->powMod($this->e, $this->n)->toBytes(); } } /////////////////////////////// /// Authorization key creation /////////////////////////////// //resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector = ResPQ; //p_q_inner_data#83c95aec pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data; //server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params; //server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params; //server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data; //client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data; //dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer; //dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer; //dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer; destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes; destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes; destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes; ---functions--- //req_pq#60469778 nonce:int128 = ResPQ; //req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params; //set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer; destroy_auth_key#d1435160 = DestroyAuthKeyRes; /////////////////////////////// ///////// Main application API /////////////////////////////// ---types--- boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#630c9af1 flags:# file:InputFile caption:string stickers:flags.0?Vector = InputMedia; inputMediaPhoto#e9bfb4f3 id:InputPhoto caption:string = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; inputMediaUploadedDocument#d070f1e9 flags:# file:InputFile mime_type:string attributes:Vector caption:string stickers:flags.0?Vector = InputMedia; inputMediaUploadedThumbDocument#50d88cae flags:# file:InputFile thumb:InputFile mime_type:string attributes:Vector caption:string stickers:flags.0?Vector = InputMedia; inputMediaDocument#1a77f29c id:InputDocument caption:string = InputMedia; inputMediaVenue#2827a81a geo_point:InputGeoPoint title:string address:string provider:string venue_id:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#b55f4f18 url:string caption:string = InputMedia; inputMediaDocumentExternal#e5e9607c url:string caption:string = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#fb95c6c4 id:long access_hash:long = InputPhoto; inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#430f0724 id:long access_hash:long version:int = InputFileLocation; inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation; userEmpty#200250ba id:int = User; user#d10d979a flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#a14dca52 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true editor:flags.3?true moderator:flags.4?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string = Chat; channelForbidden#8537784f flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; channelFull#c3d5512f flags:# can_view_participants:flags.3?true can_set_username:flags.6?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#c09be45f flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#3d8ce53d photo:Photo caption:string = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#f3e02ea8 document:Document caption:string = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#7912b71f geo:GeoPoint title:string address:string provider:string venue_id:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; dialog#66ffba14 flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#2049d70c long:double lat:double = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#5e002502 flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyAll#a429b886 = InputNotifyPeer; inputPeerNotifyEventsEmpty#f03064d8 = InputPeerNotifyEvents; inputPeerNotifyEventsAll#e86a2c74 = InputPeerNotifyEvents; inputPeerNotifySettings#38935eb2 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = InputPeerNotifySettings; peerNotifyEventsEmpty#add53cb3 = PeerNotifyEvents; peerNotifyEventsAll#6d1ded88 = PeerNotifyEvents; peerNotifySettingsEmpty#70a68512 = PeerNotifySettings; peerNotifySettings#9acda4c0 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = PeerNotifySettings; peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; userFull#f220f3f flags:# blocked:flags.0?true phone_calls_available:flags.4?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#6f8b8cb2 contacts:Vector users:Vector = contacts.Contacts; contacts.importedContacts#ad524315 imported:Vector retry_contacts:Vector users:Vector = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector users:Vector = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector users:Vector = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#99262e37 flags:# pts:int count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; messages.chatsSlice#9cd81144 count:int chats:Vector = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector users:Vector = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterPhotoVideoDocuments#d95e73bb = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updateDialogPinned#d711a2cc flags:# pinned:flags.0?true peer:Peer = Update; updatePinnedDialogs#d8caf68d flags:# order:flags.0?Vector = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector intermediate_state:updates.State = updates.Difference; updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; dcOption#5d8c6cc flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true id:int ip_address:string port:int = DcOption; config#3af6fb5f flags:# phonecalls_enabled:flags.1?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int rating_e_decay:int stickers_recent_limit:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int disabled_features:Vector = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#8987f311 id:int critical:Bool url:string text:string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#18798952 id:long access_hash:long = InputDocument; documentEmpty#36f8c871 id:long = Document; document#87232bc7 id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int version:int attributes:Vector = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyAll#74d07c60 = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; contacts.found#1aa1f784 results:Vector chats:Vector users:Vector = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector = PrivacyRule; account.privacyRules#554abb6f rules:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; documentAttributeVideo#5910cccb duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#8a8ecd32 hash:string stickers:Vector = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector = messages.AllStickers; disabledFeature#ae636f24 feature:string description:string = DisabledFeature; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector = account.Authorizations; account.noPassword#96dabc18 new_salt:bytes email_unconfirmed_pattern:string = account.Password; account.password#7c18141c current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = account.Password; account.passwordSettings#b7b72ab3 email:string = account.PasswordSettings; account.passwordInputSettings#86916deb flags:# new_salt:flags.0?bytes new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#cd303b41 flags:# installed:flags.0?true archived:flags.1?true official:flags.2?true masks:flags.3?true id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#98e81d3a user_id:int description:string commands:Vector = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector = ReplyMarkup; help.appChangelogEmpty#af7e0394 = help.AppChangelog; help.appChangelog#2a137e7c message:string media:MessageMedia entities:Vector = help.AppChangelog; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector users:Vector = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#410dee07 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int messages:Vector chats:Vector users:Vector = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector other_updates:Vector chats:Vector users:Vector = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantModerator#91057fef user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantEditor#98192d61 user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantKicked#8cc5e69a user_id:int kicked_by:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#3c37bb7a = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelRoleEmpty#b285a0c6 = ChannelParticipantRole; channelRoleModerator#9618d975 = ChannelParticipantRole; channelRoleEditor#820bfe8c = ChannelParticipantRole; channels.channelParticipants#f56ee2a8 count:int participants:Vector users:Vector = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector = channels.ChannelParticipant; help.termsOfService#f1ee3e90 text:string = help.TermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector = messages.SavedGifs; inputBotInlineMessageMediaAuto#292fed13 flags:# caption:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#f4a59de1 flags:# geo_point:InputGeoPoint reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#aaafadc8 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#2daf01a7 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#2cbbe15a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#a74b15b flags:# caption:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#3a8fd8b8 flags:# geo:GeoPoint reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#4366232e flags:# geo:GeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#9bebaeb9 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; messages.botResults#ccd3563d flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector cache_time:int = messages.BotResults; exportedMessageLink#1f486803 link:string = ExportedMessageLink; messageFwdHeader#c786ddcb flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; messages.peerDialogs#3371c354 dialogs:Vector messages:Vector chats:Vector users:Vector state:updates.State = messages.PeerDialogs; topPeer#edcdc05b peer:Peer rating:double = TopPeer; topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; topPeerCategoryBotsInline#148677e2 = TopPeerCategory; topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector chats:Vector users:Vector = contacts.TopPeers; draftMessageEmpty#ba4baec5 = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; messages.featuredStickers#f89d88e5 hash:int sets:Vector unread:Vector = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#5ce20970 hash:int stickers:Vector = messages.RecentStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector = messages.ArchivedStickers; messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector = messages.StickerSetInstallResult; stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector users:Vector = messages.HighScores; textEmpty#dc3d824f = RichText; textPlain#744694e0 text:string = RichText; textBold#6724abc4 text:RichText = RichText; textItalic#d912a59c text:RichText = RichText; textUnderline#c12622c4 text:RichText = RichText; textStrike#9bf8bb95 text:RichText = RichText; textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; pageBlockHeader#bfd064ec text:RichText = PageBlock; pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; pageBlockParagraph#467a0766 text:RichText = PageBlock; pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; pageBlockList#3a58c7f4 ordered:Bool items:Vector = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; pageBlockVideo#d9d71866 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:RichText = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; pageBlockEmbed#cde200d1 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:int h:int caption:RichText = PageBlock; pageBlockEmbedPost#292c7be9 url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:RichText = PageBlock; pageBlockCollage#8b31c4f items:Vector caption:RichText = PageBlock; pageBlockSlideshow#130c8963 items:Vector caption:RichText = PageBlock; pagePart#8dee6c44 blocks:Vector photos:Vector videos:Vector = Page; pageFull#d7a19d69 blocks:Vector photos:Vector videos:Vector = Page; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#6c448ae8 id:long access_hash:long date:int admin_id:int participant_id:int g_a:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCall#ffe6ab67 id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector = phone.PhoneCall; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X; initConnection#69796de9 {X:Type} api_id:int device_model:string system_version:string app_version:string lang_code:string query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone; auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.sendInvites#771c1d97 phone_numbers:Vector message:string = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector = Bool; account.registerDevice#637ea878 token_type:int token:string = Bool; account.unregisterDevice#65c55b40 token_type:int token:string = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; contacts.getStatuses#c4a353ee = Vector; contacts.getContacts#22c6aa08 hash:string = contacts.Contacts; contacts.importContacts#da30b32d contacts:Vector replace:Bool = contacts.ImportedContacts; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector; contacts.importCard#4fe196fe export_card:Vector = User; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; messages.getMessages#4222fa74 id:Vector = messages.Messages; messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs; messages.getHistory#afa92846 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.search#d4569248 flags:# peer:InputPeer q:string filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.sendMedia#c8f16791 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.getChats#3c6aa187 id:Vector = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector title:string = Updates; messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#25223e24 message:string = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#ce91e4ca flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.editInlineBotMessage#130c2c85 flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#2d9776b9 peers:Vector = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector = Bool; messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#3289be6a flags:# pinned:flags.0?true peer:InputPeer = Bool; messages.reorderPinnedDialogs#959ff644 flags:# force:flags.0?true order:Vector = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector = Vector; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#ae2de196 = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector = Bool; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#b921197a = help.AppChangelog; help.getTermsOfService#350170f3 = help.TermsOfService; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector = Bool; channels.getMessages#93d7b347 channel:InputChannel id:Vector = messages.Messages; channels.getParticipants#24d98f92 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#eb7611d0 channel:InputChannel user_id:InputUser role:ChannelParticipantRole = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector = Updates; channels.kickFromChannel#a672de14 channel:InputChannel user_id:InputUser kicked:Bool = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; channels.exportMessageLink#c846d22d channel:InputChannel id:int = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; phone.requestCall#a41aa5e4 user_id:InputUser random_id:int g_a:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#220f0b20 peer:InputPhoneCall g_b:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.discardCall#5dfbcddc peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Bool; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; // LAYER 62 . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class Lua { use \danog\Serializable; public $MadelineProto; protected $Lua; protected $script; public function __magic_construct($script, $MadelineProto) { if (!file_exists($script)) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['script_not_exist']); } $this->MadelineProto = $MadelineProto; $this->MadelineProto->settings['updates']['handle_updates'] = true; $this->MadelineProto->API->datacenter->sockets[$this->MadelineProto->settings['connection_settings']['default_dc']]->startUpdateLoop(); $this->script = $script; $this->__wakeup(); } public function __sleep() { return ['MadelineProto', 'script']; } public function __wakeup() { $this->Lua = new \Lua($this->script); $this->madelineproto_lua = 1; $this->Lua->registerCallback('tdcli_function', [$this, 'tdcli_function']); $this->Lua->registerCallback('madeline_function', [$this, 'madeline_function']); $this->Lua->registerCallback('var_dump', 'var_dump'); foreach (get_class_methods($this->MadelineProto->API) as $method) { $this->Lua->registerCallback($method, [$this->MadelineProto, $method]); } $methods = []; foreach ($this->MadelineProto->get_methods_namespaced() as $pair) { $namespace = key($pair); $method = $pair[$namespace]; if ($namespace === 'upload') { continue; } $methods[$namespace][$method] = [$this->MadelineProto->{$namespace}, $method]; } foreach ($this->MadelineProto->get_methods_namespaced() as $pair) { $namespace = key($pair); $method = $pair[$namespace]; if ($namespace === 'upload') { continue; } $this->{$namespace} = $methods[$namespace]; } $this->MadelineProto->lua = true; foreach ($this->MadelineProto->get_methods_namespaced() as $pair) { $namespace = key($pair); $this->MadelineProto->{$namespace}->lua = true; } } public function tdcli_function($params, $cb = null, $cb_extra = null) { $params = $this->MadelineProto->td_to_mtproto($this->MadelineProto->tdcli_to_td($params)); if ($params === 0) { return 0; } $result = $this->MadelineProto->API->method_call($params['_'], $params, ['datacenter' => $this->MadelineProto->API->datacenter->curdc]); if (is_callable($cb)) { $cb($this->MadelineProto->mtproto_to_td($result), $cb_extra); } return $result; } public function madeline_function($params, $cb = null, $cb_extra = null) { $result = $this->MadelineProto->API->method_call($params['_'], $params, ['datacenter' => $this->MadelineProto->API->datacenter->curdc]); if (is_callable($cb)) { $cb($result, $cb_extra); } self::convert_objects($result); return $result; } public function tdcli_update_callback($update) { $this->Lua->tdcli_update_callback($this->MadelineProto->mtproto_to_tdcli($update)); } private function convert_array($array) { if (!is_array($array)) { return $array; } if ($this->is_seqential($array)) { return array_flip(array_map(function ($el) { return $el + 1; }, array_flip($array))); } } private function is_sequential(array $arr) { if ([] === $arr) { return false; } return isset($arr[0]) && array_keys($arr) === range(0, count($arr) - 1); } public function __get($name) { if ($name === 'API') { return $this->MadelineProto->API; } return $this->Lua->{$name}; } public function __call($name, $params) { self::convert_objects($params); try { return $this->Lua->{$name}(...$params); } catch (\danog\MadelineProto\RPCErrorException $e) { return ['error_code' => $e->getCode(), 'error' => $e->getMessage()]; } catch (\danog\MadelineProto\Exception $e) { return ['error_code' => $e->getCode(), 'error' => $e->getMessage()]; } catch (\danog\MadelineProto\TL\Exception $e) { return ['error_code' => $e->getCode(), 'error' => $e->getMessage()]; } catch (\danog\MadelineProto\NothingInTheSocketException $e) { return ['error_code' => $e->getCode(), 'error' => $e->getMessage()]; } catch (\danog\MadelineProto\PTSException $e) { return ['error_code' => $e->getCode(), 'error' => $e->getMessage()]; } catch (\danog\MadelineProto\SecurityException $e) { return ['error_code' => $e->getCode(), 'error' => $e->getMessage()]; } catch (\danog\MadelineProto\TL\Conversion\Exception $e) { return ['error_code' => $e->getCode(), 'error' => $e->getMessage()]; } } public function __set($name, $value) { return $this->Lua->{$name} = $value; } public static function convert_objects(&$data) { array_walk_recursive($data, function (&$value, $key) { if (is_object($value) && !$value instanceof \phpseclib\Math\BigInteger) { $newval = []; foreach (get_class_methods($value) as $name) { $newval[$name] = [$value, $name]; } foreach ($value as $key => $name) { if ($key === 'madeline') { continue; } $newval[$key] = $name; } if ($newval === []) { $newval = $value->__toString(); } $value = $newval; } }); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; use function Amp\Promise\wait; class Magic { public static $storage = []; public static $has_thread = false; public static $BIG_ENDIAN = false; public static $bigint = true; public static $isatty = false; public static $is_fork = false; public static $can_getmypid = true; public static $can_parallel = false; public static $processed_fork = false; public static $ipv6; public static $pid; public static $inited = false; public static $zero; public static $one; public static $two; public static $three; public static $four; public static $twoe1984; public static $twoe2047; public static $twoe2048; public static $zeroeight; public static $twozerotwosixone; public static $emojis; public static $revision; const JSON_EMOJIS = '["\\ud83d\\ude09","\\ud83d\\ude0d","\\ud83d\\ude1b","\\ud83d\\ude2d","\\ud83d\\ude31","\\ud83d\\ude21","\\ud83d\\ude0e","\\ud83d\\ude34","\\ud83d\\ude35","\\ud83d\\ude08","\\ud83d\\ude2c","\\ud83d\\ude07","\\ud83d\\ude0f","\\ud83d\\udc6e","\\ud83d\\udc77","\\ud83d\\udc82","\\ud83d\\udc76","\\ud83d\\udc68","\\ud83d\\udc69","\\ud83d\\udc74","\\ud83d\\udc75","\\ud83d\\ude3b","\\ud83d\\ude3d","\\ud83d\\ude40","\\ud83d\\udc7a","\\ud83d\\ude48","\\ud83d\\ude49","\\ud83d\\ude4a","\\ud83d\\udc80","\\ud83d\\udc7d","\\ud83d\\udca9","\\ud83d\\udd25","\\ud83d\\udca5","\\ud83d\\udca4","\\ud83d\\udc42","\\ud83d\\udc40","\\ud83d\\udc43","\\ud83d\\udc45","\\ud83d\\udc44","\\ud83d\\udc4d","\\ud83d\\udc4e","\\ud83d\\udc4c","\\ud83d\\udc4a","\\u270c","\\u270b","\\ud83d\\udc50","\\ud83d\\udc46","\\ud83d\\udc47","\\ud83d\\udc49","\\ud83d\\udc48","\\ud83d\\ude4f","\\ud83d\\udc4f","\\ud83d\\udcaa","\\ud83d\\udeb6","\\ud83c\\udfc3","\\ud83d\\udc83","\\ud83d\\udc6b","\\ud83d\\udc6a","\\ud83d\\udc6c","\\ud83d\\udc6d","\\ud83d\\udc85","\\ud83c\\udfa9","\\ud83d\\udc51","\\ud83d\\udc52","\\ud83d\\udc5f","\\ud83d\\udc5e","\\ud83d\\udc60","\\ud83d\\udc55","\\ud83d\\udc57","\\ud83d\\udc56","\\ud83d\\udc59","\\ud83d\\udc5c","\\ud83d\\udc53","\\ud83c\\udf80","\\ud83d\\udc84","\\ud83d\\udc9b","\\ud83d\\udc99","\\ud83d\\udc9c","\\ud83d\\udc9a","\\ud83d\\udc8d","\\ud83d\\udc8e","\\ud83d\\udc36","\\ud83d\\udc3a","\\ud83d\\udc31","\\ud83d\\udc2d","\\ud83d\\udc39","\\ud83d\\udc30","\\ud83d\\udc38","\\ud83d\\udc2f","\\ud83d\\udc28","\\ud83d\\udc3b","\\ud83d\\udc37","\\ud83d\\udc2e","\\ud83d\\udc17","\\ud83d\\udc34","\\ud83d\\udc11","\\ud83d\\udc18","\\ud83d\\udc3c","\\ud83d\\udc27","\\ud83d\\udc25","\\ud83d\\udc14","\\ud83d\\udc0d","\\ud83d\\udc22","\\ud83d\\udc1b","\\ud83d\\udc1d","\\ud83d\\udc1c","\\ud83d\\udc1e","\\ud83d\\udc0c","\\ud83d\\udc19","\\ud83d\\udc1a","\\ud83d\\udc1f","\\ud83d\\udc2c","\\ud83d\\udc0b","\\ud83d\\udc10","\\ud83d\\udc0a","\\ud83d\\udc2b","\\ud83c\\udf40","\\ud83c\\udf39","\\ud83c\\udf3b","\\ud83c\\udf41","\\ud83c\\udf3e","\\ud83c\\udf44","\\ud83c\\udf35","\\ud83c\\udf34","\\ud83c\\udf33","\\ud83c\\udf1e","\\ud83c\\udf1a","\\ud83c\\udf19","\\ud83c\\udf0e","\\ud83c\\udf0b","\\u26a1","\\u2614","\\u2744","\\u26c4","\\ud83c\\udf00","\\ud83c\\udf08","\\ud83c\\udf0a","\\ud83c\\udf93","\\ud83c\\udf86","\\ud83c\\udf83","\\ud83d\\udc7b","\\ud83c\\udf85","\\ud83c\\udf84","\\ud83c\\udf81","\\ud83c\\udf88","\\ud83d\\udd2e","\\ud83c\\udfa5","\\ud83d\\udcf7","\\ud83d\\udcbf","\\ud83d\\udcbb","\\u260e","\\ud83d\\udce1","\\ud83d\\udcfa","\\ud83d\\udcfb","\\ud83d\\udd09","\\ud83d\\udd14","\\u23f3","\\u23f0","\\u231a","\\ud83d\\udd12","\\ud83d\\udd11","\\ud83d\\udd0e","\\ud83d\\udca1","\\ud83d\\udd26","\\ud83d\\udd0c","\\ud83d\\udd0b","\\ud83d\\udebf","\\ud83d\\udebd","\\ud83d\\udd27","\\ud83d\\udd28","\\ud83d\\udeaa","\\ud83d\\udeac","\\ud83d\\udca3","\\ud83d\\udd2b","\\ud83d\\udd2a","\\ud83d\\udc8a","\\ud83d\\udc89","\\ud83d\\udcb0","\\ud83d\\udcb5","\\ud83d\\udcb3","\\u2709","\\ud83d\\udceb","\\ud83d\\udce6","\\ud83d\\udcc5","\\ud83d\\udcc1","\\u2702","\\ud83d\\udccc","\\ud83d\\udcce","\\u2712","\\u270f","\\ud83d\\udcd0","\\ud83d\\udcda","\\ud83d\\udd2c","\\ud83d\\udd2d","\\ud83c\\udfa8","\\ud83c\\udfac","\\ud83c\\udfa4","\\ud83c\\udfa7","\\ud83c\\udfb5","\\ud83c\\udfb9","\\ud83c\\udfbb","\\ud83c\\udfba","\\ud83c\\udfb8","\\ud83d\\udc7e","\\ud83c\\udfae","\\ud83c\\udccf","\\ud83c\\udfb2","\\ud83c\\udfaf","\\ud83c\\udfc8","\\ud83c\\udfc0","\\u26bd","\\u26be","\\ud83c\\udfbe","\\ud83c\\udfb1","\\ud83c\\udfc9","\\ud83c\\udfb3","\\ud83c\\udfc1","\\ud83c\\udfc7","\\ud83c\\udfc6","\\ud83c\\udfca","\\ud83c\\udfc4","\\u2615","\\ud83c\\udf7c","\\ud83c\\udf7a","\\ud83c\\udf77","\\ud83c\\udf74","\\ud83c\\udf55","\\ud83c\\udf54","\\ud83c\\udf5f","\\ud83c\\udf57","\\ud83c\\udf71","\\ud83c\\udf5a","\\ud83c\\udf5c","\\ud83c\\udf61","\\ud83c\\udf73","\\ud83c\\udf5e","\\ud83c\\udf69","\\ud83c\\udf66","\\ud83c\\udf82","\\ud83c\\udf70","\\ud83c\\udf6a","\\ud83c\\udf6b","\\ud83c\\udf6d","\\ud83c\\udf6f","\\ud83c\\udf4e","\\ud83c\\udf4f","\\ud83c\\udf4a","\\ud83c\\udf4b","\\ud83c\\udf52","\\ud83c\\udf47","\\ud83c\\udf49","\\ud83c\\udf53","\\ud83c\\udf51","\\ud83c\\udf4c","\\ud83c\\udf50","\\ud83c\\udf4d","\\ud83c\\udf46","\\ud83c\\udf45","\\ud83c\\udf3d","\\ud83c\\udfe1","\\ud83c\\udfe5","\\ud83c\\udfe6","\\u26ea","\\ud83c\\udff0","\\u26fa","\\ud83c\\udfed","\\ud83d\\uddfb","\\ud83d\\uddfd","\\ud83c\\udfa0","\\ud83c\\udfa1","\\u26f2","\\ud83c\\udfa2","\\ud83d\\udea2","\\ud83d\\udea4","\\u2693","\\ud83d\\ude80","\\u2708","\\ud83d\\ude81","\\ud83d\\ude82","\\ud83d\\ude8b","\\ud83d\\ude8e","\\ud83d\\ude8c","\\ud83d\\ude99","\\ud83d\\ude97","\\ud83d\\ude95","\\ud83d\\ude9b","\\ud83d\\udea8","\\ud83d\\ude94","\\ud83d\\ude92","\\ud83d\\ude91","\\ud83d\\udeb2","\\ud83d\\udea0","\\ud83d\\ude9c","\\ud83d\\udea6","\\u26a0","\\ud83d\\udea7","\\u26fd","\\ud83c\\udfb0","\\ud83d\\uddff","\\ud83c\\udfaa","\\ud83c\\udfad","\\ud83c\\uddef\\ud83c\\uddf5","\\ud83c\\uddf0\\ud83c\\uddf7","\\ud83c\\udde9\\ud83c\\uddea","\\ud83c\\udde8\\ud83c\\uddf3","\\ud83c\\uddfa\\ud83c\\uddf8","\\ud83c\\uddeb\\ud83c\\uddf7","\\ud83c\\uddea\\ud83c\\uddf8","\\ud83c\\uddee\\ud83c\\uddf9","\\ud83c\\uddf7\\ud83c\\uddfa","\\ud83c\\uddec\\ud83c\\udde7","1\\u20e3","2\\u20e3","3\\u20e3","4\\u20e3","5\\u20e3","6\\u20e3","7\\u20e3","8\\u20e3","9\\u20e3","0\\u20e3","\\ud83d\\udd1f","\\u2757","\\u2753","\\u2665","\\u2666","\\ud83d\\udcaf","\\ud83d\\udd17","\\ud83d\\udd31","\\ud83d\\udd34","\\ud83d\\udd35","\\ud83d\\udd36","\\ud83d\\udd37"]'; public static function class_exists() { if (!self::$inited) { self::$has_thread = class_exists('\\Thread') && method_exists('\\Thread', 'getCurrentThread'); self::$BIG_ENDIAN = pack('L', 1) === pack('N', 1); self::$bigint = PHP_INT_SIZE < 8; self::$ipv6 = (bool) strlen(@file_get_contents('http://v6.ipv6-test.com/api/myip.php', false, stream_context_create(['http' => ['timeout' => 1]]))) > 0; preg_match('/const V = (\\d+);/', @file_get_contents('https://raw.githubusercontent.com/danog/MadelineProto/master/src/danog/MadelineProto/MTProto.php'), $matches); if (isset($matches[1]) && \danog\MadelineProto\MTProto::V < (int) $matches[1]) { throw new \danog\MadelineProto\Exception(hex2bin(\danog\MadelineProto\Lang::$current_lang['v_error']), 0, null, 'MadelineProto', 1); } if (class_exists('\\danog\\MadelineProto\\VoIP')) { if (!defined('\\danog\\MadelineProto\\VoIP::PHP_LIBTGVOIP_VERSION') || !in_array(\danog\MadelineProto\VoIP::PHP_LIBTGVOIP_VERSION, ['1.2.0', '1.1.2'])) { throw new \danog\MadelineProto\Exception(hex2bin(\danog\MadelineProto\Lang::$current_lang['v_tgerror']), 0, null, 'MadelineProto', 1); } } self::$emojis = json_decode(self::JSON_EMOJIS); self::$zero = new \phpseclib\Math\BigInteger(0); self::$one = new \phpseclib\Math\BigInteger(1); self::$two = new \phpseclib\Math\BigInteger(2); self::$three = new \phpseclib\Math\BigInteger(3); self::$four = new \phpseclib\Math\BigInteger(4); self::$twoe1984 = new \phpseclib\Math\BigInteger('1751908409537131537220509645351687597690304110853111572994449976845956819751541616602568796259317428464425605223064365804210081422215355425149431390635151955247955156636234741221447435733643262808668929902091770092492911737768377135426590363166295684370498604708288556044687341394398676292971255828404734517580702346564613427770683056761383955397564338690628093211465848244049196353703022640400205739093118270803778352768276670202698397214556629204420309965547056893233608758387329699097930255380715679250799950923553703740673620901978370802540218870279314810722790539899334271514365444369275682816'); self::$twoe2047 = new \phpseclib\Math\BigInteger('16158503035655503650357438344334975980222051334857742016065172713762327569433945446598600705761456731844358980460949009747059779575245460547544076193224141560315438683650498045875098875194826053398028819192033784138396109321309878080919047169238085235290822926018152521443787945770532904303776199561965192760957166694834171210342487393282284747428088017663161029038902829665513096354230157075129296432088558362971801859230928678799175576150822952201848806616643615613562842355410104862578550863465661734839271290328348967522998634176499319107762583194718667771801067716614802322659239302476074096777926805529798115328'); self::$twoe2048 = new \phpseclib\Math\BigInteger('32317006071311007300714876688669951960444102669715484032130345427524655138867890893197201411522913463688717960921898019494119559150490921095088152386448283120630877367300996091750197750389652106796057638384067568276792218642619756161838094338476170470581645852036305042887575891541065808607552399123930385521914333389668342420684974786564569494856176035326322058077805659331026192708460314150258592864177116725943603718461857357598351152301645904403697613233287231227125684710820209725157101726931323469678542580656697935045997268352998638215525166389437335543602135433229604645318478604952148193555853611059596230656'); self::$twozerotwosixone = new \phpseclib\Math\BigInteger(20261); self::$zeroeight = new \phpseclib\Math\BigInteger('2147483648'); try { self::$isatty = defined('STDOUT') && function_exists('posix_isatty') && posix_isatty(STDOUT); } catch (\danog\MadelineProto\Exception $e) { } self::$can_getmypid = !(isset($_SERVER['SERVER_ADMIN']) && strpos($_SERVER['SERVER_ADMIN'], 'altervista.org')); self::$revision = @file_get_contents(__DIR__.'/../../../.git/refs/heads/master'); if (self::$revision) { self::$revision = trim(self::$revision); $latest = @file_get_contents('https://phar.madelineproto.xyz/release'); if ($latest) { $latest = self::$revision === trim($latest) ? '' : ' (AN UPDATE IS REQUIRED)'; } self::$revision = 'Revision: '.self::$revision.$latest; } self::$can_parallel = false; try { $back = debug_backtrace(0); $promise = \Amp\File\get(end($back)['file']); do { try { if (wait($promise)) { self::$can_parallel = true; break; } } catch (\Throwable $e) { if ($e->getMessage() !== 'Loop stopped without resolving the promise') { throw $e; } } } while (true); } catch (\Exception $e) { } if (!self::$can_parallel && !defined('AMP_WORKER')) { define('AMP_WORKER', 1); } self::$inited = true; } } public static function is_fork() { if (self::$is_fork) { return true; } if (!self::$can_getmypid) { return false; } try { if (self::$pid === null) { self::$pid = getmypid(); } return self::$is_fork = self::$pid !== getmypid(); } catch (\danog\MadelineProto\Exception $e) { return self::$can_getmypid = false; } } } { "constructors": [ { "id": "-1132882121", "predicate": "boolFalse", "params": [], "type": "Bool" }, { "id": "-1720552011", "predicate": "boolTrue", "params": [], "type": "Bool" }, { "id": "1072550713", "predicate": "true", "params": [], "type": "True" }, { "id": "481674261", "predicate": "vector", "params": [], "type": "Vector t" }, { "id": "-994444869", "predicate": "error", "params": [ { "name": "code", "type": "int" }, { "name": "text", "type": "string" } ], "type": "Error" }, { "id": "1450380236", "predicate": "null", "params": [], "type": "Null" }, { "id": "2134579434", "predicate": "inputPeerEmpty", "params": [], "type": "InputPeer" }, { "id": "2107670217", "predicate": "inputPeerSelf", "params": [], "type": "InputPeer" }, { "id": "396093539", "predicate": "inputPeerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1182234929", "predicate": "inputUserEmpty", "params": [], "type": "InputUser" }, { "id": "-138301121", "predicate": "inputUserSelf", "params": [], "type": "InputUser" }, { "id": "-208488460", "predicate": "inputPhoneContact", "params": [ { "name": "client_id", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputContact" }, { "id": "-181407105", "predicate": "inputFile", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" }, { "name": "md5_checksum", "type": "string" } ], "type": "InputFile" }, { "id": "-1771768449", "predicate": "inputMediaEmpty", "params": [], "type": "InputMedia" }, { "id": "-139464256", "predicate": "inputMediaUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-373312269", "predicate": "inputMediaPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-104578748", "predicate": "inputMediaGeoPoint", "params": [ { "name": "geo_point", "type": "InputGeoPoint" } ], "type": "InputMedia" }, { "id": "-1494984313", "predicate": "inputMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputMedia" }, { "id": "-2106507297", "predicate": "inputMediaUploadedVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "2004934137", "predicate": "inputMediaUploadedThumbVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-1821749571", "predicate": "inputMediaVideo", "params": [ { "name": "id", "type": "InputVideo" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "480546647", "predicate": "inputChatPhotoEmpty", "params": [], "type": "InputChatPhoto" }, { "id": "-1809496270", "predicate": "inputChatUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-1293828344", "predicate": "inputChatPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-457104426", "predicate": "inputGeoPointEmpty", "params": [], "type": "InputGeoPoint" }, { "id": "-206066487", "predicate": "inputGeoPoint", "params": [ { "name": "lat", "type": "double" }, { "name": "long", "type": "double" } ], "type": "InputGeoPoint" }, { "id": "483901197", "predicate": "inputPhotoEmpty", "params": [], "type": "InputPhoto" }, { "id": "-74070332", "predicate": "inputPhoto", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputPhoto" }, { "id": "1426648181", "predicate": "inputVideoEmpty", "params": [], "type": "InputVideo" }, { "id": "-296249774", "predicate": "inputVideo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputVideo" }, { "id": "342061462", "predicate": "inputFileLocation", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1023632620", "predicate": "inputVideoFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-1377390588", "predicate": "inputPhotoCropAuto", "params": [], "type": "InputPhotoCrop" }, { "id": "-644787419", "predicate": "inputPhotoCrop", "params": [ { "name": "crop_left", "type": "double" }, { "name": "crop_top", "type": "double" }, { "name": "crop_width", "type": "double" } ], "type": "InputPhotoCrop" }, { "id": "1996904104", "predicate": "inputAppEvent", "params": [ { "name": "time", "type": "double" }, { "name": "type", "type": "string" }, { "name": "peer", "type": "long" }, { "name": "data", "type": "string" } ], "type": "InputAppEvent" }, { "id": "-1649296275", "predicate": "peerUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "Peer" }, { "id": "-1160714821", "predicate": "peerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Peer" }, { "id": "-1432995067", "predicate": "storage.fileUnknown", "params": [], "type": "storage.FileType" }, { "id": "8322574", "predicate": "storage.fileJpeg", "params": [], "type": "storage.FileType" }, { "id": "-891180321", "predicate": "storage.fileGif", "params": [], "type": "storage.FileType" }, { "id": "172975040", "predicate": "storage.filePng", "params": [], "type": "storage.FileType" }, { "id": "-1373745011", "predicate": "storage.filePdf", "params": [], "type": "storage.FileType" }, { "id": "1384777335", "predicate": "storage.fileMp3", "params": [], "type": "storage.FileType" }, { "id": "1258941372", "predicate": "storage.fileMov", "params": [], "type": "storage.FileType" }, { "id": "1086091090", "predicate": "storage.filePartial", "params": [], "type": "storage.FileType" }, { "id": "-1278304028", "predicate": "storage.fileMp4", "params": [], "type": "storage.FileType" }, { "id": "276907596", "predicate": "storage.fileWebp", "params": [], "type": "storage.FileType" }, { "id": "2086234950", "predicate": "fileLocationUnavailable", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "1406570614", "predicate": "fileLocation", "params": [ { "name": "dc_id", "type": "int" }, { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "537022650", "predicate": "userEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "User" }, { "id": "1326562017", "predicate": "userProfilePhotoEmpty", "params": [], "type": "UserProfilePhoto" }, { "id": "-715532088", "predicate": "userProfilePhoto", "params": [ { "name": "photo_id", "type": "long" }, { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "UserProfilePhoto" }, { "id": "164646985", "predicate": "userStatusEmpty", "params": [], "type": "UserStatus" }, { "id": "-306628279", "predicate": "userStatusOnline", "params": [ { "name": "expires", "type": "int" } ], "type": "UserStatus" }, { "id": "9203775", "predicate": "userStatusOffline", "params": [ { "name": "was_online", "type": "int" } ], "type": "UserStatus" }, { "id": "-1683826688", "predicate": "chatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Chat" }, { "id": "-652419756", "predicate": "chat", "params": [ { "name": "flags", "type": "#" }, { "name": "creator", "type": "flags.0?true" }, { "name": "kicked", "type": "flags.1?true" }, { "name": "left", "type": "flags.2?true" }, { "name": "admins_enabled", "type": "flags.3?true" }, { "name": "admin", "type": "flags.4?true" }, { "name": "deactivated", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" }, { "name": "migrated_to", "type": "flags.6?InputChannel" } ], "type": "Chat" }, { "id": "120753115", "predicate": "chatForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Chat" }, { "id": "771925524", "predicate": "chatFull", "params": [ { "name": "id", "type": "int" }, { "name": "participants", "type": "ChatParticipants" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector" } ], "type": "ChatFull" }, { "id": "-925415106", "predicate": "chatParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "-57668565", "predicate": "chatParticipantsForbidden", "params": [ { "name": "flags", "type": "#" }, { "name": "chat_id", "type": "int" }, { "name": "self_participant", "type": "flags.0?ChatParticipant" } ], "type": "ChatParticipants" }, { "id": "1061556205", "predicate": "chatParticipants", "params": [ { "name": "chat_id", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "version", "type": "int" } ], "type": "ChatParticipants" }, { "id": "935395612", "predicate": "chatPhotoEmpty", "params": [], "type": "ChatPhoto" }, { "id": "1632839530", "predicate": "chatPhoto", "params": [ { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "ChatPhoto" }, { "id": "-2082087340", "predicate": "messageEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Message" }, { "id": "1537633299", "predicate": "message", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "reply_markup", "type": "flags.6?ReplyMarkup" }, { "name": "entities", "type": "flags.7?Vector" }, { "name": "views", "type": "flags.10?int" } ], "type": "Message" }, { "id": "-1066691065", "predicate": "messageService", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "Message" }, { "id": "1038967584", "predicate": "messageMediaEmpty", "params": [], "type": "MessageMedia" }, { "id": "1032643901", "predicate": "messageMediaPhoto", "params": [ { "name": "photo", "type": "Photo" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1540298357", "predicate": "messageMediaVideo", "params": [ { "name": "video", "type": "Video" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1457575028", "predicate": "messageMediaGeo", "params": [ { "name": "geo", "type": "GeoPoint" } ], "type": "MessageMedia" }, { "id": "1585262393", "predicate": "messageMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "user_id", "type": "int" } ], "type": "MessageMedia" }, { "id": "-1618676578", "predicate": "messageMediaUnsupported", "params": [], "type": "MessageMedia" }, { "id": "-1230047312", "predicate": "messageActionEmpty", "params": [], "type": "MessageAction" }, { "id": "-1503425638", "predicate": "messageActionChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "users", "type": "Vector" } ], "type": "MessageAction" }, { "id": "-1247687078", "predicate": "messageActionChatEditTitle", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "2144015272", "predicate": "messageActionChatEditPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageAction" }, { "id": "-1780220945", "predicate": "messageActionChatDeletePhoto", "params": [], "type": "MessageAction" }, { "id": "1217033015", "predicate": "messageActionChatAddUser", "params": [ { "name": "users", "type": "Vector" } ], "type": "MessageAction" }, { "id": "-1297179892", "predicate": "messageActionChatDeleteUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1042448310", "predicate": "dialog", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Dialog" }, { "id": "590459437", "predicate": "photoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Photo" }, { "id": "-840088834", "predicate": "photo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "sizes", "type": "Vector" } ], "type": "Photo" }, { "id": "236446268", "predicate": "photoSizeEmpty", "params": [ { "name": "type", "type": "string" } ], "type": "PhotoSize" }, { "id": "2009052699", "predicate": "photoSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "size", "type": "int" } ], "type": "PhotoSize" }, { "id": "-374917894", "predicate": "photoCachedSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "PhotoSize" }, { "id": "-1056548696", "predicate": "videoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Video" }, { "id": "-148338733", "predicate": "video", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "Video" }, { "id": "286776671", "predicate": "geoPointEmpty", "params": [], "type": "GeoPoint" }, { "id": "541710092", "predicate": "geoPoint", "params": [ { "name": "long", "type": "double" }, { "name": "lat", "type": "double" } ], "type": "GeoPoint" }, { "id": "-2128698738", "predicate": "auth.checkedPhone", "params": [ { "name": "phone_registered", "type": "Bool" } ], "type": "auth.CheckedPhone" }, { "id": "-269659687", "predicate": "auth.sentCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "-16553231", "predicate": "auth.authorization", "params": [ { "name": "user", "type": "User" } ], "type": "auth.Authorization" }, { "id": "-543777747", "predicate": "auth.exportedAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.ExportedAuthorization" }, { "id": "-1195615476", "predicate": "inputNotifyPeer", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "InputNotifyPeer" }, { "id": "423314455", "predicate": "inputNotifyUsers", "params": [], "type": "InputNotifyPeer" }, { "id": "1251338318", "predicate": "inputNotifyChats", "params": [], "type": "InputNotifyPeer" }, { "id": "-1540769658", "predicate": "inputNotifyAll", "params": [], "type": "InputNotifyPeer" }, { "id": "-265263912", "predicate": "inputPeerNotifyEventsEmpty", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "-395694988", "predicate": "inputPeerNotifyEventsAll", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "1185074840", "predicate": "inputPeerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "InputPeerNotifySettings" }, { "id": "-1378534221", "predicate": "peerNotifyEventsEmpty", "params": [], "type": "PeerNotifyEvents" }, { "id": "1830677896", "predicate": "peerNotifyEventsAll", "params": [], "type": "PeerNotifyEvents" }, { "id": "1889961234", "predicate": "peerNotifySettingsEmpty", "params": [], "type": "PeerNotifySettings" }, { "id": "-1923214866", "predicate": "peerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "PeerNotifySettings" }, { "id": "-860866985", "predicate": "wallPaper", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "sizes", "type": "Vector" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "1518971995", "predicate": "userFull", "params": [ { "name": "user", "type": "User" }, { "name": "link", "type": "contacts.Link" }, { "name": "profile_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "blocked", "type": "Bool" }, { "name": "bot_info", "type": "BotInfo" } ], "type": "UserFull" }, { "id": "-116274796", "predicate": "contact", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual", "type": "Bool" } ], "type": "Contact" }, { "id": "-805141448", "predicate": "importedContact", "params": [ { "name": "user_id", "type": "int" }, { "name": "client_id", "type": "long" } ], "type": "ImportedContact" }, { "id": "1444661369", "predicate": "contactBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ContactBlocked" }, { "id": "1038193057", "predicate": "contactSuggested", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual_contacts", "type": "int" } ], "type": "ContactSuggested" }, { "id": "-748155807", "predicate": "contactStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "ContactStatus" }, { "id": "986597452", "predicate": "contacts.link", "params": [ { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" }, { "name": "user", "type": "User" } ], "type": "contacts.Link" }, { "id": "-1219778094", "predicate": "contacts.contactsNotModified", "params": [], "type": "contacts.Contacts" }, { "id": "1871416498", "predicate": "contacts.contacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Contacts" }, { "id": "-1387117803", "predicate": "contacts.importedContacts", "params": [ { "name": "imported", "type": "Vector" }, { "name": "retry_contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ImportedContacts" }, { "id": "471043349", "predicate": "contacts.blocked", "params": [ { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "-1878523231", "predicate": "contacts.blockedSlice", "params": [ { "name": "count", "type": "int" }, { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "1447681221", "predicate": "contacts.suggested", "params": [ { "name": "results", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Suggested" }, { "id": "364538944", "predicate": "messages.dialogs", "params": [ { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "1910543603", "predicate": "messages.dialogsSlice", "params": [ { "name": "count", "type": "int" }, { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "-1938715001", "predicate": "messages.messages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "189033187", "predicate": "messages.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "1694474197", "predicate": "messages.chats", "params": [ { "name": "chats", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "-438840932", "predicate": "messages.chatFull", "params": [ { "name": "full_chat", "type": "ChatFull" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.ChatFull" }, { "id": "-1269012015", "predicate": "messages.affectedHistory", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "1474492012", "predicate": "inputMessagesFilterEmpty", "params": [], "type": "MessagesFilter" }, { "id": "-1777752804", "predicate": "inputMessagesFilterPhotos", "params": [], "type": "MessagesFilter" }, { "id": "-1614803355", "predicate": "inputMessagesFilterVideo", "params": [], "type": "MessagesFilter" }, { "id": "1458172132", "predicate": "inputMessagesFilterPhotoVideo", "params": [], "type": "MessagesFilter" }, { "id": "-648121413", "predicate": "inputMessagesFilterPhotoVideoDocuments", "params": [], "type": "MessagesFilter" }, { "id": "-1629621880", "predicate": "inputMessagesFilterDocument", "params": [], "type": "MessagesFilter" }, { "id": "-808946398", "predicate": "inputMessagesFilterAudio", "params": [], "type": "MessagesFilter" }, { "id": "1526462308", "predicate": "inputMessagesFilterAudioDocuments", "params": [], "type": "MessagesFilter" }, { "id": "2129714567", "predicate": "inputMessagesFilterUrl", "params": [], "type": "MessagesFilter" }, { "id": "522914557", "predicate": "updateNewMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1318109142", "predicate": "updateMessageID", "params": [ { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Update" }, { "id": "-1576161051", "predicate": "updateDeleteMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1548249383", "predicate": "updateUserTyping", "params": [ { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "-1704596961", "predicate": "updateChatUserTyping", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "125178264", "predicate": "updateChatParticipants", "params": [ { "name": "participants", "type": "ChatParticipants" } ], "type": "Update" }, { "id": "469489699", "predicate": "updateUserStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "Update" }, { "id": "-1489818765", "predicate": "updateUserName", "params": [ { "name": "user_id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "Update" }, { "id": "-1791935732", "predicate": "updateUserPhoto", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "previous", "type": "Bool" } ], "type": "Update" }, { "id": "628472761", "predicate": "updateContactRegistered", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1657903163", "predicate": "updateContactLink", "params": [ { "name": "user_id", "type": "int" }, { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" } ], "type": "Update" }, { "id": "-1895411046", "predicate": "updateNewAuthorization", "params": [ { "name": "auth_key_id", "type": "long" }, { "name": "date", "type": "int" }, { "name": "device", "type": "string" }, { "name": "location", "type": "string" } ], "type": "Update" }, { "id": "-1519637954", "predicate": "updates.state", "params": [ { "name": "pts", "type": "int" }, { "name": "qts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "unread_count", "type": "int" } ], "type": "updates.State" }, { "id": "1567990072", "predicate": "updates.differenceEmpty", "params": [ { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "updates.Difference" }, { "id": "16030880", "predicate": "updates.difference", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-1459938943", "predicate": "updates.differenceSlice", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "intermediate_state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-484987010", "predicate": "updatesTooLong", "params": [], "type": "Updates" }, { "id": "-136766906", "predicate": "updateShortMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "-892863022", "predicate": "updateShortChatMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "chat_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?Peer" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "2027216577", "predicate": "updateShort", "params": [ { "name": "update", "type": "Update" }, { "name": "date", "type": "int" } ], "type": "Updates" }, { "id": "1918567619", "predicate": "updatesCombined", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq_start", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "1957577280", "predicate": "updates", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "-1916114267", "predicate": "photos.photos", "params": [ { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "352657236", "predicate": "photos.photosSlice", "params": [ { "name": "count", "type": "int" }, { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "539045032", "predicate": "photos.photo", "params": [ { "name": "photo", "type": "Photo" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photo" }, { "id": "157948117", "predicate": "upload.file", "params": [ { "name": "type", "type": "storage.FileType" }, { "name": "mtime", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "upload.File" }, { "id": "98092748", "predicate": "dcOption", "params": [ { "name": "flags", "type": "#" }, { "name": "ipv6", "type": "flags.0?true" }, { "name": "media_only", "type": "flags.1?true" }, { "name": "id", "type": "int" }, { "name": "ip_address", "type": "string" }, { "name": "port", "type": "int" } ], "type": "DcOption" }, { "id": "1823925854", "predicate": "config", "params": [ { "name": "date", "type": "int" }, { "name": "expires", "type": "int" }, { "name": "test_mode", "type": "Bool" }, { "name": "this_dc", "type": "int" }, { "name": "dc_options", "type": "Vector" }, { "name": "chat_size_max", "type": "int" }, { "name": "megagroup_size_max", "type": "int" }, { "name": "forwarded_count_max", "type": "int" }, { "name": "online_update_period_ms", "type": "int" }, { "name": "offline_blur_timeout_ms", "type": "int" }, { "name": "offline_idle_timeout_ms", "type": "int" }, { "name": "online_cloud_timeout_ms", "type": "int" }, { "name": "notify_cloud_delay_ms", "type": "int" }, { "name": "notify_default_delay_ms", "type": "int" }, { "name": "chat_big_size", "type": "int" }, { "name": "push_chat_period_ms", "type": "int" }, { "name": "push_chat_limit", "type": "int" }, { "name": "disabled_features", "type": "Vector" } ], "type": "Config" }, { "id": "-1910892683", "predicate": "nearestDc", "params": [ { "name": "country", "type": "string" }, { "name": "this_dc", "type": "int" }, { "name": "nearest_dc", "type": "int" } ], "type": "NearestDc" }, { "id": "-1987579119", "predicate": "help.appUpdate", "params": [ { "name": "id", "type": "int" }, { "name": "critical", "type": "Bool" }, { "name": "url", "type": "string" }, { "name": "text", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "-1000708810", "predicate": "help.noAppUpdate", "params": [], "type": "help.AppUpdate" }, { "id": "415997816", "predicate": "help.inviteText", "params": [ { "name": "message", "type": "string" } ], "type": "help.InviteText" }, { "id": "1662091044", "predicate": "wallPaperSolid", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "bg_color", "type": "int" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "314359194", "predicate": "updateNewEncryptedMessage", "params": [ { "name": "message", "type": "EncryptedMessage" }, { "name": "qts", "type": "int" } ], "type": "Update" }, { "id": "386986326", "predicate": "updateEncryptedChatTyping", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Update" }, { "id": "-1264392051", "predicate": "updateEncryption", "params": [ { "name": "chat", "type": "EncryptedChat" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "956179895", "predicate": "updateEncryptedMessagesRead", "params": [ { "name": "chat_id", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1417756512", "predicate": "encryptedChatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "1006044124", "predicate": "encryptedChatWaiting", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-931638658", "predicate": "encryptedChatRequested", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "-94974410", "predicate": "encryptedChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a_or_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "332848423", "predicate": "encryptedChatDiscarded", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-247351839", "predicate": "inputEncryptedChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedChat" }, { "id": "-1038136962", "predicate": "encryptedFileEmpty", "params": [], "type": "EncryptedFile" }, { "id": "1248893260", "predicate": "encryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "EncryptedFile" }, { "id": "406307684", "predicate": "inputEncryptedFileEmpty", "params": [], "type": "InputEncryptedFile" }, { "id": "1690108678", "predicate": "inputEncryptedFileUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "md5_checksum", "type": "string" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "1511503333", "predicate": "inputEncryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedFile" }, { "id": "-182231723", "predicate": "inputEncryptedFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-317144808", "predicate": "encryptedMessage", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" }, { "name": "file", "type": "EncryptedFile" } ], "type": "EncryptedMessage" }, { "id": "594758406", "predicate": "encryptedMessageService", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "EncryptedMessage" }, { "id": "-1058912715", "predicate": "messages.dhConfigNotModified", "params": [ { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "740433629", "predicate": "messages.dhConfig", "params": [ { "name": "g", "type": "int" }, { "name": "p", "type": "bytes" }, { "name": "version", "type": "int" }, { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "1443858741", "predicate": "messages.sentEncryptedMessage", "params": [ { "name": "date", "type": "int" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1802240206", "predicate": "messages.sentEncryptedFile", "params": [ { "name": "date", "type": "int" }, { "name": "file", "type": "EncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-95482955", "predicate": "inputFileBig", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" } ], "type": "InputFile" }, { "id": "767652808", "predicate": "inputEncryptedFileBigUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "-364179876", "predicate": "updateChatParticipantAdd", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1851755554", "predicate": "updateChatParticipantDelete", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1906403213", "predicate": "updateDcOptions", "params": [ { "name": "dc_options", "type": "Vector" } ], "type": "Update" }, { "id": "1313442987", "predicate": "inputMediaUploadedAudio", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1986820223", "predicate": "inputMediaAudio", "params": [ { "name": "id", "type": "InputAudio" } ], "type": "InputMedia" }, { "id": "-1610888", "predicate": "inputMediaUploadedDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "1095242886", "predicate": "inputMediaUploadedThumbDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "-779818943", "predicate": "inputMediaDocument", "params": [ { "name": "id", "type": "InputDocument" } ], "type": "InputMedia" }, { "id": "802824708", "predicate": "messageMediaDocument", "params": [ { "name": "document", "type": "Document" } ], "type": "MessageMedia" }, { "id": "-961117440", "predicate": "messageMediaAudio", "params": [ { "name": "audio", "type": "Audio" } ], "type": "MessageMedia" }, { "id": "-648356732", "predicate": "inputAudioEmpty", "params": [], "type": "InputAudio" }, { "id": "2010398975", "predicate": "inputAudio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputAudio" }, { "id": "1928391342", "predicate": "inputDocumentEmpty", "params": [], "type": "InputDocument" }, { "id": "410618194", "predicate": "inputDocument", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputDocument" }, { "id": "1960591437", "predicate": "inputAudioFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1313188841", "predicate": "inputDocumentFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1483311320", "predicate": "audioEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Audio" }, { "id": "-102543275", "predicate": "audio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" } ], "type": "Audio" }, { "id": "922273905", "predicate": "documentEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Document" }, { "id": "-106717361", "predicate": "document", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "attributes", "type": "Vector" } ], "type": "Document" }, { "id": "398898678", "predicate": "help.support", "params": [ { "name": "phone_number", "type": "string" }, { "name": "user", "type": "User" } ], "type": "help.Support" }, { "id": "-1613493288", "predicate": "notifyPeer", "params": [ { "name": "peer", "type": "Peer" } ], "type": "NotifyPeer" }, { "id": "-1261946036", "predicate": "notifyUsers", "params": [], "type": "NotifyPeer" }, { "id": "-1073230141", "predicate": "notifyChats", "params": [], "type": "NotifyPeer" }, { "id": "1959820384", "predicate": "notifyAll", "params": [], "type": "NotifyPeer" }, { "id": "-2131957734", "predicate": "updateUserBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "blocked", "type": "Bool" } ], "type": "Update" }, { "id": "-1094555409", "predicate": "updateNotifySettings", "params": [ { "name": "peer", "type": "NotifyPeer" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Update" }, { "id": "-484053553", "predicate": "auth.sentAppCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "381645902", "predicate": "sendMessageTypingAction", "params": [], "type": "SendMessageAction" }, { "id": "-44119819", "predicate": "sendMessageCancelAction", "params": [], "type": "SendMessageAction" }, { "id": "-1584933265", "predicate": "sendMessageRecordVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-378127636", "predicate": "sendMessageUploadVideoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-718310409", "predicate": "sendMessageRecordAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-212740181", "predicate": "sendMessageUploadAudioAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-774682074", "predicate": "sendMessageUploadPhotoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-1441998364", "predicate": "sendMessageUploadDocumentAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "393186209", "predicate": "sendMessageGeoLocationAction", "params": [], "type": "SendMessageAction" }, { "id": "1653390447", "predicate": "sendMessageChooseContactAction", "params": [], "type": "SendMessageAction" }, { "id": "446822276", "predicate": "contacts.found", "params": [ { "name": "results", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Found" }, { "id": "942527460", "predicate": "updateServiceNotification", "params": [ { "name": "type", "type": "string" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" }, { "name": "popup", "type": "Bool" } ], "type": "Update" }, { "id": "-496024847", "predicate": "userStatusRecently", "params": [], "type": "UserStatus" }, { "id": "129960444", "predicate": "userStatusLastWeek", "params": [], "type": "UserStatus" }, { "id": "2011940674", "predicate": "userStatusLastMonth", "params": [], "type": "UserStatus" }, { "id": "-298113238", "predicate": "updatePrivacy", "params": [ { "name": "key", "type": "PrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "Update" }, { "id": "1335282456", "predicate": "inputPrivacyKeyStatusTimestamp", "params": [], "type": "InputPrivacyKey" }, { "id": "-1137792208", "predicate": "privacyKeyStatusTimestamp", "params": [], "type": "PrivacyKey" }, { "id": "218751099", "predicate": "inputPrivacyValueAllowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "407582158", "predicate": "inputPrivacyValueAllowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "320652927", "predicate": "inputPrivacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "195371015", "predicate": "inputPrivacyValueDisallowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "-697604407", "predicate": "inputPrivacyValueDisallowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "-1877932953", "predicate": "inputPrivacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "-123988", "predicate": "privacyValueAllowContacts", "params": [], "type": "PrivacyRule" }, { "id": "1698855810", "predicate": "privacyValueAllowAll", "params": [], "type": "PrivacyRule" }, { "id": "1297858060", "predicate": "privacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "-125240806", "predicate": "privacyValueDisallowContacts", "params": [], "type": "PrivacyRule" }, { "id": "-1955338397", "predicate": "privacyValueDisallowAll", "params": [], "type": "PrivacyRule" }, { "id": "209668535", "predicate": "privacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "1430961007", "predicate": "account.privacyRules", "params": [ { "name": "rules", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "-1194283041", "predicate": "accountDaysTTL", "params": [ { "name": "days", "type": "int" } ], "type": "AccountDaysTTL" }, { "id": "-1527411636", "predicate": "account.sentChangePhoneCode", "params": [ { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" } ], "type": "account.SentChangePhoneCode" }, { "id": "314130811", "predicate": "updateUserPhone", "params": [ { "name": "user_id", "type": "int" }, { "name": "phone", "type": "string" } ], "type": "Update" }, { "id": "1815593308", "predicate": "documentAttributeImageSize", "params": [ { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "297109817", "predicate": "documentAttributeAnimated", "params": [], "type": "DocumentAttribute" }, { "id": "978674434", "predicate": "documentAttributeSticker", "params": [ { "name": "alt", "type": "string" }, { "name": "stickerset", "type": "InputStickerSet" } ], "type": "DocumentAttribute" }, { "id": "1494273227", "predicate": "documentAttributeVideo", "params": [ { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "-556656416", "predicate": "documentAttributeAudio", "params": [ { "name": "duration", "type": "int" }, { "name": "title", "type": "string" }, { "name": "performer", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "358154344", "predicate": "documentAttributeFilename", "params": [ { "name": "file_name", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "-244016606", "predicate": "messages.stickersNotModified", "params": [], "type": "messages.Stickers" }, { "id": "-1970352846", "predicate": "messages.stickers", "params": [ { "name": "hash", "type": "string" }, { "name": "stickers", "type": "Vector" } ], "type": "messages.Stickers" }, { "id": "313694676", "predicate": "stickerPack", "params": [ { "name": "emoticon", "type": "string" }, { "name": "documents", "type": "Vector" } ], "type": "StickerPack" }, { "id": "-395967805", "predicate": "messages.allStickersNotModified", "params": [], "type": "messages.AllStickers" }, { "id": "-719474725", "predicate": "messages.allStickers", "params": [ { "name": "hash", "type": "string" }, { "name": "sets", "type": "Vector" } ], "type": "messages.AllStickers" }, { "id": "-1369215196", "predicate": "disabledFeature", "params": [ { "name": "feature", "type": "string" }, { "name": "description", "type": "string" } ], "type": "DisabledFeature" }, { "id": "-1721631396", "predicate": "updateReadHistoryInbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "791617983", "predicate": "updateReadHistoryOutbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-2066640507", "predicate": "messages.affectedMessages", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "1599050311", "predicate": "contactLinkUnknown", "params": [], "type": "ContactLink" }, { "id": "-17968211", "predicate": "contactLinkNone", "params": [], "type": "ContactLink" }, { "id": "646922073", "predicate": "contactLinkHasPhone", "params": [], "type": "ContactLink" }, { "id": "-721239344", "predicate": "contactLinkContact", "params": [], "type": "ContactLink" }, { "id": "2139689491", "predicate": "updateWebPage", "params": [ { "name": "webpage", "type": "WebPage" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-350980120", "predicate": "webPageEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "WebPage" }, { "id": "-981018084", "predicate": "webPagePending", "params": [ { "name": "id", "type": "long" }, { "name": "date", "type": "int" } ], "type": "WebPage" }, { "id": "-897446185", "predicate": "webPage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "long" }, { "name": "url", "type": "string" }, { "name": "display_url", "type": "string" }, { "name": "type", "type": "flags.0?string" }, { "name": "site_name", "type": "flags.1?string" }, { "name": "title", "type": "flags.2?string" }, { "name": "description", "type": "flags.3?string" }, { "name": "photo", "type": "flags.4?Photo" }, { "name": "embed_url", "type": "flags.5?string" }, { "name": "embed_type", "type": "flags.5?string" }, { "name": "embed_width", "type": "flags.6?int" }, { "name": "embed_height", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "author", "type": "flags.8?string" }, { "name": "document", "type": "flags.9?Document" } ], "type": "WebPage" }, { "id": "-1557277184", "predicate": "messageMediaWebPage", "params": [ { "name": "webpage", "type": "WebPage" } ], "type": "MessageMedia" }, { "id": "2079516406", "predicate": "authorization", "params": [ { "name": "hash", "type": "long" }, { "name": "flags", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "platform", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "api_id", "type": "int" }, { "name": "app_name", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "date_created", "type": "int" }, { "name": "date_active", "type": "int" }, { "name": "ip", "type": "string" }, { "name": "country", "type": "string" }, { "name": "region", "type": "string" } ], "type": "Authorization" }, { "id": "307276766", "predicate": "account.authorizations", "params": [ { "name": "authorizations", "type": "Vector" } ], "type": "account.Authorizations" }, { "id": "-1764049896", "predicate": "account.noPassword", "params": [ { "name": "new_salt", "type": "bytes" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "2081952796", "predicate": "account.password", "params": [ { "name": "current_salt", "type": "bytes" }, { "name": "new_salt", "type": "bytes" }, { "name": "hint", "type": "string" }, { "name": "has_recovery", "type": "Bool" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "-1212732749", "predicate": "account.passwordSettings", "params": [ { "name": "email", "type": "string" } ], "type": "account.PasswordSettings" }, { "id": "-1124314324", "predicate": "account.passwordInputSettings", "params": [ { "name": "flags", "type": "#" }, { "name": "new_salt", "type": "flags.0?bytes" }, { "name": "new_password_hash", "type": "flags.0?bytes" }, { "name": "hint", "type": "flags.0?string" }, { "name": "email", "type": "flags.1?string" } ], "type": "account.PasswordInputSettings" }, { "id": "326715557", "predicate": "auth.passwordRecovery", "params": [ { "name": "email_pattern", "type": "string" } ], "type": "auth.PasswordRecovery" }, { "id": "673687578", "predicate": "inputMediaVenue", "params": [ { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "InputMedia" }, { "id": "2031269663", "predicate": "messageMediaVenue", "params": [ { "name": "geo", "type": "GeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "MessageMedia" }, { "id": "-1551583367", "predicate": "receivedNotifyMessage", "params": [ { "name": "id", "type": "int" }, { "name": "flags", "type": "int" } ], "type": "ReceivedNotifyMessage" }, { "id": "1776236393", "predicate": "chatInviteEmpty", "params": [], "type": "ExportedChatInvite" }, { "id": "-64092740", "predicate": "chatInviteExported", "params": [ { "name": "link", "type": "string" } ], "type": "ExportedChatInvite" }, { "id": "1516793212", "predicate": "chatInviteAlready", "params": [ { "name": "chat", "type": "Chat" } ], "type": "ChatInvite" }, { "id": "-1813406880", "predicate": "chatInvite", "params": [ { "name": "flags", "type": "#" }, { "name": "channel", "type": "flags.0?true" }, { "name": "broadcast", "type": "flags.1?true" }, { "name": "public", "type": "flags.2?true" }, { "name": "megagroup", "type": "flags.3?true" }, { "name": "title", "type": "string" } ], "type": "ChatInvite" }, { "id": "-123931160", "predicate": "messageActionChatJoinedByLink", "params": [ { "name": "inviter_id", "type": "int" } ], "type": "MessageAction" }, { "id": "1757493555", "predicate": "updateReadMessagesContents", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-4838507", "predicate": "inputStickerSetEmpty", "params": [], "type": "InputStickerSet" }, { "id": "-1645763991", "predicate": "inputStickerSetID", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputStickerSet" }, { "id": "-2044933984", "predicate": "inputStickerSetShortName", "params": [ { "name": "short_name", "type": "string" } ], "type": "InputStickerSet" }, { "id": "-852477119", "predicate": "stickerSet", "params": [ { "name": "flags", "type": "#" }, { "name": "installed", "type": "flags.0?true" }, { "name": "disabled", "type": "flags.1?true" }, { "name": "official", "type": "flags.2?true" }, { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "short_name", "type": "string" }, { "name": "count", "type": "int" }, { "name": "hash", "type": "int" } ], "type": "StickerSet" }, { "id": "-1240849242", "predicate": "messages.stickerSet", "params": [ { "name": "set", "type": "StickerSet" }, { "name": "packs", "type": "Vector" }, { "name": "documents", "type": "Vector" } ], "type": "messages.StickerSet" }, { "id": "585404530", "predicate": "user", "params": [ { "name": "flags", "type": "#" }, { "name": "self", "type": "flags.10?true" }, { "name": "contact", "type": "flags.11?true" }, { "name": "mutual_contact", "type": "flags.12?true" }, { "name": "deleted", "type": "flags.13?true" }, { "name": "bot", "type": "flags.14?true" }, { "name": "bot_chat_history", "type": "flags.15?true" }, { "name": "bot_nochats", "type": "flags.16?true" }, { "name": "verified", "type": "flags.17?true" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "flags.0?long" }, { "name": "first_name", "type": "flags.1?string" }, { "name": "last_name", "type": "flags.2?string" }, { "name": "username", "type": "flags.3?string" }, { "name": "phone", "type": "flags.4?string" }, { "name": "photo", "type": "flags.5?UserProfilePhoto" }, { "name": "status", "type": "flags.6?UserStatus" }, { "name": "bot_info_version", "type": "flags.14?int" } ], "type": "User" }, { "id": "-1032140601", "predicate": "botCommand", "params": [ { "name": "command", "type": "string" }, { "name": "description", "type": "string" } ], "type": "BotCommand" }, { "id": "-1154598962", "predicate": "botInfoEmpty", "params": [], "type": "BotInfo" }, { "id": "164583517", "predicate": "botInfo", "params": [ { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" }, { "name": "share_text", "type": "string" }, { "name": "description", "type": "string" }, { "name": "commands", "type": "Vector" } ], "type": "BotInfo" }, { "id": "-1560655744", "predicate": "keyboardButton", "params": [ { "name": "text", "type": "string" } ], "type": "KeyboardButton" }, { "id": "2002815875", "predicate": "keyboardButtonRow", "params": [ { "name": "buttons", "type": "Vector" } ], "type": "KeyboardButtonRow" }, { "id": "-1606526075", "predicate": "replyKeyboardHide", "params": [ { "name": "flags", "type": "#" }, { "name": "selective", "type": "flags.2?true" } ], "type": "ReplyMarkup" }, { "id": "-200242528", "predicate": "replyKeyboardForceReply", "params": [ { "name": "flags", "type": "#" }, { "name": "single_use", "type": "flags.1?true" }, { "name": "selective", "type": "flags.2?true" } ], "type": "ReplyMarkup" }, { "id": "889353612", "predicate": "replyKeyboardMarkup", "params": [ { "name": "flags", "type": "#" }, { "name": "resize", "type": "flags.0?true" }, { "name": "single_use", "type": "flags.1?true" }, { "name": "selective", "type": "flags.2?true" }, { "name": "rows", "type": "Vector" } ], "type": "ReplyMarkup" }, { "id": "2072935910", "predicate": "inputPeerUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "-668391402", "predicate": "inputUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputUser" }, { "id": "-1350696044", "predicate": "help.appChangelogEmpty", "params": [], "type": "help.AppChangelog" }, { "id": "1181279933", "predicate": "help.appChangelog", "params": [ { "name": "text", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-1148011883", "predicate": "messageEntityUnknown", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-100378723", "predicate": "messageEntityMention", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1868782349", "predicate": "messageEntityHashtag", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1827637959", "predicate": "messageEntityBotCommand", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1859134776", "predicate": "messageEntityUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1692693954", "predicate": "messageEntityEmail", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-1117713463", "predicate": "messageEntityBold", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-2106619040", "predicate": "messageEntityItalic", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "681706865", "predicate": "messageEntityCode", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1938967520", "predicate": "messageEntityPre", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "language", "type": "string" } ], "type": "MessageEntity" }, { "id": "1990644519", "predicate": "messageEntityTextUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "url", "type": "string" } ], "type": "MessageEntity" }, { "id": "301019932", "predicate": "updateShortSentMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "unread", "type": "flags.0?true" }, { "name": "out", "type": "flags.1?true" }, { "name": "id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "entities", "type": "flags.7?Vector" } ], "type": "Updates" }, { "id": "-292807034", "predicate": "inputChannelEmpty", "params": [], "type": "InputChannel" }, { "id": "-1343524562", "predicate": "inputChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputChannel" }, { "id": "-1109531342", "predicate": "peerChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Peer" }, { "id": "548253432", "predicate": "inputPeerChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "1737397639", "predicate": "channel", "params": [ { "name": "flags", "type": "#" }, { "name": "creator", "type": "flags.0?true" }, { "name": "kicked", "type": "flags.1?true" }, { "name": "left", "type": "flags.2?true" }, { "name": "editor", "type": "flags.3?true" }, { "name": "moderator", "type": "flags.4?true" }, { "name": "broadcast", "type": "flags.5?true" }, { "name": "verified", "type": "flags.7?true" }, { "name": "megagroup", "type": "flags.8?true" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "username", "type": "flags.6?string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Chat" }, { "id": "763724588", "predicate": "channelForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" } ], "type": "Chat" }, { "id": "2131196633", "predicate": "contacts.resolvedPeer", "params": [ { "name": "peer", "type": "Peer" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ResolvedPeer" }, { "id": "-1640751649", "predicate": "channelFull", "params": [ { "name": "flags", "type": "#" }, { "name": "can_view_participants", "type": "flags.3?true" }, { "name": "id", "type": "int" }, { "name": "about", "type": "string" }, { "name": "participants_count", "type": "flags.0?int" }, { "name": "admins_count", "type": "flags.1?int" }, { "name": "kicked_count", "type": "flags.2?int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector" }, { "name": "migrated_from_chat_id", "type": "flags.4?int" }, { "name": "migrated_from_max_id", "type": "flags.4?int" } ], "type": "ChatFull" }, { "id": "1535415986", "predicate": "dialogChannel", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "top_important_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "pts", "type": "int" } ], "type": "Dialog" }, { "id": "182649427", "predicate": "messageRange", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "MessageRange" }, { "id": "-399216813", "predicate": "messageGroup", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "count", "type": "int" }, { "name": "date", "type": "int" } ], "type": "MessageGroup" }, { "id": "-1139861572", "predicate": "messages.channelMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "pts", "type": "int" }, { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "collapsed", "type": "flags.0?Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "-1781355374", "predicate": "messageActionChannelCreate", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "1620337698", "predicate": "updateChannelTooLong", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Update" }, { "id": "-1227598250", "predicate": "updateChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Update" }, { "id": "-1016324548", "predicate": "updateChannelGroup", "params": [ { "name": "channel_id", "type": "int" }, { "name": "group", "type": "MessageGroup" } ], "type": "Update" }, { "id": "1656358105", "predicate": "updateNewChannelMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1108669311", "predicate": "updateReadChannelInbox", "params": [ { "name": "channel_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "Update" }, { "id": "-1015733815", "predicate": "updateDeleteChannelMessages", "params": [ { "name": "channel_id", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-1734268085", "predicate": "updateChannelMessageViews", "params": [ { "name": "channel_id", "type": "int" }, { "name": "id", "type": "int" }, { "name": "views", "type": "int" } ], "type": "Update" }, { "id": "1041346555", "predicate": "updates.channelDifferenceEmpty", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" } ], "type": "updates.ChannelDifference" }, { "id": "1578530374", "predicate": "updates.channelDifferenceTooLong", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "top_message", "type": "int" }, { "name": "top_important_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "unread_important_count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "updates.ChannelDifference" }, { "id": "543450958", "predicate": "updates.channelDifference", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "new_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "updates.ChannelDifference" }, { "id": "-1798033689", "predicate": "channelMessagesFilterEmpty", "params": [], "type": "ChannelMessagesFilter" }, { "id": "-847783593", "predicate": "channelMessagesFilter", "params": [ { "name": "flags", "type": "#" }, { "name": "important_only", "type": "flags.0?true" }, { "name": "exclude_new_messages", "type": "flags.1?true" }, { "name": "ranges", "type": "Vector" } ], "type": "ChannelMessagesFilter" }, { "id": "-100588754", "predicate": "channelMessagesFilterCollapsed", "params": [], "type": "ChannelMessagesFilter" }, { "id": "367766557", "predicate": "channelParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1557620115", "predicate": "channelParticipantSelf", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1861910545", "predicate": "channelParticipantModerator", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1743180447", "predicate": "channelParticipantEditor", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1933187430", "predicate": "channelParticipantKicked", "params": [ { "name": "user_id", "type": "int" }, { "name": "kicked_by", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-471670279", "predicate": "channelParticipantCreator", "params": [ { "name": "user_id", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-566281095", "predicate": "channelParticipantsRecent", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-1268741783", "predicate": "channelParticipantsAdmins", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "1010285434", "predicate": "channelParticipantsKicked", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-1299865402", "predicate": "channelRoleEmpty", "params": [], "type": "ChannelParticipantRole" }, { "id": "-1776756363", "predicate": "channelRoleModerator", "params": [], "type": "ChannelParticipantRole" }, { "id": "-2113143156", "predicate": "channelRoleEditor", "params": [], "type": "ChannelParticipantRole" }, { "id": "-177282392", "predicate": "channels.channelParticipants", "params": [ { "name": "count", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "channels.ChannelParticipants" }, { "id": "-791039645", "predicate": "channels.channelParticipant", "params": [ { "name": "participant", "type": "ChannelParticipant" }, { "name": "users", "type": "Vector" } ], "type": "channels.ChannelParticipant" }, { "id": "-636267638", "predicate": "chatParticipantCreator", "params": [ { "name": "user_id", "type": "int" } ], "type": "ChatParticipant" }, { "id": "-489233354", "predicate": "chatParticipantAdmin", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "1855224129", "predicate": "updateChatAdmins", "params": [ { "name": "chat_id", "type": "int" }, { "name": "enabled", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1232070311", "predicate": "updateChatParticipantAdmin", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "is_admin", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1371385889", "predicate": "messageActionChatMigrateTo", "params": [ { "name": "channel_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1336546578", "predicate": "messageActionChannelMigrateFrom", "params": [ { "name": "title", "type": "string" }, { "name": "chat_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1328445861", "predicate": "channelParticipantsBots", "params": [], "type": "ChannelParticipantsFilter" } ], "methods": [ { "id": "-878758099", "method": "invokeAfterMsg", "params": [ { "name": "msg_id", "type": "long" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1036301552", "method": "invokeAfterMsgs", "params": [ { "name": "msg_ids", "type": "Vector" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1877286395", "method": "auth.checkPhone", "params": [ { "name": "phone_number", "type": "string" } ], "type": "auth.CheckedPhone" }, { "id": "1988976461", "method": "auth.sendCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "sms_type", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "auth.SentCode" }, { "id": "63247716", "method": "auth.sendCall", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "453408308", "method": "auth.signUp", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1126886015", "method": "auth.signIn", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "1461180992", "method": "auth.logOut", "params": [], "type": "Bool" }, { "id": "-1616179942", "method": "auth.resetAuthorizations", "params": [], "type": "Bool" }, { "id": "1998331287", "method": "auth.sendInvites", "params": [ { "name": "phone_numbers", "type": "Vector" }, { "name": "message", "type": "string" } ], "type": "Bool" }, { "id": "-440401971", "method": "auth.exportAuthorization", "params": [ { "name": "dc_id", "type": "int" } ], "type": "auth.ExportedAuthorization" }, { "id": "-470837741", "method": "auth.importAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-841733627", "method": "auth.bindTempAuthKey", "params": [ { "name": "perm_auth_key_id", "type": "long" }, { "name": "nonce", "type": "long" }, { "name": "expires_at", "type": "int" }, { "name": "encrypted_message", "type": "bytes" } ], "type": "Bool" }, { "id": "1147957548", "method": "account.registerDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "app_sandbox", "type": "Bool" }, { "name": "lang_code", "type": "string" } ], "type": "Bool" }, { "id": "1707432768", "method": "account.unregisterDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" } ], "type": "Bool" }, { "id": "-2067899501", "method": "account.updateNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" }, { "name": "settings", "type": "InputPeerNotifySettings" } ], "type": "Bool" }, { "id": "313765169", "method": "account.getNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" } ], "type": "PeerNotifySettings" }, { "id": "-612493497", "method": "account.resetNotifySettings", "params": [], "type": "Bool" }, { "id": "-259486360", "method": "account.updateProfile", "params": [ { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "User" }, { "id": "1713919532", "method": "account.updateStatus", "params": [ { "name": "offline", "type": "Bool" } ], "type": "Bool" }, { "id": "-1068696894", "method": "account.getWallPapers", "params": [], "type": "Vector" }, { "id": "227648840", "method": "users.getUsers", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-902781519", "method": "users.getFullUser", "params": [ { "name": "id", "type": "InputUser" } ], "type": "UserFull" }, { "id": "-995929106", "method": "contacts.getStatuses", "params": [], "type": "Vector" }, { "id": "583445000", "method": "contacts.getContacts", "params": [ { "name": "hash", "type": "string" } ], "type": "contacts.Contacts" }, { "id": "-634342611", "method": "contacts.importContacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "replace", "type": "Bool" } ], "type": "contacts.ImportedContacts" }, { "id": "-847825880", "method": "contacts.getSuggested", "params": [ { "name": "limit", "type": "int" } ], "type": "contacts.Suggested" }, { "id": "-1902823612", "method": "contacts.deleteContact", "params": [ { "name": "id", "type": "InputUser" } ], "type": "contacts.Link" }, { "id": "1504393374", "method": "contacts.deleteContacts", "params": [ { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "858475004", "method": "contacts.block", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-448724803", "method": "contacts.unblock", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-176409329", "method": "contacts.getBlocked", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "contacts.Blocked" }, { "id": "-2065352905", "method": "contacts.exportCard", "params": [], "type": "Vector" }, { "id": "1340184318", "method": "contacts.importCard", "params": [ { "name": "export_card", "type": "Vector" } ], "type": "User" }, { "id": "1109588596", "method": "messages.getMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "1799878989", "method": "messages.getDialogs", "params": [ { "name": "offset_date", "type": "int" }, { "name": "offset_id", "type": "int" }, { "name": "offset_peer", "type": "InputPeer" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-1970355494", "method": "messages.getHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset_id", "type": "int" }, { "name": "add_offset", "type": "int" }, { "name": "limit", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" } ], "type": "messages.Messages" }, { "id": "-732523960", "method": "messages.search", "params": [ { "name": "flags", "type": "#" }, { "name": "important_only", "type": "flags.0?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "238054714", "method": "messages.readHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "-1212072999", "method": "messages.deleteHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-1510897371", "method": "messages.deleteMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "94983360", "method": "messages.receivedMessages", "params": [ { "name": "max_id", "type": "int" } ], "type": "Vector" }, { "id": "-1551737264", "method": "messages.setTyping", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Bool" }, { "id": "-91733382", "method": "messages.sendMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.1?true" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" }, { "name": "entities", "type": "flags.3?Vector" } ], "type": "Updates" }, { "id": "-923703407", "method": "messages.sendMedia", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "Updates" }, { "id": "1888354709", "method": "messages.forwardMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.4?true" }, { "name": "from_peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "random_id", "type": "Vector" }, { "name": "to_peer", "type": "InputPeer" } ], "type": "Updates" }, { "id": "-820669733", "method": "messages.reportSpam", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "Bool" }, { "id": "1013621127", "method": "messages.getChats", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "998448230", "method": "messages.getFullChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "messages.ChatFull" }, { "id": "-599447467", "method": "messages.editChatTitle", "params": [ { "name": "chat_id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-900957736", "method": "messages.editChatPhoto", "params": [ { "name": "chat_id", "type": "int" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-106911223", "method": "messages.addChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "fwd_limit", "type": "int" } ], "type": "Updates" }, { "id": "-530505962", "method": "messages.deleteChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" } ], "type": "Updates" }, { "id": "164303470", "method": "messages.createChat", "params": [ { "name": "users", "type": "Vector" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-304838614", "method": "updates.getState", "params": [], "type": "updates.State" }, { "id": "168039573", "method": "updates.getDifference", "params": [ { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "qts", "type": "int" } ], "type": "updates.Difference" }, { "id": "-285902432", "method": "photos.updateProfilePhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "UserProfilePhoto" }, { "id": "-720397176", "method": "photos.uploadProfilePhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "photos.Photo" }, { "id": "-2016444625", "method": "photos.deletePhotos", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-1291540959", "method": "upload.saveFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "-475607115", "method": "upload.getFile", "params": [ { "name": "location", "type": "InputFileLocation" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "upload.File" }, { "id": "-990308245", "method": "help.getConfig", "params": [], "type": "Config" }, { "id": "531836966", "method": "help.getNearestDc", "params": [], "type": "NearestDc" }, { "id": "-938300290", "method": "help.getAppUpdate", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "1862465352", "method": "help.saveAppLog", "params": [ { "name": "events", "type": "Vector" } ], "type": "Bool" }, { "id": "-1532407418", "method": "help.getInviteText", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.InviteText" }, { "id": "-1848823128", "method": "photos.getUserPhotos", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "long" }, { "name": "limit", "type": "int" } ], "type": "photos.Photos" }, { "id": "865483769", "method": "messages.forwardMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Updates" }, { "id": "-1082919718", "method": "messages.sendBroadcast", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "random_id", "type": "Vector" }, { "name": "message", "type": "string" }, { "name": "media", "type": "InputMedia" } ], "type": "Updates" }, { "id": "651135312", "method": "messages.getDhConfig", "params": [ { "name": "version", "type": "int" }, { "name": "random_length", "type": "int" } ], "type": "messages.DhConfig" }, { "id": "-162681021", "method": "messages.requestEncryption", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "random_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "1035731989", "method": "messages.acceptEncryption", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "g_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "-304536635", "method": "messages.discardEncryption", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Bool" }, { "id": "2031374829", "method": "messages.setEncryptedTyping", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "2135648522", "method": "messages.readEncryptedHistory", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "max_date", "type": "int" } ], "type": "Bool" }, { "id": "-1451792525", "method": "messages.sendEncrypted", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1701831834", "method": "messages.sendEncryptedFile", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" }, { "name": "file", "type": "InputEncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "852769188", "method": "messages.sendEncryptedService", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "1436924774", "method": "messages.receivedQueue", "params": [ { "name": "max_qts", "type": "int" } ], "type": "Vector" }, { "id": "-562337987", "method": "upload.saveBigFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "file_total_parts", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "1769565673", "method": "initConnection", "params": [ { "name": "api_id", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-1663104819", "method": "help.getSupport", "params": [], "type": "help.Support" }, { "id": "229241832", "method": "auth.sendSms", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "916930423", "method": "messages.readMessageContents", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "655677548", "method": "account.checkUsername", "params": [ { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "1040964988", "method": "account.updateUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "301470424", "method": "contacts.search", "params": [ { "name": "q", "type": "string" }, { "name": "limit", "type": "int" } ], "type": "contacts.Found" }, { "id": "-623130288", "method": "account.getPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" } ], "type": "account.PrivacyRules" }, { "id": "-906486552", "method": "account.setPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "1099779595", "method": "account.deleteAccount", "params": [ { "name": "reason", "type": "string" } ], "type": "Bool" }, { "id": "150761757", "method": "account.getAccountTTL", "params": [], "type": "AccountDaysTTL" }, { "id": "608323678", "method": "account.setAccountTTL", "params": [ { "name": "ttl", "type": "AccountDaysTTL" } ], "type": "Bool" }, { "id": "-627372787", "method": "invokeWithLayer", "params": [ { "name": "layer", "type": "int" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-113456221", "method": "contacts.resolveUsername", "params": [ { "name": "username", "type": "string" } ], "type": "contacts.ResolvedPeer" }, { "id": "-1543001868", "method": "account.sendChangePhoneCode", "params": [ { "name": "phone_number", "type": "string" } ], "type": "account.SentChangePhoneCode" }, { "id": "1891839707", "method": "account.changePhone", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "User" }, { "id": "-1373446075", "method": "messages.getStickers", "params": [ { "name": "emoticon", "type": "string" }, { "name": "hash", "type": "string" } ], "type": "messages.Stickers" }, { "id": "-1438922648", "method": "messages.getAllStickers", "params": [ { "name": "hash", "type": "string" } ], "type": "messages.AllStickers" }, { "id": "954152242", "method": "account.updateDeviceLocked", "params": [ { "name": "period", "type": "int" } ], "type": "Bool" }, { "id": "1738800940", "method": "auth.importBotAuthorization", "params": [ { "name": "flags", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "bot_auth_token", "type": "string" } ], "type": "auth.Authorization" }, { "id": "623001124", "method": "messages.getWebPagePreview", "params": [ { "name": "message", "type": "string" } ], "type": "MessageMedia" }, { "id": "-484392616", "method": "account.getAuthorizations", "params": [], "type": "account.Authorizations" }, { "id": "-545786948", "method": "account.resetAuthorization", "params": [ { "name": "hash", "type": "long" } ], "type": "Bool" }, { "id": "1418342645", "method": "account.getPassword", "params": [], "type": "account.Password" }, { "id": "-1131605573", "method": "account.getPasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" } ], "type": "account.PasswordSettings" }, { "id": "-92517498", "method": "account.updatePasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" }, { "name": "new_settings", "type": "account.PasswordInputSettings" } ], "type": "Bool" }, { "id": "174260510", "method": "auth.checkPassword", "params": [ { "name": "password_hash", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-661144474", "method": "auth.requestPasswordRecovery", "params": [], "type": "auth.PasswordRecovery" }, { "id": "1319464594", "method": "auth.recoverPassword", "params": [ { "name": "code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1080796745", "method": "invokeWithoutUpdates", "params": [ { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "2106086025", "method": "messages.exportChatInvite", "params": [ { "name": "chat_id", "type": "int" } ], "type": "ExportedChatInvite" }, { "id": "1051570619", "method": "messages.checkChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "ChatInvite" }, { "id": "1817183516", "method": "messages.importChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "Updates" }, { "id": "639215886", "method": "messages.getStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "messages.StickerSet" }, { "id": "2066793382", "method": "messages.installStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" }, { "name": "disabled", "type": "Bool" } ], "type": "Bool" }, { "id": "-110209570", "method": "messages.uninstallStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "Bool" }, { "id": "-421563528", "method": "messages.startBot", "params": [ { "name": "bot", "type": "InputUser" }, { "name": "peer", "type": "InputPeer" }, { "name": "random_id", "type": "long" }, { "name": "start_param", "type": "string" } ], "type": "Updates" }, { "id": "1537966002", "method": "help.getAppChangelog", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-993483427", "method": "messages.getMessagesViews", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" }, { "name": "increment", "type": "Bool" } ], "type": "Vector" }, { "id": "-1445735863", "method": "channels.getDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-575067701", "method": "channels.getImportantHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "offset_id", "type": "int" }, { "name": "add_offset", "type": "int" }, { "name": "limit", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" } ], "type": "messages.Messages" }, { "id": "-871347913", "method": "channels.readHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "max_id", "type": "int" } ], "type": "Bool" }, { "id": "-2067661490", "method": "channels.deleteMessages", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "Vector" } ], "type": "messages.AffectedMessages" }, { "id": "-787622117", "method": "channels.deleteUserHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" } ], "type": "messages.AffectedHistory" }, { "id": "-32999408", "method": "channels.reportSpam", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "-1814580409", "method": "channels.getMessages", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "618237842", "method": "channels.getParticipants", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "filter", "type": "ChannelParticipantsFilter" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "channels.ChannelParticipants" }, { "id": "1416484774", "method": "channels.getParticipant", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" } ], "type": "channels.ChannelParticipant" }, { "id": "176122811", "method": "channels.getChannels", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "141781513", "method": "channels.getFullChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "messages.ChatFull" }, { "id": "-192332417", "method": "channels.createChannel", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.0?true" }, { "name": "megagroup", "type": "flags.1?true" }, { "name": "title", "type": "string" }, { "name": "about", "type": "string" } ], "type": "Updates" }, { "id": "333610782", "method": "channels.editAbout", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "about", "type": "string" } ], "type": "Bool" }, { "id": "-344583728", "method": "channels.editAdmin", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "role", "type": "ChannelParticipantRole" } ], "type": "Updates" }, { "id": "1450044624", "method": "channels.editTitle", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-248621111", "method": "channels.editPhoto", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-1432183160", "method": "channels.toggleComments", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "283557164", "method": "channels.checkUsername", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "890549214", "method": "channels.updateUsername", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "615851205", "method": "channels.joinChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "-130635115", "method": "channels.leaveChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "429865580", "method": "channels.inviteToChannel", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "users", "type": "Vector" } ], "type": "Updates" }, { "id": "-1502421484", "method": "channels.kickFromChannel", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "kicked", "type": "Bool" } ], "type": "Updates" }, { "id": "-950663035", "method": "channels.exportInvite", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "ExportedChatInvite" }, { "id": "-1072619549", "method": "channels.deleteChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "-1154295872", "method": "updates.getChannelDifference", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "filter", "type": "ChannelMessagesFilter" }, { "name": "pts", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "updates.ChannelDifference" }, { "id": "-326379039", "method": "messages.toggleChatAdmins", "params": [ { "name": "chat_id", "type": "int" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "-1444503762", "method": "messages.editChatAdmin", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "is_admin", "type": "Bool" } ], "type": "Bool" }, { "id": "363051235", "method": "messages.migrateChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Updates" }, { "id": "-1640190800", "method": "messages.searchGlobal", "params": [ { "name": "q", "type": "string" }, { "name": "offset_date", "type": "int" }, { "name": "offset_peer", "type": "InputPeer" }, { "name": "offset_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" } ] }. * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; use Amp\ByteStream\InputStream; use Amp\Promise; /** * PayloadStream. * * Represents an MTProto payload * * @author Daniil Gentili */ class PayloadStream implements InputStream { public function read(): Promise { } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Wrappers; /** * Manages logging in and out. */ trait TOS { public function check_tos() { if ($this->authorized === self::LOGGED_IN && !$this->authorization['user']['bot']) { if ($this->tos['expires'] < time()) { $this->logger->logger('Fetching TOS...'); $this->tos = $this->method_call('help.getTermsOfServiceUpdate', [], ['datacenter' => $this->datacenter->curdc]); $this->tos['accepted'] = $this->tos['_'] === 'help.termsOfServiceUpdateEmpty'; } if (!$this->tos['accepted']) { $this->logger->logger('Telegram has updated their Terms Of Service', \danog\MadelineProto\Logger::ERROR); $this->logger->logger('Accept the TOS before proceeding by calling $MadelineProto->accept_tos().', \danog\MadelineProto\Logger::ERROR); $this->logger->logger('You can also decline the TOS by calling $MadelineProto->decline_tos().', \danog\MadelineProto\Logger::ERROR); $this->logger->logger('By declining the TOS, the currently logged in account will be PERMANENTLY DELETED.', \danog\MadelineProto\Logger::FATAL_ERROR); $this->logger->logger('Read the following TOS very carefully: ', \danog\MadelineProto\Logger::ERROR); $this->logger->logger($this->tos); throw new \danog\MadelineProto\Exception('TOS action required, check the logs', 0, null, 'MadelineProto', 1); } } } public function accept_tos() { $this->tos['accepted'] = $this->method_call('help.acceptTermsOfService', ['id' => $this->tos['terms_of_service']['id']], ['datacenter' => $this->datacenter->curdc]); if ($this->tos['accepted']) { $this->logger->logger('TOS accepted successfully'); } else { throw new \danog\MadelineProto\Exception('An error occurred while accepting the TOS'); } } public function decline_tos() { $this->method_call('account.deleteAccount', ['reason' => 'Decline ToS update'], ['datacenter' => $this->datacenter->curdc]); $this->logout(); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Wrappers; use Amp\Deferred; /** * Manages logging in and out. */ trait Loop { private $loop_callback; public function setLoopCallback($callback) { $this->loop_callback = $callback; } public function loop_async($max_forks = 0) { if (is_callable($max_forks)) { return $max_forks(); } if (in_array($this->settings['updates']['callback'], [['danog\\MadelineProto\\API', 'get_updates_update_handler'], 'get_updates_update_handler'])) { return true; } if (!is_callable($this->loop_callback) || (is_array($this->loop_callback) && $this->loop_callback[1] === 'onLoop' && !method_exists(...$this->loop_callback))) { $this->loop_callback = null; } if (php_sapi_name() !== 'cli') { try { set_time_limit(-1); } catch (\danog\MadelineProto\Exception $e) { register_shutdown_function(function () { //$this->logger->logger(['Restarting script...']); $a = fsockopen((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'tls' : 'tcp').'://'.$_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']); fwrite($a, $_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI'].' '.$_SERVER['SERVER_PROTOCOL']."\r\n".'Host: '.$_SERVER['SERVER_NAME']."\r\n\r\n"); }); } } if (!$this->settings['updates']['handle_updates']) { $this->settings['updates']['handle_updates'] = true; } if (!$this->settings['updates']['run_callback']) { $this->settings['updates']['run_callback'] = true; } $this->datacenter->sockets[$this->settings['connection_settings']['default_dc']]->updater->start(); $this->logger->logger('Started update loop', \danog\MadelineProto\Logger::NOTICE); $offset = 0; while (true) { foreach ($this->updates as $update) { $r = $this->settings['updates']['callback']($update); if (is_object($r)) { \Amp\Promise\rethrow($this->call($r)); } } $this->updates = []; if ($this->loop_callback !== null) { $callback = $this->loop_callback; $callback(); } array_walk($this->calls, function ($controller, $id) { if ($controller->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { $controller->discard(); } }); $this->update_deferred = new Deferred(); yield $this->update_deferred->promise(); } } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Wrappers; /** * Manages logging in and out. */ trait Callback { public function setCallback($callback) { $this->settings['updates']['callback'] = $callback; $this->settings['updates']['run_callback'] = true; $this->settings['updates']['handle_updates'] = true; return $this->datacenter->sockets[$this->settings['connection_settings']['default_dc']]->updater->start(); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Wrappers; /** * Manages simple logging in and out. */ trait ApiStart { public function api_start() { if (php_sapi_name() === 'cli') { if (!function_exists('readline')) { $readline = function ($prompt = null) { if ($prompt) { echo $prompt; } $fp = fopen('php://stdin', 'r'); $line = rtrim(fgets($fp, 1024)); return $line; }; } else { $readline = 'readline'; } echo 'You did not define a valid API ID/API hash. Do you want to define it now manually, or automatically? (m/a) Note that you can also provide the API parameters directly in the code using the settings: https://docs.madelineproto.xyz/docs/SETTINGS.html#settingsapp_infoapi_id'.PHP_EOL; if (strpos($res = $readline('Your choice (m/a): '), 'm') !== false) { echo '1) Login to my.telegram.org 2) Go to API development tools 3) App title: your app\'s name, can be anything Short name: your app\'s short name, can be anything URL: your app/website\'s URL, or t.me/yourusername Platform: anything Description: Describe your app here 4) Click on create application'.PHP_EOL; $app['api_id'] = $readline('5) Enter your API ID: '); $app['api_hash'] = $readline('6) Enter your API hash: '); return $app; } else { $this->my_telegram_org_wrapper = new \danog\MadelineProto\MyTelegramOrgWrapper($readline('Enter a phone number that is already registered on Telegram: ')); $this->my_telegram_org_wrapper->complete_login($readline('Enter the verification code you received in telegram: ')); if (!$this->my_telegram_org_wrapper->has_app()) { $app_title = $readline('Enter the app\'s name, can be anything: '); $short_name = $readline('Enter the app\'s short name, can be anything: '); $url = $readline('Enter the app/website\'s URL, or t.me/yourusername: '); $description = $readline('Describe your app: '); $app = $this->my_telegram_org_wrapper->create_app(['app_title' => $app_title, 'app_shortname' => $short_name, 'app_url' => $short_name, 'app_platform' => 'web', 'app_desc' => $description]); } else { $app = $this->my_telegram_org_wrapper->get_app(); } return $app; } } else { $this->getting_api_id = true; if (!isset($this->my_telegram_org_wrapper)) { if (isset($_POST['api_id']) && isset($_POST['api_hash'])) { $app['api_id'] = (int) $_POST['api_id']; $app['api_hash'] = $_POST['api_hash']; $this->getting_api_id = false; return $app; } elseif (isset($_POST['phone_number'])) { $this->web_api_phone_login(); } else { $this->web_api_echo(); } } elseif (!$this->my_telegram_org_wrapper->logged_in()) { if (isset($_POST['code'])) { $this->web_api_complete_login(); if ($this->my_telegram_org_wrapper->has_app()) { return $this->my_telegram_org_wrapper->get_app(); } $this->web_api_echo(); } else { $this->web_api_echo("You didn't provide a phone code!"); } } else { if (isset($_POST['app_title'], $_POST['app_shortname'], $_POST['app_url'], $_POST['app_platform'], $_POST['app_desc'])) { $app = $this->web_api_create_app(); $this->getting_api_id = false; return $app; } else { $this->web_api_echo("You didn't provide all of the required parameters!"); } } exit; } } public function web_api_phone_login() { try { $this->my_telegram_org_wrapper = new \danog\MadelineProto\MyTelegramOrgWrapper($_POST['phone_number']); $this->web_api_echo(); } catch (\danog\MadelineProto\RPCErrorException $e) { $this->web_api_echo('ERROR: '.$e->getMessage().'. Try again.'); } catch (\danog\MadelineProto\Exception $e) { $this->web_api_echo('ERROR: '.$e->getMessage().'. Try again.'); } } public function web_api_complete_login() { try { $this->my_telegram_org_wrapper->complete_login($_POST['code']); } catch (\danog\MadelineProto\RPCErrorException $e) { $this->web_api_echo('ERROR: '.$e->getMessage().'. Try again.'); } catch (\danog\MadelineProto\Exception $e) { $this->web_api_echo('ERROR: '.$e->getMessage().'. Try again.'); } } public function web_api_create_app() { try { $params = $_POST; unset($params['creating_app']); $app = $this->my_telegram_org_wrapper->create_app($params); return $app; } catch (\danog\MadelineProto\RPCErrorException $e) { $this->web_api_echo('ERROR: '.$e->getMessage().' Try again.'); } catch (\danog\MadelineProto\Exception $e) { $this->web_api_echo('ERROR: '.$e->getMessage().' Try again.'); } } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Wrappers; trait DialogHandler { public function get_dialogs($force = true) { if ($force || !isset($this->dialog_params['offset_date']) || is_null($this->dialog_params['offset_date']) || !isset($this->dialog_params['offset_id']) || is_null($this->dialog_params['offset_id']) || !isset($this->dialog_params['offset_peer']) || is_null($this->dialog_params['offset_peer']) || !isset($this->dialog_params['count']) || is_null($this->dialog_params['count'])) { $this->dialog_params = ['limit' => 100, 'offset_date' => 0, 'offset_id' => 0, 'offset_peer' => ['_' => 'inputPeerEmpty'], 'count' => 0]; } if (!isset($this->dialog_params['hash'])) { $this->dialog_params['hash'] = 0; } $this->updates_state['sync_loading'] = true; $res = ['dialogs' => [0], 'count' => 1]; $datacenter = $this->datacenter->curdc; $peers = []; $this->postpone_updates = true; try { while ($this->dialog_params['count'] < $res['count']) { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['getting_dialogs']); $res = $this->method_call('messages.getDialogs', $this->dialog_params, ['datacenter' => $datacenter, 'FloodWaitLimit' => 100]); foreach ($res['dialogs'] as $dialog) { if (!in_array($dialog['peer'], $peers)) { $peers[] = $dialog['peer']; } } $this->dialog_params['count'] += count($res['dialogs']); $this->dialog_params['offset_date'] = end($res['messages'])['date']; $this->dialog_params['offset_peer'] = end($res['dialogs'])['peer']; $this->dialog_params['offset_id'] = end($res['messages'])['id'] & 4294967296; if (!isset($res['count'])) { break; } } } finally { $this->postpone_updates = false; $this->updates_state['sync_loading'] = false; $this->handle_pending_updates(); } return $peers; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Wrappers; use danog\MadelineProto\MTProtoTools\PasswordCalculator; /** * Manages logging in and out. */ trait Login { public function logout() { foreach ($this->datacenter->sockets as $socket) { $socket->authorized = false; } $this->authorized = self::NOT_LOGGED_IN; $this->authorized_dc = -1; $this->authorization = null; $this->updates = []; $this->secret_chats = []; $this->chats = []; $this->users = []; $this->state = []; $this->tos = ['expires' => 0, 'accepted' => true]; if (!$this->method_call('auth.logOut', [], ['datacenter' => $this->datacenter->curdc])) { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['logout_error']); } $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['logout_ok'], \danog\MadelineProto\Logger::NOTICE); return true; } public function bot_login($token) { if ($this->authorized === self::LOGGED_IN) { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['already_logged_in'], \danog\MadelineProto\Logger::NOTICE); $this->logout(); } $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_bot'], \danog\MadelineProto\Logger::NOTICE); $this->authorization = $this->method_call('auth.importBotAuthorization', ['bot_auth_token' => $token, 'api_id' => $this->settings['app_info']['api_id'], 'api_hash' => $this->settings['app_info']['api_hash']], ['datacenter' => $this->datacenter->curdc]); $this->authorized = self::LOGGED_IN; $this->authorized_dc = $this->datacenter->curdc; $this->datacenter->sockets[$this->datacenter->curdc]->authorized = true; $this->updates = []; $this->updates_key = 0; $this->init_authorization(); $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_ok'], \danog\MadelineProto\Logger::NOTICE); return $this->authorization; } public function phone_login($number, $sms_type = 5) { if ($this->authorized === self::LOGGED_IN) { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['already_logged_in'], \danog\MadelineProto\Logger::NOTICE); $this->logout(); } $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_code_sending'], \danog\MadelineProto\Logger::NOTICE); $this->authorization = $this->method_call('auth.sendCode', ['phone_number' => $number, 'sms_type' => $sms_type, 'api_id' => $this->settings['app_info']['api_id'], 'api_hash' => $this->settings['app_info']['api_hash'], 'lang_code' => $this->settings['app_info']['lang_code']], ['datacenter' => $this->datacenter->curdc]); $this->authorized_dc = $this->datacenter->curdc; $this->authorization['phone_number'] = $number; //$this->authorization['_'] .= 'MP'; $this->authorized = self::WAITING_CODE; $this->updates = []; $this->updates_key = 0; $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_code_sent'], \danog\MadelineProto\Logger::NOTICE); return $this->authorization; } public function complete_phone_login($code) { if ($this->authorized !== self::WAITING_CODE) { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['login_code_uncalled']); } $this->authorized = self::NOT_LOGGED_IN; $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_user'], \danog\MadelineProto\Logger::NOTICE); try { $authorization = $this->method_call('auth.signIn', ['phone_number' => $this->authorization['phone_number'], 'phone_code_hash' => $this->authorization['phone_code_hash'], 'phone_code' => (string) $code], ['datacenter' => $this->datacenter->curdc]); } catch (\danog\MadelineProto\RPCErrorException $e) { if ($e->rpc === 'SESSION_PASSWORD_NEEDED') { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_2fa_enabled'], \danog\MadelineProto\Logger::NOTICE); $this->authorization = $this->method_call('account.getPassword', [], ['datacenter' => $this->datacenter->curdc]); $this->authorized = self::WAITING_PASSWORD; return $this->authorization; } if ($e->rpc === 'PHONE_NUMBER_UNOCCUPIED') { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_need_signup'], \danog\MadelineProto\Logger::NOTICE); $this->authorized = self::WAITING_SIGNUP; $this->authorization['phone_code'] = $code; return ['_' => 'account.needSignup']; } throw $e; } $this->authorized = self::LOGGED_IN; $this->authorization = $authorization; $this->datacenter->sockets[$this->datacenter->curdc]->authorized = true; $this->init_authorization(); $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_ok'], \danog\MadelineProto\Logger::NOTICE); return $this->authorization; } public function import_authorization($authorization) { if ($this->authorized === self::LOGGED_IN) { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['already_logged_in'], \danog\MadelineProto\Logger::NOTICE); $this->logout(); } $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_auth_key'], \danog\MadelineProto\Logger::NOTICE); list($dc_id, $auth_key) = $authorization; if (!is_array($auth_key)) { $auth_key = ['auth_key' => $auth_key, 'id' => substr(sha1($auth_key, true), -8), 'server_salt' => '']; } $this->authorized_dc = $dc_id; $this->datacenter->sockets[$dc_id]->session_id = $this->random(8); $this->datacenter->sockets[$dc_id]->session_in_seq_no = 0; $this->datacenter->sockets[$dc_id]->session_out_seq_no = 0; $this->datacenter->sockets[$dc_id]->auth_key = $auth_key; $this->datacenter->sockets[$dc_id]->temp_auth_key = null; $this->datacenter->sockets[$dc_id]->incoming_messages = []; $this->datacenter->sockets[$dc_id]->outgoing_messages = []; $this->datacenter->sockets[$dc_id]->new_outgoing = []; $this->datacenter->sockets[$dc_id]->new_incoming = []; $this->datacenter->sockets[$dc_id]->authorized = true; $this->authorized = self::LOGGED_IN; $this->init_authorization(); return $this->get_self(); } public function export_authorization() { if ($this->authorized !== self::LOGGED_IN) { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['not_logged_in']); } $this->get_self(); $this->authorized_dc = $this->datacenter->curdc; return [$this->datacenter->curdc, $this->datacenter->sockets[$this->datacenter->curdc]->auth_key['auth_key']]; } public function complete_signup($first_name, $last_name) { if ($this->authorized !== self::WAITING_SIGNUP) { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['signup_uncalled']); } $this->authorized = self::NOT_LOGGED_IN; $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['signing_up'], \danog\MadelineProto\Logger::NOTICE); $this->authorization = $this->method_call('auth.signUp', ['phone_number' => $this->authorization['phone_number'], 'phone_code_hash' => $this->authorization['phone_code_hash'], 'phone_code' => $this->authorization['phone_code'], 'first_name' => $first_name, 'last_name' => $last_name], ['datacenter' => $this->datacenter->curdc]); $this->authorized = self::LOGGED_IN; $this->datacenter->sockets[$this->datacenter->curdc]->authorized = true; $this->init_authorization(); $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['signup_ok'], \danog\MadelineProto\Logger::NOTICE); return $this->authorization; } public function complete_2fa_login($password) { if ($this->authorized !== self::WAITING_PASSWORD) { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['2fa_uncalled']); } $this->authorized = self::NOT_LOGGED_IN; $hasher = new PasswordCalculator($this->logger); $hasher->addInfo($this->authorization); $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_user'], \danog\MadelineProto\Logger::NOTICE); $this->authorization = $this->method_call('auth.checkPassword', ['password' => $hasher->getCheckPassword($password)], ['datacenter' => $this->datacenter->curdc]); $this->authorized = self::LOGGED_IN; $this->datacenter->sockets[$this->datacenter->curdc]->authorized = true; $this->init_authorization(); $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_ok'], \danog\MadelineProto\Logger::NOTICE); return $this->authorization; } public function update_2fa(array $params): bool { $hasher = new PasswordCalculator($this->logger); $hasher->addInfo($this->method_call('account.getPassword', [], ['datacenter' => $this->datacenter->curdc])); return $this->method_call('account.updatePasswordSettings', $hasher->getPassword($params), ['datacenter' => $this->datacenter->curdc]); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Wrappers; trait Templates { public function web_echo($message = '') { switch ($this->authorized) { case self::NOT_LOGGED_IN: if (isset($_POST['type'])) { if ($_POST['type'] === 'phone') { echo $this->web_echo_template('Enter your phone number
'.$message.'', ''); } else { echo $this->web_echo_template('Enter your bot token
'.$message.'', ''); } } else { echo $this->web_echo_template('Do you want to login as user or bot?
'.$message.'', ''); } break; case self::WAITING_CODE: echo $this->web_echo_template('Enter your code
'.$message.'', ''); break; case self::WAITING_PASSWORD: echo $this->web_echo_template('Enter your password
'.$message.'', ''); break; case self::WAITING_SIGNUP: echo $this->web_echo_template('Sign up please
'.$message.'', ''); break; } } private $web_template = ' MadelineProto

MadelineProto

%s

%s

'; public function web_echo_template($message, $form) { return sprintf($this->web_template, $form, $message); } public function get_web_template() { return $this->web_template; } public function set_web_template($template) { $this->web_template = $template; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Wrappers; trait ApiTemplates { private $web_api_template = ' MadelineProto

MadelineProto

%s

%s
'; public function web_api_echo_template($message, $form) { return sprintf($this->web_api_template, $message, $form); } public function get_web_api_template() { return $this->web_template; } public function set_web_api_template($template) { $this->web_template = $template; } public function web_api_echo($message = '') { if (!isset($this->my_telegram_org_wrapper)) { if (isset($_POST['type'])) { if ($_POST['type'] === 'manual') { echo $this->web_api_echo_template('Enter your API ID and API hash
'.$message.'
  1. Login to my.telegram.org
  2. Go to API development tools
    • App title: your app's name, can be anything
    • Short name: your app's short name, only numbers and letters
    • Platform: Web
    • Description: describe your app here
  3. Click on create application
', ''); } else { echo $this->web_api_echo_template('Enter your phone number
'.$message.'', ''); } } else { echo $this->web_api_echo_template('Do you want to enter the API id and the API hash manually or automatically?
Note that you can also provide it directly in the code using the settings.'.$message.'', ''); } } else { if (!$this->my_telegram_org_wrapper->logged_in()) { echo $this->web_api_echo_template('Enter your code
'.$message.'', ''); } else { echo $this->web_api_echo_template( 'Enter the API info
'.$message.'', ' Enter the app name, can be anything:


Enter the app's short name, alphanumeric, 5-32 chars:


Enter the app/website URL, or https://t.me/yourusername:


Enter the app platform:


Enter the app description, can be anything:


'); } } } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Wrappers; /** * Manages logging in and out. */ trait Events { public $event_handler; private $event_handler_instance; private $event_handler_methods = []; public function setEventHandler($event_handler) { if (!class_exists($event_handler) || !is_subclass_of($event_handler, '\danog\MadelineProto\EventHandler')) { throw new \danog\MadelineProto\Exception('Wrong event handler was defined'); } $this->event_handler = $event_handler; if (!($this->event_handler_instance instanceof $this->event_handler)) { $class_name = $this->event_handler; $this->event_handler_instance = new $class_name($this->wrapper); } elseif ($this->wrapper) { $this->event_handler_instance->__construct($this->wrapper); } $this->event_handler_methods = []; foreach (\get_class_methods($this->event_handler) as $method) { if ($method === 'onLoop') { $this->loop_callback = [$this->event_handler_instance, 'onLoop']; } elseif ($method === 'onAny') { foreach ($this->constructors->by_id as $id => $constructor) { if ($constructor['type'] === 'Update' && !isset($this->event_handler_methods[$constructor['predicate']])) { $this->event_handler_methods[$constructor['predicate']] = [$this->event_handler_instance, 'onAny']; } } } else { $method_name = lcfirst(substr($method, 2)); $this->event_handler_methods[$method_name] = [$this->event_handler_instance, $method]; } } $this->settings['updates']['callback'] = [$this, 'event_update_handler']; $this->settings['updates']['handle_updates'] = true; $this->settings['updates']['run_callback'] = true; if (isset($this->datacenter->sockets[$this->settings['connection_settings']['default_dc']]->updater)) { $this->datacenter->sockets[$this->settings['connection_settings']['default_dc']]->updater->start(); } } public function getEventHandler() { return $this->event_handler_instance; } public function event_update_handler($update) { if (isset($this->event_handler_methods[$update['_']])) { return $this->event_handler_methods[$update['_']]($update); } } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Wrappers; /** * Manages simple logging in and out. */ trait Start { public function start() { if ($this->authorized === self::LOGGED_IN) { return $this->get_self(); } if (php_sapi_name() === 'cli') { if (!function_exists('readline')) { $readline = function ($prompt = null) { if ($prompt) { echo $prompt; } $fp = fopen('php://stdin', 'r'); $line = rtrim(fgets($fp, 1024)); return $line; }; } else { $readline = 'readline'; } if (strpos($readline('Do you want to login as user or bot (u/b)? '), 'b') !== false) { $this->bot_login($readline('Enter your bot token: ')); } else { $this->phone_login($readline('Enter your phone number: ')); $authorization = $this->complete_phone_login($readline('Enter the phone code: ')); if ($authorization['_'] === 'account.password') { $authorization = $this->complete_2fa_login($readline('Please enter your password (hint '.$authorization['hint'].'): ')); } if ($authorization['_'] === 'account.needSignup') { $authorization = $this->complete_signup($readline('Please enter your first name: '), $readline('Please enter your last name (can be empty): ')); } } $this->serialize(); return $this->get_self(); } else { if ($this->authorized === self::NOT_LOGGED_IN) { if (isset($_POST['phone_number'])) { $this->web_phone_login(); } elseif (isset($_POST['token'])) { $this->web_bot_login(); } else { $this->web_echo(); } } elseif ($this->authorized === self::WAITING_CODE) { if (isset($_POST['phone_code'])) { $this->web_complete_phone_login(); } else { $this->web_echo("You didn't provide a phone code!"); } } elseif ($this->authorized === self::WAITING_PASSWORD) { if (isset($_POST['password'])) { $this->web_complete_2fa_login(); } else { $this->web_echo("You didn't provide the password!"); } } elseif ($this->authorized === self::WAITING_SIGNUP) { if (isset($_POST['first_name'])) { $this->web_complete_signup(); } else { $this->web_echo("You didn't provide the first name!"); } } if ($this->authorized === self::LOGGED_IN) { $this->serialize(); return $this->get_self(); } exit; } } public function web_phone_login() { try { $this->phone_login($_POST['phone_number']); $this->web_echo(); } catch (\danog\MadelineProto\RPCErrorException $e) { $this->web_echo('ERROR: '.$e->getMessage().'. Try again.'); } catch (\danog\MadelineProto\Exception $e) { $this->web_echo('ERROR: '.$e->getMessage().'. Try again.'); } } public function web_complete_phone_login() { try { $this->complete_phone_login($_POST['phone_code']); $this->web_echo(); } catch (\danog\MadelineProto\RPCErrorException $e) { $this->web_echo('ERROR: '.$e->getMessage().'. Try again.'); } catch (\danog\MadelineProto\Exception $e) { $this->web_echo('ERROR: '.$e->getMessage().'. Try again.'); } } public function web_complete_2fa_login() { try { $this->complete_2fa_login($_POST['password']); $this->web_echo(); } catch (\danog\MadelineProto\RPCErrorException $e) { $this->web_echo('ERROR: '.$e->getMessage().'. Try again.'); } catch (\danog\MadelineProto\Exception $e) { $this->web_echo('ERROR: '.$e->getMessage().'. Try again.'); } } public function web_complete_signup() { try { $this->complete_signup($_POST['first_name'], isset($_POST['last_name']) ? $_POST['last_name'] : ''); $this->web_echo(); } catch (\danog\MadelineProto\RPCErrorException $e) { $this->web_echo('ERROR: '.$e->getMessage().'. Try again.'); } catch (\danog\MadelineProto\Exception $e) { $this->web_echo('ERROR: '.$e->getMessage().'. Try again.'); } } public function web_bot_login() { try { $this->bot_login($_POST['token']); $this->web_echo(); } catch (\danog\MadelineProto\RPCErrorException $e) { $this->web_echo('ERROR: '.$e->getMessage().'. Try again.'); } catch (\danog\MadelineProto\Exception $e) { $this->web_echo('ERROR: '.$e->getMessage().'. Try again.'); } } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Wrappers; /** * Manages logging in and out. */ trait Webhook { public function setWebhook($hook_url, $pem_path = null) { $this->pem_path = $pem_path; $this->hook_url = $hook_url; $this->settings['updates']['callback'] = [$this, 'pwr_webhook']; $this->settings['updates']['run_callback'] = true; $this->settings['updates']['handle_updates'] = true; $this->datacenter->sockets[$this->settings['connection_settings']['default_dc']]->updater->start(); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Wrappers; trait Noop { public function setNoop() { $this->settings['updates']['callback'] = [$this, 'noop']; $this->settings['updates']['run_callback'] = false; $this->settings['updates']['handle_updates'] = true; $this->datacenter->sockets[$this->settings['connection_settings']['default_dc']]->updater->start(); } public function noop() { } } ---types--- boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaPhoto#b3ba0635 flags:# id:InputPhoto ttl_seconds:flags.0?int = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaDocument#23ab23d2 flags:# id:InputDocument ttl_seconds:flags.0?int = InputMedia; inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = InputMedia; inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia; inputMediaGeoLive#7b1a118f geo_point:InputGeoPoint period:int = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#fb95c6c4 id:long access_hash:long = InputPhoto; inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#430f0724 id:long access_hash:long version:int = InputFileLocation; inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation; userEmpty#200250ba id:int = User; user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#450b7115 flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights participants_count:flags.17?int = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; channelFull#76af5481 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#44f9b43d flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#9cb070d7 flags:# document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia; messageMediaGeoLive#7c3c2609 geo:GeoPoint period:int = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction; messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; messageActionScreenshotTaken#4792929b = MessageAction; messageActionCustomAction#fae69f56 message:string = MessageAction; dialog#e4def5db flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#2049d70c long:double lat:double = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#5e002502 flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyAll#a429b886 = InputNotifyPeer; inputPeerNotifyEventsEmpty#f03064d8 = InputPeerNotifyEvents; inputPeerNotifyEventsAll#e86a2c74 = InputPeerNotifyEvents; inputPeerNotifySettings#38935eb2 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = InputPeerNotifySettings; peerNotifyEventsEmpty#add53cb3 = PeerNotifyEvents; peerNotifyEventsAll#6d1ded88 = PeerNotifyEvents; peerNotifySettingsEmpty#70a68512 = PeerNotifySettings; peerNotifySettings#9acda4c0 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = PeerNotifySettings; peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; userFull#f220f3f flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#eae87e42 contacts:Vector saved_count:int users:Vector = contacts.Contacts; contacts.importedContacts#77d01c3b imported:Vector popular_invites:Vector retry_contacts:Vector users:Vector = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector users:Vector = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector users:Vector = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#99262e37 flags:# pts:int count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesNotModified#74535f21 count:int = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; messages.chatsSlice#9cd81144 count:int chats:Vector = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector users:Vector = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter; inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter; inputMessagesFilterGeo#e7026d0d = MessagesFilter; inputMessagesFilterContacts#e062db83 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updateDialogPinned#d711a2cc flags:# pinned:flags.0?true peer:Peer = Update; updatePinnedDialogs#d8caf68d flags:# order:flags.0?Vector = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updateLangPackTooLong#10c2404b = Update; updateLangPack#56022f4d difference:LangPackDifference = Update; updateFavedStickers#e511996d = Update; updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector = Update; updateContactsReset#7084a7be = Update; updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector intermediate_state:updates.State = updates.Difference; updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; upload.fileCdnRedirect#ea52fe5a dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes cdn_file_hashes:Vector = upload.File; dcOption#5d8c6cc flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int = DcOption; config#9c840964 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string suggested_lang_code:flags.2?string lang_pack_version:flags.2?int disabled_features:Vector = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#8987f311 id:int critical:Bool url:string text:string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#18798952 id:long access_hash:long = InputDocument; documentEmpty#36f8c871 id:long = Document; document#87232bc7 id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int version:int attributes:Vector = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyAll#74d07c60 = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; sendMessageRecordRoundAction#88f27fbc = SendMessageAction; sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; contacts.found#b3134d9d my_results:Vector results:Vector chats:Vector users:Vector = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector = PrivacyRule; account.privacyRules#554abb6f rules:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true supports_streaming:flags.1?true duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#8a8ecd32 hash:string stickers:Vector = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector = messages.AllStickers; disabledFeature#ae636f24 feature:string description:string = DisabledFeature; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector = account.Authorizations; account.noPassword#96dabc18 new_salt:bytes email_unconfirmed_pattern:string = account.Password; account.password#7c18141c current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = account.Password; account.passwordSettings#b7b72ab3 email:string = account.PasswordSettings; account.passwordInputSettings#86916deb flags:# new_salt:flags.0?bytes new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#cd303b41 flags:# installed:flags.0?true archived:flags.1?true official:flags.2?true masks:flags.3?true id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#98e81d3a user_id:int description:string commands:Vector = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector = ReplyMarkup; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector users:Vector = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#6a9d7b35 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int messages:Vector chats:Vector users:Vector = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector other_updates:Vector chats:Vector users:Vector = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantAdmin#a82fa898 flags:# can_edit:flags.0?true user_id:int inviter_id:int promoted_by:int date:int admin_rights:ChannelAdminRights = ChannelParticipant; channelParticipantBanned#222c1886 flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChannelBannedRights = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter; channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter; channels.channelParticipants#f56ee2a8 count:int participants:Vector users:Vector = channels.ChannelParticipants; channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector = channels.ChannelParticipant; help.termsOfService#f1ee3e90 text:string = help.TermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector = messages.SavedGifs; inputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#c1b15d65 flags:# geo_point:InputGeoPoint period:int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#aaafadc8 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#2daf01a7 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#2cbbe15a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#b722de65 flags:# geo:GeoPoint period:int reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#4366232e flags:# geo:GeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#9bebaeb9 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector cache_time:int users:Vector = messages.BotResults; exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink; messageFwdHeader#559ebe6d flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; messages.peerDialogs#3371c354 dialogs:Vector messages:Vector chats:Vector users:Vector state:updates.State = messages.PeerDialogs; topPeer#edcdc05b peer:Peer rating:double = TopPeer; topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; topPeerCategoryBotsInline#148677e2 = TopPeerCategory; topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector chats:Vector users:Vector = contacts.TopPeers; draftMessageEmpty#ba4baec5 = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; messages.featuredStickers#f89d88e5 hash:int sets:Vector unread:Vector = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#5ce20970 hash:int stickers:Vector = messages.RecentStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector = messages.ArchivedStickers; messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector = messages.StickerSetInstallResult; stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector users:Vector = messages.HighScores; textEmpty#dc3d824f = RichText; textPlain#744694e0 text:string = RichText; textBold#6724abc4 text:RichText = RichText; textItalic#d912a59c text:RichText = RichText; textUnderline#c12622c4 text:RichText = RichText; textStrike#9bf8bb95 text:RichText = RichText; textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; pageBlockHeader#bfd064ec text:RichText = PageBlock; pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; pageBlockParagraph#467a0766 text:RichText = PageBlock; pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; pageBlockList#3a58c7f4 ordered:Bool items:Vector = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; pageBlockVideo#d9d71866 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:RichText = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; pageBlockEmbed#cde200d1 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:int h:int caption:RichText = PageBlock; pageBlockEmbedPost#292c7be9 url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:RichText = PageBlock; pageBlockCollage#8b31c4f items:Vector caption:RichText = PageBlock; pageBlockSlideshow#130c8963 items:Vector caption:RichText = PageBlock; pageBlockChannel#ef1751b5 channel:Chat = PageBlock; pageBlockAudio#31b81a7f audio_id:long caption:RichText = PageBlock; pagePart#8e3f9ebe blocks:Vector photos:Vector documents:Vector = Page; pageFull#556ec7aa blocks:Vector photos:Vector documents:Vector = Page; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; webDocument#c61acbd8 url:string access_hash:long size:int mime_type:string attributes:Vector dc_id:int = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector = payments.PaymentReceipt; payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsAndroidPay#ca05d50e payment_token:DataJSON google_transaction_id:string = InputPaymentCredentials; account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; shippingOption#b6213cdf id:string title:string prices:Vector = ShippingOption; inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCall#ffe6ab67 id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector = phone.PhoneCall; upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey; cdnConfig#5725e40a public_keys:Vector = CdnConfig; langPackString#cad181f6 key:string value:string = LangPackString; langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString; langPackStringDeleted#2979eeb2 key:string = LangPackString; langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector = LangPackDifference; langPackLanguage#117698f1 name:string native_name:string lang_code:string = LangPackLanguage; channelAdminRights#5d7ceba5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true invite_link:flags.6?true pin_messages:flags.7?true add_admins:flags.9?true = ChannelAdminRights; channelBannedRights#58cf4249 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true until_date:int = ChannelBannedRights; channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangePhoto#b82f55c3 prev_photo:ChatPhoto new_photo:ChatPhoto = ChannelAdminLogEventAction; channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; cdnFileHash#77eec38f offset:int limit:int hash:bytes = CdnFileHash; messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers; messages.favedStickers#f37f2f16 hash:int packs:Vector stickers:Vector = messages.FavedStickers; recentMeUrlUnknown#46e1d13d url:string = RecentMeUrl; recentMeUrlUser#8dbc3336 url:string user_id:int = RecentMeUrl; recentMeUrlChat#a01b22f9 url:string chat_id:int = RecentMeUrl; recentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl; recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl; help.recentMeUrls#e0310d7 urls:Vector chats:Vector users:Vector = help.RecentMeUrls; inputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector = InputSingleMedia; webAuthorization#cac943f2 hash:long bot_id:int domain:string browser:string platform:string date_created:int date_active:int ip:string region:string = WebAuthorization; account.webAuthorizations#ed56c9fc authorizations:Vector users:Vector = account.WebAuthorizations; inputMessageID#a676a322 id:int = InputMessage; inputMessageReplyTo#bad88395 id:int = InputMessage; inputMessagePinned#86872538 = InputMessage; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X; initConnection#c7481da6 {X:Type} api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone; auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.sendInvites#771c1d97 phone_numbers:Vector message:string = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector = Bool; account.registerDevice#1389cc token_type:int token:string app_sandbox:Bool other_uids:Vector = Bool; account.unregisterDevice#3076c4bf token_type:int token:string other_uids:Vector = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; account.getTmpPassword#4a82327e password_hash:bytes period:int = account.TmpPassword; account.getWebAuthorizations#182e6d6f = account.WebAuthorizations; account.resetWebAuthorization#2d01b9ef hash:long = Bool; account.resetWebAuthorizations#682d2594 = Bool; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; contacts.getStatuses#c4a353ee = Vector; contacts.getContacts#c023849f hash:int = contacts.Contacts; contacts.importContacts#2c800be5 contacts:Vector = contacts.ImportedContacts; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector; contacts.importCard#4fe196fe export_card:Vector = User; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; contacts.resetSaved#879537f1 = Bool; messages.getMessages#63c66506 id:Vector = messages.Messages; messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs; messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.search#39e9ea0 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.sendMedia#b8d1262b flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true grouped:flags.9?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.getChats#3c6aa187 id:Vector = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector title:string = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; messages.getStickers#ae22e045 emoticon:string hash:string = messages.Stickers; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#8b68b0cc flags:# message:string entities:flags.3?Vector = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#5d1b8dd flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true peer:InputPeer id:int message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector geo_point:flags.13?InputGeoPoint = Updates; messages.editInlineBotMessage#b0e08243 flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector geo_point:flags.13?InputGeoPoint = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#2d9776b9 peers:Vector = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector = Bool; messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#3289be6a flags:# pinned:flags.0?true peer:InputPeer = Bool; messages.reorderPinnedDialogs#959ff644 flags:# force:flags.0?true order:Vector = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia; messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates; messages.getFavedStickers#21ce0b0e hash:int = messages.FavedStickers; messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool; messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory; messages.getRecentLocations#249431e2 peer:InputPeer limit:int = messages.Messages; messages.sendMultiMedia#2095512f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector = Vector; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; upload.reuploadCdnFile#1af91c09 file_token:bytes request_token:bytes = Vector; upload.getCdnFileHashes#f715c87b file_token:bytes offset:int = Vector; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#ae2de196 = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector = Bool; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#9010ef6f prev_app_version:string = Updates; help.getTermsOfService#350170f3 = help.TermsOfService; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector = Bool; channels.getMessages#ad8c9a23 channel:InputChannel id:Vector = messages.Messages; channels.getParticipants#123e05e9 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#20b88214 channel:InputChannel user_id:InputUser admin_rights:ChannelAdminRights = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; channels.exportMessageLink#ceb77163 channel:InputChannel id:int grouped:Bool = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; channels.editBanned#bfd915cd channel:InputChannel user_id:InputUser banned_rights:ChannelBannedRights = Updates; channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector max_id:long min_id:long limit:int = channels.AdminLogResults; channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool; channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector = Bool; channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool; channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm; payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt; payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult; payments.getSavedInfo#227d824b = payments.SavedInfo; payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet; stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; phone.getCallConfig#55451fa9 = DataJSON; phone.requestCall#5b95b3d4 user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = Updates; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; langpack.getLangPack#9ab5c58e lang_code:string = LangPackDifference; langpack.getStrings#2e1ee318 lang_code:string keys:Vector = Vector; langpack.getDifference#b2e4d7d from_version:int = LangPackDifference; langpack.getLanguages#800fd57d = Vector; // LAYER 75 generator = $generator; try { $yielded = $this->generator->current(); if (!$yielded instanceof Promise) { if (!$this->generator->valid()) { $this->resolve($this->generator->getReturn()); return; } $yielded = $this->transform($yielded); } } catch (\Throwable $exception) { $this->fail($exception); return; } /* * @param \Throwable|null $exception Exception to be thrown into the generator. * @param mixed $value Value to be sent into the generator. */ $this->onResolve = function ($exception, $value) { $this->exception = $exception; $this->value = $value; if (!$this->immediate) { $this->immediate = true; return; } try { do { if ($this->exception) { // Throw exception at current execution point. $yielded = $this->generator->throw($this->exception); } else { // Send the new value and execute to next yield statement. $yielded = $this->generator->send($this->value); } if (!$yielded instanceof Promise) { if (!$this->generator->valid()) { $this->resolve($this->generator->getReturn()); $this->onResolve = null; return; } $yielded = $this->transform($yielded); } $this->immediate = false; $yielded->onResolve($this->onResolve); } while ($this->immediate); $this->immediate = true; } catch (\Throwable $exception) { $this->fail($exception); $this->onResolve = null; } finally { $this->exception = null; $this->value = null; } }; $yielded->onResolve($this->onResolve); } /** * Attempts to transform the non-promise yielded from the generator into a promise, otherwise returns an instance * `Amp\Failure` failed with an instance of `Amp\InvalidYieldError`. * * @param mixed $yielded Non-promise yielded from generator. * * @return \Amp\Promise */ private function transform($yielded): Promise { try { if (\is_array($yielded)) { foreach ($yielded as &$val) { if ($val instanceof \Generator) { $val = new self($val); } } return Promise\all($yielded); } if ($yielded instanceof \Generator) { return new self($yielded); } // No match, continue to returning Failure below. } catch (\Throwable $exception) { // Conversion to promise failed, fall-through to returning Failure below. } return $yielded instanceof \Throwable || $yielded instanceof \Exception ? new Failure($yielded) : new Success($yielded); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\MTProtoTools; use danog\MadelineProto\Async\AsyncParameters; use danog\MadelineProto\Exception; use danog\MadelineProto\Logger; use danog\MadelineProto\RPCErrorException; use function Amp\call; /** * Manages upload and download of files. */ trait Files { public function upload_async($file, $file_name = '', $cb = null, $encrypted = false, $datacenter = null): \Generator { if (is_object($file)) { if (!isset(class_implements($file)['danog\MadelineProto\FileCallbackInterface'])) { throw new \danog\MadelineProto\Exception('Provided object does not implement FileCallbackInterface'); } $cb = $file; $file = $file->getFile(); } $file = \danog\MadelineProto\Absolute::absolute($file); if (!file_exists($file)) { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['file_not_exist']); } if (empty($file_name)) { $file_name = basename($file); } $datacenter = is_null($datacenter) ? $this->settings['connection_settings']['default_dc'] : $datacenter; if (isset($this->datacenter->sockets[$datacenter.'_media'])) { $datacenter .= '_media'; } $file_size = filesize($file); if ($file_size > 512 * 1024 * 3000) { throw new \danog\MadelineProto\Exception('Given file is too big!'); } if ($cb === null) { $cb = function ($percent) { $this->logger->logger('Upload status: '.$percent.'%', \danog\MadelineProto\Logger::NOTICE); }; } $part_size = $this->settings['upload']['part_size']; $part_total_num = (int) ceil($file_size / $part_size); $part_num = 0; $method = $file_size > 10 * 1024 * 1024 ? 'upload.saveBigFilePart' : 'upload.saveFilePart'; $constructor = 'input'.($encrypted === true ? 'Encrypted' : '').($file_size > 10 * 1024 * 1024 ? 'FileBig' : 'File').($encrypted === true ? 'Uploaded' : ''); $file_id = $this->random(8); $f = fopen($file, 'r'); $seekable = stream_get_meta_data($f)['seekable']; if ($seekable) { fseek($f, 0); } $ige = null; if ($encrypted === true) { $key = $this->random(32); $iv = $this->random(32); $digest = hash('md5', $key.$iv, true); $fingerprint = $this->unpack_signed_int(substr($digest, 0, 4) ^ substr($digest, 4, 4)); $ige = new \phpseclib\Crypt\AES('ige'); $ige->setIV($iv); $ige->setKey($key); $ige->enableContinuousBuffer(); } $ctx = hash_init('md5'); $promises = []; $cur_part_num = 0; while ($part_num < $part_total_num) { $t = microtime(true); $read_deferred = yield $this->method_call_async_write( $method, new AsyncParameters( static function () use ($file_id, $part_num, $part_total_num, $part_size, $f, $ctx, $ige, $seekable) { if ($seekable) { fseek($f, $part_num * $part_size); } $bytes = stream_get_contents($f, $part_size); if ($ige) { $bytes = $ige->encrypt(str_pad($bytes, $part_size, chr(0))); } hash_update($ctx, $bytes); return ['file_id' => $file_id, 'file_part' => $part_num, 'file_total_parts' => $part_total_num, 'bytes' => $bytes]; }, $seekable ), ['heavy' => true, 'file' => true, 'datacenter' => $datacenter] ); $this->logger->logger('Speed for chunk: '.(($part_size * 8 / 1000000) / (microtime(true) - $t))); $part_num++; $promises[] = $read_deferred->promise(); } $result = yield $promises; foreach ($result as $key => $result) { if (!$result) { throw new \danog\MadelineProto\Exception('Upload of part '.$key.' failed'); } } $constructor = ['_' => $constructor, 'id' => $file_id, 'parts' => $part_total_num, 'name' => $file_name, 'mime_type' => $this->get_mime_from_file($file)]; if ($encrypted === true) { $constructor['key_fingerprint'] = $fingerprint; $constructor['key'] = $key; $constructor['iv'] = $iv; } fclose($f); return $constructor; } public function upload($file, $file_name = '', $cb = null, $encrypted = false, $datacenter = null) { $t = microtime(true); $res = $this->wait(call([$this, 'upload_async'], $file, $file_name, $cb, $encrypted, $datacenter)); $this->logger->logger('Speed: '.((filesize($file) * 8) / (microtime(true) - $t) / 1000000)); return $res; } public function upload_encrypted($file, $file_name = '', $cb = null) { return $this->upload($file, $file_name, $cb, true); } public function gen_all_file($media, $regenerate) { $res = [$this->constructors->find_by_predicate($media['_'])['type'] => $media]; switch ($media['_']) { case 'messageMediaPhoto': if (!isset($media['photo']['access_hash'])) { throw new \danog\MadelineProto\Exception('No access hash'); } $res['Photo'] = $media['photo']; $res['InputPhoto'] = ['_' => 'inputPhoto', 'id' => $media['photo']['id'], 'access_hash' => $media['photo']['access_hash'], 'file_reference' => $this->wait($this->referenceDatabase->getReference(ReferenceDatabase::PHOTO_LOCATION, $media['photo']))]; $res['InputMedia'] = ['_' => 'inputMediaPhoto', 'id' => $res['InputPhoto']]; if (isset($media['ttl_seconds'])) { $res['InputMedia']['ttl_seconds'] = $media['ttl_seconds']; } break; case 'messageMediaDocument': if (!isset($media['document']['access_hash'])) { throw new \danog\MadelineProto\Exception('No access hash'); } $res['Document'] = $media['document']; $res['InputDocument'] = ['_' => 'inputDocument', 'id' => $media['document']['id'], 'access_hash' => $media['document']['access_hash'], 'file_reference' => $this->wait($this->referenceDatabase->getReference(ReferenceDatabase::DOCUMENT_LOCATION, $media['document']))]; $res['InputMedia'] = ['_' => 'inputMediaDocument', 'id' => $res['InputDocument']]; if (isset($media['ttl_seconds'])) { $res['InputMedia']['ttl_seconds'] = $media['ttl_seconds']; } break; case 'document': if (!isset($media['access_hash'])) { throw new \danog\MadelineProto\Exception('No access hash'); } $res['InputDocument'] = ['_' => 'inputDocument', 'id' => $media['id'], 'access_hash' => $media['access_hash'], 'file_reference' => $this->wait($this->referenceDatabase->getReference(ReferenceDatabase::DOCUMENT_LOCATION, $media))]; $res['InputMedia'] = ['_' => 'inputMediaDocument', 'id' => $res['InputDocument']]; $res['MessageMedia'] = ['_' => 'messageMediaDocument', 'document' => $media]; break; case 'photo': if (!isset($media['access_hash'])) { throw new \danog\MadelineProto\Exception('No access hash'); } $res['InputPhoto'] = ['_' => 'inputPhoto', 'id' => $media['id'], 'access_hash' => $media['access_hash'], 'file_reference' => $this->wait($this->referenceDatabase->getReference(ReferenceDatabase::PHOTO_LOCATION, $media))]; $res['InputMedia'] = ['_' => 'inputMediaPhoto', 'id' => $res['InputPhoto']]; $res['MessageMedia'] = ['_' => 'messageMediaPhoto', 'photo' => $media]; break; default: throw new \danog\MadelineProto\Exception('Could not convert media object'); } return $res; } public function get_file_info($constructor, $regenerate = false) { if (is_string($constructor)) { $constructor = $this->unpack_file_id($constructor)['MessageMedia']; } switch ($constructor['_']) { case 'updateNewMessage': case 'updateNewChannelMessage': $constructor = $constructor['message']; case 'message': $constructor = $constructor['media']; } return $this->gen_all_file($constructor, $regenerate); } public function get_download_info($message_media) { if (is_string($message_media)) { $message_media = $this->unpack_file_id($message_media)['MessageMedia']; } if (!isset($message_media['_'])) { return $message_media; } $res = []; switch ($message_media['_']) { // Updates case 'updateNewMessage': case 'updateNewChannelMessage': $message_media = $message_media['message']; case 'message': return $this->get_download_info($message_media['media']); case 'updateNewEncryptedMessage': $message_media = $message_media['message']; // Secret media case 'encryptedMessage': if ($message_media['decrypted_message']['media']['_'] === 'decryptedMessageMediaExternalDocument') { return $this->get_download_info($message_media['decrypted_message']['media']); } $res['InputFileLocation'] = ['_' => 'inputEncryptedFileLocation', 'id' => $message_media['file']['id'], 'access_hash' => $message_media['file']['access_hash'], 'dc_id' => $message_media['file']['dc_id']]; $res['size'] = $message_media['decrypted_message']['media']['size']; $res['key_fingerprint'] = $message_media['file']['key_fingerprint']; $res['key'] = $message_media['decrypted_message']['media']['key']; $res['iv'] = $message_media['decrypted_message']['media']['iv']; if (isset($message_media['decrypted_message']['media']['file_name'])) { $pathinfo = pathinfo($message_media['decrypted_message']['media']['file_name']); if (isset($pathinfo['extension'])) { $res['ext'] = '.'.$pathinfo['extension']; } $res['name'] = $pathinfo['filename']; } if (isset($message_media['decrypted_message']['media']['mime_type'])) { $res['mime'] = $message_media['decrypted_message']['media']['mime_type']; } elseif ($message_media['decrypted_message']['media']['_'] === 'decryptedMessageMediaPhoto') { $res['mime'] = 'image/jpeg'; } if (isset($message_media['decrypted_message']['media']['attributes'])) { foreach ($message_media['decrypted_message']['media']['attributes'] as $attribute) { switch ($attribute['_']) { case 'documentAttributeFilename': $pathinfo = pathinfo($attribute['file_name']); if (isset($pathinfo['extension'])) { $res['ext'] = '.'.$pathinfo['extension']; } $res['name'] = $pathinfo['filename']; break; case 'documentAttributeAudio': $audio = $attribute; break; } } } if (isset($audio) && isset($audio['title']) && !isset($res['name'])) { $res['name'] = $audio['title']; if (isset($audio['performer'])) { $res['name'] .= ' - '.$audio['performer']; } } if (!isset($res['ext'])) { $res['ext'] = $this->get_extension_from_location($res['InputFileLocation'], $this->get_extension_from_mime(isset($res['mime']) ? $res['mime'] : 'image/jpeg')); } if (!isset($res['mime'])) { $res['mime'] = $this->get_mime_from_extension($res['ext'], 'image/jpeg'); } if (!isset($res['name'])) { $res['name'] = $message_media['file']['access_hash']; } return $res; // Wallpapers case 'wallPaper': $photo = end($message_media['sizes']); return array_merge($res, $this->get_download_info($photo)); // Photos case 'photo': case 'messageMediaPhoto': if ($message_media['_'] == 'photo') { $res['MessageMedia'] = ['_' => 'messageMediaPhoto', 'photo' => $message_media, 'ttl_seconds' => 0]; $photo = end($message_media['sizes']); } else { $res['MessageMedia'] = $message_media; $photo = end($message_media['photo']['sizes']); } return array_merge($res, $this->get_download_info($photo)); case 'userProfilePhoto': case 'chatPhoto': return array_merge($res, $this->get_download_info($message_media['photo_big'])); case 'photoCachedSize': $res['size'] = strlen($message_media['bytes']); $res['data'] = $message_media['bytes']; if ($message_media['location']['_'] === 'fileLocationUnavailable') { $res['name'] = $message_media['volume_id'].'_'.$message_media['local_id']; $res['mime'] = $this->get_mime_from_buffer($res['data']); $res['ext'] = $this->get_extension_from_mime($res['mime']); } else { $res = array_merge($res, $this->get_download_info($message_media['location'])); } return $res; case 'photoSize': $res = $this->get_download_info($message_media['location']); if (isset($message_media['size'])) { $res['size'] = $message_media['size']; } return $res; case 'fileLocationUnavailable': throw new \danog\MadelineProto\Exception('File location unavailable'); case 'fileLocation': $res['name'] = $message_media['volume_id'].'_'.$message_media['local_id']; $res['InputFileLocation'] = ['_' => 'inputFileLocation', 'volume_id' => $message_media['volume_id'], 'local_id' => $message_media['local_id'], 'secret' => $message_media['secret'], 'dc_id' => $message_media['dc_id'], 'file_reference' => $this->wait($this->referenceDatabase->getReference(ReferenceDatabase::PHOTO_LOCATION_LOCATION, $message_media))]; $res['ext'] = $this->get_extension_from_location($res['InputFileLocation'], '.jpg'); $res['mime'] = $this->get_mime_from_extension($res['ext'], 'image/jpeg'); return $res; // Documents case 'decryptedMessageMediaExternalDocument': case 'document': $message_media = ['_' => 'messageMediaDocument', 'ttl_seconds' => 0, 'document' => $message_media]; case 'messageMediaDocument': $res['MessageMedia'] = $message_media; foreach ($message_media['document']['attributes'] as $attribute) { switch ($attribute['_']) { case 'documentAttributeFilename': $pathinfo = pathinfo($attribute['file_name']); if (isset($pathinfo['extension'])) { $res['ext'] = '.'.$pathinfo['extension']; } $res['name'] = $pathinfo['filename']; break; case 'documentAttributeAudio': $audio = $attribute; break; } } if (isset($audio) && isset($audio['title']) && !isset($res['name'])) { $res['name'] = $audio['title']; if (isset($audio['performer'])) { $res['name'] .= ' - '.$audio['performer']; } } $res['InputFileLocation'] = ['_' => 'inputDocumentFileLocation', 'id' => $message_media['document']['id'], 'access_hash' => $message_media['document']['access_hash'], 'version' => isset($message_media['document']['version']) ? $message_media['document']['version'] : 0, 'dc_id' => $message_media['document']['dc_id'], 'file_reference' => $this->wait($this->referenceDatabase->getReference(ReferenceDatabase::DOCUMENT_LOCATION_LOCATION, $message_media['document']))]; if (!isset($res['ext'])) { $res['ext'] = $this->get_extension_from_location($res['InputFileLocation'], $this->get_extension_from_mime($message_media['document']['mime_type'])); } if (!isset($res['name'])) { $res['name'] = $message_media['document']['access_hash']; } if (isset($message_media['document']['size'])) { $res['size'] = $message_media['document']['size']; } $res['name'] .= '_'.$message_media['document']['id']; $res['mime'] = $message_media['document']['mime_type']; return $res; default: throw new \danog\MadelineProto\Exception('Invalid constructor provided: '.$message_media['_']); } } public function download_to_dir($message_media, $dir, $cb = null) { if (is_object($dir) && class_implements($dir)['danog\MadelineProto\FileCallbackInterface']) { $cb = $dir; $dir = $dir->getFile(); } $message_media = $this->get_download_info($message_media); return $this->download_to_file($message_media, $dir.'/'.$message_media['name'].$message_media['ext'], $cb); } public function download_to_file($message_media, $file, $cb = null) { if (is_object($file) && class_implements($file)['danog\MadelineProto\FileCallbackInterface']) { $cb = $file; $file = $file->getFile(); } $file = \danog\MadelineProto\Absolute::absolute(preg_replace('|/+|', '/', $file)); if (!file_exists($file)) { touch($file); } $file = realpath($file); $message_media = $this->get_download_info($message_media); $stream = fopen($file, 'r+b'); $size = fstat($stream)['size']; $this->logger->logger('Waiting for lock of file to download...'); flock($stream, LOCK_EX); try { $this->download_to_stream($message_media, $stream, $cb, $size, -1); } finally { flock($stream, LOCK_UN); fclose($stream); clearstatcache(); } return $file; } public function download_to_stream($message_media, $stream, $cb = null, $offset = 0, $end = -1) { if (is_object($stream) && class_implements($stream)['danog\MadelineProto\FileCallbackInterface']) { $cb = $stream; $stream = $stream->getFile(); } if ($cb === null) { $cb = function ($percent) { $this->logger->logger('Download status: '.$percent.'%', \danog\MadelineProto\Logger::NOTICE); }; } $message_media = $this->get_download_info($message_media); try { if (stream_get_meta_data($stream)['seekable']) { fseek($stream, $offset); } } catch (\danog\MadelineProto\Exception $e) { } $downloaded_size = 0; if ($end === -1 && isset($message_media['size'])) { $end = $message_media['size']; } $size = $end - $offset; $part_size = $this->settings['download']['part_size']; $percent = 0; $datacenter = isset($message_media['InputFileLocation']['dc_id']) ? $message_media['InputFileLocation']['dc_id'] : $this->settings['connection_settings']['default_dc']; if (isset($this->datacenter->sockets[$datacenter.'_media'])) { $datacenter .= '_media'; } if (isset($message_media['key'])) { $digest = hash('md5', $message_media['key'].$message_media['iv'], true); $fingerprint = $this->unpack_signed_int(substr($digest, 0, 4) ^ substr($digest, 4, 4)); if ($fingerprint !== $message_media['key_fingerprint']) { throw new \danog\MadelineProto\Exception('Fingerprint mismatch!'); } $ige = new \phpseclib\Crypt\AES('ige'); $ige->setIV($message_media['iv']); $ige->setKey($message_media['key']); $ige->enableContinuousBuffer(); } $theend = false; $cdn = false; while (true) { if ($start_at = $offset % $part_size) { $offset -= $start_at; } try { $res = $cdn ? $this->method_call('upload.getCdnFile', ['file_token' => $message_media['file_token'], 'offset' => $offset, 'limit' => $part_size], ['heavy' => true, 'file' => true, 'datacenter' => $datacenter]) : $this->method_call('upload.getFile', ['location' => $message_media['InputFileLocation'], 'offset' => $offset, 'limit' => $part_size], ['heavy' => true, 'file' => true, 'datacenter' => &$datacenter]); } catch (\danog\MadelineProto\RPCErrorException $e) { if (strpos($e->rpc, 'FLOOD_WAIT_') === 0) { if (isset($message_media['MessageMedia']) && !$this->authorization['user']['bot'] && $this->settings['download']['report_broken_media']) { try { $this->method_call('messages.sendMedia', ['peer' => 'support', 'media' => $message_media['MessageMedia'], 'message' => "I can't download this file, could you please help?"], ['datacenter' => $this->datacenter->curdc]); } catch (RPCErrorException $e) { $this->logger->logger('An error occurred while reporting the broken file: '.$e->rpc, Logger::FATAL_ERROR); } catch (Exception $e) { $this->logger->logger('An error occurred while reporting the broken file: '.$e->getMessage(), Logger::FATAL_ERROR); } } throw new \danog\MadelineProto\Exception('The media server where this file is hosted is offline/overloaded, please try again later. Send the media to the telegram devs or to @danogentili to fix this.'); } switch ($e->rpc) { case 'FILE_TOKEN_INVALID': $cdn = false; continue 2; default: throw $e; } } if ($res['_'] === 'upload.fileCdnRedirect') { $cdn = true; $message_media['file_token'] = $res['file_token']; $message_media['cdn_key'] = $res['encryption_key']; $message_media['cdn_iv'] = $res['encryption_iv']; $old_dc = $datacenter; $datacenter = $res['dc_id'].'_cdn'; if (!isset($this->datacenter->sockets[$datacenter])) { $this->config['expires'] = -1; $this->get_config([], ['datacenter' => $this->datacenter->curdc]); } $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['stored_on_cdn'], \danog\MadelineProto\Logger::NOTICE); continue; } if ($res['_'] === 'upload.cdnFileReuploadNeeded') { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['cdn_reupload'], \danog\MadelineProto\Logger::NOTICE); $this->get_config([], ['datacenter' => $this->datacenter->curdc]); try { $this->add_cdn_hashes($message_media['file_token'], $this->method_call('upload.reuploadCdnFile', ['file_token' => $message_media['file_token'], 'request_token' => $res['request_token']], ['heavy' => true, 'datacenter' => $old_dc])); } catch (\danog\MadelineProto\RPCErrorException $e) { switch ($e->rpc) { case 'FILE_TOKEN_INVALID': case 'REQUEST_TOKEN_INVALID': $cdn = false; continue 2; default: throw $e; } } continue; } if ($cdn === false && $res['type']['_'] === 'storage.fileUnknown' && $res['bytes'] === '') { $datacenter = 1; } while ($cdn === false && $res['type']['_'] === 'storage.fileUnknown' && $res['bytes'] === '') { $res = $this->method_call('upload.getFile', ['location' => $message_media['InputFileLocation'], 'offset' => $offset, 'limit' => $part_size], ['heavy' => true, 'datacenter' => $datacenter]); $datacenter++; if (!isset($this->datacenter->sockets[$datacenter])) { break; } } if (isset($message_media['cdn_key'])) { $ivec = substr($message_media['cdn_iv'], 0, 12).pack('N', $offset >> 4); $res['bytes'] = $this->ctr_encrypt($res['bytes'], $message_media['cdn_key'], $ivec); $this->check_cdn_hash($message_media['file_token'], $offset, $res['bytes'], $old_dc); } if (isset($message_media['key'])) { $res['bytes'] = $ige->decrypt($res['bytes']); } if ($start_at) { $res['bytes'] = substr($res['bytes'], $start_at); } if ($end !== -1 && strlen($res['bytes']) + $downloaded_size >= $size) { $res['bytes'] = substr($res['bytes'], 0, $size - $downloaded_size); $theend = true; } if ($res['bytes'] === '') { break; } $offset += strlen($res['bytes']); $downloaded_size += strlen($res['bytes']); $this->logger->logger(fwrite($stream, $res['bytes']), \danog\MadelineProto\Logger::ULTRA_VERBOSE); if ($theend) { break; } if ($end !== -1) { $cb($percent = $downloaded_size * 100 / $size); } } if ($end === -1) { $cb(100); } if ($cdn) { $this->clear_cdn_hashes($message_media['file_token']); } return true; } private $cdn_hashes = []; private function add_cdn_hashes($file, $hashes) { if (!isset($this->cdn_hashes[$file])) { $this->cdn_hashes = []; } foreach ($hashes as $hash) { $this->cdn_hashes[$file][$hash['offset']] = ['limit' => $hash['limit'], 'hash' => (string) $hash['hash']]; } } private function check_cdn_hash($file, $offset, $data, &$datacenter) { while (strlen($data)) { if (!isset($this->cdn_hashes[$file][$offset])) { $this->add_cdn_hashes($file, $this->method_call('upload.getCdnFileHashes', ['file_token' => $file, 'offset' => $offset], ['datacenter' => $datacenter])); } if (!isset($this->cdn_hashes[$file][$offset])) { throw new \danog\MadelineProto\Exception('Could not fetch CDN hashes for offset '.$offset); } if (hash('sha256', substr($data, 0, $this->cdn_hashes[$file][$offset]['limit']), true) !== $this->cdn_hashes[$file][$offset]['hash']) { throw new \danog\MadelineProto\SecurityException('CDN hash mismatch for offset '.$offset); } $data = substr($data, $this->cdn_hashes[$file][$offset]['limit']); $offset += $this->cdn_hashes[$file][$offset]['limit']; } return true; } private function clear_cdn_hashes($file) { unset($this->cdn_hashes[$file]); return true; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\MTProtoTools; use Amp\Deferred; use Amp\Promise; use danog\MadelineProto\Async\Parameters; use function Amp\call; use function Amp\Promise\all; /** * Manages method and object calls. */ trait CallHandler { /* public function select() { $result = []; try { /* if ($this->is_http($this->settings['connection_settings']['default_dc']) || $this->altervista) { $this->logger->logger("Initial HTTP short poll"); $waiting = $this->datacenter->select(0.1); $result = $this->handle_select($waiting, $result); }/ $tries = 10; // TODO add setting $this->logger->logger('Long poll'); $t = microtime(true); $waiting = $this->datacenter->select(); $t = microtime(true) - $t; $this->logger->logger("Long poll took $t"); $result = $this->handle_select($waiting, $result); do { $this->logger->logger('Short poll'); $waiting = $this->datacenter->select($this->is_http($this->settings['connection_settings']['default_dc']) || $this->altervista ? $this->settings['connection_settings']['all']['timeout'] / 10 : true); $result = $this->handle_select($waiting, $result); } while ($tries-- && $waiting); } catch (\danog\MadelineProto\NothingInTheSocketException $e) { $this->logger->logger('Nothing in the socket while selecting', \danog\MadelineProto\Logger::ULTRA_VERBOSE); foreach ($this->datacenter->sockets as $dc => $socket) { $this->close_and_reopen($dc); $this->send_messages($dc); } } return $result; } public $did = []; public function handle_select($waiting, $result) { foreach ($waiting as $dc) { $error = $this->recv_message($dc); if ($error !== true) { $this->close_and_reopen($dc); if ($error === -404) { if ($this->datacenter->sockets[$dc]->temp_auth_key !== null) { $this->logger->logger('WARNING: Resetting auth key...', \danog\MadelineProto\Logger::WARNING); $this->datacenter->sockets[$dc]->temp_auth_key = null; $this->init_authorization(); return $result; } } throw new \danog\MadelineProto\RPCErrorException($error, $error); } $result[$dc] = $this->handle_messages($dc) && (isset($result[$dc]) ? $result[$dc] : true); if (($this->is_http($dc) || $this->altervista) && $this->datacenter->sockets[$dc]->new_outgoing) { $this->send_messages($dc); } } return $result; } public function iorun($updates) { do { if ($updates && time() - $this->last_getdifference > $this->settings['updates']['getdifference_interval']) { $this->get_updates_difference(); return; } if ($canunset = !$this->updates_state['sync_loading']) { $this->updates_state['sync_loading'] = true; } if ($canunsetpostponeupdates = !$this->postpone_updates) { $this->postpone_updates = true; } if ($canunsetpostponepwrchat = !$this->postpone_pwrchat) { $this->postpone_pwrchat = true; } if (($this->is_http($this->settings['connection_settings']['default_dc']) || $this->altervista) && $updates) { $this->send_messages($this->settings['connection_settings']['default_dc']); } foreach ($this->datacenter->sockets as $id => $datacenter) { if ($datacenter->pending_outgoing) { $this->send_messages($id); } } $this->logger->logger('Polling for ' . ($updates ? 'updates' : 'replies') . ': selecting', \danog\MadelineProto\Logger::ULTRA_VERBOSE); $t = microtime(true); $only_updates = $this->select(); $t = microtime(true) - $t; $this->logger->logger('Polling for ' . ($updates ? 'updates' : 'replies') . ': selecting took ' . $t, \danog\MadelineProto\Logger::ULTRA_VERBOSE); $response_result = $this->has_pending_calls(); $repeat = 0; foreach ($this->datacenter->sockets as $id => $datacenter) { if ($updates) { if (isset($only_updates[$id])) { if ($only_updates[$id]) { $this->logger->logger("Polling for updates: got only updates for DC $id", \danog\MadelineProto\Logger::VERBOSE); } else { $this->logger->logger("Polling for updates: got also RPC replies for DC $id", \danog\MadelineProto\Logger::NOTICE); } if ($response_result[$id]) { $this->logger->logger("Polling for updates: still pending requests, resending for DC $id", \danog\MadelineProto\Logger::WARNING); $this->send_messages($id); } } else { if ($response_result[$id] || $id === $this->settings['connection_settings']['default_dc']) { $this->logger->logger("Polling for updates: got nothing for DC $id", \danog\MadelineProto\Logger::ERROR); if ($this->is_http($id) || $this->altervista) { $this->logger->logger("Polling for updates: closing and reopening DC $id since we're on HTTP, and we polled"); $this->close_and_reopen($id); $datacenter->last_http_wait = 0; $repeat |= 1; $this->logger->logger("Polling for updates: and now repolling for DC $id"); $this->send_messages($id); } } } } else { if (isset($only_updates[$id])) { if ($only_updates[$id]) { $this->logger->logger("Polling for replies: got only updates for DC $id", \danog\MadelineProto\Logger::WARNING); if ($response_result[$id]) { $this->logger->logger("Polling for replies: still pending requests, repolling for DC $id", \danog\MadelineProto\Logger::WARNING); $this->send_messages($id); $repeat |= 1; } else { $this->logger->logger("Polling for replies: got all RPC replies for DC $id", \danog\MadelineProto\Logger::ULTRA_VERBOSE); } } else { if ($response_result[$id]) { $this->logger->logger("Polling for replies: still pending requests, repolling for DC $id", \danog\MadelineProto\Logger::WARNING); $this->send_messages($id); } else { $this->logger->logger("Polling for replies: got all RPC replies for DC $id", \danog\MadelineProto\Logger::NOTICE); } } } else { if ($response_result[$id]) { $this->logger->logger("Polling for replies: got nothing for DC $id", \danog\MadelineProto\Logger::ERROR); $this->logger->logger("Polling for replies: closing and reopening DC $id", \danog\MadelineProto\Logger::ERROR); $this->close_and_reopen($id); $datacenter->last_http_wait = 0; $repeat |= 1; $this->logger->logger("Polling for replies: resending for DC $id", \danog\MadelineProto\Logger::WARNING); $this->send_messages($id); } else { $this->logger->logger("Polling for replies: got all RPC replies for DC $id", \danog\MadelineProto\Logger::ULTRA_VERBOSE); } } } } $this->logger->logger('Running guzzle promise queue'); \GuzzleHttp\Promise\queue()->run(); if ($repeat) { $this->logger->logger('Repeat iowait'); } } while ($repeat); if ($canunset) { $this->updates_state['sync_loading'] = false; } if ($canunsetpostponepwrchat) { $this->postpone_pwrchat = false; $this->handle_pending_pwrchat(); } if ($canunsetpostponeupdates) { $this->postpone_updates = false; $this->handle_pending_updates(); } } */ public function has_pending_calls() { $result = []; foreach ($this->datacenter->sockets as $id => $socket) { $result[$id] = $this->has_pending_calls_dc($id); } return $result; } public function has_pending_calls_dc($datacenter) { //$result = 0; $dc_config_number = isset($this->settings['connection_settings'][$datacenter]) ? $datacenter : 'all'; foreach ($this->datacenter->sockets[$datacenter]->new_outgoing as $message_id) { if (isset($this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['sent']) && ($this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['sent'] + $this->settings['connection_settings'][$dc_config_number]['timeout'] < time()) && ($this->datacenter->sockets[$datacenter]->temp_auth_key === null) === (isset($this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['unencrypted']) && $this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['unencrypted']) && $this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['_'] !== 'msgs_state_req') { return true; //$result |= 1; } } return false; //(bool) $result; } public function check_pending_calls() { foreach ($this->datacenter->sockets as $datacenter => $socket) { $this->check_pending_calls_dc($datacenter); } } public function check_pending_calls_dc($datacenter) { if (!empty($this->datacenter->sockets[$datacenter]->new_outgoing)) { if ($this->has_pending_calls_dc($datacenter)) { if ($this->datacenter->sockets[$datacenter]->temp_auth_key !== null) { $message_ids = array_values($this->datacenter->sockets[$datacenter]->new_outgoing); $deferred = new \danog\MadelineProto\ImmediatePromise(); $deferred->then( function ($result) use ($datacenter, $message_ids) { $reply = []; foreach (str_split($result['info']) as $key => $chr) { $message_id = $message_ids[$key]; if (!isset($this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id])) { $this->logger->logger('Already got response for and forgot about message ID '.$this->unpack_signed_long($message_id)); continue; } if (!isset($this->datacenter->sockets[$datacenter]->new_outgoing[$message_id])) { $this->logger->logger('Already got response for '.$this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['_'].' with message ID '.$this->unpack_signed_long($message_id)); continue; } $chr = ord($chr); switch ($chr & 7) { case 0: $this->logger->logger('Wrong message status 0 for '.$this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['_'], \danog\MadelineProto\Logger::FATAL_ERROR); break; case 1: case 2: case 3: $this->logger->logger('Message '.$this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['_'].' with message ID '.$this->unpack_signed_long($message_id).' not received by server, resending...', \danog\MadelineProto\Logger::ERROR); $this->method_recall($message_id, $datacenter, false, true); break; case 4: if ($chr & 32) { $this->logger->logger('Message '.$this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['_'].' with message ID '.$this->unpack_signed_long($message_id).' received by server and is being processed, waiting...', \danog\MadelineProto\Logger::ERROR); } elseif ($chr & 64) { $this->logger->logger('Message '.$this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['_'].' with message ID '.$this->unpack_signed_long($message_id).' received by server and was already processed, requesting reply...', \danog\MadelineProto\Logger::ERROR); $reply[] = $message_id; } elseif ($chr & 128) { $this->logger->logger('Message '.$this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['_'].' with message ID '.$this->unpack_signed_long($message_id).' received by server and was already sent, requesting reply...', \danog\MadelineProto\Logger::ERROR); $reply[] = $message_id; } else { $this->logger->logger('Message '.$this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['_'].' with message ID '.$this->unpack_signed_long($message_id).' received by server, requesting reply...', \danog\MadelineProto\Logger::ERROR); $reply[] = $message_id; } } } if ($reply) { $this->object_call('msg_resend_ans_req', ['msg_ids' => $reply], ['datacenter' => $datacenter, 'postpone' => true]); } $this->send_messages($datacenter); }, function ($error) use ($datacenter) { throw $error; } ); $this->logger->logger("Still missing something on DC $datacenter, sending state request", \danog\MadelineProto\Logger::ERROR); $this->object_call('msgs_state_req', ['msg_ids' => $message_ids], ['datacenter' => $datacenter, 'promise' => $deferred]); } else { $dc_config_number = isset($this->settings['connection_settings'][$datacenter]) ? $datacenter : 'all'; foreach ($this->datacenter->sockets[$datacenter]->new_outgoing as $message_id) { if (isset($this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['sent']) && $this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['sent'] + $this->settings['connection_settings'][$dc_config_number]['timeout'] < time() && $this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['unencrypted']) { $this->logger->logger('Still missing '.$this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['_'].' with message id '.$this->unpack_signed_long($message_id)." on DC $datacenter, resending", \danog\MadelineProto\Logger::ERROR); $this->method_recall($message_id, $datacenter, false, true); } } } } } } public function method_recall($watcherId, $args) { $message_id = $args['message_id']; $new_datacenter = $args['datacenter']; $old_datacenter = $new_datacenter; if (isset($args['old_datacenter'])) { $old_datacenter = $args['old_datacenter']; } $postpone = false; if (isset($args['postpone'])) { $postpone = $args['postpone']; } if (isset($this->datacenter->sockets[$old_datacenter]->outgoing_messages[$message_id]['container'])) { $message_ids = $this->datacenter->sockets[$old_datacenter]->outgoing_messages[$message_id]['container']; } else { $message_ids = [$message_id]; } foreach ($message_ids as $message_id) { if (isset($this->datacenter->sockets[$old_datacenter]->outgoing_messages[$message_id]['body'])) { $this->datacenter->sockets[$new_datacenter]->sendMessage($this->datacenter->sockets[$old_datacenter]->outgoing_messages[$message_id], false); $this->ack_outgoing_message_id($message_id, $old_datacenter); $this->got_response_for_outgoing_message_id($message_id, $old_datacenter); } } if (!$postpone) { $this->datacenter->sockets[$new_datacenter]->writer->resume(); } } public function method_call($method, $args = [], $aargs = ['msg_id' => null, 'heavy' => false]) { $promise = $this->method_call_async_read($method, $args, $aargs); return $this->wait($promise); } public function method_call_async_read($method, $args = [], $aargs = ['msg_id' => null, 'heavy' => false]): Promise { $deferred = new Deferred(); $this->method_call_async_write($method, $args, $aargs)->onResolve(function ($e, $read_deferred) use ($deferred) { if ($e) { $deferred->fail($e); } else { if (is_array($read_deferred)) { $read_deferred = array_map(function ($value) { return $value->promise(); }, $read_deferred); $deferred->resolve(all($read_deferred)); } else { $deferred->resolve($read_deferred->promise()); } } }); return isset($aargs['noResponse']) && $aargs['noResponse'] ? new \Amp\Success(0) : $deferred->promise(); } public function method_call_async_write($method, $args = [], $aargs = ['msg_id' => null, 'heavy' => false]): Promise { return call([$this, 'method_call_async_write_generator'], $method, $args, $aargs); } public function method_call_async_write_generator($method, $args = [], $aargs = ['msg_id' => null, 'heavy' => false]): \Generator { if (is_array($args) && isset($args['id']['_']) && isset($args['id']['dc_id']) && $args['id']['_'] === 'inputBotInlineMessageID') { $aargs['datacenter'] = $args['id']['dc_id']; } if ($this->wrapper instanceof \danog\MadelineProto\API && isset($this->wrapper->session) && !is_null($this->wrapper->session) && time() - $this->wrapper->serialized > $this->settings['serialization']['serialization_interval']) { $this->logger->logger("Didn't serialize in a while, doing that now..."); $this->wrapper->serialize($this->wrapper->session); } if (isset($aargs['file']) && $aargs['file'] && isset($this->datacenter->sockets[$aargs['datacenter'].'_media'])) { \danog\MadelineProto\Logger::log('Using media DC'); $aargs['datacenter'] .= '_media'; } if (in_array($method, ['messages.setEncryptedTyping', 'messages.readEncryptedHistory', 'messages.sendEncrypted', 'messages.sendEncryptedFile', 'messages.sendEncryptedService', 'messages.receivedQueue'])) { $aargs['queue'] = 'secret'; } if (is_array($args)) { if (isset($args['message']) && is_string($args['message']) && $this->mb_strlen($args['message']) > $this->config['message_length_max']) { $arg_chunks = $this->split_to_chunks($args); $promises = []; $new_aargs = $aargs; $new_aargs['postpone'] = true; $new_aargs['queue'] = $method; foreach ($arg_chunks as $args) { $promises[] = $this->method_call_async_write($method, $args, $new_aargs); } if (!isset($aargs['postpone'])) { $this->datacenter->sockets[$aargs['datacenter']]->writer->resume(); } return yield $promises; } $args = $this->botAPI_to_MTProto($args); if (isset($args['ping_id']) && is_int($args['ping_id'])) { $args['ping_id'] = $this->pack_signed_long($args['ping_id']); } } $deferred = new Deferred(); $message = ['_' => $method, 'type' => $this->methods->find_by_method($method)['type'], 'content_related' => $this->content_related($method), 'promise' => $deferred, 'method' => true, 'unencrypted' => $this->datacenter->sockets[$aargs['datacenter']]->temp_auth_key === null && strpos($method, '.') === false]; if (is_object($args) && $args instanceof Parameters) { $message['body'] = call([$args, 'fetchParameters']); } else { $message['body'] = $args; } if (isset($aargs['msg_id'])) { $message['msg_id'] = $aargs['msg_id']; } if (isset($aargs['queue'])) { $message['queue'] = $aargs['queue']; } if (isset($aargs['file'])) { $message['file'] = $aargs['file']; } if (isset($aargs['botAPI'])) { $message['botAPI'] = $aargs['botAPI']; } if (($method === 'users.getUsers' && $args === ['id' => [['_' => 'inputUserSelf']]]) || $method === 'auth.exportAuthorization' || $method === 'updates.getDifference') { $message['user_related'] = true; } $write_deferred = yield $this->datacenter->sockets[$aargs['datacenter']]->sendMessage($message, isset($aargs['postpone']) ? !$aargs['postpone'] : true); $deferred = new Deferred(); $write_promise = $write_deferred->promise(); $write_promise->onResolve( function ($e, $result) use ($aargs, $deferred) { //$this->datacenter->sockets[$aargs['datacenter']]->checker->resume(); if ($e) { return $deferred->fail($e); } $deferred->resolve($result); } ); $this->datacenter->sockets[$aargs['datacenter']]->checker->resume(); return $deferred; } public function object_call($object, $args = [], $aargs = ['msg_id' => null, 'heavy' => false]) { return $this->wait($this->object_call_async($object, $args, $aargs)); } public function object_call_async($object, $args = [], $aargs = ['msg_id' => null, 'heavy' => false]): Promise { $message = ['_' => $object, 'body' => $args, 'content_related' => $this->content_related($object), 'unencrypted' => $this->datacenter->sockets[$aargs['datacenter']]->temp_auth_key === null, 'method' => false]; if (isset($aargs['promise'])) { $message['promise'] = $aargs['promise']; } return $this->datacenter->sockets[$aargs['datacenter']]->sendMessage($message, isset($aargs['postpone']) ? !$aargs['postpone'] : true); } /* $message = [ // only in outgoing messages 'body' => 'serialized body', (optional if container) 'content_related' => bool, '_' => 'predicate', 'promise' => deferred promise that gets resolved when a response to the message is received (optional), 'send_promise' => deferred promise that gets resolved when the message is sent (optional), 'file' => bool (optional), 'type' => 'type' (optional), 'queue' => queue ID (optional), 'container' => [message ids] (optional), // only in incoming messages 'content' => deserialized body, 'seq_no' => number (optional), 'from_container' => bool (optional), // can be present in both 'response' => message id (optional), 'msg_id' => message id (optional), 'sent' => timestamp, 'tries' => number ]; */ } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\MTProtoTools; use Amp\Deferred; use Amp\Promise; use Amp\Success; use danog\MadelineProto\Exception; use danog\MadelineProto\TL\TLCallback; use danog\MadelineProto\Tools; use function Amp\call; /** * Manages upload and download of files. */ class ReferenceDatabase implements TLCallback { use Tools; // Reference from a document const DOCUMENT_LOCATION = 0; // Reference from a photo const PHOTO_LOCATION = 1; // Reference from a location (can only be photo location) const PHOTO_LOCATION_LOCATION = 2; // Reference from a location (can only be document location) const DOCUMENT_LOCATION_LOCATION = 0; // Peer + photo ID const USER_PHOTO_ORIGIN = 0; // Peer (default photo ID) const PEER_PHOTO_ORIGIN = 1; // set ID const STICKER_SET_ID_ORIGIN = 2; // Peer + msg ID const MESSAGE_ORIGIN = 3; // const SAVED_GIFS_ORIGIN = 4; // const STICKER_SET_RECENT_ORIGIN = 5; // const STICKER_SET_FAVED_ORIGIN = 6; // emoticon const STICKER_SET_EMOTICON_ORIGIN = 8; // const WALLPAPER_ORIGIN = 9; const LOCATION_CONTEXT = [ 'inputFileLocation' => self::PHOTO_LOCATION_LOCATION, 'inputDocumentFileLocation' => self::DOCUMENT_LOCATION_LOCATION, 'inputPhoto' => self::PHOTO_LOCATION, 'inputDocument' => self::DOCUMENT_LOCATION, ]; const METHOD_CONTEXT = [ 'photos.updateProfilePhoto' => self::USER_PHOTO_ORIGIN, 'photos.getUserPhotos' => self::USER_PHOTO_ORIGIN, 'photos.uploadProfilePhoto' => self::USER_PHOTO_ORIGIN, 'messages.getStickers' => self::STICKER_SET_EMOTICON_ORIGIN, ]; const CONSTRUCTOR_CONTEXT = [ 'message' => self::MESSAGE_ORIGIN, 'messageService' => self::MESSAGE_ORIGIN, 'chatFull' => self::PEER_PHOTO_ORIGIN, 'channelFull' => self::PEER_PHOTO_ORIGIN, 'chat' => self::PEER_PHOTO_ORIGIN, 'channel' => self::PEER_PHOTO_ORIGIN, 'updateUserPhoto' => self::USER_PHOTO_ORIGIN, 'user' => self::USER_PHOTO_ORIGIN, 'userFull' => self::USER_PHOTO_ORIGIN, 'message' => self::MESSAGE_ORIGIN, 'messageService' => self::MESSAGE_ORIGIN, 'wallPaper' => self::WALLPAPER_ORIGIN, 'messages.savedGifs' => self::SAVED_GIFS_ORIGIN, 'messages.recentStickers' => self::STICKER_SET_RECENT_ORIGIN, 'messages.favedStickers' => self::STICKER_SET_FAVED_ORIGIN, 'messages.stickerSet' => self::STICKER_SET_ID_ORIGIN, 'document' => self::STICKER_SET_ID_ORIGIN, ]; /** * References indexed by location. * * @var array */ private $db = []; private $cache = []; private $cacheContexts = []; private $refreshed = []; private $API; private $refresh = false; private $refreshCount = 0; public function __construct($API) { $this->API = $API; $this->init(); } public function __wakeup() { $this->init(); } public function __sleep() { return ['db', 'API']; } public function init() { } public function getMethodCallbacks(): array { return array_fill_keys(array_keys(self::METHOD_CONTEXT), [[$this, 'addOriginMethod']]); } public function getMethodBeforeCallbacks(): array { return array_fill_keys(array_keys(self::METHOD_CONTEXT), [[$this, 'addOriginMethodContext']]); } public function getConstructorCallbacks(): array { return array_merge( array_fill_keys(['document', 'photo', 'fileLocation'], [[$this, 'addReference']]), array_fill_keys(array_keys(self::CONSTRUCTOR_CONTEXT), [[$this, 'addOrigin']]), ['document' => [[$this, 'addReference'], [$this, 'addOrigin']]] ); } public function getConstructorBeforeCallbacks(): array { return array_fill_keys(array_keys(self::CONSTRUCTOR_CONTEXT), [[$this, 'addOriginContext']]); } public function getConstructorSerializeCallbacks(): array { return array_fill_keys(array_keys(self::LOCATION_CONTEXT), [$this, 'populateReferenceSync']); } public function getTypeMismatchCallbacks(): array { return []; } public function reset() { if ($this->cacheContexts) { $this->API->logger->logger('Found '.count($this->cacheContexts).' pending contexts', \danog\MadelineProto\Logger::ERROR); $this->cacheContexts = []; } if ($this->cache) { $this->API->logger->logger('Found pending locations', \danog\MadelineProto\Logger::ERROR); $this->cache = []; } } public function addReference(array $location) { if (!$this->cacheContexts) { $this->API->logger->logger('Trying to add reference out of context, report the following message to @danogentili!', \danog\MadelineProto\Logger::ERROR); $frames = []; $previous = ''; foreach (debug_backtrace(0) as $k => $frame) { if (isset($frame['function']) && $frame['function'] === 'deserialize') { if (isset($frame['args'][1]['subtype'])) { if ($frame['args'][1]['subtype'] === $previous) { continue; } $frames[] = $frame['args'][1]['subtype']; $previous = $frame['args'][1]['subtype']; } elseif (isset($frame['args'][1]['type'])) { if ($frame['args'][1]['type'] === '') { break; } if ($frame['args'][1]['type'] === $previous) { continue; } $frames[] = $frame['args'][1]['type']; $previous = $frame['args'][1]['type']; } } } $frames = array_reverse($frames); $tl_trace = array_shift($frames); foreach ($frames as $frame) { $tl_trace .= "['".$frame."']"; } $this->API->logger->logger($tl_trace, \danog\MadelineProto\Logger::ERROR); return false; } $key = count($this->cacheContexts) - 1; switch ($location['_']) { case 'document': $locationType = self::DOCUMENT_LOCATION; break; case 'photo': $locationType = self::PHOTO_LOCATION; break; case 'fileLocation': $locationType = self::PHOTO_LOCATION_LOCATION; break; default: throw new Exception('Unknown location type provided: '.$location['_']); } $this->API->logger->logger("Caching reference from location of type $locationType from {$location['_']}", \danog\MadelineProto\Logger::ULTRA_VERBOSE); if (!isset($this->cache[$key])) { $this->cache[$key] = []; } $this->cache[$key][$this->serializeLocation($locationType, $location)] = (string) $location['file_reference']; return true; } public function addOriginContext(string $type) { if (!isset(self::CONSTRUCTOR_CONTEXT[$type])) { throw new \danog\MadelineProto\Exception("Unknown origin type provided: $type"); } $originContext = self::CONSTRUCTOR_CONTEXT[$type]; $this->API->logger->logger("Adding origin context $originContext for {$type}!", \danog\MadelineProto\Logger::ULTRA_VERBOSE); $this->cacheContexts[] = $originContext; } public function addOrigin(array $data = []) { $key = count($this->cacheContexts) - 1; if ($key === -1) { throw new \danog\MadelineProto\Exception('Trying to add origin with no origin context set'); } $originType = array_pop($this->cacheContexts); if (!isset($this->cache[$key])) { $this->API->logger->logger("Removing origin context $originType for {$data['_']}, nothing in the reference cache!", \danog\MadelineProto\Logger::ULTRA_VERBOSE); return; } $cache = $this->cache[$key]; unset($this->cache[$key]); $origin = []; switch ($data['_']) { case 'message': case 'messageService': $origin['peer'] = $data; $origin['msg_id'] = $data['id']; break; case 'messages.savedGifs': case 'messages.recentStickers': case 'messages.favedStickers': case 'wallPaper': break; case 'user': $origin['max_id'] = $data['photo']['photo_id']; $origin['offset'] = -1; $origin['limit'] = 1; $origin['user_id'] = $data['id']; break; case 'updateUserPhoto': $origin['max_id'] = $data['photo']['photo_id']; $origin['offset'] = -1; $origin['limit'] = 1; $origin['user_id'] = $data['user_id']; break; case 'userFull': $origin['max_id'] = $data['profile_photo']['id']; $origin['offset'] = -1; $origin['limit'] = 1; $origin['user_id'] = $data['user']['id']; break; case 'chatFull': case 'chat': $origin['peer'] = -$data['id']; break; case 'channelFull': case 'channel': $origin['peer'] = $this->API->to_supergroup($data['id']); break; case 'document': foreach ($data['attributes'] as $attribute) { if ($attribute['_'] === 'documentAttributeSticker' && $attribute['stickerset']['_'] !== 'inputStickerSetEmpty') { $origin['stickerset'] = $attribute['stickerset']; } } if (!isset($origin['stickerset'])) { $key = count($this->cacheContexts) - 1; if (!isset($this->cache[$key])) { $this->cache[$key] = []; } foreach ($cache as $location => $reference) { $this->cache[$key][$location] = $reference; } $this->API->logger->logger("Skipped origin $originType ({$data['_']}) for ".count($cache).' references', \danog\MadelineProto\Logger::ULTRA_VERBOSE); return; } break; case 'messages.stickerSet': $origin['stickerset'] = ['_' => 'inputStickerSetID', 'id' => $data['set']['id'], 'access_hash' => $data['set']['access_hash']]; break; default: throw new \danog\MadelineProto\Exception("Unknown origin type provided: {$data['_']}"); } foreach ($cache as $location => $reference) { $this->storeReference($location, $reference, $originType, $origin); } $this->API->logger->logger("Added origin $originType ({$data['_']}) to ".count($cache).' references', \danog\MadelineProto\Logger::ULTRA_VERBOSE); } public function addOriginMethodContext(string $type) { if (!isset(self::METHOD_CONTEXT[$type])) { throw new \danog\MadelineProto\Exception("Unknown origin type provided: {$type}"); } $originContext = self::METHOD_CONTEXT[$type]; $this->API->logger->logger("Adding origin context $originContext for {$type}!", \danog\MadelineProto\Logger::ULTRA_VERBOSE); $this->cacheContexts[] = $originContext; } public function addOriginMethod(array $data, array $res) { $key = count($this->cacheContexts) - 1; if ($key === -1) { throw new \danog\MadelineProto\Exception('Trying to add origin with no origin context set'); } $originType = array_pop($this->cacheContexts); if (!isset($this->cache[$key])) { $this->API->logger->logger("Removing origin context $originType for {$data['_']}, nothing in the reference cache!", \danog\MadelineProto\Logger::ULTRA_VERBOSE); return; } $cache = $this->cache[$key]; unset($this->cache[$key]); $origin = []; $body = $data['body']; switch ($data['_']) { case 'photos.updateProfilePhoto': $origin['max_id'] = $res['photo_id']; $origin['offset'] = -1; $origin['limit'] = 1; $origin['user_id'] = $this->API->authorization['user']['id']; break; case 'photos.uploadProfilePhoto': $origin['max_id'] = $res['photo']['id']; $origin['offset'] = -1; $origin['limit'] = 1; $origin['user_id'] = $this->API->authorization['user']['id']; break; case 'photos.getUserPhotos': $origin['user_id'] = $body['user_id']; $origin['offset'] = -1; $origin['limit'] = 1; $count = 0; foreach ($res['photos'] as $photo) { $origin['max_id'] = $photo['id']; $location = $this->serializeLocation(self::PHOTO_LOCATION, $photo); if (isset($cache[$location])) { $reference = $cache[$location]; unset($cache[$location]); $this->storeReference($location, $reference, $originType, $origin); $count++; } if (isset($photo['sizes'])) { foreach ($photo['sizes'] as $size) { if (isset($size['location'])) { $location = $this->serializeLocation(self::PHOTO_LOCATION_LOCATION, $size['location']); if (isset($cache[$location])) { $reference = $cache[$location]; unset($cache[$location]); $this->storeReference($location, $reference, $originType, $origin); $count++; } } } } } $this->API->logger->logger("Added origin $originType ({$data['_']}) to $count references", \danog\MadelineProto\Logger::ULTRA_VERBOSE); return; case 'messages.getStickers': $origin['emoticon'] = $body['emoticon']; break; default: throw new \danog\MadelineProto\Exception("Unknown origin type provided: {$data['_']}"); } foreach ($cache as $location => $reference) { $this->storeReference($location, $reference, $originType, $origin); } $this->API->logger->logger("Added origin $originType ({$data['_']}) to ".count($cache).' references', \danog\MadelineProto\Logger::ULTRA_VERBOSE); } public function storeReference(string $location, string $reference, int $originType, array $origin) { if (!isset($this->db[$location])) { $this->db[$location] = ['origins' => []]; } $this->db[$location]['reference'] = $reference; $this->db[$location]['origins'][$originType] = $origin; if ($this->refresh) { $this->refreshed[$location] = true; } $key = count($this->cacheContexts) - 1; if ($key >= 0) { $this->cache[$key][$location] = $reference; } } public function refreshNext($refresh = false) { if ($this->refreshCount === 1 && !$refresh) { $this->refreshed = []; $this->refreshCount--; $this->refresh = false; } elseif ($this->refreshCount === 0 && $refresh) { $this->refreshed = []; $this->refreshCount++; $this->refresh = true; } elseif ($this->refreshCount === 0 && !$refresh) { } elseif ($refresh) { $this->refreshCount++; } elseif (!$refresh) { $this->refreshCount--; } } public function refreshReference(int $locationType, array $location): Promise { return $this->refreshReferenceInternal($this->serializeLocation($locationType, $location)); } public function refreshReferenceInternal(string $location): Promise { if (isset($this->refreshed[$location])) { $this->API->logger->logger('Reference already refreshed!', \danog\MadelineProto\Logger::VERBOSE); return new Success($this->db[$location]['reference']); } return call([$this, 'refreshReferenceInternalGenerator'], $location); } public function refreshReferenceInternalGenerator(string $location): \Generator { ksort($this->db[$location]['origins']); $count = 0; foreach ($this->db[$location]['origins'] as $originType => &$origin) { $count++; $this->API->logger->logger("Try {$count} refreshing file reference with origin type {$originType}", \danog\MadelineProto\Logger::VERBOSE); switch ($originType) { // Peer + msg ID case self::MESSAGE_ORIGIN: if (is_array($origin['peer'])) { $origin['peer'] = $this->API->get_info($origin['peer'])['bot_api_id']; } if ($origin['peer'] < 0) { yield $this->API->method_call_async_read('channels.getMessages', ['channel' => $origin['peer'], 'id' => [$origin['msg_id']]], ['datacenter' => $this->API->settings['connection_settings']['default_dc']]); break; } yield $this->API->method_call_async_read('messages.getMessages', ['id' => [$origin['msg_id']]], ['datacenter' => $this->API->settings['connection_settings']['default_dc']]); break; // Peer + photo ID case self::PEER_PHOTO_ORIGIN: if (isset($this->API->full_chats[$origin['peer']]['last_update'])) { $this->API->full_chats[$origin['peer']]['last_update'] = 0; } $this->API->get_full_info($origin['peer']); yield new Success(0); break; // Peer (default photo ID) case self::USER_PHOTO_ORIGIN: yield $this->API->method_call_async_read('photos.getUserPhotos', $origin, ['datacenter' => $this->API->settings['connection_settings']['default_dc']]); break; case self::SAVED_GIFS_ORIGIN: yield $this->API->method_call_async_read('messages.getSavedGifs', $origin, ['datacenter' => $this->API->settings['connection_settings']['default_dc']]); break; case self::STICKER_SET_ID_ORIGIN: yield $this->API->method_call_async_read('messages.getStickerSet', $origin, ['datacenter' => $this->API->settings['connection_settings']['default_dc']]); break; case self::STICKER_SET_RECENT_ORIGIN: yield $this->API->method_call_async_read('messages.getRecentStickers', $origin, ['datacenter' => $this->API->settings['connection_settings']['default_dc']]); break; case self::STICKER_SET_FAVED_ORIGIN: yield $this->API->method_call_async_read('messages.getFavedStickers', $origin, ['datacenter' => $this->API->settings['connection_settings']['default_dc']]); break; case self::STICKER_SET_EMOTICON_ORIGIN: yield $this->API->method_call_async_read('messages.getStickers', $origin, ['datacenter' => $this->API->settings['connection_settings']['default_dc']]); break; case self::WALLPAPER_ORIGIN: yield $this->API->method_call_async_read('account.getWallPapers', $origin, ['datacenter' => $this->API->settings['connection_settings']['default_dc']]); break; default: throw new \danog\MadelineProto\Exception("Unknown origin type $originType"); } if (isset($this->refreshed[$location])) { return $this->db[$location]['reference']; } } throw new Exception('Did not refresh reference'); } public function populateReferenceSync(array $object): array { return $this->wait($this->populateReference($object)); } public function populateReference(array $object): Promise { $deferred = new Deferred(); $this->getReference(self::LOCATION_CONTEXT[$object['_']], $object)->onResolve(function ($e, $res) use ($deferred, $object) { if ($e) { throw $e; } $object['file_reference'] = $res; $deferred->resolve($object); }); return $deferred->promise(); } public function getReference(int $locationType, array $location): Promise { $locationString = $this->serializeLocation($locationType, $location); if (!isset($this->db[$locationString]['reference'])) { if (isset($location['file_reference'])) { $this->API->logger->logger("Using outdated file reference for location of type $locationType object {$location['_']}", \danog\MadelineProto\Logger::ULTRA_VERBOSE); return new Success($location['file_reference']); } throw new \danog\MadelineProto\Exception("Could not find file reference for location of type $locationType object {$location['_']}"); } $this->API->logger->logger("Getting file reference for location of type $locationType object {$location['_']}", \danog\MadelineProto\Logger::ULTRA_VERBOSE); if ($this->refresh) { return $this->refreshReferenceInternal($locationString); } return new Success($this->db[$locationString]['reference']); } private function serializeLocation(int $locationType, array $location) { switch ($locationType) { case self::DOCUMENT_LOCATION: case self::DOCUMENT_LOCATION_LOCATION: case self::PHOTO_LOCATION: return $locationType.(is_int($location['id']) ? $this->pack_signed_long($location['id']) : $location['id']); case self::PHOTO_LOCATION_LOCATION: $dc_id = $this->pack_signed_int($location['dc_id']); $volume_id = is_int($location['volume_id']) ? $this->pack_signed_long($location['volume_id']) : $location['volume_id']; $local_id = $this->pack_signed_int($location['local_id']); return $locationType.$dc_id.$volume_id.$local_id; } } public function __debugInfo() { return ['ReferenceDatabase instance '.spl_object_hash($this)]; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\MTProtoTools; use danog\MadelineProto\MTProto; /** * Manages sequence number. */ trait SeqNoHandler { public function content_related($method) { $method = is_array($method) && isset($method['_']) ? $method['_'] : $method; return is_string($method) ? !in_array($method, MTProto::NOT_CONTENT_RELATED) : true; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\MTProtoTools; trait Crypt { public function aes_calculate($msg_key, $auth_key, $to_server = true) { $x = $to_server ? 0 : 8; $sha256_a = hash('sha256', $msg_key.substr($auth_key, $x, 36), true); $sha256_b = hash('sha256', substr($auth_key, 40 + $x, 36).$msg_key, true); $aes_key = substr($sha256_a, 0, 8).substr($sha256_b, 8, 16).substr($sha256_a, 24, 8); $aes_iv = substr($sha256_b, 0, 8).substr($sha256_a, 8, 16).substr($sha256_b, 24, 8); return [$aes_key, $aes_iv]; } public function old_aes_calculate($msg_key, $auth_key, $to_server = true) { $x = $to_server ? 0 : 8; $sha1_a = sha1($msg_key.substr($auth_key, $x, 32), true); $sha1_b = sha1(substr($auth_key, 32 + $x, 16).$msg_key.substr($auth_key, 48 + $x, 16), true); $sha1_c = sha1(substr($auth_key, 64 + $x, 32).$msg_key, true); $sha1_d = sha1($msg_key.substr($auth_key, 96 + $x, 32), true); $aes_key = substr($sha1_a, 0, 8).substr($sha1_b, 8, 12).substr($sha1_c, 4, 12); $aes_iv = substr($sha1_a, 8, 12).substr($sha1_b, 0, 8).substr($sha1_c, 16, 4).substr($sha1_d, 0, 8); return [$aes_key, $aes_iv]; } public function ige_encrypt($message, $key, $iv) { $cipher = new \phpseclib\Crypt\AES('ige'); $cipher->setKey($key); $cipher->setIV($iv); return @$cipher->encrypt($message); } public function ctr_encrypt($message, $key, $iv) { $cipher = new \phpseclib\Crypt\AES('ctr'); $cipher->setKey($key); $cipher->setIV($iv); return @$cipher->encrypt($message); } public function ige_decrypt($message, $key, $iv) { $cipher = new \phpseclib\Crypt\AES('ige'); $cipher->setKey($key); $cipher->setIV($iv); return @$cipher->decrypt($message); } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\MTProtoTools; use Amp\Loop; /** * Manages peers. */ trait PeerHandler { public function to_supergroup($id) { return -($id + pow(10, (int) floor(log($id, 10) + 3))); } public function from_supergroup($id) { return -$id - pow(10, (int) floor(log(-$id, 10))); } public function is_supergroup($id) { $log = log(-$id, 10); return ($log - intval($log)) * 1000 < 10; } public function handle_pending_pwrchat() { if ($this->postpone_pwrchat || empty($this->pending_pwrchat)) { return false; } $this->postpone_pwrchat = true; try { $this->logger->logger('Handling pending pwrchat queries...', \danog\MadelineProto\Logger::VERBOSE); foreach ($this->pending_pwrchat as $query => $params) { unset($this->pending_pwrchat[$query]); try { $this->get_pwr_chat($query,...$params); } catch (\danog\MadelineProto\Exception $e) { $this->logger->logger($e->getMessage(), \danog\MadelineProto\Logger::WARNING); } catch (\danog\MadelineProto\RPCErrorException $e) { $this->logger->logger($e->getMessage(), \danog\MadelineProto\Logger::WARNING); } } } finally { $this->postpone_pwrchat = false; } } public function add_support($support) { $this->supportUser = $support['user']['id']; } public function add_users($users) { foreach ($users as $user) { $this->add_user($user); } } public function add_user($user) { if (!isset($user['access_hash'])) { if (isset($user['username']) && !isset($this->chats[$user['id']])) { $this->cache_pwr_chat($user['username'], false, true); } return; } switch ($user['_']) { case 'user': if (!isset($this->chats[$user['id']]) || $this->chats[$user['id']] !== $user) { $this->chats[$user['id']] = $user; $this->cache_pwr_chat($user['id'], false, true); } case 'userEmpty': break; default: throw new \danog\MadelineProto\Exception('Invalid user provided', $user); break; } } public function add_chats($chats) { foreach ($chats as $chat) { $this->add_chat($chat); } } public function add_chat($chat) { switch ($chat['_']) { case 'chat': case 'chatEmpty': case 'chatForbidden': if (!isset($this->chats[-$chat['id']]) || $this->chats[-$chat['id']] !== $chat) { $this->chats[-$chat['id']] = $chat; $this->cache_pwr_chat(-$chat['id'], $this->settings['peer']['full_fetch'], true); } break; case 'channelEmpty': break; case 'channel': case 'channelForbidden': $bot_api_id = $this->to_supergroup($chat['id']); if (!isset($chat['access_hash'])) { if (isset($chat['username']) && !isset($this->chats[$bot_api_id])) { $this->cache_pwr_chat($chat['username'], $this->settings['peer']['full_fetch'], true); } return; } if (!isset($this->chats[$bot_api_id]) || $this->chats[$bot_api_id] !== $chat) { $this->chats[$bot_api_id] = $chat; if ($this->settings['peer']['full_fetch'] && (!isset($this->full_chats[$bot_api_id]) || $this->full_chats[$bot_api_id]['full']['participants_count'] !== $this->get_full_info($bot_api_id)['full']['participants_count'])) { $this->cache_pwr_chat($bot_api_id, $this->settings['peer']['full_fetch'], true); } } break; default: throw new \danog\MadelineProto\Exception('Invalid chat provided at key '.$key.': '.var_export($chat, true)); break; } } public function cache_pwr_chat($id, $full_fetch, $send) { if ($this->postpone_pwrchat) { $this->pending_pwrchat[$id] = [$full_fetch, $send]; } else { Loop::defer(function () use ($id, $full_fetch, $send) { try { $this->get_pwr_chat($id, $full_fetch, $send); } catch (\danog\MadelineProto\Exception $e) { $this->logger->logger($e->getMessage(), \danog\MadelineProto\Logger::WARNING); } catch (\danog\MadelineProto\RPCErrorException $e) { $this->logger->logger($e->getMessage(), \danog\MadelineProto\Logger::WARNING); } }); } } public function peer_isset($id) { try { return isset($this->chats[$this->get_info($id)['bot_api_id']]); } catch (\danog\MadelineProto\Exception $e) { return false; } catch (\danog\MadelineProto\RPCErrorException $e) { if ($e->rpc === 'CHAT_FORBIDDEN') { return true; } if ($e->rpc === 'CHANNEL_PRIVATE') { return true; } return false; } } public function entities_peer_isset($entities) { try { foreach ($entities as $entity) { if ($entity['_'] === 'messageEntityMentionName' || $entity['_'] === 'inputMessageEntityMentionName') { if (!$this->peer_isset($entity['user_id'])) { return false; } } } } catch (\danog\MadelineProto\Exception $e) { return false; } return true; } public function fwd_peer_isset($fwd) { try { if (isset($fwd['user_id']) && !$this->peer_isset($fwd['user_id'])) { return false; } if (isset($fwd['channel_id']) && !$this->peer_isset($this->to_supergroup($fwd['channel_id']))) { return false; } } catch (\danog\MadelineProto\Exception $e) { return false; } return true; } public function get_info($id, $recursive = true) { if (is_array($id)) { switch ($id['_']) { case 'updateDialogPinned': case 'updateDialogUnreadMark': case 'updateNotifySettings': $id = $id['peer']; case 'updateDraftMessage': case 'inputDialogPeer': case 'dialogPeer': case 'inputNotifyPeer': case 'notifyPeer': case 'dialog': case 'help.proxyDataPromo': return $this->get_info($id['peer']); case 'inputUserSelf': case 'inputPeerSelf': $id = $this->authorization['user']['id']; break; case 'user': $id = $id['id']; break; case 'userFull': $id = $id['user']['id']; break; case 'inputPeerUser': case 'inputUser': case 'peerUser': $id = $id['user_id']; break; case 'chat': case 'chatFull': $id = -$id['id']; break; case 'inputPeerChat': case 'peerChat': $id = -$id['chat_id']; break; case 'channel': case 'channelFull': $id = $this->to_supergroup($id['id']); break; case 'inputPeerChannel': case 'inputChannel': case 'peerChannel': $id = $this->to_supergroup($id['channel_id']); break; case 'message': case 'messageService': if (!isset($id['from_id']) || $id['to_id']['_'] !== 'peerUser' || $id['to_id']['user_id'] !== $this->authorization['user']['id']) { return $this->get_info($id['to_id']); } $id = $id['from_id']; break; case 'encryptedMessage': case 'encryptedMessageService': $id = $id['chat_id']; if (!isset($this->secret_chats[$id])) { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['sec_peer_not_in_db']); } return $this->secret_chats[$id]; case 'updateChannelReadMessagesContents': case 'updateChannelAvailableMessages': case 'updateChannel': case 'updateChannelWebPage': case 'updateChannelMessageViews': case 'updateChannelTooLong': case 'updateReadChannelInbox': case 'updateReadChannelOutbox': case 'updateDeleteChannelMessages': case 'updateChannelPinnedMessage': return $this->get_info($this->to_supergroup($id['channel_id'])); case 'updateChatParticipants': $id = $id['participants']; case 'updateChatUserTyping': case 'updateChatParticipantAdd': case 'updateChatParticipantDelete': case 'updateChatParticipantAdmin': case 'updateChatAdmins': return $this->get_info(-$id['chat_id']); case 'updateUserTyping': case 'updateUserStatus': case 'updateUserName': case 'updateUserPhoto': case 'updateUserPhone': case 'updateUserBlocked': case 'updateContactRegistered': case 'updateContactLink': case 'updateBotInlineQuery': case 'updateInlineBotCallbackQuery': case 'updateBotInlineSend': case 'updateBotCallbackQuery': case 'updateBotPrecheckoutQuery': case 'updateBotShippingQuery': return $this->get_info($id['user_id']); case 'updatePhoneCall': return $this->get_info($id->getOtherID()); case 'updateReadHistoryInbox': case 'updateReadHistoryOutbox': return $this->get_info($id['peer']); case 'updateNewMessage': case 'updateNewChannelMessage': case 'updateEditMessage': case 'updateEditChannelMessage': case 'updateNewEncryptedMessage': return $this->get_info($id['message']); case 'updateEncryption': return $this->get_secret_chat($id['chat']['id']); case 'updateEncryptedChatTyping': case 'updateEncryptedMessagesRead': return $this->get_secret_chat($id['chat_id']); case 'chatForbidden': case 'channelForbidden': throw new \danog\MadelineProto\RPCErrorException('CHAT_FORBIDDEN'); default: throw new \danog\MadelineProto\Exception('Invalid constructor given '.var_export($id, true)); break; } } if (is_string($id) && strpos($id, '#') !== false) { if (preg_match('/^channel#(\d*)/', $id, $matches)) { $id = $this->to_supergroup($matches[1]); } if (preg_match('/^chat#(\d*)/', $id, $matches)) { $id = '-'.$matches[1]; } if (preg_match('/^user#(\d*)/', $id, $matches)) { $id = $matches[1]; } } if (is_numeric($id)) { if (is_string($id)) { $id = \danog\MadelineProto\Magic::$bigint ? (float) $id : (int) $id; } if (!isset($this->chats[$id])) { try { if ($id < 0) { if ($this->is_supergroup($id)) { $this->method_call('channels.getChannels', ['id' => [['access_hash' => 0, 'channel_id' => $this->from_supergroup($id), '_' => 'inputChannel']]], ['datacenter' => $this->datacenter->curdc]); } else { $this->method_call('messages.getFullChat', ['chat_id' => -$id], ['datacenter' => $this->datacenter->curdc]); } } else { $this->method_call('users.getUsers', ['id' => [['access_hash' => 0, 'user_id' => $id, '_' => 'inputUser']]], ['datacenter' => $this->datacenter->curdc]); } } catch (\danog\MadelineProto\Exception $e) { $this->logger->logger($e->getMessage(), \danog\MadelineProto\Logger::WARNING); } catch (\danog\MadelineProto\RPCErrorException $e) { $this->logger->logger($e->getMessage(), \danog\MadelineProto\Logger::WARNING); } } if (isset($this->chats[$id])) { try { return $this->gen_all($this->chats[$id]); } catch (\danog\MadelineProto\Exception $e) { if ($e->getMessage() === 'This peer is not present in the internal peer database') { unset($this->chats[$id]); } else { throw $e; } } } if (!isset($this->settings['pwr']['requests']) || $this->settings['pwr']['requests'] === true && $recursive) { $dbres = json_decode(@file_get_contents('https://id.pwrtelegram.xyz/db/getusername?id='.$id, false, stream_context_create(['http' => ['timeout' => 2]])), true); if (isset($dbres['ok']) && $dbres['ok']) { $this->resolve_username('@'.$dbres['result']); return $this->get_info($id, false); } } throw new \danog\MadelineProto\Exception('This peer is not present in the internal peer database'); } if (preg_match('@(?:t|telegram)\.(?:me|dog)/(joinchat/)?([a-z0-9_-]*)@i', $id, $matches)) { if ($matches[1] === '') { $id = $matches[2]; } else { $invite = $this->method_call('messages.checkChatInvite', ['hash' => $matches[2]], ['datacenter' => $this->datacenter->curdc]); if (isset($invite['chat'])) { return $this->get_info($invite['chat']); } else { throw new \danog\MadelineProto\Exception('You have not joined this chat'); } } } $id = strtolower(str_replace('@', '', $id)); if ($id === 'me') { return $this->get_info($this->authorization['user']['id']); } if ($id === 'support') { if (!$this->supportUser) { $this->method_call('help.getSupport', [], ['datacenter' => $this->settings['connection_settings']['default_dc']]); } return $this->get_info($this->supportUser); } foreach ($this->chats as $chat) { if (isset($chat['username']) && strtolower($chat['username']) === $id) { return $this->gen_all($chat); } } if ($recursive) { $this->resolve_username($id); return $this->get_info($id, false); } throw new \danog\MadelineProto\Exception('This peer is not present in the internal peer database'); } public function gen_all($constructor) { $res = [$this->constructors->find_by_predicate($constructor['_'])['type'] => $constructor]; switch ($constructor['_']) { case 'user': if ($constructor['self']) { $res['InputPeer'] = ['_' => 'inputPeerSelf']; $res['InputUser'] = ['_' => 'inputUserSelf']; } elseif (isset($constructor['access_hash'])) { $res['InputPeer'] = ['_' => 'inputPeerUser', 'user_id' => $constructor['id'], 'access_hash' => $constructor['access_hash']]; $res['InputUser'] = ['_' => 'inputUser', 'user_id' => $constructor['id'], 'access_hash' => $constructor['access_hash']]; } else { throw new \danog\MadelineProto\Exception('This peer is not present in the internal peer database'); } $res['Peer'] = ['_' => 'peerUser', 'user_id' => $constructor['id']]; $res['DialogPeer'] = ['_' => 'dialogPeer', 'peer' => $res['Peer']]; $res['NotifyPeer'] = ['_' => 'notifyPeer', 'peer' => $res['Peer']]; $res['InputDialogPeer'] = ['_' => 'inputDialogPeer', 'peer' => $res['InputPeer']]; $res['InputNotifyPeer'] = ['_' => 'inputNotifyPeer', 'peer' => $res['InputPeer']]; $res['user_id'] = $constructor['id']; $res['bot_api_id'] = $constructor['id']; $res['type'] = $constructor['bot'] ? 'bot' : 'user'; break; case 'chat': case 'chatForbidden': $res['InputPeer'] = ['_' => 'inputPeerChat', 'chat_id' => $constructor['id']]; $res['Peer'] = ['_' => 'peerChat', 'chat_id' => $constructor['id']]; $res['DialogPeer'] = ['_' => 'dialogPeer', 'peer' => $res['Peer']]; $res['NotifyPeer'] = ['_' => 'notifyPeer', 'peer' => $res['Peer']]; $res['InputDialogPeer'] = ['_' => 'inputDialogPeer', 'peer' => $res['InputPeer']]; $res['InputNotifyPeer'] = ['_' => 'inputNotifyPeer', 'peer' => $res['InputPeer']]; $res['chat_id'] = $constructor['id']; $res['bot_api_id'] = -$constructor['id']; $res['type'] = 'chat'; break; case 'channel': if (!isset($constructor['access_hash'])) { throw new \danog\MadelineProto\Exception('This peer is not present in the internal peer database'); } $res['InputPeer'] = ['_' => 'inputPeerChannel', 'channel_id' => $constructor['id'], 'access_hash' => $constructor['access_hash']]; $res['Peer'] = ['_' => 'peerChannel', 'channel_id' => $constructor['id']]; $res['DialogPeer'] = ['_' => 'dialogPeer', 'peer' => $res['Peer']]; $res['NotifyPeer'] = ['_' => 'notifyPeer', 'peer' => $res['Peer']]; $res['InputDialogPeer'] = ['_' => 'inputDialogPeer', 'peer' => $res['InputPeer']]; $res['InputNotifyPeer'] = ['_' => 'inputNotifyPeer', 'peer' => $res['InputPeer']]; $res['InputChannel'] = ['_' => 'inputChannel', 'channel_id' => $constructor['id'], 'access_hash' => $constructor['access_hash']]; $res['channel_id'] = $constructor['id']; $res['bot_api_id'] = $this->to_supergroup($constructor['id']); $res['type'] = $constructor['megagroup'] ? 'supergroup' : 'channel'; break; case 'channelForbidden': throw new \danog\MadelineProto\RPCErrorException('CHAT_FORBIDDEN'); default: throw new \danog\MadelineProto\Exception('Invalid constructor given '.var_export($constructor, true)); } return $res; } public function full_chat_last_updated($id) { return isset($this->full_chats[$id]['last_update']) ? $this->full_chats[$id]['last_update'] : 0; } public function get_full_info($id) { $partial = $this->get_info($id); if (time() - $this->full_chat_last_updated($partial['bot_api_id']) < (isset($this->settings['peer']['full_info_cache_time']) ? $this->settings['peer']['full_info_cache_time'] : 0)) { return array_merge($partial, $this->full_chats[$partial['bot_api_id']]); } switch ($partial['type']) { case 'user': case 'bot': $full = $this->method_call('users.getFullUser', ['id' => $partial['InputUser']], ['datacenter' => $this->datacenter->curdc]); break; case 'chat': $full = $this->method_call('messages.getFullChat', $partial, ['datacenter' => $this->datacenter->curdc])['full_chat']; break; case 'channel': case 'supergroup': $full = $this->method_call('channels.getFullChannel', ['channel' => $partial['InputChannel']], ['datacenter' => $this->datacenter->curdc])['full_chat']; break; } $res = []; $res['full'] = $full; $res['last_update'] = time(); $this->full_chats[$partial['bot_api_id']] = $res; $partial = $this->get_info($id); return array_merge($partial, $res); } public function get_pwr_chat($id, $fullfetch = true, $send = true) { $full = $fullfetch ? $this->get_full_info($id) : $this->get_info($id); $res = ['id' => $full['bot_api_id'], 'type' => $full['type']]; switch ($full['type']) { case 'user': case 'bot': foreach (['first_name', 'last_name', 'username', 'verified', 'restricted', 'restriction_reason', 'status', 'bot_inline_placeholder', 'access_hash', 'phone', 'lang_code', 'bot_nochats'] as $key) { if (isset($full['User'][$key])) { $res[$key] = $full['User'][$key]; } } foreach (['about', 'bot_info', 'phone_calls_available', 'phone_calls_private', 'common_chats_count', 'can_pin_message', 'pinned_msg_id', 'notify_settings'] as $key) { if (isset($full['full'][$key])) { $res[$key] = $full['full'][$key]; } } if (isset($full['full']['profile_photo']['sizes'])) { $res['photo'] = $this->photosize_to_botapi(end($full['full']['profile_photo']['sizes']), $full['full']['profile_photo']); } /*$bio = ''; if ($full['type'] === 'user' && isset($res['username']) && !isset($res['about']) && $fullfetch) { if (preg_match('/meta property="og:description" content=".+/', file_get_contents('https://telegram.me/'.$res['username']), $biores)) { $bio = html_entity_decode(preg_replace_callback('/(&#[0-9]+;)/', function ($m) { return mb_convert_encoding($m[1], 'UTF-8', 'HTML-ENTITIES'); }, str_replace(['meta property="og:description" content="', '">'], '', $biores[0]))); } if ($bio != '' && $bio != 'You can contact @'.$res['username'].' right away.') { $res['about'] = $bio; } }*/ break; case 'chat': foreach (['title', 'participants_count', 'admin', 'admins_enabled'] as $key) { if (isset($full['Chat'][$key])) { $res[$key] = $full['Chat'][$key]; } } foreach (['bot_info', 'pinned_msg_id', 'notify_settings'] as $key) { if (isset($full['full'][$key])) { $res[$key] = $full['full'][$key]; } } if (isset($res['admins_enabled'])) { $res['all_members_are_administrators'] = !$res['admins_enabled']; } if (isset($full['full']['chat_photo']['sizes'])) { $res['photo'] = $this->photosize_to_botapi(end($full['full']['chat_photo']['sizes']), $full['full']['chat_photo']); } if (isset($full['full']['exported_invite']['link'])) { $res['invite'] = $full['full']['exported_invite']['link']; } if (isset($full['full']['participants']['participants'])) { $res['participants'] = $full['full']['participants']['participants']; } break; case 'channel': case 'supergroup': foreach (['title', 'democracy', 'restricted', 'restriction_reason', 'access_hash', 'username', 'signatures'] as $key) { if (isset($full['Chat'][$key])) { $res[$key] = $full['Chat'][$key]; } } foreach (['read_inbox_max_id', 'read_outbox_max_id', 'hidden_prehistory', 'bot_info', 'notify_settings', 'can_set_stickers', 'stickerset', 'can_view_participants', 'can_set_username', 'participants_count', 'admins_count', 'kicked_count', 'banned_count', 'migrated_from_chat_id', 'migrated_from_max_id', 'pinned_msg_id', 'about', 'hidden_prehistory', 'available_min_id', 'can_view_stats', 'online_count'] as $key) { if (isset($full['full'][$key])) { $res[$key] = $full['full'][$key]; } } if (isset($full['full']['chat_photo']['sizes'])) { $res['photo'] = $this->photosize_to_botapi(end($full['full']['chat_photo']['sizes']), $full['full']['chat_photo']); } if (isset($full['full']['exported_invite']['link'])) { $res['invite'] = $full['full']['exported_invite']['link']; } if (isset($full['full']['participants']['participants'])) { $res['participants'] = $full['full']['participants']['participants']; } break; } if (isset($res['participants']) && $fullfetch) { foreach ($res['participants'] as $key => $participant) { $newres = []; $newres['user'] = $this->get_pwr_chat($participant['user_id'], false, true); if (isset($participant['inviter_id'])) { $newres['inviter'] = $this->get_pwr_chat($participant['inviter_id'], false, true); } if (isset($participant['promoted_by'])) { $newres['promoted_by'] = $this->get_pwr_chat($participant['promoted_by'], false, true); } if (isset($participant['kicked_by'])) { $newres['kicked_by'] = $this->get_pwr_chat($participant['kicked_by'], false, true); } if (isset($participant['date'])) { $newres['date'] = $participant['date']; } if (isset($participant['admin_rights'])) { $newres['admin_rights'] = $participant['admin_rights']; } if (isset($participant['banned_rights'])) { $newres['banned_rights'] = $participant['banned_rights']; } if (isset($participant['can_edit'])) { $newres['can_edit'] = $participant['can_edit']; } if (isset($participant['left'])) { $newres['left'] = $participant['left']; } switch ($participant['_']) { case 'chatParticipant': $newres['role'] = 'user'; break; case 'chatParticipantAdmin': $newres['role'] = 'admin'; break; case 'chatParticipantCreator': $newres['role'] = 'creator'; break; } $res['participants'][$key] = $newres; } } if (!isset($res['participants']) && $fullfetch && in_array($res['type'], ['supergroup', 'channel'])) { $total_count = (isset($res['participants_count']) ? $res['participants_count'] : 0) + (isset($res['admins_count']) ? $res['admins_count'] : 0) + (isset($res['kicked_count']) ? $res['kicked_count'] : 0) + (isset($res['banned_count']) ? $res['banned_count'] : 0); $res['participants'] = []; $limit = 200; $filters = ['channelParticipantsAdmins', 'channelParticipantsBots']; foreach ($filters as $filter) { $this->fetch_participants($full['InputChannel'], $filter, '', $total_count, $res); } $q = ''; $filters = ['channelParticipantsSearch', 'channelParticipantsKicked', 'channelParticipantsBanned']; foreach ($filters as $filter) { $this->recurse_alphabet_search_participants($full['InputChannel'], $filter, $q, $total_count, $res); } $this->logger->logger('Fetched '.count($res['participants'])." out of $total_count"); $res['participants'] = array_values($res['participants']); } if (!$fullfetch) { unset($res['participants']); } if ($fullfetch || $send) { $this->store_db($res); } return $res; } public function recurse_alphabet_search_participants($channel, $filter, $q, $total_count, &$res) { if (!$this->fetch_participants($channel, $filter, $q, $total_count, $res)) { return false; } for ($x = 'a'; $x !== 'aa' && $total_count > count($res['participants']); $x++) { $this->recurse_alphabet_search_participants($channel, $filter, $q.$x, $total_count, $res); } } public function fetch_participants($channel, $filter, $q, $total_count, &$res) { $offset = 0; $limit = 200; $has_more = false; $cached = false; $last_count = -1; do { try { $gres = $this->method_call('channels.getParticipants', ['channel' => $channel, 'filter' => ['_' => $filter, 'q' => $q], 'offset' => $offset, 'limit' => $limit, 'hash' => $hash = $this->get_participants_hash($channel, $filter, $q, $offset, $limit)], ['datacenter' => $this->datacenter->curdc, 'heavy' => true]); } catch (\danog\MadelineProto\RPCErrorException $e) { if ($e->rpc === 'CHAT_ADMIN_REQUIRED') { return $has_more; } else { throw $e; } } if ($cached = $gres['_'] === 'channels.channelParticipantsNotModified') { $gres = $this->fetch_participants_cache($channel, $filter, $q, $offset, $limit); } else { $this->store_participants_cache($gres, $channel, $filter, $q, $offset, $limit); } if ($last_count !== -1 && $last_count !== $gres['count']) { $has_more = true; } else { $last_count = $gres['count']; } foreach ($gres['participants'] as $participant) { $newres = []; $newres['user'] = $this->get_pwr_chat($participant['user_id'], false, true); if (isset($participant['inviter_id'])) { $newres['inviter'] = $this->get_pwr_chat($participant['inviter_id'], false, true); } if (isset($participant['kicked_by'])) { $newres['kicked_by'] = $this->get_pwr_chat($participant['kicked_by'], false, true); } if (isset($participant['promoted_by'])) { $newres['promoted_by'] = $this->get_pwr_chat($participant['promoted_by'], false, true); } if (isset($participant['date'])) { $newres['date'] = $participant['date']; } switch ($participant['_']) { case 'channelParticipantSelf': $newres['role'] = 'user'; if (isset($newres['admin_rights'])) { $newres['admin_rights'] = $full['Chat']['admin_rights']; } if (isset($newres['banned_rights'])) { $newres['banned_rights'] = $full['Chat']['banned_rights']; } break; case 'channelParticipant': $newres['role'] = 'user'; break; case 'channelParticipantCreator': $newres['role'] = 'creator'; break; case 'channelParticipantAdmin': $newres['role'] = 'admin'; break; case 'channelParticipantBanned': $newres['role'] = 'banned'; break; } $res['participants'][$participant['user_id']] = $newres; } $this->logger->logger('Fetched '.count($gres['participants'])." channel participants with filter $filter, query $q, offset $offset, limit $limit, hash $hash: ".($cached ? 'cached' : 'not cached').', '.($offset + count($gres['participants'])).' participants out of '.$gres['count'].', in total fetched '.count($res['participants']).' out of '.$total_count); $offset += count($gres['participants']); } while (count($gres['participants'])); return $has_more; } public function fetch_participants_cache($channel, $filter, $q, $offset, $limit) { return $this->channel_participants[$channel['channel_id']][$filter][$q][$offset][$limit]; } public function store_participants_cache($gres, $channel, $filter, $q, $offset, $limit) { //return; unset($gres['users']); $ids = []; foreach ($gres['participants'] as $participant) { $ids[] = $participant['user_id']; } sort($ids, SORT_NUMERIC); $gres['hash'] = $this->gen_vector_hash($ids); $this->channel_participants[$channel['channel_id']][$filter][$q][$offset][$limit] = $gres; } public function get_participants_hash($channel, $filter, $q, $offset, $limit) { return isset($this->channel_participants[$channel['channel_id']][$filter][$q][$offset][$limit]) ? $this->channel_participants[$channel['channel_id']][$filter][$q][$offset][$limit]['hash'] : 0; } public function store_db($res, $force = false) { $settings = isset($this->settings['connection_settings'][$this->datacenter->curdc]) ? $this->settings['connection_settings'][$this->datacenter->curdc] : $this->settings['connection_settings']['all']; if (!isset($this->settings['pwr']) || $this->settings['pwr']['pwr'] === false || $settings['test_mode']) { /* try { if (isset($res['username'])) { shell_exec('curl '.escapeshellarg('https://api.pwrtelegram.xyz/getchat?chat_id=@'.$res['username']).' -s -o /dev/null >/dev/null 2>/dev/null & '); } } catch (\danog\MadelineProto\Exception $e) { $this->logger->logger([$e->getMessage()); } */ return; } if (!empty($res)) { if (isset($res['participants'])) { unset($res['participants']); } $this->qres[] = $res; } if ($this->last_stored > time() && !$force) { //$this->logger->logger("========== WILL SERIALIZE IN ".($this->last_stored - time())." ============="); return false; } if (empty($this->qres)) { return false; } try { $payload = json_encode($this->qres); //$path = '/tmp/ids'.hash('sha256', $payload); //file_put_contents($path, $payload); $id = isset($this->authorization['user']['username']) ? $this->authorization['user']['username'] : $this->authorization['user']['id']; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, 'https://id.pwrtelegram.xyz/db'.$this->settings['pwr']['db_token'].'/addnewmadeline?d=pls&from='.$id); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $result = curl_exec($ch); curl_close($ch); //$result = shell_exec('curl '.escapeshellarg('https://id.pwrtelegram.xyz/db'.$this->settings['pwr']['db_token'].'/addnewmadeline?d=pls&from='.$id).' -d '.escapeshellarg('@'.$path).' -s >/dev/null 2>/dev/null & '); $this->logger->logger("============ $result =============", \danog\MadelineProto\Logger::VERBOSE); $this->qres = []; $this->last_stored = time() + 10; } catch (\danog\MadelineProto\Exception $e) { if (file_exists($path)) { unlink($path); } $this->logger->logger('======= COULD NOT STORE IN DB DUE TO '.$e->getMessage().' =============', \danog\MadelineProto\Logger::VERBOSE); } } public function resolve_username($username) { try { $res = $this->method_call('contacts.resolveUsername', ['username' => str_replace('@', '', $username)], ['datacenter' => $this->datacenter->curdc]); } catch (\danog\MadelineProto\RPCErrorException $e) { $this->logger->logger('Username resolution failed with error '.$e->getMessage(), \danog\MadelineProto\Logger::ERROR); if (strpos($e->rpc, 'FLOOD_WAIT_') === 0 || $e->rpc === 'AUTH_KEY_UNREGISTERED' || $e->rpc === 'USERNAME_INVALID') { throw $e; } return false; } if ($res['_'] === 'contacts.resolvedPeer') { return $res; } return false; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\MTProtoTools; /** * Manages the creation of the authorization key. * * https://core.telegram.org/mtproto/auth_key * https://core.telegram.org/mtproto/samples-auth_key */ trait AuthKeyHandler { private $init_auth_dcs = []; private $pending_auth = false; public function create_auth_key_async($expires_in, $datacenter): \Generator { $req_pq = strpos($datacenter, 'cdn') ? 'req_pq' : 'req_pq_multi'; for ($retry_id_total = 1; $retry_id_total <= $this->settings['max_tries']['authorization']; $retry_id_total++) { try { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['req_pq'], \danog\MadelineProto\Logger::VERBOSE); /** * *********************************************************************** * Make pq request, DH exchange initiation. * * @method req_pq * * @param [ * int128 $nonce : The value of nonce is selected randomly by the client (random number) and identifies the client within this communication * ] * * @return ResPQ [ * int128 $nonce : The value of nonce is selected randomly by the server * int128 $server_nonce : The value of server_nonce is selected randomly by the server * string $pq : This is a representation of a natural number (in binary big endian format). This number is the product of two different odd prime numbers * Vector long $server_public_key_fingerprints : This is a list of public RSA key fingerprints * ] */ $nonce = $this->random(16); $ResPQ = yield $this->method_call_async_read($req_pq, ['nonce' => $nonce], ['datacenter' => $datacenter]); /* * *********************************************************************** * Check if the client's nonce and the server's nonce are the same */ if ($ResPQ['nonce'] !== $nonce) { throw new \danog\MadelineProto\SecurityException('wrong nonce'); } /* * *********************************************************************** * Find our key in the server_public_key_fingerprints vector */ foreach ($this->rsa_keys as $curkey) { if (in_array($curkey->fp, $ResPQ['server_public_key_fingerprints'])) { $key = $curkey; } } if (!isset($key)) { throw new \danog\MadelineProto\SecurityException("Couldn't find any of our keys in the server_public_key_fingerprints vector."); } $pq_bytes = $ResPQ['pq']; $server_nonce = $ResPQ['server_nonce']; /* * *********************************************************************** * Compute p and q */ $pq = new \phpseclib\Math\BigInteger($pq_bytes, 256); $q = new \phpseclib\Math\BigInteger(0); $p = new \phpseclib\Math\BigInteger(\danog\PrimeModule::auto_single($pq->__toString())); if (!$p->equals(\danog\MadelineProto\Magic::$zero)) { $q = $pq->divide($p)[0]; if ($p->compare($q) > 0) { list($p, $q) = [$q, $p]; } } if (!$pq->equals($p->multiply($q))) { $this->logger->logger('Automatic factorization failed, trying native CPP module', \danog\MadelineProto\Logger::ERROR); $p = new \phpseclib\Math\BigInteger(\danog\PrimeModule::native_single_cpp($pq->__toString())); if (!$p->equals(\danog\MadelineProto\Magic::$zero)) { $q = $pq->divide($p)[0]; if ($p->compare($q) > 0) { list($p, $q) = [$q, $p]; } } if (!$pq->equals($p->multiply($q))) { $this->logger->logger('Automatic factorization failed, trying alt py module', \danog\MadelineProto\Logger::ERROR); $p = new \phpseclib\Math\BigInteger(\danog\PrimeModule::python_single_alt($pq->__toString())); if (!$p->equals(\danog\MadelineProto\Magic::$zero)) { $q = $pq->divide($p)[0]; if ($p->compare($q) > 0) { list($p, $q) = [$q, $p]; } } if (!$pq->equals($p->multiply($q))) { $this->logger->logger('Automatic factorization failed, trying py module', \danog\MadelineProto\Logger::ERROR); $p = new \phpseclib\Math\BigInteger(\danog\PrimeModule::python_single($pq->__toString())); if (!$p->equals(\danog\MadelineProto\Magic::$zero)) { $q = $pq->divide($p)[0]; if ($p->compare($q) > 0) { list($p, $q) = [$q, $p]; } } if (!$pq->equals($p->multiply($q))) { $this->logger->logger('Automatic factorization failed, trying native module', \danog\MadelineProto\Logger::ERROR); $p = new \phpseclib\Math\BigInteger(\danog\PrimeModule::native_single($pq->__toString())); if (!$p->equals(\danog\MadelineProto\Magic::$zero)) { $q = $pq->divide($p)[0]; if ($p->compare($q) > 0) { list($p, $q) = [$q, $p]; } } if (!$pq->equals($p->multiply($q))) { $this->logger->logger('Automatic factorization failed, trying wolfram module', \danog\MadelineProto\Logger::ERROR); if (!extension_loaded('curl')) { throw new Exception(['extension', 'curl']); } $p = new \phpseclib\Math\BigInteger(\danog\PrimeModule::wolfram_single($pq->__toString())); if (!$p->equals(\danog\MadelineProto\Magic::$zero)) { $q = $pq->divide($p)[0]; if ($p->compare($q) > 0) { list($p, $q) = [$q, $p]; } } if (!$pq->equals($p->multiply($q))) { throw new \danog\MadelineProto\SecurityException("Couldn't compute p and q, install prime.madelineproto.xyz to fix. Original pq: {$pq}, computed p: {$p}, computed q: {$q}, computed pq: ".$p->multiply($q)); } } } } } } $this->logger->logger('Factorization '.$pq.' = '.$p.' * '.$q, \danog\MadelineProto\Logger::VERBOSE); /* * *********************************************************************** * Serialize object for req_DH_params */ $p_bytes = $p->toBytes(); $q_bytes = $q->toBytes(); $new_nonce = $this->random(32); $data_unserialized = ['pq' => $pq_bytes, 'p' => $p_bytes, 'q' => $q_bytes, 'nonce' => $nonce, 'server_nonce' => $server_nonce, 'new_nonce' => $new_nonce, 'expires_in' => $expires_in, 'dc' => preg_replace('|_.*|', '', $datacenter)]; $p_q_inner_data = $this->serialize_object(['type' => 'p_q_inner_data'.($expires_in < 0 ? '' : '_temp')], $data_unserialized, 'p_q_inner_data'); /* * *********************************************************************** * Encrypt serialized object */ $sha_digest = sha1($p_q_inner_data, true); $random_bytes = $this->random(255 - strlen($p_q_inner_data) - strlen($sha_digest)); $to_encrypt = $sha_digest.$p_q_inner_data.$random_bytes; $encrypted_data = $key->encrypt($to_encrypt); $this->logger->logger('Starting Diffie Hellman key exchange', \danog\MadelineProto\Logger::VERBOSE); /* * *********************************************************************** * Starting Diffie Hellman key exchange, Server authentication * @method req_DH_params * @param [ * int128 $nonce : The value of nonce is selected randomly by the client (random number) and identifies the client within this communication * int128 $server_nonce : The value of server_nonce is selected randomly by the server * string $p : The value of BigInteger * string $q : The value of BigInteger * long $public_key_fingerprint : This is our key in the server_public_key_fingerprints vector * string $encrypted_data * ] * @return Server_DH_Params [ * int128 $nonce : The value of nonce is selected randomly by the server * int128 $server_nonce : The value of server_nonce is selected randomly by the server * string $new_nonce_hash : Return this value if server responds with server_DH_params_fail * string $encrypted_answer : Return this value if server responds with server_DH_params_ok * ] */ // $server_dh_params = yield $this->method_call_async_read('req_DH_params', ['nonce' => $nonce, 'server_nonce' => $server_nonce, 'p' => $p_bytes, 'q' => $q_bytes, 'public_key_fingerprint' => $key->fp, 'encrypted_data' => $encrypted_data], ['datacenter' => $datacenter]); /* * *********************************************************************** * Check if the client's nonce and the server's nonce are the same */ if ($nonce != $server_dh_params['nonce']) { throw new \danog\MadelineProto\SecurityException('wrong nonce.'); } /* * *********************************************************************** * Check if server_nonce and new server_nonce are the same */ if ($server_nonce != $server_dh_params['server_nonce']) { throw new \danog\MadelineProto\SecurityException('wrong server nonce.'); } /* * *********************************************************************** * Check valid new nonce hash if return from server * new nonce hash return in server_DH_params_fail */ if (isset($server_dh_params['new_nonce_hash']) && substr(sha1($new_nonce), -32) != $server_dh_params['new_nonce_hash']) { throw new \danog\MadelineProto\SecurityException('wrong new nonce hash.'); } /* * *********************************************************************** * Get key, iv and decrypt answer */ $encrypted_answer = $server_dh_params['encrypted_answer']; $tmp_aes_key = sha1($new_nonce.$server_nonce, true).substr(sha1($server_nonce.$new_nonce, true), 0, 12); $tmp_aes_iv = substr(sha1($server_nonce.$new_nonce, true), 12, 8).sha1($new_nonce.$new_nonce, true).substr($new_nonce, 0, 4); $answer_with_hash = $this->ige_decrypt($encrypted_answer, $tmp_aes_key, $tmp_aes_iv); /* * *********************************************************************** * Separate answer and hash */ $answer_hash = substr($answer_with_hash, 0, 20); $answer = substr($answer_with_hash, 20); /* * *********************************************************************** * Deserialize answer * @return Server_DH_inner_data [ * int128 $nonce : The value of nonce is selected randomly by the client (random number) and identifies the client within this communication * int128 $server_nonce : The value of server_nonce is selected randomly by the server * int $g * string $dh_prime * string $g_a * int $server_time * ] */ $server_DH_inner_data = $this->deserialize($answer, ['type' => '']); /* * *********************************************************************** * Do some checks */ $server_DH_inner_data_length = $this->get_length($answer); if (sha1(substr($answer, 0, $server_DH_inner_data_length), true) != $answer_hash) { throw new \danog\MadelineProto\SecurityException('answer_hash mismatch.'); } if ($nonce != $server_DH_inner_data['nonce']) { throw new \danog\MadelineProto\SecurityException('wrong nonce'); } if ($server_nonce != $server_DH_inner_data['server_nonce']) { throw new \danog\MadelineProto\SecurityException('wrong server nonce'); } $g = new \phpseclib\Math\BigInteger($server_DH_inner_data['g']); $g_a = new \phpseclib\Math\BigInteger($server_DH_inner_data['g_a'], 256); $dh_prime = new \phpseclib\Math\BigInteger($server_DH_inner_data['dh_prime'], 256); /* * *********************************************************************** * Time delta */ $server_time = $server_DH_inner_data['server_time']; $this->datacenter->sockets[$datacenter]->time_delta = $server_time - time(); $this->logger->logger(sprintf('Server-client time delta = %.1f s', $this->datacenter->sockets[$datacenter]->time_delta), \danog\MadelineProto\Logger::VERBOSE); $this->check_p_g($dh_prime, $g); $this->check_G($g_a, $dh_prime); for ($retry_id = 0; $retry_id <= $this->settings['max_tries']['authorization']; $retry_id++) { $this->logger->logger('Generating b...', \danog\MadelineProto\Logger::VERBOSE); $b = new \phpseclib\Math\BigInteger($this->random(256), 256); $this->logger->logger('Generating g_b...', \danog\MadelineProto\Logger::VERBOSE); $g_b = $g->powMod($b, $dh_prime); $this->check_G($g_b, $dh_prime); /* * *********************************************************************** * Check validity of g_b * 1 < g_b < dh_prime - 1 */ $this->logger->logger('Executing g_b check...', \danog\MadelineProto\Logger::VERBOSE); if ($g_b->compare(\danog\MadelineProto\Magic::$one) <= 0 || $g_b->compare($dh_prime->subtract(\danog\MadelineProto\Magic::$one)) >= 0) { throw new \danog\MadelineProto\SecurityException('g_b is invalid (1 < g_b < dh_prime - 1 is false).'); } $this->logger->logger('Preparing client_DH_inner_data...', \danog\MadelineProto\Logger::VERBOSE); $g_b_str = $g_b->toBytes(); /* * *********************************************************************** * serialize client_DH_inner_data * @method client_DH_inner_data * @param Server_DH_inner_data [ * int128 $nonce : The value of nonce is selected randomly by the client (random number) and identifies the client within this communication * int128 $server_nonce : The value of server_nonce is selected randomly by the server * long $retry_id : First attempt * string $g_b : g^b mod dh_prime * ] */ $data = $this->serialize_object(['type' => 'client_DH_inner_data'], ['nonce' => $nonce, 'server_nonce' => $server_nonce, 'retry_id' => $retry_id, 'g_b' => $g_b_str], 'client_DH_inner_data'); /* * *********************************************************************** * encrypt client_DH_inner_data */ $data_with_sha = sha1($data, true).$data; $data_with_sha_padded = $data_with_sha.$this->random($this->posmod(-strlen($data_with_sha), 16)); $encrypted_data = $this->ige_encrypt($data_with_sha_padded, $tmp_aes_key, $tmp_aes_iv); $this->logger->logger('Executing set_client_DH_params...', \danog\MadelineProto\Logger::VERBOSE); /* * *********************************************************************** * Send set_client_DH_params query * @method set_client_DH_params * @param Server_DH_inner_data [ * int128 $nonce : The value of nonce is selected randomly by the client (random number) and identifies the client within this communication * int128 $server_nonce : The value of server_nonce is selected randomly by the server * string $encrypted_data * ] * @return Set_client_DH_params_answer [ * string $_ : This value is dh_gen_ok, dh_gen_retry OR dh_gen_fail * int128 $server_nonce : The value of server_nonce is selected randomly by the server * int128 $new_nonce_hash1 : Return this value if server responds with dh_gen_ok * int128 $new_nonce_hash2 : Return this value if server responds with dh_gen_retry * int128 $new_nonce_hash2 : Return this value if server responds with dh_gen_fail * ] */ $Set_client_DH_params_answer = yield $this->method_call_async_read('set_client_DH_params', ['nonce' => $nonce, 'server_nonce' => $server_nonce, 'encrypted_data' => $encrypted_data], ['datacenter' => $datacenter]); /* * *********************************************************************** * Generate auth_key */ $this->logger->logger('Generating authorization key...', \danog\MadelineProto\Logger::VERBOSE); $auth_key = $g_a->powMod($b, $dh_prime); $auth_key_str = $auth_key->toBytes(); $auth_key_sha = sha1($auth_key_str, true); $auth_key_aux_hash = substr($auth_key_sha, 0, 8); $new_nonce_hash1 = substr(sha1($new_nonce.chr(1).$auth_key_aux_hash, true), -16); $new_nonce_hash2 = substr(sha1($new_nonce.chr(2).$auth_key_aux_hash, true), -16); $new_nonce_hash3 = substr(sha1($new_nonce.chr(3).$auth_key_aux_hash, true), -16); /* * *********************************************************************** * Check if the client's nonce and the server's nonce are the same */ if ($Set_client_DH_params_answer['nonce'] != $nonce) { throw new \danog\MadelineProto\SecurityException('wrong nonce.'); } /* * *********************************************************************** * Check if server_nonce and new server_nonce are the same */ if ($Set_client_DH_params_answer['server_nonce'] != $server_nonce) { throw new \danog\MadelineProto\SecurityException('wrong server nonce'); } /* * *********************************************************************** * Check Set_client_DH_params_answer type */ switch ($Set_client_DH_params_answer['_']) { case 'dh_gen_ok': if ($Set_client_DH_params_answer['new_nonce_hash1'] != $new_nonce_hash1) { throw new \danog\MadelineProto\SecurityException('wrong new_nonce_hash1'); } $this->logger->logger('Diffie Hellman key exchange processed successfully!', \danog\MadelineProto\Logger::VERBOSE); $res_authorization['server_salt'] = substr($new_nonce, 0, 8 - 0) ^ substr($server_nonce, 0, 8 - 0); $res_authorization['auth_key'] = $auth_key_str; $res_authorization['id'] = substr($auth_key_sha, -8); $res_authorization['connection_inited'] = false; $this->logger->logger('Auth key generated', \danog\MadelineProto\Logger::NOTICE); return $res_authorization; case 'dh_gen_retry': if ($Set_client_DH_params_answer['new_nonce_hash2'] != $new_nonce_hash2) { throw new \danog\MadelineProto\SecurityException('wrong new_nonce_hash_2'); } //repeat foreach $this->logger->logger('Retrying Auth', \danog\MadelineProto\Logger::VERBOSE); break; case 'dh_gen_fail': if ($Set_client_DH_params_answer['new_nonce_hash3'] != $new_nonce_hash3) { throw new \danog\MadelineProto\SecurityException('wrong new_nonce_hash_3'); } $this->logger->logger('Auth Failed', \danog\MadelineProto\Logger::WARNING); break 2; default: throw new \danog\MadelineProto\SecurityException('Response Error'); break; } } } catch (\danog\MadelineProto\SecurityException $e) { $this->logger->logger('An exception occurred while generating the authorization key: '.$e->getMessage().' in '.basename($e->getFile(), '.php').' on line '.$e->getLine().'. Retrying...', \danog\MadelineProto\Logger::WARNING); } catch (\danog\MadelineProto\Exception $e) { $this->logger->logger('An exception occurred while generating the authorization key: '.$e->getMessage().' in '.basename($e->getFile(), '.php').' on line '.$e->getLine().'. Retrying...', \danog\MadelineProto\Logger::WARNING); $req_pq = $req_pq === 'req_pq_multi' ? 'req_pq' : 'req_pq_multi'; } catch (\danog\MadelineProto\RPCErrorException $e) { $this->logger->logger('An RPCErrorException occurred while generating the authorization key: '.$e->getMessage().' Retrying (try number '.$retry_id_total.')...', \danog\MadelineProto\Logger::WARNING); } } if (strpos($datacenter, 'cdn') === false) { throw new \danog\MadelineProto\SecurityException('Auth Failed'); } } public function check_G($g_a, $p) { /* * *********************************************************************** * Check validity of g_a * 1 < g_a < p - 1 */ $this->logger->logger('Executing g_a check (1/2)...', \danog\MadelineProto\Logger::VERBOSE); if ($g_a->compare(\danog\MadelineProto\Magic::$one) <= 0 || $g_a->compare($p->subtract(\danog\MadelineProto\Magic::$one)) >= 0) { throw new \danog\MadelineProto\SecurityException('g_a is invalid (1 < g_a < p - 1 is false).'); } $this->logger->logger('Executing g_a check (2/2)...', \danog\MadelineProto\Logger::VERBOSE); if ($g_a->compare(\danog\MadelineProto\Magic::$twoe1984) < 0 || $g_a->compare($p->subtract(\danog\MadelineProto\Magic::$twoe1984)) >= 0) { throw new \danog\MadelineProto\SecurityException('g_a is invalid (2^1984 < g_a < p - 2^1984 is false).'); } return true; } public function check_p_g($p, $g) { /* * *********************************************************************** * Check validity of dh_prime * Is it a prime? */ $this->logger->logger('Executing p/g checks (1/2)...', \danog\MadelineProto\Logger::VERBOSE); if (!$p->isPrime()) { throw new \danog\MadelineProto\SecurityException("p isn't a safe 2048-bit prime (p isn't a prime)."); } /* * *********************************************************************** * Check validity of p * Is (p - 1) / 2 a prime? * * Almost always fails */ /* $this->logger->logger('Executing p/g checks (2/3)...', \danog\MadelineProto\Logger::VERBOSE); if (!$p->subtract(\danog\MadelineProto\Magic::$one)->divide(\danog\MadelineProto\Magic::$two)[0]->isPrime()) { throw new \danog\MadelineProto\SecurityException("p isn't a safe 2048-bit prime ((p - 1) / 2 isn't a prime)."); } */ /* * *********************************************************************** * Check validity of p * 2^2047 < p < 2^2048 */ $this->logger->logger('Executing p/g checks (2/2)...', \danog\MadelineProto\Logger::VERBOSE); if ($p->compare(\danog\MadelineProto\Magic::$twoe2047) <= 0 || $p->compare(\danog\MadelineProto\Magic::$twoe2048) >= 0) { throw new \danog\MadelineProto\SecurityException("g isn't a safe 2048-bit prime (2^2047 < p < 2^2048 is false)."); } /* * *********************************************************************** * Check validity of g * 1 < g < p - 1 */ $this->logger->logger('Executing g check...', \danog\MadelineProto\Logger::VERBOSE); if ($g->compare(\danog\MadelineProto\Magic::$one) <= 0 || $g->compare($p->subtract(\danog\MadelineProto\Magic::$one)) >= 0) { throw new \danog\MadelineProto\SecurityException('g is invalid (1 < g < p - 1 is false).'); } return true; } public function get_dh_config() { $this->updates_state['sync_loading'] = true; try { $dh_config = $this->method_call('messages.getDhConfig', ['version' => $this->dh_config['version'], 'random_length' => 0], ['datacenter' => $this->datacenter->curdc]); } finally { $this->updates_state['sync_loading'] = false; } if ($dh_config['_'] === 'messages.dhConfigNotModified') { $this->logger->logger(\danog\MadelineProto\Logger::VERBOSE, ['DH configuration not modified']); return $this->dh_config; } $dh_config['p'] = new \phpseclib\Math\BigInteger($dh_config['p'], 256); $dh_config['g'] = new \phpseclib\Math\BigInteger($dh_config['g']); $this->check_p_g($dh_config['p'], $dh_config['g']); return $this->dh_config = $dh_config; } public function bind_temp_auth_key_async($expires_in, $datacenter) { for ($retry_id_total = 1; $retry_id_total <= $this->settings['max_tries']['authorization']; $retry_id_total++) { try { $this->logger->logger('Binding authorization keys...', \danog\MadelineProto\Logger::VERBOSE); $nonce = $this->random(8); $expires_at = time() + $expires_in; $temp_auth_key_id = $this->datacenter->sockets[$datacenter]->temp_auth_key['id']; $perm_auth_key_id = $this->datacenter->sockets[$datacenter]->auth_key['id']; $temp_session_id = $this->datacenter->sockets[$datacenter]->session_id; $message_data = $this->serialize_object(['type' => 'bind_auth_key_inner'], ['nonce' => $nonce, 'temp_auth_key_id' => $temp_auth_key_id, 'perm_auth_key_id' => $perm_auth_key_id, 'temp_session_id' => $temp_session_id, 'expires_at' => $expires_at], 'bind_temp_auth_key_inner'); $message_id = $this->datacenter->sockets[$datacenter]->generate_message_id(); $seq_no = 0; $encrypted_data = $this->random(16).$message_id.pack('VV', $seq_no, strlen($message_data)).$message_data; $message_key = substr(sha1($encrypted_data, true), -16); $padding = $this->random($this->posmod(-strlen($encrypted_data), 16)); list($aes_key, $aes_iv) = $this->old_aes_calculate($message_key, $this->datacenter->sockets[$datacenter]->auth_key['auth_key']); $encrypted_message = $this->datacenter->sockets[$datacenter]->auth_key['id'].$message_key.$this->ige_encrypt($encrypted_data.$padding, $aes_key, $aes_iv); $res = yield $this->method_call_async_read('auth.bindTempAuthKey', ['perm_auth_key_id' => $perm_auth_key_id, 'nonce' => $nonce, 'expires_at' => $expires_at, 'encrypted_message' => $encrypted_message], ['msg_id' => $message_id, 'datacenter' => $datacenter]); if ($res === true) { $this->logger->logger('Successfully binded temporary and permanent authorization keys, DC '.$datacenter, \danog\MadelineProto\Logger::NOTICE); return true; } } catch (\danog\MadelineProto\SecurityException $e) { $this->logger->logger('An exception occurred while generating the authorization key: '.$e->getMessage().' Retrying (try number '.$retry_id_total.')...', \danog\MadelineProto\Logger::WARNING); } catch (\danog\MadelineProto\Exception $e) { $this->logger->logger('An exception occurred while generating the authorization key: '.$e->getMessage().' Retrying (try number '.$retry_id_total.')...', \danog\MadelineProto\Logger::WARNING); } catch (\danog\MadelineProto\RPCErrorException $e) { $this->logger->logger('An RPCErrorException occurred while generating the authorization key: '.$e->getMessage().' Retrying (try number '.$retry_id_total.')...', \danog\MadelineProto\Logger::WARNING); } } throw new \danog\MadelineProto\SecurityException('An error occurred while binding temporary and permanent authorization keys.'); } // Creates authorization keys public function init_authorization() { return $this->wait($this->init_authorization_async()); } public function init_authorization_async() { if ($this->pending_auth) { return; } $initing = $this->initing_authorization; $this->initing_authorization = true; $this->updates_state['sync_loading'] = true; $this->postpone_updates = true; try { $dcs = []; $postpone = []; foreach ($this->datacenter->sockets as $id => $socket) { if (strpos($id, 'media') !== false) { $oid = intval($id); if (isset($dcs[$oid])) { $postpone[$id] = $socket; } continue; } if (isset($this->init_auth_dcs[$id])) { $this->pending_auth = true; continue; } $dcs[$id] = function () use ($id, $socket) { return $this->init_authorization_socket($id, $socket); }; } yield array_shift($dcs)(); foreach ($dcs as &$dc) { $dc = $dc(); } yield $dcs; foreach ($postpone as $id => $socket) { yield $this->init_authorization_socket($id, $socket); } //foreach ($dcs as $dc) { yield $dc; } if ($this->pending_auth && empty($this->init_auth_dcs)) { $this->pending_auth = false; yield $this->init_authorization_async(); } } finally { $this->pending_auth = false; $this->postpone_updates = false; $this->initing_authorization = $initing; $this->updates_state['sync_loading'] = false; $this->handle_pending_updates(); } } public function init_authorization_socket($id, $socket) { $this->init_auth_dcs[$id] = true; try { if ($socket->session_id === null) { $socket->session_id = $this->random(8); $socket->session_in_seq_no = 0; $socket->session_out_seq_no = 0; } $cdn = strpos($id, 'cdn'); $media = strpos($id, 'media'); if ($socket->temp_auth_key === null || $socket->auth_key === null) { $dc_config_number = isset($this->settings['connection_settings'][$id]) ? $id : 'all'; if ($socket->auth_key === null && !$cdn && !$media) { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['gen_perm_auth_key'], $id), \danog\MadelineProto\Logger::NOTICE); $socket->auth_key = yield $this->create_auth_key_async(-1, $id); $socket->authorized = false; } elseif ($socket->auth_key === null && $media) { $socket->auth_key = $this->datacenter->sockets[intval($id)]->auth_key; $socket->authorized = &$this->datacenter->sockets[intval($id)]->authorized; } if ($media) { $socket->authorized = &$this->datacenter->sockets[intval($id)]->authorized; } if ($this->settings['connection_settings'][$dc_config_number]['pfs']) { if (!$cdn) { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['gen_temp_auth_key'], $id), \danog\MadelineProto\Logger::NOTICE); //$authorized = $socket->authorized; //$socket->authorized = false; $socket->temp_auth_key = null; $socket->temp_auth_key = yield $this->create_auth_key_async($this->settings['authorization']['default_temp_auth_key_expires_in'], $id); yield $this->bind_temp_auth_key_async($this->settings['authorization']['default_temp_auth_key_expires_in'], $id); //$socket->authorized = $authorized; $config = yield $this->method_call_async_read('help.getConfig', [], ['datacenter' => $id]); yield $this->sync_authorization_async($id); yield $this->get_config_async($config); } elseif ($socket->temp_auth_key === null) { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['gen_temp_auth_key'], $id), \danog\MadelineProto\Logger::NOTICE); $socket->temp_auth_key = yield $this->create_auth_key_async($this->settings['authorization']['default_temp_auth_key_expires_in'], $id); } } else { if (!$cdn) { $socket->temp_auth_key = $socket->auth_key; $config = yield $this->method_call_async_read('help.getConfig', [], ['datacenter' => $id]); yield $this->sync_authorization_async($id); yield $this->get_config_async($config); } elseif ($socket->temp_auth_key === null) { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['gen_temp_auth_key'], $id), \danog\MadelineProto\Logger::NOTICE); $socket->temp_auth_key = yield $this->create_auth_key_async($this->settings['authorization']['default_temp_auth_key_expires_in'], $id); } } } elseif (!$cdn) { yield $this->sync_authorization_async($id); } } finally { unset($this->init_auth_dcs[$id]); } } public function sync_authorization_async($id) { if (!isset($this->datacenter->sockets[$id])) { return false; } $socket = $this->datacenter->sockets[$id]; if ($this->authorized === self::LOGGED_IN && $socket->authorized === false) { foreach ($this->datacenter->sockets as $authorized_dc_id => $authorized_socket) { if ($this->authorized_dc !== -1 && $authorized_dc_id !== $this->authorized_dc) { continue; } if ($authorized_socket->temp_auth_key !== null && $authorized_socket->auth_key !== null && $authorized_socket->authorized === true && $this->authorized === self::LOGGED_IN && $socket->authorized === false && strpos($authorized_dc_id, 'cdn') === false) { try { $this->logger->logger('Trying to copy authorization from dc '.$authorized_dc_id.' to dc '.$id); $exported_authorization = yield $this->method_call_async_read('auth.exportAuthorization', ['dc_id' => preg_replace('|_.*|', '', $id)], ['datacenter' => $authorized_dc_id]); $authorization = yield $this->method_call_async_read('auth.importAuthorization', $exported_authorization, ['datacenter' => $id]); $socket->authorized = true; break; } catch (\danog\MadelineProto\Exception $e) { $this->logger->logger('Failure while syncing authorization from DC '.$authorized_dc_id.' to DC '.$id.': '.$e->getMessage(), \danog\MadelineProto\Logger::ERROR); } catch (\danog\MadelineProto\RPCErrorException $e) { $this->logger->logger('Failure while syncing authorization from DC '.$authorized_dc_id.' to DC '.$id.': '.$e->getMessage(), \danog\MadelineProto\Logger::ERROR); if ($e->rpc === 'DC_ID_INVALID') { break; } } // Turns out this DC isn't authorized after all } } } } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\MTProtoTools; use Amp\Deferred; use Amp\Delayed; use function Amp\Promise\any; /** * Manages updates. */ trait UpdateHandler { private $pending_updates = []; private $updates_state = ['_' => 'MadelineProto.Updates_state', 'seq' => 0, 'pts' => 0, 'date' => 0, 'qts' => 0]; private $got_state = false; private $channels_state = []; public $updates = []; public $updates_key = 0; public $last_getdifference = 0; public function pwr_update_handler($update) { if (isset($this->settings['pwr']['update_handler'])) { if (is_array($this->settings['pwr']['update_handler']) && $this->settings['pwr']['update_handler'][0] === false) { $this->settings['pwr']['update_handler'] = $this->settings['pwr']['update_handler'][1]; } if (is_string($this->settings['pwr']['update_handler'])) { return $this->{$this->settings['pwr']['update_handler']}($update); } in_array($this->settings['pwr']['update_handler'], [['danog\\MadelineProto\\API', 'get_updates_update_handler'], 'get_updates_update_handler']) ? $this->get_updates_update_handler($update) : $this->settings['pwr']['update_handler']($update); } } public function get_updates_update_handler($update) { if (!$this->settings['updates']['handle_updates']) { return; } $this->updates[$this->updates_key++] = $update; $this->logger->logger('Stored '); } public function get_updates_async($params = []) { if (!$this->settings['updates']['handle_updates']) { $this->settings['updates']['handle_updates'] = true; $this->datacenter->sockets[$this->settings['connection_settings']['default_dc']]->updater->start(); } if (!$this->settings['updates']['run_callback']) { $this->settings['updates']['run_callback'] = true; } array_walk($this->calls, function ($controller, $id) { if ($controller->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { $controller->discard(); } }); $params = array_merge(self::DEFAULT_GETUPDATES_PARAMS, $params); if (empty($this->updates)) { $this->update_deferred = new Deferred(); yield any([$this->update_deferred->promise(), new Delayed($params['timeout'] * 1000)]); } if (empty($this->updates)) { return []; } if ($params['offset'] < 0) { $params['offset'] = array_reverse(array_keys((array) $this->updates))[abs($params['offset']) - 1]; } $updates = []; if (isset($this->updates["\0*\0state"])) { unset($this->updates["\0*\0state"]); } $supdates = (array) $this->updates; ksort($supdates); foreach ($supdates as $key => $value) { if ($params['offset'] > $key) { unset($this->updates[$key]); } elseif ($params['limit'] === null || count($updates) < $params['limit']) { $updates[] = ['update_id' => $key, 'update' => $value]; } } if (empty($this->updates)) { $this->updates_key = 0; } return $updates; } public function &load_channel_state($channel, $pts = 1) { if (!isset($this->channels_state[$channel])) { $this->channels_state[$channel] = ['pts' => $pts, 'sync_loading' => false]; } return $this->channels_state[$channel]; } public function set_channel_state($channel, $data) { if (isset($data['pts']) && $data['pts'] !== 0) { $this->load_channel_state($channel)['pts'] = $data['pts']; } } public function check_msg_id($message) { try { $peer_id = $this->get_info($message['to_id'])['bot_api_id']; } catch (\danog\MadelineProto\Exception $e) { return true; } catch (\danog\MadelineProto\RPCErrorException $e) { return true; } $message_id = $message['id']; if (!isset($this->msg_ids[$peer_id]) || $message_id > $this->msg_ids[$peer_id]) { $this->msg_ids[$peer_id] = $message_id; return true; } return false; } public function get_channel_difference($channel) { if (!$this->settings['updates']['handle_updates']) { return; } if ($this->load_channel_state($channel)['sync_loading']) { $this->logger->logger('Not fetching '.$channel.' difference, I am already fetching it'); return; } $this->load_channel_state($channel)['sync_loading'] = true; $this->postpone_updates = true; try { $input = $this->get_info('channel#'.$channel); if (!isset($input['InputChannel'])) { throw new \danog\MadelineProto\Exception('This peer is not present in the internal peer database'); } $input = $input['InputChannel']; } catch (\danog\MadelineProto\Exception $e) { return false; } catch (\danog\MadelineProto\RPCErrorException $e) { return false; } finally { $this->postpone_updates = false; $this->load_channel_state($channel)['sync_loading'] = false; } $this->logger->logger('Fetching '.$channel.' difference...', \danog\MadelineProto\Logger::ULTRA_VERBOSE); $this->load_channel_state($channel)['sync_loading'] = true; $this->postpone_updates = true; try { $difference = $this->method_call('updates.getChannelDifference', ['channel' => $input, 'filter' => ['_' => 'channelMessagesFilterEmpty'], 'pts' => $this->load_channel_state($channel)['pts'], 'limit' => 30], ['datacenter' => $this->datacenter->curdc]); } catch (\danog\MadelineProto\RPCErrorException $e) { if ($e->getMessage() === "You haven't joined this channel/supergroup") { return false; } throw $e; } catch (\danog\MadelineProto\PTSException $e) { $this->logger->logger($e->getMessage()); unset($this->channels_state[$channel]); return false; //$this->get_channel_difference($channel); } finally { $this->postpone_updates = false; $this->load_channel_state($channel)['sync_loading'] = false; } unset($input); switch ($difference['_']) { case 'updates.channelDifferenceEmpty': $this->set_channel_state($channel, $difference); break; case 'updates.channelDifference': $this->load_channel_state($channel)['sync_loading'] = true; $this->postpone_updates = true; try { $this->set_channel_state($channel, $difference); $this->handle_update_messages($difference['new_messages'], $channel); $this->handle_multiple_update($difference['other_updates'], [], $channel); } finally { $this->postpone_updates = false; $this->load_channel_state($channel)['sync_loading'] = false; } if (!$difference['final']) { unset($difference); $this->get_channel_difference($channel); } break; case 'updates.channelDifferenceTooLong': $this->logger->logger('Got '.$difference['_'], \danog\MadelineProto\Logger::VERBOSE); $this->load_channel_state($channel)['sync_loading'] = true; $this->postpone_updates = true; try { $this->set_channel_state($channel, $difference); $this->handle_update_messages($difference['messages'], $channel); unset($difference); } finally { $this->postpone_updates = false; $this->load_channel_state($channel)['sync_loading'] = false; } $this->get_channel_difference($channel); break; default: throw new \danog\MadelineProto\Exception('Unrecognized update difference received: '.var_export($difference, true)); break; } $this->handle_pending_updates(); } public function set_update_state($data) { if (isset($data['pts']) && $data['pts'] !== 0) { $this->load_update_state()['pts'] = $data['pts']; } if (isset($data['qts']) && $data['qts'] !== 0) { $this->load_update_state()['qts'] = $data['qts']; } if (isset($data['seq']) && $data['seq'] !== 0) { $this->load_update_state()['seq'] = $data['seq']; } if (isset($data['date']) && $data['date'] > $this->load_update_state()['date']) { $this->load_update_state()['date'] = $data['date']; } } public function &load_update_state() { if (!isset($this->updates_state['qts'])) { $this->updates_state['qts'] = 0; } if (!$this->got_state) { $this->got_state = true; $this->set_update_state($this->get_updates_state()); } return $this->updates_state; } public function get_updates_difference($w = null) { if (!$this->settings['updates']['handle_updates']) { return; } if ($this->updates_state['sync_loading']) { $this->logger->logger('Not fetching normal difference, I am already fetching it'); return false; } $this->updates_state['sync_loading'] = true; $this->postpone_updates = true; $this->logger->logger('Fetching normal difference...', \danog\MadelineProto\Logger::ULTRA_VERBOSE); while (!isset($difference)) { try { $difference = $this->method_call('updates.getDifference', ['pts' => $this->load_update_state()['pts'], 'date' => $this->load_update_state()['date'], 'qts' => $this->load_update_state()['qts']], ['datacenter' => $this->settings['connection_settings']['default_dc']]); } catch (\danog\MadelineProto\PTSException $e) { $this->updates_state['sync_loading'] = false; $this->got_state = false; } finally { $this->postpone_updates = false; $this->updates_state['sync_loading'] = false; } } $this->logger->logger('Got '.$difference['_'], \danog\MadelineProto\Logger::ULTRA_VERBOSE); $this->postpone_updates = true; $this->updates_state['sync_loading'] = true; $this->last_getdifference = time(); $this->datacenter->sockets[$this->settings['connection_settings']['default_dc']]->updater->resume(); try { switch ($difference['_']) { case 'updates.differenceEmpty': $this->set_update_state($difference); break; case 'updates.difference': $this->updates_state['sync_loading'] = true; $this->handle_multiple_update($difference['other_updates']); foreach ($difference['new_encrypted_messages'] as $encrypted) { $this->handle_encrypted_update(['_' => 'updateNewEncryptedMessage', 'message' => $encrypted], true); } $this->handle_update_messages($difference['new_messages']); $this->set_update_state($difference['state']); break; case 'updates.differenceSlice': $this->updates_state['sync_loading'] = true; $this->handle_multiple_update($difference['other_updates']); $this->handle_update_messages($difference['new_messages']); $this->set_update_state($difference['intermediate_state']); unset($difference); $this->updates_state['sync_loading'] = false; $this->get_updates_difference(); break; default: throw new \danog\MadelineProto\Exception('Unrecognized update difference received: '.var_export($difference, true)); break; } } finally { $this->postpone_updates = false; $this->updates_state['sync_loading'] = false; } $this->handle_pending_updates(); if ($this->updates && $this->update_deferred) { $d = $this->update_deferred; $this->update_deferred = null; $d->resolve(); } return true; } public function get_updates_state() { $last = $this->updates_state['sync_loading']; $this->updates_state['sync_loading'] = true; try { $data = $this->method_call('updates.getState', [], ['datacenter' => $this->settings['connection_settings']['default_dc']]); $this->get_cdn_config($this->settings['connection_settings']['default_dc']); } finally { $this->updates_state['sync_loading'] = $last; } return $data; } public function handle_update($update, $options = []) { if (!$this->settings['updates']['handle_updates']) { return; } $this->logger->logger('Handling an update of type '.$update['_'].'...', \danog\MadelineProto\Logger::VERBOSE); $channel_id = false; switch ($update['_']) { case 'updateNewChannelMessage': case 'updateEditChannelMessage': if ($update['message']['_'] === 'messageEmpty') { $this->logger->logger('Got message empty, not saving', \danog\MadelineProto\Logger::ULTRA_VERBOSE); return false; } $channel_id = $update['message']['to_id']['channel_id']; break; case 'updateDeleteChannelMessages': $channel_id = $update['channel_id']; break; case 'updateChannelTooLong': $channel_id = $update['channel_id']; $this->logger->logger('Got channel too long update, getting difference...', \danog\MadelineProto\Logger::VERBOSE); if (!isset($this->channels_state[$channel_id]) && !isset($update['pts'])) { $this->logger->logger('I do not have the channel in the states and the pts is not set.', \danog\MadelineProto\Logger::ERROR); return; } break; } if ($channel_id === false) { $cur_state = &$this->load_update_state(); } else { $cur_state = &$this->load_channel_state($channel_id, (isset($update['pts']) ? $update['pts'] : 0) - (isset($update['pts_count']) ? $update['pts_count'] : 0)); } /* if ($cur_state['sync_loading'] && in_array($update['_'], ['updateNewMessage', 'updateEditMessage', 'updateNewChannelMessage', 'updateEditChannelMessage'])) { $this->logger->logger('Sync loading, not handling update', \danog\MadelineProto\Logger::NOTICE); return false; }*/ switch ($update['_']) { case 'updateChannelTooLong': $this->get_channel_difference($channel_id); return false; case 'updateNewMessage': case 'updateEditMessage': case 'updateNewChannelMessage': case 'updateEditChannelMessage': if (isset($update['message']['from_id']) && !$this->peer_isset($update['message']['from_id']) || !$this->peer_isset($update['message']['to_id']) || isset($update['message']['via_bot_id']) && !$this->peer_isset($update['message']['via_bot_id']) || isset($update['message']['entities']) && !$this->entities_peer_isset($update['message']['entities']) || isset($update['message']['fwd_from']) && !$this->fwd_peer_isset($update['message']['fwd_from'])) { $this->logger->logger('Not enough data for message update, getting difference...', \danog\MadelineProto\Logger::VERBOSE); if ($channel_id !== false && $this->peer_isset($this->to_supergroup($channel_id))) { $this->get_channel_difference($channel_id); } else { $this->get_updates_difference(); } return false; } break; default: if ($channel_id !== false && !$this->peer_isset($this->to_supergroup($channel_id))) { $this->logger->logger('Skipping update, I do not have the channel id '.$channel_id, \danog\MadelineProto\Logger::ERROR); return false; } break; } if (isset($update['pts'])) { if ($update['pts'] < $cur_state['pts']) { $this->logger->logger('Duplicate update, channel id: '.$channel_id, \danog\MadelineProto\Logger::ERROR); return false; } if ($cur_state['pts'] + (isset($update['pts_count']) ? $update['pts_count'] : 0) !== $update['pts']) { $this->logger->logger('Pts hole. current pts: '.$cur_state['pts'].', pts count: '.(isset($update['pts_count']) ? $update['pts_count'] : 0).', pts: '.$update['pts'].', channel id: '.$channel_id, \danog\MadelineProto\Logger::ERROR); if ($channel_id !== false && $this->peer_isset($this->to_supergroup($channel_id))) { $this->get_channel_difference($channel_id); } else { $this->get_updates_difference(); } return false; } if (isset($update['message']['id'], $update['message']['to_id']) && !in_array($update['_'], ['updateEditMessage', 'updateEditChannelMessage'])) { if (!$this->check_msg_id($update['message'])) { $this->logger->logger('Duplicate update by message id, channel id: '.$channel_id, \danog\MadelineProto\Logger::ERROR); return false; } } $this->logger->logger('Applying pts. current pts: '.$cur_state['pts'].', new pts: '.$update['pts'].', channel id: '.$channel_id, \danog\MadelineProto\Logger::VERBOSE); $cur_state['pts'] = $update['pts']; if ($channel_id === false && isset($options['date']) && $cur_state['date'] < $options['date']) { $cur_state['date'] = $options['date']; } } if ($channel_id === false && isset($options['seq']) || isset($options['seq_start'])) { $seq = $options['seq']; $seq_start = isset($options['seq_start']) ? $options['seq_start'] : $options['seq']; if ($seq_start != $cur_state['seq'] + 1 && $seq_start > $cur_state['seq']) { $this->logger->logger('Seq hole. seq_start: '.$seq_start.' != cur seq: '.$cur_state['seq'].' + 1', \danog\MadelineProto\Logger::ERROR); $this->get_updates_difference(); return false; } if ($cur_state['seq'] !== $seq) { $cur_state['seq'] = $seq; if (isset($options['date']) && $cur_state['date'] < $options['date']) { $cur_state['date'] = $options['date']; } } } $this->save_update($update); } public function handle_multiple_update($updates, $options = [], $channel = false) { if (!$this->settings['updates']['handle_updates']) { return; } if ($channel === false) { foreach ($updates as $update) { $this->handle_update($update, $options); } } else { foreach ($updates as $update) { $this->handle_update($update); } } } public function handle_update_messages($messages, $channel = false) { if (!$this->settings['updates']['handle_updates']) { return; } foreach ($messages as $message) { $this->handle_update(['_' => $channel === false ? 'updateNewMessage' : 'updateNewChannelMessage', 'message' => $message, 'pts' => $channel === false ? $this->load_update_state()['pts'] : $this->load_channel_state($channel)['pts'], 'pts_count' => 0]); } } public function save_update($update) { if ($update['_'] === 'updateConfig') { $this->config['expires'] = 0; $this->get_config(); } if (in_array($update['_'], ['updateUserName', 'updateUserPhone', 'updateUserBlocked', 'updateUserPhoto', 'updateContactRegistered', 'updateContactLink'])) { $id = $this->get_info($update)['bot_api_id']; $this->full_chats[$id]['last_update'] = 0; $this->get_full_info($id); } if ($update['_'] === 'updateDcOptions') { $this->logger->logger('Got new dc options', \danog\MadelineProto\Logger::VERBOSE); $this->parse_dc_options($update['dc_options']); return; } if ($update['_'] === 'updatePhoneCall') { if (!class_exists('\\danog\\MadelineProto\\VoIP')) { $this->logger->logger('The php-libtgvoip extension is required to accept and manage calls. See daniil.it/MadelineProto for more info.', \danog\MadelineProto\Logger::WARNING); return; } switch ($update['phone_call']['_']) { case 'phoneCallRequested': if (isset($this->calls[$update['phone_call']['id']])) { return; } $controller = new \danog\MadelineProto\VoIP(false, $update['phone_call']['admin_id'], ['_' => 'inputPhoneCall', 'id' => $update['phone_call']['id'], 'access_hash' => $update['phone_call']['access_hash']], $this, \danog\MadelineProto\VoIP::CALL_STATE_INCOMING, $update['phone_call']['protocol']); $controller->storage = ['g_a_hash' => $update['phone_call']['g_a_hash']]; $update['phone_call'] = $this->calls[$update['phone_call']['id']] = $controller; break; case 'phoneCallAccepted': if (!$this->confirm_call($update['phone_call'])) { return; } $update['phone_call'] = $this->calls[$update['phone_call']['id']]; break; case 'phoneCall': if (!$this->complete_call($update['phone_call'])) { return; } $update['phone_call'] = $this->calls[$update['phone_call']['id']]; break; case 'phoneCallDiscarded': if (!isset($this->calls[$update['phone_call']['id']])) { return; } return $this->calls[$update['phone_call']['id']]->discard($update['phone_call']['reason'], [], $update['phone_call']['need_debug']); } } if ($update['_'] === 'updateNewEncryptedMessage' && !isset($update['message']['decrypted_message'])) { $cur_state = $this->load_update_state(); if ($cur_state['qts'] === -1) { $cur_state['qts'] = $update['qts']; } if ($update['qts'] < $cur_state['qts']) { $this->logger->logger('Duplicate update. update qts: '.$update['qts'].' <= current qts '.$cur_state['qts'].', chat id: '.$update['message']['chat_id'], \danog\MadelineProto\Logger::ERROR); return false; } if ($update['qts'] > $cur_state['qts'] + 1) { $this->logger->logger('Qts hole. Fetching updates manually: update qts: '.$update['qts'].' > current qts '.$cur_state['qts'].'+1, chat id: '.$update['message']['chat_id'], \danog\MadelineProto\Logger::ERROR); $this->get_updates_difference(); return false; } $this->logger->logger('Applying qts: '.$update['qts'].' over current qts '.$cur_state['qts'].', chat id: '.$update['message']['chat_id'], \danog\MadelineProto\Logger::VERBOSE); $this->method_call('messages.receivedQueue', ['max_qts' => $cur_state['qts'] = $update['qts']], ['datacenter' => $this->settings['connection_settings']['default_dc']]); $this->handle_encrypted_update($update); return; } /* if ($update['_'] === 'updateEncryptedChatTyping') { $update = ['_' => 'updateUserTyping', 'user_id' => $this->encrypted_chats[$update['chat_id']]['user_id'], 'action' => ['_' => 'sendMessageTypingAction']]; } */ if ($update['_'] === 'updateEncryption') { switch ($update['chat']['_']) { case 'encryptedChatRequested': if ($this->settings['secret_chats']['accept_chats'] === false || is_array($this->settings['secret_chats']['accept_chats']) && !in_array($update['chat']['admin_id'], $this->settings['secret_chats']['accept_chats'])) { return; } $this->logger->logger('Accepting secret chat '.$update['chat']['id'], \danog\MadelineProto\Logger::NOTICE); $this->accept_secret_chat($update['chat']); break; case 'encryptedChatDiscarded': $this->logger->logger('Deleting secret chat '.$update['chat']['id'].' because it was revoked by the other user', \danog\MadelineProto\Logger::NOTICE); if (isset($this->secret_chats[$update['chat']['id']])) { unset($this->secret_chats[$update['chat']['id']]); } if (isset($this->temp_requested_secret_chats[$update['chat']['id']])) { unset($this->temp_requested_secret_chats[$update['chat']['id']]); } if (isset($this->temp_rekeyed_secret_chats[$update['chat']['id']])) { unset($this->temp_rekeyed_secret_chats[$update['chat']['id']]); } break; case 'encryptedChat': $this->logger->logger('Completing creation of secret chat '.$update['chat']['id'], \danog\MadelineProto\Logger::NOTICE); $this->complete_secret_chat($update['chat']); break; } //$this->logger->logger($update, \danog\MadelineProto\Logger::NOTICE); } if (!$this->settings['updates']['handle_updates']) { return; } if (isset($update['message']['_']) && $update['message']['_'] === 'messageEmpty') { return; } if (isset($update['message']['from_id']) && $update['message']['from_id'] === $this->authorization['user']['id']) { $update['message']['out'] = true; } $this->logger->logger('Saving an update of type '.$update['_'].'...', \danog\MadelineProto\Logger::VERBOSE); if (isset($this->settings['pwr']['strict']) && $this->settings['pwr']['strict'] && isset($this->settings['pwr']['update_handler'])) { $this->pwr_update_handler($update); } elseif ($this->settings['updates']['run_callback']) { $this->get_updates_update_handler($update); } } public function pwr_webhook($update) { $payload = json_encode($update); //$this->logger->logger($update, $payload, json_last_error()); if ($payload === '') { $this->logger->logger('EMPTY UPDATE'); return false; } $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, $this->hook_url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $parse = parse_url($this->hook_url); if (isset($parse['scheme']) && $parse['scheme'] == 'https') { if (isset($this->pem_path) && file_exists($this->pem_path)) { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_CAINFO, $this->pem_path); } else { //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); } } $result = curl_exec($ch); curl_close($ch); $this->logger->logger('Result of webhook query is '.$result, \danog\MadelineProto\Logger::NOTICE); $result = json_decode($result, true); if (is_array($result) && isset($result['method']) && $result['method'] != '' && is_string($result['method'])) { try { $this->logger->logger('Reverse webhook command returned', $this->method_call($result['method'], $result, ['datacenter' => $this->datacenter->curdc])); } catch (\danog\MadelineProto\Exception $e) { } catch (\danog\MadelineProto\TL\Exception $e) { } catch (\danog\MadelineProto\RPCErrorException $e) { } catch (\danog\MadelineProto\SecurityException $e) { } } } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\MTProtoTools; use Amp\Loop; /** * Manages responses. */ trait ResponseHandler { public function send_msgs_state_info($req_msg_id, $msg_ids, $datacenter) { // TODO REWRITE $info = ''; foreach ($msg_ids as $msg_id) { $cur_info = 0; if (!isset($this->datacenter->sockets[$datacenter]->incoming_messages[$msg_id])) { $msg_id = new \phpseclib\Math\BigInteger(strrev($msg_id), 256); if ((new \phpseclib\Math\BigInteger(time() + $this->datacenter->sockets[$datacenter]->time_delta + 30))->bitwise_leftShift(32)->compare($msg_id) < 0) { $cur_info |= 3; } elseif ((new \phpseclib\Math\BigInteger(time() + $this->datacenter->sockets[$datacenter]->time_delta - 300))->bitwise_leftShift(32)->compare($msg_id) > 0) { $cur_info |= 1; } else { $cur_info |= 2; } } else { $cur_info |= 4; if ($this->datacenter->sockets[$datacenter]->incoming_messages[$msg_id]['ack']) { $cur_info |= 8; } } $info .= chr($cur_info); } $this->datacenter->sockets[$datacenter]->outgoing_messages[$this->object_call('msgs_state_info', ['req_msg_id' => $req_msg_id, 'info' => $info], ['datacenter' => $datacenter])]['response'] = $req_msg_id; } public $n = 0; public function handle_messages($datacenter, $actual_datacenter = null) { if ($actual_datacenter) { $datacenter = $actual_datacenter; } //$n = $this->n++; $only_updates = true; foreach ($this->datacenter->sockets[$datacenter]->new_incoming as $current_msg_id) { //var_dump($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]); $this->logger->logger((isset($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['from_container']) ? 'Inside of container, received ' : 'Received ').$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['_'].' from DC '.$datacenter, \danog\MadelineProto\Logger::ULTRA_VERBOSE); switch ($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['_']) { case 'msgs_ack': unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; foreach ($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['msg_ids'] as $msg_id) { $this->ack_outgoing_message_id($msg_id, $datacenter); // Acknowledge that the server received my message } break; case 'rpc_result': unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); $this->ack_incoming_message_id($current_msg_id, $datacenter); // Acknowledge that the server received my request $req_msg_id = $this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['req_msg_id']; $this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content'] = $this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['result']; $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $this->handle_response($req_msg_id, $current_msg_id, $datacenter); $only_updates = false; break; case 'future_salts': unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; $this->handle_response($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['req_msg_id'], $current_msg_id, $datacenter); break; case 'bad_server_salt': case 'bad_msg_notification': $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); $this->handle_response($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['bad_msg_id'], $current_msg_id, $datacenter); break; case 'pong': $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); $this->handle_response($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['msg_id'], $current_msg_id, $datacenter); break; case 'new_session_created': $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; $this->datacenter->sockets[$datacenter]->temp_auth_key['server_salt'] = $this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['server_salt']; unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); $this->ack_incoming_message_id($current_msg_id, $datacenter); // Acknowledge that I received the server's response if ($this->authorized === self::LOGGED_IN && !$this->initing_authorization && $this->datacenter->sockets[$this->datacenter->curdc]->temp_auth_key !== null) { Loop::defer([$this, 'get_updates_difference']); } //foreach ($this->datacenter->sockets[$datacenter]->new_outgoing as $message_id) { // $this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['sent'] = 0; //} // Loop::defer([$this->datacenter->sockets[$datacenter]->checker, 'resume']); unset($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']); break; case 'msg_container': unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); foreach ($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['messages'] as $message) { $this->datacenter->sockets[$datacenter]->check_message_id($message['msg_id'], ['outgoing' => false, 'container' => true]); $this->datacenter->sockets[$datacenter]->incoming_messages[$message['msg_id']] = ['seq_no' => $message['seqno'], 'content' => $message['body'], 'from_container' => true]; $this->datacenter->sockets[$datacenter]->new_incoming[$message['msg_id']] = $message['msg_id']; $this->handle_messages($datacenter); } $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; unset($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']); break; case 'msg_copy': $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; $this->ack_incoming_message_id($current_msg_id, $datacenter); // Acknowledge that I received the server's response if (isset($this->datacenter->sockets[$datacenter]->incoming_messages[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['orig_message']['msg_id']])) { $this->ack_incoming_message_id($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['orig_message']['msg_id'], $datacenter); // Acknowledge that I received the server's response } else { $this->datacenter->sockets[$datacenter]->check_message_id($message['orig_message']['msg_id'], ['outgoing' => false, 'container' => true]); $this->datacenter->sockets[$datacenter]->incoming_messages[$message['orig_message']['msg_id']] = ['content' => $this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['orig_message']]; $this->datacenter->sockets[$datacenter]->new_incoming[$message['orig_message']['msg_id']] = $message['orig_message']['msg_id']; $this->handle_messages($datacenter); } unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); unset($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']); break; case 'http_wait': $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; $this->logger->logger($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content'], \danog\MadelineProto\Logger::NOTICE); unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); unset($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']); break; case 'msgs_state_info': $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); $this->handle_response($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['req_msg_id'], $current_msg_id, $datacenter); break; case 'msgs_state_req': $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); $this->send_msgs_state_info($current_msg_id, $this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['msg_ids'], $datacenter); break; case 'msgs_all_info': $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); foreach ($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['msg_ids'] as $key => $msg_id) { $msg_id = new \phpseclib\Math\BigInteger(strrev($msg_id), 256); $status = 'Status for message id '.$msg_id.': '; if (($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['info'][$key] & 4) !== 0) { $this->got_response_for_outgoing_message_id($msg_id, $datacenter); } foreach (self::MSGS_INFO_FLAGS as $flag => $description) { if (($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['info'][$key] & $flag) !== 0) { $status .= $description; } } $this->logger->logger($status, \danog\MadelineProto\Logger::NOTICE); } break; case 'msg_detailed_info': $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; if (isset($this->datacenter->sockets[$datacenter]->outgoing_messages[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['msg_id']])) { if (isset($this->datacenter->sockets[$datacenter]->incoming_messages[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['answer_msg_id']])) { $this->datacenter->sockets[$datacenter]->outgoing_messages[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['msg_id']]['response'] = $this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['answer_msg_id']; unset($this->datacenter->sockets[$datacenter]->new_outgoing[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['msg_id']]); } else { $this->object_call('msg_resend_req', ['msg_ids' => [$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['answer_msg_id']]], ['datacenter' => $datacenter]); } } case 'msg_new_detailed_info': $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; if (isset($this->datacenter->sockets[$datacenter]->incoming_messages[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['answer_msg_id']])) { $this->ack_incoming_message_id($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['answer_msg_id'], $datacenter); } else { $this->object_call('msg_resend_req', ['msg_ids' => [$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['answer_msg_id']]], ['datacenter' => $datacenter]); } unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); break; case 'msg_resend_req': $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; $ok = true; unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); foreach ($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['msg_ids'] as $msg_id) { if (!isset($this->datacenter->sockets[$datacenter]->outgoing_messages[$msg_id]) || isset($this->datacenter->sockets[$datacenter]->incoming_messages[$msg_id])) { $ok = false; } } if ($ok) { foreach ($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['msg_ids'] as $msg_id) { $this->object_call($this->datacenter->sockets[$datacenter]->outgoing_messages[$msg_id]['content']['method'], $this->datacenter->sockets[$datacenter]->outgoing_messages[$msg_id]['content']['args'], ['datacenter' => $datacenter]); } } else { $this->send_msgs_state_info($current_msg_id, $this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['msg_ids'], $datacenter); } break; case 'msg_resend_ans_req': $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $only_updates = false; unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); $this->send_msgs_state_info($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['msg_ids'], $datacenter); foreach ($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['msg_ids'] as $msg_id) { if (isset($this->datacenter->sockets[$datacenter]->incoming_messages[$msg_id]) && isset($this->datacenter->sockets[$datacenter]->outgoing_messages[$this->datacenter->sockets[$datacenter]->incoming_messages[$msg_id]['response']])) { $this->object_call($this->datacenter->sockets[$datacenter]->outgoing_messages[$this->datacenter->sockets[$datacenter]->incoming_messages[$msg_id]['response']]['method'], $this->datacenter->sockets[$datacenter]->outgoing_messages[$this->datacenter->sockets[$datacenter]->incoming_messages[$msg_id]['response']]['args'], ['datacenter' => $datacenter]); } } break; default: $this->datacenter->sockets[$datacenter]->check_in_seq_no($current_msg_id); $this->ack_incoming_message_id($current_msg_id, $datacenter); // Acknowledge that I received the server's response $response_type = $this->constructors->find_by_predicate($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['_'])['type']; switch ($response_type) { case 'Updates': unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); if (strpos($datacenter, 'cdn') === false) { Loop::defer([$this, 'handle_updates'], $this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']); } unset($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']); $only_updates = true && $only_updates; break; default: $only_updates = false; $this->logger->logger('Trying to assign a response of type '.$response_type.' to its request...', \danog\MadelineProto\Logger::VERBOSE); foreach ($this->datacenter->sockets[$datacenter]->new_outgoing as $key => $expecting_msg_id) { $expecting = $this->datacenter->sockets[$datacenter]->outgoing_messages[$expecting_msg_id]; $this->logger->logger('Does the request of return type '.$expecting['type'].' match?', \danog\MadelineProto\Logger::VERBOSE); if ($response_type === $expecting['type']) { $this->logger->logger('Yes', \danog\MadelineProto\Logger::VERBOSE); unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]); $this->handle_response($expecting_msg_id, $current_msg_id, $datacenter); break 2; } $this->logger->logger('No', \danog\MadelineProto\Logger::VERBOSE); } throw new \danog\MadelineProto\ResponseException('Dunno how to handle '.PHP_EOL.var_export($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content'], true)); break; } break; } } //$this->n--; return $only_updates; } public function handle_reject($datacenter, &$request, $data) { if (isset($request['promise']) && is_object($request['promise'])) { Loop::defer(function () use (&$request, $data) { $request['promise']->fail($data); unset($request['promise']); }); } elseif (isset($request['container'])) { foreach ($request['container'] as $message_id) { $this->handle_reject($datacenter, $this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id], $data); } } else { $this->logger->logger('Rejecting: already got response for '.(isset($request['_']) ? $request['_'] : '-')); $this->logger->logger("Rejecting: $data"); } } public function handle_response($request_id, $response_id, $datacenter) { //var_dumP("Response ".bin2hex($request_id)); $response = &$this->datacenter->sockets[$datacenter]->incoming_messages[$response_id]['content']; unset($this->datacenter->sockets[$datacenter]->incoming_messages[$response_id]['content']); $request = &$this->datacenter->sockets[$datacenter]->outgoing_messages[$request_id]; if (isset($request['method']) && $request['method'] && $request['_'] !== 'auth.bindTempAuthKey' && $this->datacenter->sockets[$datacenter]->temp_auth_key !== null && (!isset($this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited']) || $this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited'] === false)) { $this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited'] = true; } if (isset($response['_'])) { switch ($response['_']) { case 'rpc_error': if (in_array($response['error_message'], ['PERSISTENT_TIMESTAMP_EMPTY', 'PERSISTENT_TIMESTAMP_OUTDATED', 'PERSISTENT_TIMESTAMP_INVALID'])) { $this->got_response_for_outgoing_message_id($request_id, $datacenter); $this->handle_reject($datacenter, $request, new \danog\MadelineProto\PTSException($response['error_message'])); return; } if (strpos($response['error_message'], 'FILE_REFERENCE_') === 0) { $this->logger->logger("Got {$response['error_message']}, refreshing file reference and repeating method call..."); $request['refresh_references'] = true; if (isset($request['serialized_body'])) { unset($request['serialized_body']); } Loop::defer([$this, 'method_recall'], ['message_id' => $request_id, 'datacenter' => $datacenter]); return; } switch ($response['error_code']) { case 500: if ($response['error_message'] === 'MSG_WAIT_FAILED') { $this->datacenter->sockets[$datacenter]->call_queue[$request['queue']] = []; } Loop::defer([$this, 'method_recall'], ['message_id' => $request_id, 'datacenter' => $datacenter]); return; case 303: $old_datacenter = $datacenter; $this->datacenter->curdc = $datacenter = (int) preg_replace('/[^0-9]+/', '', $response['error_message']); if (isset($request['file']) && $request['file'] && isset($this->datacenter->sockets[$datacenter.'_media'])) { \danog\MadelineProto\Logger::log('Using media DC'); $datacenter .= '_media'; } if (isset($request['user_related']) && $request['user_related']) { $this->settings['connection_settings']['default_dc'] = $this->authorized_dc = $this->datacenter->curdc; } Loop::defer([$this, 'method_recall'], ['message_id' => $request_id, 'datacenter' => $datacenter, 'old_datacenter' => $old_datacenter]); return; case 401: switch ($response['error_message']) { case 'USER_DEACTIVATED': case 'SESSION_REVOKED': case 'SESSION_EXPIRED': $this->got_response_for_outgoing_message_id($request_id, $datacenter); $this->logger->logger($response['error_message'], \danog\MadelineProto\Logger::FATAL_ERROR); foreach ($this->datacenter->sockets as $socket) { $socket->temp_auth_key = null; $socket->session_id = null; $socket->auth_key = null; $socket->authorized = false; } if ($response['error_message'] === 'USER_DEACTIVATED') { $this->logger->logger('!!!!!!! WARNING !!!!!!!', \danog\MadelineProto\Logger::FATAL_ERROR); $this->logger->logger("Telegram's flood prevention system suspended this account.", \danog\MadelineProto\Logger::ERROR); $this->logger->logger('To continue, manual verification is required.', \danog\MadelineProto\Logger::FATAL_ERROR); $phone = isset($this->authorization['user']['phone']) ? '+'.$this->authorization['user']['phone'] : 'you are currently using'; $this->logger->logger('Send an email to recover@telegram.org, asking to unban the phone number '.$phone.', and quickly describe what will you do with this phone number.', \danog\MadelineProto\Logger::FATAL_ERROR); $this->logger->logger('Then login again.', \danog\MadelineProto\Logger::FATAL_ERROR); $this->logger->logger('If you intentionally deleted this account, ignore this message.', \danog\MadelineProto\Logger::FATAL_ERROR); } $this->authorized = self::NOT_LOGGED_IN; $this->authorization = null; Loop::defer(function () use ($datacenter, &$request, &$response) { $this->init_authorization(); $this->handle_reject($datacenter, $request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'])); }); return; case 'AUTH_KEY_UNREGISTERED': case 'AUTH_KEY_INVALID': if ($this->authorized !== self::LOGGED_IN) { $this->got_response_for_outgoing_message_id($request_id, $datacenter); Loop::defer(function () use ($datacenter, &$request, &$response) { $this->init_authorization(); $this->handle_reject($datacenter, $request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'])); }); return; } $this->datacenter->sockets[$datacenter]->session_id = null; $this->datacenter->sockets[$datacenter]->temp_auth_key = null; $this->datacenter->sockets[$datacenter]->auth_key = null; $this->datacenter->sockets[$datacenter]->authorized = false; $this->logger->logger('Auth key not registered, resetting temporary and permanent auth keys...', \danog\MadelineProto\Logger::ERROR); if ($this->authorized_dc === $datacenter && $this->authorized === self::LOGGED_IN) { $this->got_response_for_outgoing_message_id($request_id, $datacenter); $this->logger->logger('Permanent auth key was main authorized key, logging out...', \danog\MadelineProto\Logger::FATAL_ERROR); foreach ($this->datacenter->sockets as $socket) { $socket->temp_auth_key = null; $socket->auth_key = null; $socket->authorized = false; } $this->logger->logger('!!!!!!! WARNING !!!!!!!', \danog\MadelineProto\Logger::FATAL_ERROR); $this->logger->logger("Telegram's flood prevention system suspended this account.", \danog\MadelineProto\Logger::ERROR); $this->logger->logger('To continue, manual verification is required.', \danog\MadelineProto\Logger::FATAL_ERROR); $phone = isset($this->authorization['user']['phone']) ? '+'.$this->authorization['user']['phone'] : 'you are currently using'; $this->logger->logger('Send an email to recover@telegram.org, asking to unban the phone number '.$phone.', and quickly describe what will you do with this phone number.', \danog\MadelineProto\Logger::FATAL_ERROR); $this->logger->logger('Then login again.', \danog\MadelineProto\Logger::FATAL_ERROR); $this->logger->logger('If you intentionally deleted this account, ignore this message.', \danog\MadelineProto\Logger::FATAL_ERROR); $this->authorized = self::NOT_LOGGED_IN; $this->authorization = null; Loop::defer(function () use ($datacenter, &$request, &$response) { $this->init_authorization(); $this->handle_reject($datacenter, $request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'])); }); return; } Loop::defer(function () use ($request_id, $datacenter) { $this->init_authorization(); $this->method_recall('', ['message_id' => $request_id, 'datacenter' => $datacenter]); }); return; case 'AUTH_KEY_PERM_EMPTY': $this->logger->logger('Temporary auth key not bound, resetting temporary auth key...', \danog\MadelineProto\Logger::ERROR); $this->datacenter->sockets[$datacenter]->temp_auth_key = null; Loop::defer(function () use ($request_id, $datacenter) { $this->init_authorization(); $this->method_recall('', ['message_id' => $request_id, 'datacenter' => $datacenter]); }); return; } $this->got_response_for_outgoing_message_id($request_id, $datacenter); $this->handle_reject($datacenter, $request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'])); return; case 420: $seconds = preg_replace('/[^0-9]+/', '', $response['error_message']); $limit = isset($aargs['FloodWaitLimit']) ? $aargs['FloodWaitLimit'] : $this->settings['flood_timeout']['wait_if_lt']; if (is_numeric($seconds) && $seconds < $limit) { $this->logger->logger('Flood, waiting '.$seconds.' seconds before repeating async call...', \danog\MadelineProto\Logger::NOTICE); Loop::delay($seconds * 1000, [$this, 'method_recall'], ['message_id' => $request_id, 'datacenter' => $datacenter]); return; } // no break default: $this->got_response_for_outgoing_message_id($request_id, $datacenter); $this->handle_reject($datacenter, $request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'])); return; } return; case 'boolTrue': case 'boolFalse': $response = $response['_'] === 'boolTrue'; break; case 'bad_server_salt': case 'bad_msg_notification': $this->logger->logger('Received bad_msg_notification: '.self::BAD_MSG_ERROR_CODES[$response['error_code']], \danog\MadelineProto\Logger::WARNING); switch ($response['error_code']) { case 48: $this->datacenter->sockets[$datacenter]->temp_auth_key['server_salt'] = $response['new_server_salt']; Loop::defer([$this, 'method_recall'], ['message_id' => $request_id, 'datacenter' => $datacenter]); return; case 16: case 17: $this->datacenter->sockets[$datacenter]->time_delta = (int) (new \phpseclib\Math\BigInteger(strrev($response_id), 256))->bitwise_rightShift(32)->subtract(new \phpseclib\Math\BigInteger(time()))->toString(); $this->logger->logger('Set time delta to '.$this->datacenter->sockets[$datacenter]->time_delta, \danog\MadelineProto\Logger::WARNING); $this->reset_session(); $this->datacenter->sockets[$datacenter]->temp_auth_key = null; Loop::defer(function () use ($request_id, $datacenter) { $this->init_authorization(); $this->method_recall('', ['message_id' => $request_id, 'datacenter' => $datacenter]); }); return; } $this->got_response_for_outgoing_message_id($request_id, $datacenter); $this->handle_reject($datacenter, $request, new \danog\MadelineProto\RPCErrorException('Received bad_msg_notification: '.self::BAD_MSG_ERROR_CODES[$response['error_code']], $response['error_code'])); return; } } if (!isset($request['promise'])) { $this->logger->logger('Response: already got response for '.(isset($request['_']) ? $request['_'] : '-').' with message ID '.$this->unpack_signed_long($request_id)); return; } if (isset($request['botAPI']) && $request['botAPI']) { $response = $this->MTProto_to_botAPI($response); } unset($request); $this->got_response_for_outgoing_message_id($request_id, $datacenter); Loop::defer(function () use ($request_id, $response, $datacenter) { $this->datacenter->sockets[$datacenter]->outgoing_messages[$request_id]['promise']->resolve($response); unset($this->datacenter->sockets[$datacenter]->outgoing_messages[$request_id]['promise']); }); } public function handle_pending_updates() { if ($this->postpone_updates) { return false; } if (count($this->pending_updates)) { $this->logger->logger('Parsing pending updates...'); foreach (array_keys($this->pending_updates) as $key) { if (isset($this->pending_updates[$key])) { $updates = $this->pending_updates[$key]; unset($this->pending_updates[$key]); $this->handle_updates($updates); } } } } public function handle_updates($updates, $actual_updates = null) { if (!$this->settings['updates']['handle_updates']) { return; } if ($actual_updates) { $updates = $actual_updates; } if ($this->postpone_updates) { $this->logger->logger('Postpone update handling', \danog\MadelineProto\Logger::VERBOSE); $this->pending_updates[] = $updates; return false; } $this->handle_pending_updates(); $this->logger->logger('Parsing updates received via the socket...', \danog\MadelineProto\Logger::VERBOSE); try { $this->postpone_updates = true; $opts = []; foreach (['date', 'seq', 'seq_start'] as $key) { if (isset($updates[$key])) { $opts[$key] = $updates[$key]; } } switch ($updates['_']) { case 'updates': case 'updatesCombined': foreach ($updates['updates'] as $update) { $this->handle_update($update, $opts); } break; case 'updateShort': $this->handle_update($updates['update'], $opts); break; case 'updateShortMessage': case 'updateShortChatMessage': $from_id = isset($updates['from_id']) ? $updates['from_id'] : ($updates['out'] ? $this->authorization['user']['id'] : $updates['user_id']); $to_id = isset($updates['chat_id']) ? -$updates['chat_id'] : ($updates['out'] ? $updates['user_id'] : $this->authorization['user']['id']); if (!$this->peer_isset($from_id) || !$this->peer_isset($to_id) || isset($updates['via_bot_id']) && !$this->peer_isset($updates['via_bot_id']) || isset($updates['entities']) && !$this->entities_peer_isset($updates['entities']) || isset($updates['fwd_from']) && !$this->fwd_peer_isset($updates['fwd_from'])) { $this->logger->logger('getDifference: good - getting user for updateShortMessage', \danog\MadelineProto\Logger::VERBOSE); $this->get_updates_difference(); } $message = $updates; $message['_'] = 'message'; $message['from_id'] = $from_id; try { $message['to_id'] = $this->get_info($to_id)['Peer']; } catch (\danog\MadelineProto\Exception $e) { $this->logger->logger('Still did not get user in database, postponing update', \danog\MadelineProto\Logger::ERROR); //$this->pending_updates[] = $updates; break; } catch (\danog\MadelineProto\RPCErrorException $e) { $this->logger->logger('Still did not get user in database, postponing update', \danog\MadelineProto\Logger::ERROR); //$this->pending_updates[] = $updates; break; } $update = ['_' => 'updateNewMessage', 'message' => $message, 'pts' => $updates['pts'], 'pts_count' => $updates['pts_count']]; $this->handle_update($update, $opts); break; case 'updateShortSentMessage': //$this->set_update_state(['date' => $updates['date']]); break; case 'updatesTooLong': $this->get_updates_difference(); break; default: throw new \danog\MadelineProto\ResponseException('Unrecognized update received: '.var_export($updates, true)); break; } } finally { $this->postpone_updates = false; } if ($this->updates && $this->update_deferred) { $d = $this->update_deferred; $this->update_deferred = null; $d->resolve(); } } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\MTProtoTools; use danog\MadelineProto\Exception; use danog\MadelineProto\Magic; use danog\MadelineProto\SecurityException; use danog\MadelineProto\Tools; use phpseclib\Math\BigInteger; /** * Manages password calculation. */ class PasswordCalculator { use AuthKeyHandler; use Tools; private $new_algo; private $secure_random = ''; private $current_algo; private $srp_B; private $srp_BForHash; private $srp_id; public function __construct($logger) { $this->logger = $logger; } public function addInfo(array $object) { if ($object['_'] !== 'account.password') { throw new Exception('Wrong constructor'); } if ($object['has_secure_values']) { throw new Exception('Cannot parse secure values'); } if ($object['has_password']) { switch ($object['current_algo']['_']) { case 'passwordKdfAlgoUnknown': throw new Exception('Update your client to continue'); case 'passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow': $object['current_algo']['g'] = new BigInteger($object['current_algo']['g']); $object['current_algo']['p'] = new BigInteger((string) $object['current_algo']['p'], 256); $this->check_p_g($object['current_algo']['p'], $object['current_algo']['g']); $object['current_algo']['gForHash'] = str_pad($object['current_algo']['g']->toBytes(), 256, chr(0), \STR_PAD_LEFT); $object['current_algo']['pForHash'] = str_pad($object['current_algo']['p']->toBytes(), 256, chr(0), \STR_PAD_LEFT); break; default: throw new Exception("Unknown KDF algo {$object['current_algo']['_']}"); } $this->current_algo = $object['current_algo']; $object['srp_B'] = new BigInteger((string) $object['srp_B'], 256); if ($object['srp_B']->compare(\danog\MadelineProto\Magic::$zero) < 0) { throw new SecurityException('srp_B < 0'); } if ($object['srp_B']->compare($object['current_algo']['p']) > 0) { throw new SecurityException('srp_B > p'); } $this->srp_B = $object['srp_B']; $this->srp_BForHash = str_pad($object['srp_B']->toBytes(), 256, chr(0), \STR_PAD_LEFT); $this->srp_id = $object['srp_id']; } else { $this->current_algo = null; $this->srp_B = null; $this->srp_BForHash = null; $this->srp_id = null; } switch ($object['new_algo']['_']) { case 'passwordKdfAlgoUnknown': throw new Exception('Update your client to continue'); case 'passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow': $object['new_algo']['g'] = new BigInteger($object['new_algo']['g']); $object['new_algo']['p'] = new BigInteger((string) $object['new_algo']['p'], 256); $this->check_p_g($object['new_algo']['p'], $object['new_algo']['g']); $object['new_algo']['gForHash'] = str_pad($object['new_algo']['g']->toBytes(), 256, chr(0), \STR_PAD_LEFT); $object['new_algo']['pForHash'] = str_pad($object['new_algo']['p']->toBytes(), 256, chr(0), \STR_PAD_LEFT); break; default: throw new Exception("Unknown KDF algo {$object['new_algo']['_']}"); } $this->new_algo = $object['new_algo']; $this->secure_random = $object['secure_random']; } public function createSalt(string $prefix = ''): string { return $prefix.$this->random(32); } public function hashSha256(string $data, string $salt): string { return hash('sha256', $salt.$data.$salt, true); } public function hashPassword(string $password, string $client_salt, string $server_salt): string { $buf = $this->hashSha256($password, $client_salt); $buf = $this->hashSha256($buf, $server_salt); $hash = hash_pbkdf2('sha512', $buf, $client_salt, 100000, 0, true); return $this->hashSha256($hash, $server_salt); } public function getCheckPassword(string $password): array { if ($password === '') { return ['_' => 'inputCheckPasswordEmpty']; } $client_salt = $this->current_algo['salt1']; $server_salt = $this->current_algo['salt2']; $g = $this->current_algo['g']; $gForHash = $this->current_algo['gForHash']; $p = $this->current_algo['p']; $pForHash = $this->current_algo['pForHash']; $B = $this->srp_B; $BForHash = $this->srp_BForHash; $id = $this->srp_id; $x = new BigInteger($this->hashPassword($password, $client_salt, $server_salt), 256); $g_x = $g->powMod($x, $p); $k = new BigInteger(hash('sha256', $pForHash.$gForHash, true), 256); $kg_x = $k->multiply($g_x)->powMod(Magic::$one, $p); $a = new BigInteger($this->random(2048 / 8), 256); $A = $g->powMod($a, $p); $this->check_G($A, $p); $AForHash = str_pad($A->toBytes(), 256, chr(0), \STR_PAD_LEFT); $b_kg_x = $B->powMod(Magic::$one, $p)->subtract($kg_x); $u = new BigInteger(hash('sha256', $AForHash.$BForHash, true), 256); $ux = $u->multiply($x); $a_ux = $a->add($ux); $S = $b_kg_x->powMod($a_ux, $p); $SForHash = str_pad($S->toBytes(), 256, chr(0), \STR_PAD_LEFT); $K = hash('sha256', $SForHash, true); $h1 = hash('sha256', $pForHash, true); $h2 = hash('sha256', $gForHash, true); $h1 ^= $h2; $M1 = hash('sha256', $h1.hash('sha256', $client_salt, true).hash('sha256', $server_salt, true).$AForHash.$BForHash.$K, true); return ['_' => 'inputCheckPasswordSRP', 'srp_id' => $id, 'A' => $AForHash, 'M1' => $M1]; } public function getPassword(array $params): array { $return = ['password' => $this->getCheckPassword(isset($params['password']) ? $params['password'] : ''), 'new_settings' => ['_' => 'account.passwordInputSettings', 'new_algo' => ['_' => 'passwordKdfAlgoUnknown'], 'new_password_hash' => '', 'hint' => '']]; $new_settings = &$return['new_settings']; if (isset($params['new_password']) && $params['new_password'] !== '') { $client_salt = $this->createSalt($this->new_algo['salt1']); $server_salt = $this->new_algo['salt2']; $g = $this->new_algo['g']; $p = $this->new_algo['p']; $pForHash = $this->new_algo['pForHash']; $x = new BigInteger($this->hashPassword($params['new_password'], $client_salt, $server_salt), 256); $v = $g->powMod($x, $p); $vForHash = str_pad($v->toBytes(), 256, chr(0), \STR_PAD_LEFT); $new_settings['new_algo'] = [ '_' => 'passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow', 'salt1' => $client_salt, 'salt2' => $server_salt, 'g' => (int) $g->toString(), 'p' => $pForHash, ]; $new_settings['new_password_hash'] = $vForHash; $new_settings['hint'] = $params['hint']; if (isset($params['email'])) { $new_settings['email'] = $params['email']; } } return $return; } } . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\MTProtoTools; /** * Manages acknowledgement of messages. */ trait AckHandler { public function ack_outgoing_message_id($message_id, $datacenter) { // The server acknowledges that it received my message if (!isset($this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id])) { $this->logger->logger("WARNING: Couldn't find message id ".$message_id.' in the array of outgoing messages. Maybe try to increase its size?', \danog\MadelineProto\Logger::WARNING); return false; } //$this->logger->logger("Ack-ed ".$this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['_']." with message ID $message_id on DC $datacenter"); /* if (isset($this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['body'])) { unset($this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['body']); } if (isset($this->datacenter->sockets[$datacenter]->new_outgoing[$message_id])) { unset($this->datacenter->sockets[$datacenter]->new_outgoing[$message_id]); }*/ return true; } public function got_response_for_outgoing_message_id($message_id, $datacenter) { // The server acknowledges that it received my message if (!isset($this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id])) { $this->logger->logger("WARNING: Couldn't find message id ".$message_id.' in the array of outgoing messages. Maybe try to increase its size?', \danog\MadelineProto\Logger::WARNING); return false; } if (isset($this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['body'])) { unset($this->datacenter->sockets[$datacenter]->outgoing_messages[$message_id]['body']); } if (isset($this->datacenter->sockets[$datacenter]->new_outgoing[$message_id])) { unset($this->datacenter->sockets[$datacenter]->new_outgoing[$message_id]); } return true; } public function ack_incoming_message_id($message_id, $datacenter) { // I let the server know that I received its message if (!isset($this->datacenter->sockets[$datacenter]->incoming_messages[$message_id])) { $this->logger->logger("WARNING: Couldn't find message id ".$message_id.' in the array of incoming messages. Maybe try to increase its size?', \danog\MadelineProto\Logger::WARNING); } /*if ($this->datacenter->sockets[$datacenter]->temp_auth_key['id'] === null || $this->datacenter->sockets[$datacenter]->temp_auth_key['id'] === "\0\0\0\0\0\0\0\0") { // || (isset($this->datacenter->sockets[$datacenter]->incoming_messages[$message_id]['ack']) && $this->datacenter->sockets[$datacenter]->incoming_messages[$message_id]['ack'])) { return; }*/ $this->datacenter->sockets[$datacenter]->ack_queue[$message_id] = $message_id; return true; } } { "constructors": [ { "id": "-1132882121", "predicate": "boolFalse", "params": [], "type": "Bool" }, { "id": "-1720552011", "predicate": "boolTrue", "params": [], "type": "Bool" }, { "id": "1072550713", "predicate": "true", "params": [], "type": "True" }, { "id": "481674261", "predicate": "vector", "params": [], "type": "Vector t" }, { "id": "-994444869", "predicate": "error", "params": [ { "name": "code", "type": "int" }, { "name": "text", "type": "string" } ], "type": "Error" }, { "id": "1450380236", "predicate": "null", "params": [], "type": "Null" }, { "id": "2134579434", "predicate": "inputPeerEmpty", "params": [], "type": "InputPeer" }, { "id": "2107670217", "predicate": "inputPeerSelf", "params": [], "type": "InputPeer" }, { "id": "270785512", "predicate": "inputPeerContact", "params": [ { "name": "user_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1690012891", "predicate": "inputPeerForeign", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "396093539", "predicate": "inputPeerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1182234929", "predicate": "inputUserEmpty", "params": [], "type": "InputUser" }, { "id": "-138301121", "predicate": "inputUserSelf", "params": [], "type": "InputUser" }, { "id": "-2031530139", "predicate": "inputUserContact", "params": [ { "name": "user_id", "type": "int" } ], "type": "InputUser" }, { "id": "1700689151", "predicate": "inputUserForeign", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputUser" }, { "id": "-208488460", "predicate": "inputPhoneContact", "params": [ { "name": "client_id", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputContact" }, { "id": "-181407105", "predicate": "inputFile", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" }, { "name": "md5_checksum", "type": "string" } ], "type": "InputFile" }, { "id": "-1771768449", "predicate": "inputMediaEmpty", "params": [], "type": "InputMedia" }, { "id": "767900285", "predicate": "inputMediaUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" } ], "type": "InputMedia" }, { "id": "-1893027092", "predicate": "inputMediaPhoto", "params": [ { "name": "id", "type": "InputPhoto" } ], "type": "InputMedia" }, { "id": "-104578748", "predicate": "inputMediaGeoPoint", "params": [ { "name": "geo_point", "type": "InputGeoPoint" } ], "type": "InputMedia" }, { "id": "-1494984313", "predicate": "inputMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputMedia" }, { "id": "322623222", "predicate": "inputMediaUploadedVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1726817601", "predicate": "inputMediaUploadedThumbVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "2130852582", "predicate": "inputMediaVideo", "params": [ { "name": "id", "type": "InputVideo" } ], "type": "InputMedia" }, { "id": "480546647", "predicate": "inputChatPhotoEmpty", "params": [], "type": "InputChatPhoto" }, { "id": "-1809496270", "predicate": "inputChatUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-1293828344", "predicate": "inputChatPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-457104426", "predicate": "inputGeoPointEmpty", "params": [], "type": "InputGeoPoint" }, { "id": "-206066487", "predicate": "inputGeoPoint", "params": [ { "name": "lat", "type": "double" }, { "name": "long", "type": "double" } ], "type": "InputGeoPoint" }, { "id": "483901197", "predicate": "inputPhotoEmpty", "params": [], "type": "InputPhoto" }, { "id": "-74070332", "predicate": "inputPhoto", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputPhoto" }, { "id": "1426648181", "predicate": "inputVideoEmpty", "params": [], "type": "InputVideo" }, { "id": "-296249774", "predicate": "inputVideo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputVideo" }, { "id": "342061462", "predicate": "inputFileLocation", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1023632620", "predicate": "inputVideoFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-1377390588", "predicate": "inputPhotoCropAuto", "params": [], "type": "InputPhotoCrop" }, { "id": "-644787419", "predicate": "inputPhotoCrop", "params": [ { "name": "crop_left", "type": "double" }, { "name": "crop_top", "type": "double" }, { "name": "crop_width", "type": "double" } ], "type": "InputPhotoCrop" }, { "id": "1996904104", "predicate": "inputAppEvent", "params": [ { "name": "time", "type": "double" }, { "name": "type", "type": "string" }, { "name": "peer", "type": "long" }, { "name": "data", "type": "string" } ], "type": "InputAppEvent" }, { "id": "-1649296275", "predicate": "peerUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "Peer" }, { "id": "-1160714821", "predicate": "peerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Peer" }, { "id": "-1432995067", "predicate": "storage.fileUnknown", "params": [], "type": "storage.FileType" }, { "id": "8322574", "predicate": "storage.fileJpeg", "params": [], "type": "storage.FileType" }, { "id": "-891180321", "predicate": "storage.fileGif", "params": [], "type": "storage.FileType" }, { "id": "172975040", "predicate": "storage.filePng", "params": [], "type": "storage.FileType" }, { "id": "-1373745011", "predicate": "storage.filePdf", "params": [], "type": "storage.FileType" }, { "id": "1384777335", "predicate": "storage.fileMp3", "params": [], "type": "storage.FileType" }, { "id": "1258941372", "predicate": "storage.fileMov", "params": [], "type": "storage.FileType" }, { "id": "1086091090", "predicate": "storage.filePartial", "params": [], "type": "storage.FileType" }, { "id": "-1278304028", "predicate": "storage.fileMp4", "params": [], "type": "storage.FileType" }, { "id": "276907596", "predicate": "storage.fileWebp", "params": [], "type": "storage.FileType" }, { "id": "2086234950", "predicate": "fileLocationUnavailable", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "1406570614", "predicate": "fileLocation", "params": [ { "name": "dc_id", "type": "int" }, { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "537022650", "predicate": "userEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "User" }, { "id": "1879553105", "predicate": "userSelf", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "phone", "type": "string" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" }, { "name": "inactive", "type": "Bool" } ], "type": "User" }, { "id": "-894214632", "predicate": "userContact", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "access_hash", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" } ], "type": "User" }, { "id": "-640891665", "predicate": "userRequest", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "access_hash", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" } ], "type": "User" }, { "id": "123533224", "predicate": "userForeign", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "access_hash", "type": "long" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" } ], "type": "User" }, { "id": "-704549510", "predicate": "userDeleted", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "User" }, { "id": "1326562017", "predicate": "userProfilePhotoEmpty", "params": [], "type": "UserProfilePhoto" }, { "id": "-715532088", "predicate": "userProfilePhoto", "params": [ { "name": "photo_id", "type": "long" }, { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "UserProfilePhoto" }, { "id": "164646985", "predicate": "userStatusEmpty", "params": [], "type": "UserStatus" }, { "id": "-306628279", "predicate": "userStatusOnline", "params": [ { "name": "expires", "type": "int" } ], "type": "UserStatus" }, { "id": "9203775", "predicate": "userStatusOffline", "params": [ { "name": "was_online", "type": "int" } ], "type": "UserStatus" }, { "id": "-1683826688", "predicate": "chatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Chat" }, { "id": "1855757255", "predicate": "chat", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "left", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Chat" }, { "id": "-83047359", "predicate": "chatForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "date", "type": "int" } ], "type": "Chat" }, { "id": "1661886910", "predicate": "chatFull", "params": [ { "name": "id", "type": "int" }, { "name": "participants", "type": "ChatParticipants" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "ChatFull" }, { "id": "-925415106", "predicate": "chatParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "265468810", "predicate": "chatParticipantsForbidden", "params": [ { "name": "chat_id", "type": "int" } ], "type": "ChatParticipants" }, { "id": "2017571861", "predicate": "chatParticipants", "params": [ { "name": "chat_id", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participants", "type": "Vector" }, { "name": "version", "type": "int" } ], "type": "ChatParticipants" }, { "id": "935395612", "predicate": "chatPhotoEmpty", "params": [], "type": "ChatPhoto" }, { "id": "1632839530", "predicate": "chatPhoto", "params": [ { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "ChatPhoto" }, { "id": "-2082087340", "predicate": "messageEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Message" }, { "id": "1450613171", "predicate": "message", "params": [ { "name": "flags", "type": "int" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" } ], "type": "Message" }, { "id": "-1553471722", "predicate": "messageForwarded", "params": [ { "name": "flags", "type": "int" }, { "name": "id", "type": "int" }, { "name": "fwd_from_id", "type": "int" }, { "name": "fwd_date", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" } ], "type": "Message" }, { "id": "495384334", "predicate": "messageService", "params": [ { "name": "flags", "type": "int" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "Message" }, { "id": "1038967584", "predicate": "messageMediaEmpty", "params": [], "type": "MessageMedia" }, { "id": "-926655958", "predicate": "messageMediaPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageMedia" }, { "id": "-1563278704", "predicate": "messageMediaVideo", "params": [ { "name": "video", "type": "Video" } ], "type": "MessageMedia" }, { "id": "1457575028", "predicate": "messageMediaGeo", "params": [ { "name": "geo", "type": "GeoPoint" } ], "type": "MessageMedia" }, { "id": "1585262393", "predicate": "messageMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "user_id", "type": "int" } ], "type": "MessageMedia" }, { "id": "694364726", "predicate": "messageMediaUnsupported", "params": [ { "name": "bytes", "type": "bytes" } ], "type": "MessageMedia" }, { "id": "-1230047312", "predicate": "messageActionEmpty", "params": [], "type": "MessageAction" }, { "id": "-1503425638", "predicate": "messageActionChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "users", "type": "Vector" } ], "type": "MessageAction" }, { "id": "-1247687078", "predicate": "messageActionChatEditTitle", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "2144015272", "predicate": "messageActionChatEditPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageAction" }, { "id": "-1780220945", "predicate": "messageActionChatDeletePhoto", "params": [], "type": "MessageAction" }, { "id": "1581055051", "predicate": "messageActionChatAddUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1297179892", "predicate": "messageActionChatDeleteUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1422222932", "predicate": "dialog", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Dialog" }, { "id": "590459437", "predicate": "photoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Photo" }, { "id": "582313809", "predicate": "photo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "caption", "type": "string" }, { "name": "geo", "type": "GeoPoint" }, { "name": "sizes", "type": "Vector" } ], "type": "Photo" }, { "id": "236446268", "predicate": "photoSizeEmpty", "params": [ { "name": "type", "type": "string" } ], "type": "PhotoSize" }, { "id": "2009052699", "predicate": "photoSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "size", "type": "int" } ], "type": "PhotoSize" }, { "id": "-374917894", "predicate": "photoCachedSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "PhotoSize" }, { "id": "-1056548696", "predicate": "videoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Video" }, { "id": "948937617", "predicate": "video", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "caption", "type": "string" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "Video" }, { "id": "286776671", "predicate": "geoPointEmpty", "params": [], "type": "GeoPoint" }, { "id": "541710092", "predicate": "geoPoint", "params": [ { "name": "long", "type": "double" }, { "name": "lat", "type": "double" } ], "type": "GeoPoint" }, { "id": "-486486981", "predicate": "auth.checkedPhone", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_invited", "type": "Bool" } ], "type": "auth.CheckedPhone" }, { "id": "-269659687", "predicate": "auth.sentCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "-155815004", "predicate": "auth.authorization", "params": [ { "name": "expires", "type": "int" }, { "name": "user", "type": "User" } ], "type": "auth.Authorization" }, { "id": "-543777747", "predicate": "auth.exportedAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.ExportedAuthorization" }, { "id": "-1195615476", "predicate": "inputNotifyPeer", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "InputNotifyPeer" }, { "id": "423314455", "predicate": "inputNotifyUsers", "params": [], "type": "InputNotifyPeer" }, { "id": "1251338318", "predicate": "inputNotifyChats", "params": [], "type": "InputNotifyPeer" }, { "id": "-1540769658", "predicate": "inputNotifyAll", "params": [], "type": "InputNotifyPeer" }, { "id": "-265263912", "predicate": "inputPeerNotifyEventsEmpty", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "-395694988", "predicate": "inputPeerNotifyEventsAll", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "1185074840", "predicate": "inputPeerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "InputPeerNotifySettings" }, { "id": "-1378534221", "predicate": "peerNotifyEventsEmpty", "params": [], "type": "PeerNotifyEvents" }, { "id": "1830677896", "predicate": "peerNotifyEventsAll", "params": [], "type": "PeerNotifyEvents" }, { "id": "1889961234", "predicate": "peerNotifySettingsEmpty", "params": [], "type": "PeerNotifySettings" }, { "id": "-1923214866", "predicate": "peerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "PeerNotifySettings" }, { "id": "-860866985", "predicate": "wallPaper", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "sizes", "type": "Vector" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "1490799288", "predicate": "inputReportReasonSpam", "params": [], "type": "ReportReason" }, { "id": "505595789", "predicate": "inputReportReasonViolence", "params": [], "type": "ReportReason" }, { "id": "777640226", "predicate": "inputReportReasonPornography", "params": [], "type": "ReportReason" }, { "id": "-512463606", "predicate": "inputReportReasonOther", "params": [ { "name": "text", "type": "string" } ], "type": "ReportReason" }, { "id": "1997575642", "predicate": "userFull", "params": [ { "name": "user", "type": "User" }, { "name": "link", "type": "contacts.Link" }, { "name": "profile_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "blocked", "type": "Bool" }, { "name": "real_first_name", "type": "string" }, { "name": "real_last_name", "type": "string" } ], "type": "UserFull" }, { "id": "-116274796", "predicate": "contact", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual", "type": "Bool" } ], "type": "Contact" }, { "id": "-805141448", "predicate": "importedContact", "params": [ { "name": "user_id", "type": "int" }, { "name": "client_id", "type": "long" } ], "type": "ImportedContact" }, { "id": "1444661369", "predicate": "contactBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ContactBlocked" }, { "id": "1038193057", "predicate": "contactSuggested", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual_contacts", "type": "int" } ], "type": "ContactSuggested" }, { "id": "-748155807", "predicate": "contactStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "ContactStatus" }, { "id": "322183672", "predicate": "contacts.foreignLinkUnknown", "params": [], "type": "contacts.ForeignLink" }, { "id": "-1484775609", "predicate": "contacts.foreignLinkRequested", "params": [ { "name": "has_phone", "type": "Bool" } ], "type": "contacts.ForeignLink" }, { "id": "468356321", "predicate": "contacts.foreignLinkMutual", "params": [], "type": "contacts.ForeignLink" }, { "id": "-768992160", "predicate": "contacts.myLinkEmpty", "params": [], "type": "contacts.MyLink" }, { "id": "1818882030", "predicate": "contacts.myLinkRequested", "params": [ { "name": "contact", "type": "Bool" } ], "type": "contacts.MyLink" }, { "id": "-1035932711", "predicate": "contacts.myLinkContact", "params": [], "type": "contacts.MyLink" }, { "id": "-322001931", "predicate": "contacts.link", "params": [ { "name": "my_link", "type": "contacts.MyLink" }, { "name": "foreign_link", "type": "contacts.ForeignLink" }, { "name": "user", "type": "User" } ], "type": "contacts.Link" }, { "id": "-1219778094", "predicate": "contacts.contactsNotModified", "params": [], "type": "contacts.Contacts" }, { "id": "1871416498", "predicate": "contacts.contacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Contacts" }, { "id": "-1387117803", "predicate": "contacts.importedContacts", "params": [ { "name": "imported", "type": "Vector" }, { "name": "retry_contacts", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.ImportedContacts" }, { "id": "471043349", "predicate": "contacts.blocked", "params": [ { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "-1878523231", "predicate": "contacts.blockedSlice", "params": [ { "name": "count", "type": "int" }, { "name": "blocked", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Blocked" }, { "id": "1447681221", "predicate": "contacts.suggested", "params": [ { "name": "results", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Suggested" }, { "id": "364538944", "predicate": "messages.dialogs", "params": [ { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "1910543603", "predicate": "messages.dialogsSlice", "params": [ { "name": "count", "type": "int" }, { "name": "dialogs", "type": "Vector" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Dialogs" }, { "id": "-1938715001", "predicate": "messages.messages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "189033187", "predicate": "messages.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "-1768654661", "predicate": "messages.statedMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "messages.StatedMessages" }, { "id": "-797251802", "predicate": "messages.statedMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "messages.StatedMessage" }, { "id": "-772484260", "predicate": "messages.sentMessage", "params": [ { "name": "id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "messages.SentMessage" }, { "id": "-2125411368", "predicate": "messages.chats", "params": [ { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "-438840932", "predicate": "messages.chatFull", "params": [ { "name": "full_chat", "type": "ChatFull" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "messages.ChatFull" }, { "id": "-1210173710", "predicate": "messages.affectedHistory", "params": [ { "name": "pts", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "1474492012", "predicate": "inputMessagesFilterEmpty", "params": [], "type": "MessagesFilter" }, { "id": "-1777752804", "predicate": "inputMessagesFilterPhotos", "params": [], "type": "MessagesFilter" }, { "id": "-1614803355", "predicate": "inputMessagesFilterVideo", "params": [], "type": "MessagesFilter" }, { "id": "1458172132", "predicate": "inputMessagesFilterPhotoVideo", "params": [], "type": "MessagesFilter" }, { "id": "-648121413", "predicate": "inputMessagesFilterPhotoVideoDocuments", "params": [], "type": "MessagesFilter" }, { "id": "-1629621880", "predicate": "inputMessagesFilterDocument", "params": [], "type": "MessagesFilter" }, { "id": "-808946398", "predicate": "inputMessagesFilterAudio", "params": [], "type": "MessagesFilter" }, { "id": "1526462308", "predicate": "inputMessagesFilterAudioDocuments", "params": [], "type": "MessagesFilter" }, { "id": "2129714567", "predicate": "inputMessagesFilterUrl", "params": [], "type": "MessagesFilter" }, { "id": "-3644025", "predicate": "inputMessagesFilterGif", "params": [], "type": "MessagesFilter" }, { "id": "20626867", "predicate": "updateNewMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" } ], "type": "Update" }, { "id": "1318109142", "predicate": "updateMessageID", "params": [ { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Update" }, { "id": "-966484431", "predicate": "updateReadMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" } ], "type": "Update" }, { "id": "-1456734682", "predicate": "updateDeleteMessages", "params": [ { "name": "messages", "type": "Vector" }, { "name": "pts", "type": "int" } ], "type": "Update" }, { "id": "1548249383", "predicate": "updateUserTyping", "params": [ { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "-1704596961", "predicate": "updateChatUserTyping", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "125178264", "predicate": "updateChatParticipants", "params": [ { "name": "participants", "type": "ChatParticipants" } ], "type": "Update" }, { "id": "469489699", "predicate": "updateUserStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "Update" }, { "id": "-1489818765", "predicate": "updateUserName", "params": [ { "name": "user_id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "Update" }, { "id": "-1791935732", "predicate": "updateUserPhoto", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "previous", "type": "Bool" } ], "type": "Update" }, { "id": "628472761", "predicate": "updateContactRegistered", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "1369737882", "predicate": "updateContactLink", "params": [ { "name": "user_id", "type": "int" }, { "name": "my_link", "type": "contacts.MyLink" }, { "name": "foreign_link", "type": "contacts.ForeignLink" } ], "type": "Update" }, { "id": "-1895411046", "predicate": "updateNewAuthorization", "params": [ { "name": "auth_key_id", "type": "long" }, { "name": "date", "type": "int" }, { "name": "device", "type": "string" }, { "name": "location", "type": "string" } ], "type": "Update" }, { "id": "-1519637954", "predicate": "updates.state", "params": [ { "name": "pts", "type": "int" }, { "name": "qts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "unread_count", "type": "int" } ], "type": "updates.State" }, { "id": "1567990072", "predicate": "updates.differenceEmpty", "params": [ { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "updates.Difference" }, { "id": "16030880", "predicate": "updates.difference", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-1459938943", "predicate": "updates.differenceSlice", "params": [ { "name": "new_messages", "type": "Vector" }, { "name": "new_encrypted_messages", "type": "Vector" }, { "name": "other_updates", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "intermediate_state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-484987010", "predicate": "updatesTooLong", "params": [], "type": "Updates" }, { "id": "-738961532", "predicate": "updateShortMessage", "params": [ { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "724548942", "predicate": "updateShortChatMessage", "params": [ { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "chat_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "2027216577", "predicate": "updateShort", "params": [ { "name": "update", "type": "Update" }, { "name": "date", "type": "int" } ], "type": "Updates" }, { "id": "1918567619", "predicate": "updatesCombined", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq_start", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "1957577280", "predicate": "updates", "params": [ { "name": "updates", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "-1916114267", "predicate": "photos.photos", "params": [ { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "352657236", "predicate": "photos.photosSlice", "params": [ { "name": "count", "type": "int" }, { "name": "photos", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photos" }, { "id": "539045032", "predicate": "photos.photo", "params": [ { "name": "photo", "type": "Photo" }, { "name": "users", "type": "Vector" } ], "type": "photos.Photo" }, { "id": "157948117", "predicate": "upload.file", "params": [ { "name": "type", "type": "storage.FileType" }, { "name": "mtime", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "upload.File" }, { "id": "784507964", "predicate": "dcOption", "params": [ { "name": "id", "type": "int" }, { "name": "hostname", "type": "string" }, { "name": "ip_address", "type": "string" }, { "name": "port", "type": "int" } ], "type": "DcOption" }, { "id": "2108568544", "predicate": "config", "params": [ { "name": "date", "type": "int" }, { "name": "expires", "type": "int" }, { "name": "test_mode", "type": "Bool" }, { "name": "this_dc", "type": "int" }, { "name": "dc_options", "type": "Vector" }, { "name": "chat_big_size", "type": "int" }, { "name": "chat_size_max", "type": "int" }, { "name": "broadcast_size_max", "type": "int" }, { "name": "disabled_features", "type": "Vector" } ], "type": "Config" }, { "id": "-1910892683", "predicate": "nearestDc", "params": [ { "name": "country", "type": "string" }, { "name": "this_dc", "type": "int" }, { "name": "nearest_dc", "type": "int" } ], "type": "NearestDc" }, { "id": "-1987579119", "predicate": "help.appUpdate", "params": [ { "name": "id", "type": "int" }, { "name": "critical", "type": "Bool" }, { "name": "url", "type": "string" }, { "name": "text", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "-1000708810", "predicate": "help.noAppUpdate", "params": [], "type": "help.AppUpdate" }, { "id": "415997816", "predicate": "help.inviteText", "params": [ { "name": "message", "type": "string" } ], "type": "help.InviteText" }, { "id": "1047852486", "predicate": "messages.statedMessagesLinks", "params": [ { "name": "messages", "type": "Vector" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "links", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "messages.StatedMessages" }, { "id": "-1448138623", "predicate": "messages.statedMessageLink", "params": [ { "name": "message", "type": "Message" }, { "name": "chats", "type": "Vector" }, { "name": "users", "type": "Vector" }, { "name": "links", "type": "Vector" }, { "name": "pts", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "messages.StatedMessage" }, { "id": "-371504577", "predicate": "messages.sentMessageLink", "params": [ { "name": "id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "links", "type": "Vector" } ], "type": "messages.SentMessage" }, { "id": "1662091044", "predicate": "wallPaperSolid", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "bg_color", "type": "int" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "314359194", "predicate": "updateNewEncryptedMessage", "params": [ { "name": "message", "type": "EncryptedMessage" }, { "name": "qts", "type": "int" } ], "type": "Update" }, { "id": "386986326", "predicate": "updateEncryptedChatTyping", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Update" }, { "id": "-1264392051", "predicate": "updateEncryption", "params": [ { "name": "chat", "type": "EncryptedChat" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "956179895", "predicate": "updateEncryptedMessagesRead", "params": [ { "name": "chat_id", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1417756512", "predicate": "encryptedChatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "1006044124", "predicate": "encryptedChatWaiting", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-931638658", "predicate": "encryptedChatRequested", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "-94974410", "predicate": "encryptedChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a_or_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "332848423", "predicate": "encryptedChatDiscarded", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-247351839", "predicate": "inputEncryptedChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedChat" }, { "id": "-1038136962", "predicate": "encryptedFileEmpty", "params": [], "type": "EncryptedFile" }, { "id": "1248893260", "predicate": "encryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "EncryptedFile" }, { "id": "406307684", "predicate": "inputEncryptedFileEmpty", "params": [], "type": "InputEncryptedFile" }, { "id": "1690108678", "predicate": "inputEncryptedFileUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "md5_checksum", "type": "string" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "1511503333", "predicate": "inputEncryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedFile" }, { "id": "-182231723", "predicate": "inputEncryptedFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-317144808", "predicate": "encryptedMessage", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" }, { "name": "file", "type": "EncryptedFile" } ], "type": "EncryptedMessage" }, { "id": "594758406", "predicate": "encryptedMessageService", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "EncryptedMessage" }, { "id": "-1058912715", "predicate": "messages.dhConfigNotModified", "params": [ { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "740433629", "predicate": "messages.dhConfig", "params": [ { "name": "g", "type": "int" }, { "name": "p", "type": "bytes" }, { "name": "version", "type": "int" }, { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "1443858741", "predicate": "messages.sentEncryptedMessage", "params": [ { "name": "date", "type": "int" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1802240206", "predicate": "messages.sentEncryptedFile", "params": [ { "name": "date", "type": "int" }, { "name": "file", "type": "EncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-95482955", "predicate": "inputFileBig", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" } ], "type": "InputFile" }, { "id": "767652808", "predicate": "inputEncryptedFileBigUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "974056226", "predicate": "updateChatParticipantAdd", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1851755554", "predicate": "updateChatParticipantDelete", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1906403213", "predicate": "updateDcOptions", "params": [ { "name": "dc_options", "type": "Vector" } ], "type": "Update" }, { "id": "1313442987", "predicate": "inputMediaUploadedAudio", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1986820223", "predicate": "inputMediaAudio", "params": [ { "name": "id", "type": "InputAudio" } ], "type": "InputMedia" }, { "id": "-1610888", "predicate": "inputMediaUploadedDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "1095242886", "predicate": "inputMediaUploadedThumbDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector" } ], "type": "InputMedia" }, { "id": "-779818943", "predicate": "inputMediaDocument", "params": [ { "name": "id", "type": "InputDocument" } ], "type": "InputMedia" }, { "id": "802824708", "predicate": "messageMediaDocument", "params": [ { "name": "document", "type": "Document" } ], "type": "MessageMedia" }, { "id": "-961117440", "predicate": "messageMediaAudio", "params": [ { "name": "audio", "type": "Audio" } ], "type": "MessageMedia" }, { "id": "-648356732", "predicate": "inputAudioEmpty", "params": [], "type": "InputAudio" }, { "id": "2010398975", "predicate": "inputAudio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputAudio" }, { "id": "1928391342", "predicate": "inputDocumentEmpty", "params": [], "type": "InputDocument" }, { "id": "410618194", "predicate": "inputDocument", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputDocument" }, { "id": "1960591437", "predicate": "inputAudioFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1313188841", "predicate": "inputDocumentFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1483311320", "predicate": "audioEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Audio" }, { "id": "-945003370", "predicate": "audio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" } ], "type": "Audio" }, { "id": "922273905", "predicate": "documentEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Document" }, { "id": "-106717361", "predicate": "document", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "attributes", "type": "Vector" } ], "type": "Document" }, { "id": "398898678", "predicate": "help.support", "params": [ { "name": "phone_number", "type": "string" }, { "name": "user", "type": "User" } ], "type": "help.Support" }, { "id": "-1613493288", "predicate": "notifyPeer", "params": [ { "name": "peer", "type": "Peer" } ], "type": "NotifyPeer" }, { "id": "-1261946036", "predicate": "notifyUsers", "params": [], "type": "NotifyPeer" }, { "id": "-1073230141", "predicate": "notifyChats", "params": [], "type": "NotifyPeer" }, { "id": "1959820384", "predicate": "notifyAll", "params": [], "type": "NotifyPeer" }, { "id": "-2131957734", "predicate": "updateUserBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "blocked", "type": "Bool" } ], "type": "Update" }, { "id": "-1094555409", "predicate": "updateNotifySettings", "params": [ { "name": "peer", "type": "NotifyPeer" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Update" }, { "id": "-484053553", "predicate": "auth.sentAppCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "381645902", "predicate": "sendMessageTypingAction", "params": [], "type": "SendMessageAction" }, { "id": "-44119819", "predicate": "sendMessageCancelAction", "params": [], "type": "SendMessageAction" }, { "id": "-1584933265", "predicate": "sendMessageRecordVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-1845219337", "predicate": "sendMessageUploadVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-718310409", "predicate": "sendMessageRecordAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-424899985", "predicate": "sendMessageUploadAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-1727382502", "predicate": "sendMessageUploadPhotoAction", "params": [], "type": "SendMessageAction" }, { "id": "-1884362354", "predicate": "sendMessageUploadDocumentAction", "params": [], "type": "SendMessageAction" }, { "id": "393186209", "predicate": "sendMessageGeoLocationAction", "params": [], "type": "SendMessageAction" }, { "id": "1653390447", "predicate": "sendMessageChooseContactAction", "params": [], "type": "SendMessageAction" }, { "id": "-360210539", "predicate": "contactFound", "params": [ { "name": "user_id", "type": "int" } ], "type": "ContactFound" }, { "id": "90570766", "predicate": "contacts.found", "params": [ { "name": "results", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "contacts.Found" }, { "id": "942527460", "predicate": "updateServiceNotification", "params": [ { "name": "type", "type": "string" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" }, { "name": "popup", "type": "Bool" } ], "type": "Update" }, { "id": "-496024847", "predicate": "userStatusRecently", "params": [], "type": "UserStatus" }, { "id": "129960444", "predicate": "userStatusLastWeek", "params": [], "type": "UserStatus" }, { "id": "2011940674", "predicate": "userStatusLastMonth", "params": [], "type": "UserStatus" }, { "id": "-298113238", "predicate": "updatePrivacy", "params": [ { "name": "key", "type": "PrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "Update" }, { "id": "1335282456", "predicate": "inputPrivacyKeyStatusTimestamp", "params": [], "type": "InputPrivacyKey" }, { "id": "-1137792208", "predicate": "privacyKeyStatusTimestamp", "params": [], "type": "PrivacyKey" }, { "id": "218751099", "predicate": "inputPrivacyValueAllowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "407582158", "predicate": "inputPrivacyValueAllowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "320652927", "predicate": "inputPrivacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "195371015", "predicate": "inputPrivacyValueDisallowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "-697604407", "predicate": "inputPrivacyValueDisallowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "-1877932953", "predicate": "inputPrivacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "InputPrivacyRule" }, { "id": "-123988", "predicate": "privacyValueAllowContacts", "params": [], "type": "PrivacyRule" }, { "id": "1698855810", "predicate": "privacyValueAllowAll", "params": [], "type": "PrivacyRule" }, { "id": "1297858060", "predicate": "privacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "-125240806", "predicate": "privacyValueDisallowContacts", "params": [], "type": "PrivacyRule" }, { "id": "-1955338397", "predicate": "privacyValueDisallowAll", "params": [], "type": "PrivacyRule" }, { "id": "209668535", "predicate": "privacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector" } ], "type": "PrivacyRule" }, { "id": "1430961007", "predicate": "account.privacyRules", "params": [ { "name": "rules", "type": "Vector" }, { "name": "users", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "-1194283041", "predicate": "accountDaysTTL", "params": [ { "name": "days", "type": "int" } ], "type": "AccountDaysTTL" }, { "id": "-1527411636", "predicate": "account.sentChangePhoneCode", "params": [ { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" } ], "type": "account.SentChangePhoneCode" }, { "id": "314130811", "predicate": "updateUserPhone", "params": [ { "name": "user_id", "type": "int" }, { "name": "phone", "type": "string" } ], "type": "Update" }, { "id": "1815593308", "predicate": "documentAttributeImageSize", "params": [ { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "297109817", "predicate": "documentAttributeAnimated", "params": [], "type": "DocumentAttribute" }, { "id": "-83208409", "predicate": "documentAttributeSticker", "params": [], "type": "DocumentAttribute" }, { "id": "1494273227", "predicate": "documentAttributeVideo", "params": [ { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "85215461", "predicate": "documentAttributeAudio", "params": [ { "name": "duration", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "358154344", "predicate": "documentAttributeFilename", "params": [ { "name": "file_name", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "-244016606", "predicate": "messages.stickersNotModified", "params": [], "type": "messages.Stickers" }, { "id": "-1970352846", "predicate": "messages.stickers", "params": [ { "name": "hash", "type": "string" }, { "name": "stickers", "type": "Vector" } ], "type": "messages.Stickers" }, { "id": "313694676", "predicate": "stickerPack", "params": [ { "name": "emoticon", "type": "string" }, { "name": "documents", "type": "Vector" } ], "type": "StickerPack" }, { "id": "-395967805", "predicate": "messages.allStickersNotModified", "params": [], "type": "messages.AllStickers" }, { "id": "-588304126", "predicate": "messages.allStickers", "params": [ { "name": "hash", "type": "string" }, { "name": "packs", "type": "Vector" }, { "name": "documents", "type": "Vector" } ], "type": "messages.AllStickers" }, { "id": "-1369215196", "predicate": "disabledFeature", "params": [ { "name": "feature", "type": "string" }, { "name": "description", "type": "string" } ], "type": "DisabledFeature" } ], "methods": [ { "id": "-878758099", "method": "invokeAfterMsg", "params": [ { "name": "msg_id", "type": "long" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1036301552", "method": "invokeAfterMsgs", "params": [ { "name": "msg_ids", "type": "Vector" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1877286395", "method": "auth.checkPhone", "params": [ { "name": "phone_number", "type": "string" } ], "type": "auth.CheckedPhone" }, { "id": "1988976461", "method": "auth.sendCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "sms_type", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "auth.SentCode" }, { "id": "63247716", "method": "auth.sendCall", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "453408308", "method": "auth.signUp", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1126886015", "method": "auth.signIn", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "1461180992", "method": "auth.logOut", "params": [], "type": "Bool" }, { "id": "-1616179942", "method": "auth.resetAuthorizations", "params": [], "type": "Bool" }, { "id": "1998331287", "method": "auth.sendInvites", "params": [ { "name": "phone_numbers", "type": "Vector" }, { "name": "message", "type": "string" } ], "type": "Bool" }, { "id": "-440401971", "method": "auth.exportAuthorization", "params": [ { "name": "dc_id", "type": "int" } ], "type": "auth.ExportedAuthorization" }, { "id": "-470837741", "method": "auth.importAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-841733627", "method": "auth.bindTempAuthKey", "params": [ { "name": "perm_auth_key_id", "type": "long" }, { "name": "nonce", "type": "long" }, { "name": "expires_at", "type": "int" }, { "name": "encrypted_message", "type": "bytes" } ], "type": "Bool" }, { "id": "1147957548", "method": "account.registerDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "app_sandbox", "type": "Bool" }, { "name": "lang_code", "type": "string" } ], "type": "Bool" }, { "id": "1707432768", "method": "account.unregisterDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" } ], "type": "Bool" }, { "id": "-2067899501", "method": "account.updateNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" }, { "name": "settings", "type": "InputPeerNotifySettings" } ], "type": "Bool" }, { "id": "313765169", "method": "account.getNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" } ], "type": "PeerNotifySettings" }, { "id": "-612493497", "method": "account.resetNotifySettings", "params": [], "type": "Bool" }, { "id": "-259486360", "method": "account.updateProfile", "params": [ { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "User" }, { "id": "1713919532", "method": "account.updateStatus", "params": [ { "name": "offline", "type": "Bool" } ], "type": "Bool" }, { "id": "-1068696894", "method": "account.getWallPapers", "params": [], "type": "Vector" }, { "id": "-1374118561", "method": "account.reportPeer", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "reason", "type": "ReportReason" } ], "type": "Bool" }, { "id": "227648840", "method": "users.getUsers", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-902781519", "method": "users.getFullUser", "params": [ { "name": "id", "type": "InputUser" } ], "type": "UserFull" }, { "id": "-995929106", "method": "contacts.getStatuses", "params": [], "type": "Vector" }, { "id": "583445000", "method": "contacts.getContacts", "params": [ { "name": "hash", "type": "string" } ], "type": "contacts.Contacts" }, { "id": "-634342611", "method": "contacts.importContacts", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "replace", "type": "Bool" } ], "type": "contacts.ImportedContacts" }, { "id": "-847825880", "method": "contacts.getSuggested", "params": [ { "name": "limit", "type": "int" } ], "type": "contacts.Suggested" }, { "id": "-1902823612", "method": "contacts.deleteContact", "params": [ { "name": "id", "type": "InputUser" } ], "type": "contacts.Link" }, { "id": "1504393374", "method": "contacts.deleteContacts", "params": [ { "name": "id", "type": "Vector" } ], "type": "Bool" }, { "id": "858475004", "method": "contacts.block", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-448724803", "method": "contacts.unblock", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-176409329", "method": "contacts.getBlocked", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "contacts.Blocked" }, { "id": "-2065352905", "method": "contacts.exportCard", "params": [], "type": "Vector" }, { "id": "1340184318", "method": "contacts.importCard", "params": [ { "name": "export_card", "type": "Vector" } ], "type": "User" }, { "id": "1109588596", "method": "messages.getMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Messages" }, { "id": "-321970698", "method": "messages.getDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-1834885329", "method": "messages.getHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "132772523", "method": "messages.search", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "-287800122", "method": "messages.readHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "read_contents", "type": "Bool" } ], "type": "messages.AffectedHistory" }, { "id": "-185009311", "method": "messages.deleteHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "351460618", "method": "messages.deleteMessages", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "682347368", "method": "messages.receivedMessages", "params": [ { "name": "max_id", "type": "int" } ], "type": "Vector" }, { "id": "-1551737264", "method": "messages.setTyping", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Bool" }, { "id": "1289620139", "method": "messages.sendMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" } ], "type": "messages.SentMessage" }, { "id": "-1547149962", "method": "messages.sendMedia", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" } ], "type": "messages.StatedMessage" }, { "id": "1363988751", "method": "messages.forwardMessages", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "Vector" } ], "type": "messages.StatedMessages" }, { "id": "-820669733", "method": "messages.reportSpam", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "Bool" }, { "id": "1013621127", "method": "messages.getChats", "params": [ { "name": "id", "type": "Vector" } ], "type": "messages.Chats" }, { "id": "998448230", "method": "messages.getFullChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "messages.ChatFull" }, { "id": "-1262720843", "method": "messages.editChatTitle", "params": [ { "name": "chat_id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "messages.StatedMessage" }, { "id": "-662601187", "method": "messages.editChatPhoto", "params": [ { "name": "chat_id", "type": "int" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "messages.StatedMessage" }, { "id": "787082910", "method": "messages.addChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "fwd_limit", "type": "int" } ], "type": "messages.StatedMessage" }, { "id": "-1010447069", "method": "messages.deleteChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" } ], "type": "messages.StatedMessage" }, { "id": "1100847854", "method": "messages.createChat", "params": [ { "name": "users", "type": "Vector" }, { "name": "title", "type": "string" } ], "type": "messages.StatedMessage" }, { "id": "-304838614", "method": "updates.getState", "params": [], "type": "updates.State" }, { "id": "168039573", "method": "updates.getDifference", "params": [ { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "qts", "type": "int" } ], "type": "updates.Difference" }, { "id": "-285902432", "method": "photos.updateProfilePhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "UserProfilePhoto" }, { "id": "-720397176", "method": "photos.uploadProfilePhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "photos.Photo" }, { "id": "-2016444625", "method": "photos.deletePhotos", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "-1291540959", "method": "upload.saveFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "-475607115", "method": "upload.getFile", "params": [ { "name": "location", "type": "InputFileLocation" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "upload.File" }, { "id": "-990308245", "method": "help.getConfig", "params": [], "type": "Config" }, { "id": "531836966", "method": "help.getNearestDc", "params": [], "type": "NearestDc" }, { "id": "-938300290", "method": "help.getAppUpdate", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "1862465352", "method": "help.saveAppLog", "params": [ { "name": "events", "type": "Vector" } ], "type": "Bool" }, { "id": "-1532407418", "method": "help.getInviteText", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.InviteText" }, { "id": "-1209117380", "method": "photos.getUserPhotos", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "photos.Photos" }, { "id": "66319602", "method": "messages.forwardMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "messages.StatedMessage" }, { "id": "1102776690", "method": "messages.sendBroadcast", "params": [ { "name": "contacts", "type": "Vector" }, { "name": "message", "type": "string" }, { "name": "media", "type": "InputMedia" } ], "type": "messages.StatedMessages" }, { "id": "651135312", "method": "messages.getDhConfig", "params": [ { "name": "version", "type": "int" }, { "name": "random_length", "type": "int" } ], "type": "messages.DhConfig" }, { "id": "-162681021", "method": "messages.requestEncryption", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "random_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "1035731989", "method": "messages.acceptEncryption", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "g_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "-304536635", "method": "messages.discardEncryption", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Bool" }, { "id": "2031374829", "method": "messages.setEncryptedTyping", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "2135648522", "method": "messages.readEncryptedHistory", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "max_date", "type": "int" } ], "type": "Bool" }, { "id": "-1451792525", "method": "messages.sendEncrypted", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1701831834", "method": "messages.sendEncryptedFile", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" }, { "name": "file", "type": "InputEncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "852769188", "method": "messages.sendEncryptedService", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "1436924774", "method": "messages.receivedQueue", "params": [ { "name": "max_qts", "type": "int" } ], "type": "Vector" }, { "id": "-562337987", "method": "upload.saveBigFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "file_total_parts", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "1769565673", "method": "initConnection", "params": [ { "name": "api_id", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-1663104819", "method": "help.getSupport", "params": [], "type": "help.Support" }, { "id": "229241832", "method": "auth.sendSms", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "894131138", "method": "messages.readMessageContents", "params": [ { "name": "id", "type": "Vector" } ], "type": "Vector" }, { "id": "655677548", "method": "account.checkUsername", "params": [ { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "1040964988", "method": "account.updateUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "301470424", "method": "contacts.search", "params": [ { "name": "q", "type": "string" }, { "name": "limit", "type": "int" } ], "type": "contacts.Found" }, { "id": "-623130288", "method": "account.getPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" } ], "type": "account.PrivacyRules" }, { "id": "-906486552", "method": "account.setPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" }, { "name": "rules", "type": "Vector" } ], "type": "account.PrivacyRules" }, { "id": "1099779595", "method": "account.deleteAccount", "params": [ { "name": "reason", "type": "string" } ], "type": "Bool" }, { "id": "150761757", "method": "account.getAccountTTL", "params": [], "type": "AccountDaysTTL" }, { "id": "608323678", "method": "account.setAccountTTL", "params": [ { "name": "ttl", "type": "AccountDaysTTL" } ], "type": "Bool" }, { "id": "-627372787", "method": "invokeWithLayer", "params": [ { "name": "layer", "type": "int" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "200282908", "method": "contacts.resolveUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "-1543001868", "method": "account.sendChangePhoneCode", "params": [ { "name": "phone_number", "type": "string" } ], "type": "account.SentChangePhoneCode" }, { "id": "1891839707", "method": "account.changePhone", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "User" }, { "id": "-1373446075", "method": "messages.getStickers", "params": [ { "name": "emoticon", "type": "string" }, { "name": "hash", "type": "string" } ], "type": "messages.Stickers" }, { "id": "-1438922648", "method": "messages.getAllStickers", "params": [ { "name": "hash", "type": "string" } ], "type": "messages.AllStickers" }, { "id": "954152242", "method": "account.updateDeviceLocked", "params": [ { "name": "period", "type": "int" } ], "type": "Bool" } ] }. * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; use Amp\Socket\ClientConnectContext; use danog\MadelineProto\Stream\Common\BufferedRawStream; use danog\MadelineProto\Stream\ConnectionContext; use danog\MadelineProto\Stream\MTProtoTransport\AbridgedStream; use danog\MadelineProto\Stream\MTProtoTransport\FullStream; use danog\MadelineProto\Stream\MTProtoTransport\HttpsStream; use danog\MadelineProto\Stream\MTProtoTransport\HttpStream; use danog\MadelineProto\Stream\MTProtoTransport\IntermediatePaddedStream; use danog\MadelineProto\Stream\MTProtoTransport\IntermediateStream; use danog\MadelineProto\Stream\MTProtoTransport\ObfuscatedStream; use danog\MadelineProto\Stream\Proxy\HttpProxy; use danog\MadelineProto\Stream\Proxy\SocksProxy; use danog\MadelineProto\Stream\Transport\DefaultStream; use danog\MadelineProto\Stream\Transport\WssStream; use danog\MadelineProto\Stream\Transport\WsStream; /** * Manages datacenters. */ class DataCenter { use \danog\MadelineProto\Tools; use \danog\Serializable; public $sockets = []; public $curdc = 0; private $API; private $dclist = []; private $settings = []; public function __sleep() { return ['sockets', 'curdc', 'dclist', 'settings']; } public function __magic_construct($API, $dclist, $settings) { $this->API = $API; $this->dclist = $dclist; $this->settings = $settings; foreach ($this->sockets as $key => $socket) { if ($socket instanceof Connection) { $this->API->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['dc_con_stop'], $key), \danog\MadelineProto\Logger::VERBOSE); $socket->old = true; $socket->disconnect(); } else { unset($this->sockets[$key]); } } } public function dc_connect($dc_number) { return $this->wait($this->dc_connect_async($dc_number)); } public function dc_connect_async($dc_number): \Generator { if (isset($this->sockets[$dc_number]) && !isset($this->sockets[$dc_number]->old)) { return false; } $ctxs = $this->generate_contexts($dc_number); foreach ($ctxs as $ctx) { try { if (isset($this->sockets[$dc_number]->old)) { $this->sockets[$dc_number]->setExtra($this->API); yield $this->sockets[$dc_number]->connect($ctx); } else { $this->sockets[$dc_number] = new Connection(); $this->sockets[$dc_number]->setExtra($this->API); yield $this->sockets[$dc_number]->connect($ctx); } $this->API->logger->logger('OK!', \danog\MadelineProto\Logger::WARNING); return true; } catch (\Throwable $e) { $this->API->logger->logger('Connection failed: '.$e->getMessage(), \danog\MadelineProto\Logger::ERROR); } catch (\Exception $e) { $this->API->logger->logger('Connection failed: '.$e->getMessage(), \danog\MadelineProto\Logger::ERROR); } } throw new \danog\MadelineProto\Exception("Could not connect to DC $dc_number"); } public function generate_contexts($dc_number) { $ctxs = []; $combos = []; $dc_config_number = isset($this->settings[$dc_number]) ? $dc_number : 'all'; $test = $this->settings[$dc_config_number]['test_mode'] ? 'test' : 'main'; $ipv6 = $this->settings[$dc_config_number]['ipv6'] ? 'ipv6' : 'ipv4'; switch ($this->settings[$dc_config_number]['protocol']) { case 'tcp_abridged': $default = [[DefaultStream::getName(), []], [BufferedRawStream::getName(), []], [AbridgedStream::getName(), []]]; break; case 'tcp_intermediate': $default = [[DefaultStream::getName(), []], [BufferedRawStream::getName(), []], [IntermediateStream::getName(), []]]; break; case 'tcp_intermediate_padded': $default = [[DefaultStream::getName(), []], [BufferedRawStream::getName(), []], [IntermediatePaddedStream::getName(), []]]; break; case 'tcp_full': $default = [[DefaultStream::getName(), []], [BufferedRawStream::getName(), []], [FullStream::getName(), []]]; break; case 'http': $default = [[DefaultStream::getName(), []], [BufferedRawStream::getName(), []], [HttpStream::getName(), []]]; break; case 'https': $default = [[DefaultStream::getName(), []], [BufferedRawStream::getName(), []], [HttpsStream::getName(), []]]; break; default: throw new Exception(\danog\MadelineProto\Lang::$current_lang['protocol_invalid']); } if ($this->settings[$dc_config_number]['obfuscated'] && !in_array($default[1][0], [HttpsStream::getName(), HttpStream::getName()])) { $default = [[DefaultStream::getName(), []], [BufferedRawStream::getName(), []], [ObfuscatedStream::getName(), []], end($default)]; } if ($this->settings[$dc_config_number]['transport'] && !in_array($default[1][0], [HttpsStream::getName(), HttpStream::getName()])) { switch ($this->settings[$dc_config_number]['transport']) { case 'tcp': if ($this->settings[$dc_config_number]['obfuscated']) { $default = [[DefaultStream::getName(), []], [BufferedRawStream::getName(), []], [ObfuscatedStream::getName(), []], end($default)]; } break; case 'wss': if ($this->settings[$dc_config_number]['obfuscated']) { $default = [[DefaultStream::getName(), []], [WssStream::getName(), []], [BufferedRawStream::getName(), []], [ObfuscatedStream::getName(), []], end($default)]; } else { $default = [[DefaultStream::getName(), []], [WssStream::getName(), []], [BufferedRawStream::getName(), []], end($default)]; } break; case 'ws': if ($this->settings[$dc_config_number]['obfuscated']) { $default = [[DefaultStream::getName(), []], [WsStream::getName(), []], [BufferedRawStream::getName(), []], [ObfuscatedStream::getName(), []], end($default)]; } else { $default = [[DefaultStream::getName(), []], [WsStream::getName(), []], [BufferedRawStream::getName(), []], end($default)]; } break; } } $combos[] = $default; if (!isset($this->settings[$dc_config_number]['do_not_retry'])) { if ((isset($this->dclist[$test][$ipv6][$dc_number]['tcpo_only']) && $this->dclist[$test][$ipv6][$dc_number]['tcpo_only']) || isset($this->dclist[$test][$ipv6][$dc_number]['secret'])) { $extra = isset($this->dclist[$test][$ipv6][$dc_number]['secret']) ? ['secret' => $this->dclist[$test][$ipv6][$dc_number]['secret']] : []; $combos[] = [[DefaultStream::getName(), []], [BufferedRawStream::getName(), []], [ObfuscatedStream::getName(), $extra], [IntermediatePaddedStream::getName(), []]]; } if (is_array($this->settings[$dc_config_number]['proxy'])) { $proxies = $this->settings[$dc_config_number]['proxy']; $proxy_extras = $this->settings[$dc_config_number]['proxy_extra']; } else { $proxies = [$this->settings[$dc_config_number]['proxy']]; $proxy_extras = [$this->settings[$dc_config_number]['proxy_extra']]; } foreach ($proxies as $key => $proxy) { // Convert old settings if ($proxy === '\\Socket') { $proxy = DefaultStream::getName(); } if ($proxy === '\\SocksProxy') { $proxy = SocksProxy::getName(); } if ($proxy === '\\HttpProxy') { $proxy = HttpProxy::getName(); } if ($proxy === '\\MTProxySocket') { $proxy = ObfuscatedStream::getName(); } if ($proxy === DefaultStream::getName()) { continue; } $extra = $proxy_extras[$key]; if (!isset(class_implements($proxy)['danog\\MadelineProto\\Stream\\StreamInterface'])) { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['proxy_class_invalid']); } if ($proxy === ObfuscatedStream::getName() && in_array(strlen($extra['secret']), [17, 34])) { $combos []= [[DefaultStream::getName(), []], [BufferedRawStream::getName(), []], [$proxy, $extra], [IntermediatePaddedStream::getName(), []]]; } foreach ($combos as $k => $orig) { $combo = []; if ($proxy === ObfuscatedStream::getName()) { $combo = $orig; if ($combo[count($combo) - 2][0] === ObfuscatedStream::getName()) { $combo[count($combo) - 2][1] = $extra; } else { $mtproto = end($combo); $combo[count($combo) - 1] = [$proxy, $extra]; $combo[] = $mtproto; } } else { if ($orig[1][0] === BufferedRawStream::getName()) { list($first, $second) = [array_slice($orig, 0, 2), array_slice($orig, 2)]; $first[] = [$proxy, $extra]; $combo = array_merge($first, $second); } elseif ($orig[1][0] === WssStream::getName()) { list($first, $second) = [array_slice($orig, 0, 1), array_slice($orig, 1)]; $first[] = [BufferedRawStream::getName(), []]; $first[] = [$proxy, $extra]; $combo = array_merge($first, $second); } } array_unshift($combos, $combo); //unset($combos[$k]); } } $combos[] = [[DefaultStream::getName(), []], [BufferedRawStream::getName(), []], [HttpsStream::getName(), []]]; $combos = array_unique($combos, SORT_REGULAR); } /* @var $context \Amp\ClientConnectContext */ $context = (new ClientConnectContext())->withMaxAttempts(1)->withConnectTimeout(1000 * $this->settings[$dc_config_number]['timeout']); foreach ($combos as $combo) { $ipv6 = [$this->settings[$dc_config_number]['ipv6'] ? 'ipv6' : 'ipv4', $this->settings[$dc_config_number]['ipv6'] ? 'ipv4' : 'ipv6']; foreach ($ipv6 as $ipv6) { if (!isset($this->dclist[$test][$ipv6][$dc_number]['ip_address'])) { unset($this->sockets[$dc_number]); $this->API->logger->logger("No info for DC $dc_number", \danog\MadelineProto\Logger::ERROR); continue; } $address = $this->dclist[$test][$ipv6][$dc_number]['ip_address']; $port = $this->dclist[$test][$ipv6][$dc_number]['port']; foreach (array_unique([$port, 443, 80, 88, 5222]) as $port) { $stream = end($combo)[0]; if ($stream === HttpsStream::getName()) { $subdomain = $this->dclist['ssl_subdomains'][preg_replace('/\D+/', '', $dc_number)]; if (strpos($dc_number, '_media') !== false) { $subdomain .= '-1'; } $path = $this->settings[$dc_config_number]['test_mode'] ? 'apiw_test1' : 'apiw1'; $uri = 'tcp://'.$subdomain.'.web.telegram.org:'.$port.'/'.$path; } elseif ($stream === HttpStream::getName()) { $uri = 'tcp://'.$address.':'.$port.'/api'; } else { $uri = 'tcp://'.$address.':'.$port; } if ($combo[1][0] === WssStream::getName()) { $subdomain = $this->dclist['ssl_subdomains'][preg_replace('/\D+/', '', $dc_number)]; if (strpos($dc_number, '_media') !== false) { $subdomain .= '-1'; } $path = $this->settings[$dc_config_number]['test_mode'] ? 'apiws_test' : 'apiws'; $uri = 'tcp://'.$subdomain.'.web.telegram.org:'.$port.'/'.$path; } elseif ($combo[1][0] === WsStream::getName()) { $subdomain = $this->dclist['ssl_subdomains'][preg_replace('/\D+/', '', $dc_number)]; if (strpos($dc_number, '_media') !== false) { $subdomain .= '-1'; } $path = $this->settings[$dc_config_number]['test_mode'] ? 'apiws_test' : 'apiws'; //$uri = 'tcp://' . $subdomain . '.web.telegram.org:' . $port . '/' . $path; $uri = 'tcp://'.$address.':'.$port.'/'.$path; } /** @var $ctx \danog\MadelineProto\Stream\ConnectionContext */ $ctx = (new ConnectionContext()) ->setDc($dc_number) ->setTest($this->settings[$dc_config_number]['test_mode']) ->setSocketContext($context) ->setUri($uri) ->setIpv6($ipv6 === 'ipv6'); foreach ($combo as $stream) { $ctx->addStream(...$stream); } $ctxs[] = $ctx; } } } if (isset($this->dclist[$test][$ipv6][$dc_number.'_bk']['ip_address'])) { $ctxs = array_merge($ctxs, $this->generate_contexts($dc_number.'_bk')); } return $ctxs; } public function get_dcs($all = true) { $test = $this->settings['all']['test_mode'] ? 'test' : 'main'; $ipv6 = $this->settings['all']['ipv6'] ? 'ipv6' : 'ipv4'; return $all ? array_keys((array) $this->dclist[$test][$ipv6]) : array_keys((array) $this->sockets); } } bot_thumbnail#0 dc_id:int id:long access_hash:long volume_id:long secret:long local_id:int = File; bot_photo#2 dc_id:int id:long access_hash:long volume_id:long secret:long local_id:int = File; bot_voice#3 dc_id:int id:long access_hash:long = File; bot_video#4 dc_id:int id:long access_hash:long = File; bot_document#5 dc_id:int id:long access_hash:long = File; bot_sticker#8 dc_id:int id:long access_hash:long = File; bot_audio#9 dc_id:int id:long access_hash:long = File; bot_gif#A dc_id:int id:long access_hash:long = File; bot_video_note#D dc_id:int id:long access_hash:long = File; . * * @author Daniil Gentili * @copyright 2016-2018 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; /** * Wrapper for my.telegram.org. */ class MyTelegramOrgWrapper { private $logged = false; private $hash = ''; public function __construct($number) { if (!extension_loaded('curl')) { throw new Exception(['extension', 'curl']); } $this->number = $number; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/auth/send_password'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['phone' => $number])); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate'); $headers = []; $headers[] = 'Origin: https://my.telegram.org'; $headers[] = 'Accept-Encoding: gzip, deflate, br'; $headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4'; $headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36'; $headers[] = 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8'; $headers[] = 'Accept: application/json, text/javascript, */*; q=0.01'; $headers[] = 'Referer: https://my.telegram.org/auth'; $headers[] = 'X-Requested-With: XMLHttpRequest'; $headers[] = 'Connection: keep-alive'; $headers[] = 'Dnt: 1'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { throw new Exception('Curl error: '.curl_error($ch)); } curl_close($ch); $resulta = json_decode($result, true); if (!isset($resulta['random_hash'])) { throw new Exception($result); } $this->hash = $resulta['random_hash']; } public function complete_login($password) { if ($this->logged) { throw new Exception('Already logged in!'); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/auth/login'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['phone' => $this->number, 'random_hash' => $this->hash, 'password' => $password])); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate'); $headers = []; $headers[] = 'Origin: https://my.telegram.org'; $headers[] = 'Accept-Encoding: gzip, deflate, br'; $headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4'; $headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36'; $headers[] = 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8'; $headers[] = 'Accept: application/json, text/javascript, */*; q=0.01'; $headers[] = 'Referer: https://my.telegram.org/auth'; $headers[] = 'X-Requested-With: XMLHttpRequest'; $headers[] = 'Connection: keep-alive'; $headers[] = 'Dnt: 1'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 1); $result = curl_exec($ch); if (curl_errno($ch)) { throw new Exception('Curl error: '.curl_error($ch)); } curl_close($ch); list($response_headers, $response_content) = preg_split('/(\r\n){2}/', $result, 2); switch ($response_content) { case 'true': //Logger::log(['Login OK'], Logger::VERBOSE); break; default: throw new Exception($response_content); } $this->token = explode(';', explode('stel_token=', $response_headers)[1])[0]; return $this->logged = true; } public function logged_in() { return $this->logged; } public function has_app() { if (!$this->logged) { throw new Exception('Not logged in!'); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/apps'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate'); $headers = []; $headers[] = 'Dnt: 1'; $headers[] = 'Accept-Encoding: gzip, deflate, sdch, br'; $headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4'; $headers[] = 'Upgrade-Insecure-Requests: 1'; $headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36'; $headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'; $headers[] = 'Referer: https://my.telegram.org/'; $headers[] = 'Cookie: stel_token='.$this->token; $headers[] = 'Connection: keep-alive'; $headers[] = 'Cache-Control: max-age=0'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { throw new Exception('Curl error: '.curl_error($ch)); } curl_close($ch); $title = explode('', explode('', $result)[1])[0]; switch ($title) { case 'App configuration':return true; case 'Create new application': $this->creation_hash = explode('"/>', explode('<input type="hidden" name="hash" value="', $result)[1])[0]; return false; } throw new Exception($title); } public function get_app() { if (!$this->logged) { throw new Exception('Not logged in!'); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/apps'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate'); $headers = []; $headers[] = 'Dnt: 1'; $headers[] = 'Accept-Encoding: gzip, deflate, sdch, br'; $headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4'; $headers[] = 'Upgrade-Insecure-Requests: 1'; $headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36'; $headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'; $headers[] = 'Referer: https://my.telegram.org/'; $headers[] = 'Cookie: stel_token='.$this->token; $headers[] = 'Connection: keep-alive'; $headers[] = 'Cache-Control: max-age=0'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { throw new Exception('Curl error: '.curl_error($ch)); } curl_close($ch); $cose = explode('<label for="app_id" class="col-md-4 text-right control-label">App api_id:</label> <div class="col-md-7"> <span class="form-control input-xlarge uneditable-input" onclick="this.select();"><strong>', $result); $asd = explode('</strong></span>', $cose[1]); $api_id = $asd[0]; $cose = explode('<label for="app_hash" class="col-md-4 text-right control-label">App api_hash:</label> <div class="col-md-7"> <span class="form-control input-xlarge uneditable-input" onclick="this.select();">', $result); $asd = explode('</span>', $cose[1]); $api_hash = $asd[0]; return ['api_id' => (int) $api_id, 'api_hash' => $api_hash]; } public function create_app($settings) { if (!$this->logged) { throw new Exception('Not logged in!'); } if ($this->has_app()) { throw new Exception('The app was already created!'); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/apps/create'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['hash' => $this->creation_hash, 'app_title' => $settings['app_title'], 'app_shortname' => $settings['app_shortname'], 'app_url' => $settings['app_url'], 'app_platform' => $settings['app_platform'], 'app_desc' => $settings['app_desc']])); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate'); $headers = []; $headers[] = 'Cookie: stel_token='.$this->token; $headers[] = 'Origin: https://my.telegram.org'; $headers[] = 'Accept-Encoding: gzip, deflate, br'; $headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4'; $headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36'; $headers[] = 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8'; $headers[] = 'Accept: */*'; $headers[] = 'Referer: https://my.telegram.org/apps'; $headers[] = 'X-Requested-With: XMLHttpRequest'; $headers[] = 'Connection: keep-alive'; $headers[] = 'Dnt: 1'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { throw new Exception('Curl error:'.curl_error($ch)); } curl_close($ch); if ($result) { throw new Exception($result); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/apps'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate'); $headers = []; $headers[] = 'Dnt: 1'; $headers[] = 'Accept-Encoding: gzip, deflate, sdch, br'; $headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4'; $headers[] = 'Upgrade-Insecure-Requests: 1'; $headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36'; $headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'; $headers[] = 'Referer: https://my.telegram.org/'; $headers[] = 'Cookie: stel_token='.$this->token; $headers[] = 'Connection: keep-alive'; $headers[] = 'Cache-Control: max-age=0'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { throw new Exception('Curl error:'.curl_error($ch)); } curl_close($ch); $title = explode('', explode('', $result)[1])[0]; if ($title === 'Create new application') { $this->creation_hash = explode('"/>', explode('<input type="hidden" name="hash" value="', $result)[1])[0]; throw new \danog\MadelineProto\Exception('App creation failed'); } $cose = explode('<label for="app_id" class="col-md-4 text-right control-label">App api_id:</label> <div class="col-md-7"> <span class="form-control input-xlarge uneditable-input" onclick="this.select();"><strong>', $result); $asd = explode('</strong></span>', $cose['1']); $api_id = $asd['0']; $cose = explode('<label for="app_hash" class="col-md-4 text-right control-label">App api_hash:</label> <div class="col-md-7"> <span class="form-control input-xlarge uneditable-input" onclick="this.select();">', $result); $asd = explode('</span>', $cose['1']); $api_hash = $asd['0']; return ['api_id' => (int) $api_id, 'api_hash' => $api_hash]; } } <?php /** * FileCallback module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class FileCallback implements FileCallbackInterface { private $file; private $callback; public function __construct($file, $callback) { $this->file = $file; $this->callback = $callback; } public function getFile() { return $this->file; } public function __invoke($percent) { $callback = $this->callback; $callback($percent); } } ---types--- ipPort#d433ad73 ipv4:int port:int = IpPort; ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort; accessPointRule#4679b65f phone_prefix_rules:string dc_id:int ips:vector<IpPort> = AccessPointRule; help.configSimple#5a592a6c date:int expires:int rules:vector<AccessPointRule> = help.ConfigSimple; boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia; inputMediaPhoto#b3ba0635 flags:# id:InputPhoto ttl_seconds:flags.0?int = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia; inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector<DocumentAttribute> stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia; inputMediaDocument#23ab23d2 flags:# id:InputDocument ttl_seconds:flags.0?int = InputMedia; inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = InputMedia; inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia; inputMediaGeoLive#7b1a118f geo_point:InputGeoPoint period:int = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#fb95c6c4 id:long access_hash:long = InputPhoto; inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#430f0724 id:long access_hash:long version:int = InputFileLocation; inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation; inputTakeoutFileLocation#29be5899 = InputFileLocation; inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation; userEmpty#200250ba id:int = User; user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#c88974ac flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights participants_count:flags.17?int = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> = ChatFull; channelFull#76af5481 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector<ChatParticipant> version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#44f9b43d flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#cbf24940 phone_number:string first_name:string last_name:string vcard:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#9cb070d7 flags:# document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia; messageMediaGeoLive#7c3c2609 geo:GeoPoint period:int = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector<int> = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector<int> = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction; messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; messageActionScreenshotTaken#4792929b = MessageAction; messageActionCustomAction#fae69f56 message:string = MessageAction; messageActionBotAllowed#abe9affe domain:string = MessageAction; messageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted = MessageAction; messageActionSecureValuesSent#d95c6154 types:Vector<SecureValueType> = MessageAction; dialog#e4def5db flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector<PhotoSize> = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#38faab5f flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int terms_of_service:flags.3?help.TermsOfService = auth.SentCode; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputPeerNotifySettings#9c3d198e flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = InputPeerNotifySettings; peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = PeerNotifySettings; peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; wallPaper#ccb03657 id:int title:string sizes:Vector<PhotoSize> color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; userFull#f220f3f flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#eae87e42 contacts:Vector<Contact> saved_count:int users:Vector<User> = contacts.Contacts; contacts.importedContacts#77d01c3b imported:Vector<ImportedContact> popular_invites:Vector<PopularContact> retry_contacts:Vector<long> users:Vector<User> = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs; messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs; messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; messages.channelMessages#99262e37 flags:# pts:int count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; messages.messagesNotModified#74535f21 count:int = messages.Messages; messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats; messages.chatsSlice#9cd81144 count:int chats:Vector<Chat> = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter; inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter; inputMessagesFilterGeo#e7026d0d = MessagesFilter; inputMessagesFilterContacts#e062db83 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector<int> pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector<DcOption> = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector<MessageEntity> = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector<int> pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector<int> pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector<long> = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updateDialogPinned#19d27f3c flags:# pinned:flags.0?true peer:DialogPeer = Update; updatePinnedDialogs#ea4cb65b flags:# order:flags.0?Vector<DialogPeer> = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updateLangPackTooLong#10c2404b = Update; updateLangPack#56022f4d difference:LangPackDifference = Update; updateFavedStickers#e511996d = Update; updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector<int> = Update; updateContactsReset#7084a7be = Update; updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update; updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> intermediate_state:updates.State = updates.Difference; updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates; updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> = Updates; photos.photos#8dca6aa5 photos:Vector<Photo> users:Vector<User> = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector<Photo> users:Vector<User> = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector<FileHash> = upload.File; dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption; config#3213dbba flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#8987f311 id:int critical:Bool url:string text:string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#18798952 id:long access_hash:long = InputDocument; documentEmpty#36f8c871 id:long = Document; document#87232bc7 id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int version:int attributes:Vector<DocumentAttribute> = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; sendMessageRecordRoundAction#88f27fbc = SendMessageAction; sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; contacts.found#b3134d9d my_results:Vector<Peer> results:Vector<Peer> chats:Vector<Chat> users:Vector<User> = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector<InputUser> = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector<InputUser> = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector<int> = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector<int> = PrivacyRule; account.privacyRules#554abb6f rules:Vector<PrivacyRule> users:Vector<User> = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true supports_streaming:flags.1?true duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#e4599bbd hash:int stickers:Vector<Document> = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector<StickerSet> = messages.AllStickers; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector<Authorization> = account.Authorizations; account.noPassword#5ea182f6 new_salt:bytes new_secure_salt:bytes secure_random:bytes email_unconfirmed_pattern:string = account.Password; account.password#ca39b447 flags:# has_recovery:flags.0?true has_secure_values:flags.1?true current_salt:bytes new_salt:bytes new_secure_salt:bytes secure_random:bytes hint:string email_unconfirmed_pattern:string = account.Password; account.passwordSettings#7bd9c3f1 email:string secure_salt:bytes secure_secret:bytes secure_secret_id:long = account.PasswordSettings; account.passwordInputSettings#21ffa60d flags:# new_salt:flags.0?bytes new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string new_secure_salt:flags.2?bytes new_secure_secret:flags.2?bytes new_secure_secret_id:flags.2?long = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector<User> = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#5585a139 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#98e81d3a user_id:int description:string commands:Vector<BotCommand> = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector<KeyboardButton> = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector<KeyboardButtonRow> = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector<KeyboardButtonRow> = ReplyMarkup; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; messageEntityPhone#9b69e34b offset:int length:int = MessageEntity; messageEntityCashtag#4c4e743f offset:int length:int = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector<Chat> users:Vector<User> = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#6a9d7b35 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector<Message> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector<MessageRange> = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantAdmin#a82fa898 flags:# can_edit:flags.0?true user_id:int inviter_id:int promoted_by:int date:int admin_rights:ChannelAdminRights = ChannelParticipant; channelParticipantBanned#222c1886 flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChannelBannedRights = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter; channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter; channels.channelParticipants#f56ee2a8 count:int participants:Vector<ChannelParticipant> users:Vector<User> = channels.ChannelParticipants; channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector<User> = channels.ChannelParticipant; help.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector<MessageEntity> min_age_confirm:flags.1?int = help.TermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector<FoundGif> = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector<Document> = messages.SavedGifs; inputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#c1b15d65 flags:# geo_point:InputGeoPoint period:int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#b722de65 flags:# geo:GeoPoint period:int reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector<BotInlineResult> cache_time:int users:Vector<User> = messages.BotResults; exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink; messageFwdHeader#559ebe6d flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; messages.peerDialogs#3371c354 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> state:updates.State = messages.PeerDialogs; topPeer#edcdc05b peer:Peer rating:double = TopPeer; topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; topPeerCategoryBotsInline#148677e2 = TopPeerCategory; topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector<TopPeer> = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector<TopPeerCategoryPeers> chats:Vector<Chat> users:Vector<User> = contacts.TopPeers; contacts.topPeersDisabled#b52c939d = contacts.TopPeers; draftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector<MessageEntity> date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; messages.featuredStickers#f89d88e5 hash:int sets:Vector<StickerSetCovered> unread:Vector<long> = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#22f3afb3 hash:int packs:Vector<StickerPack> stickers:Vector<Document> dates:Vector<int> = messages.RecentStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector<StickerSetCovered> = messages.ArchivedStickers; messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector<StickerSetCovered> = messages.StickerSetInstallResult; stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector<Document> = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector<HighScore> users:Vector<User> = messages.HighScores; textEmpty#dc3d824f = RichText; textPlain#744694e0 text:string = RichText; textBold#6724abc4 text:RichText = RichText; textItalic#d912a59c text:RichText = RichText; textUnderline#c12622c4 text:RichText = RichText; textStrike#9bf8bb95 text:RichText = RichText; textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector<RichText> = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; pageBlockHeader#bfd064ec text:RichText = PageBlock; pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; pageBlockParagraph#467a0766 text:RichText = PageBlock; pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; pageBlockList#3a58c7f4 ordered:Bool items:Vector<RichText> = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; pageBlockVideo#d9d71866 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:RichText = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; pageBlockEmbed#cde200d1 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:int h:int caption:RichText = PageBlock; pageBlockEmbedPost#292c7be9 url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector<PageBlock> caption:RichText = PageBlock; pageBlockCollage#8b31c4f items:Vector<PageBlock> caption:RichText = PageBlock; pageBlockSlideshow#130c8963 items:Vector<PageBlock> caption:RichText = PageBlock; pageBlockChannel#ef1751b5 channel:Chat = PageBlock; pageBlockAudio#31b81a7f audio_id:long caption:RichText = PageBlock; pagePart#8e3f9ebe blocks:Vector<PageBlock> photos:Vector<Photo> documents:Vector<Document> = Page; pageFull#556ec7aa blocks:Vector<PageBlock> photos:Vector<Photo> documents:Vector<Document> = Page; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector<LabeledPrice> = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; webDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument; webDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector<User> = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt; payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsAndroidPay#ca05d50e payment_token:DataJSON google_transaction_id:string = InputPaymentCredentials; account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; shippingOption#b6213cdf id:string title:string prices:Vector<LabeledPrice> = ShippingOption; inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCall#ffe6ab67 id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector<PhoneConnection> start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector<User> = phone.PhoneCall; upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey; cdnConfig#5725e40a public_keys:Vector<CdnPublicKey> = CdnConfig; langPackString#cad181f6 key:string value:string = LangPackString; langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString; langPackStringDeleted#2979eeb2 key:string = LangPackString; langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector<LangPackString> = LangPackDifference; langPackLanguage#117698f1 name:string native_name:string lang_code:string = LangPackLanguage; channelAdminRights#5d7ceba5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true invite_link:flags.6?true pin_messages:flags.7?true add_admins:flags.9?true manage_call:flags.10?true = ChannelAdminRights; channelBannedRights#58cf4249 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true until_date:int = ChannelBannedRights; channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangePhoto#b82f55c3 prev_photo:ChatPhoto new_photo:ChatPhoto = ChannelAdminLogEventAction; channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector<ChannelAdminLogEvent> chats:Vector<Chat> users:Vector<User> = channels.AdminLogResults; channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers; messages.favedStickers#f37f2f16 hash:int packs:Vector<StickerPack> stickers:Vector<Document> = messages.FavedStickers; recentMeUrlUnknown#46e1d13d url:string = RecentMeUrl; recentMeUrlUser#8dbc3336 url:string user_id:int = RecentMeUrl; recentMeUrlChat#a01b22f9 url:string chat_id:int = RecentMeUrl; recentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl; recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl; help.recentMeUrls#e0310d7 urls:Vector<RecentMeUrl> chats:Vector<Chat> users:Vector<User> = help.RecentMeUrls; inputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector<MessageEntity> = InputSingleMedia; webAuthorization#cac943f2 hash:long bot_id:int domain:string browser:string platform:string date_created:int date_active:int ip:string region:string = WebAuthorization; account.webAuthorizations#ed56c9fc authorizations:Vector<WebAuthorization> users:Vector<User> = account.WebAuthorizations; inputMessageID#a676a322 id:int = InputMessage; inputMessageReplyTo#bad88395 id:int = InputMessage; inputMessagePinned#86872538 = InputMessage; inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer; dialogPeer#e56dbf05 peer:Peer = DialogPeer; messages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets; messages.foundStickerSets#5108d648 hash:int sets:Vector<StickerSetCovered> = messages.FoundStickerSets; fileHash#6242c773 offset:int limit:int hash:bytes = FileHash; inputClientProxy#75588b3f address:string port:int = InputClientProxy; help.proxyDataEmpty#e09e1fb8 expires:int = help.ProxyData; help.proxyDataPromo#2bf7ee23 expires:int peer:Peer chats:Vector<Chat> users:Vector<User> = help.ProxyData; help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate; help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate; inputSecureFileUploaded#3334b0f0 id:long parts:int md5_checksum:string file_hash:bytes secret:bytes = InputSecureFile; inputSecureFile#5367e5be id:long access_hash:long = InputSecureFile; secureFileEmpty#64199744 = SecureFile; secureFile#e0277a62 id:long access_hash:long size:int dc_id:int date:int file_hash:bytes secret:bytes = SecureFile; secureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData; securePlainPhone#7d6099dd phone:string = SecurePlainData; securePlainEmail#21ec5a5f email:string = SecurePlainData; secureValueTypePersonalDetails#9d2a81e3 = SecureValueType; secureValueTypePassport#3dac6a00 = SecureValueType; secureValueTypeDriverLicense#6e425c4 = SecureValueType; secureValueTypeIdentityCard#a0d0744b = SecureValueType; secureValueTypeInternalPassport#99a48f23 = SecureValueType; secureValueTypeAddress#cbe31e26 = SecureValueType; secureValueTypeUtilityBill#fc36954e = SecureValueType; secureValueTypeBankStatement#89137c0d = SecureValueType; secureValueTypeRentalAgreement#8b883488 = SecureValueType; secureValueTypePassportRegistration#99e3806a = SecureValueType; secureValueTypeTemporaryRegistration#ea02ec33 = SecureValueType; secureValueTypePhone#b320aadb = SecureValueType; secureValueTypeEmail#8e3ca7ee = SecureValueType; secureValue#b4b4b699 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile files:flags.4?Vector<SecureFile> plain_data:flags.5?SecurePlainData hash:bytes = SecureValue; inputSecureValue#67872e8 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?InputSecureFile reverse_side:flags.2?InputSecureFile selfie:flags.3?InputSecureFile files:flags.4?Vector<InputSecureFile> plain_data:flags.5?SecurePlainData = InputSecureValue; secureValueHash#ed1ecdb0 type:SecureValueType hash:bytes = SecureValueHash; secureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError; secureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError; secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted; account.authorizationForm#cb976d53 flags:# selfie_required:flags.1?true required_types:Vector<SecureValueType> values:Vector<SecureValue> errors:Vector<SecureValueError> users:Vector<User> privacy_policy_url:flags.0?string = account.AuthorizationForm; account.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode; help.deepLinkInfoEmpty#66afa166 = help.DeepLinkInfo; help.deepLinkInfo#6a4ee832 flags:# update_app:flags.0?true message:string entities:flags.1?Vector<MessageEntity> = help.DeepLinkInfo; savedPhoneContact#1142bd56 phone:string first_name:string last_name:string date:int = SavedContact; account.takeout#4dba4501 id:long = account.Takeout; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector<long> query:!X = X; initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X; invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X; auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector<long> = Bool; account.registerDevice#5cbea590 token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector<int> = Bool; account.unregisterDevice#3076c4bf token_type:int token:string other_uids:Vector<int> = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector<WallPaper>; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; account.getTmpPassword#4a82327e password_hash:bytes period:int = account.TmpPassword; account.getWebAuthorizations#182e6d6f = account.WebAuthorizations; account.resetWebAuthorization#2d01b9ef hash:long = Bool; account.resetWebAuthorizations#682d2594 = Bool; account.getAllSecureValues#b288bc7d = Vector<SecureValue>; account.getSecureValue#73665bc2 types:Vector<SecureValueType> = Vector<SecureValue>; account.saveSecureValue#899fe31d value:InputSecureValue secure_secret_id:long = SecureValue; account.deleteSecureValue#b880bc4b types:Vector<SecureValueType> = Bool; account.getAuthorizationForm#b86ba8e1 bot_id:int scope:string public_key:string = account.AuthorizationForm; account.acceptAuthorization#e7027c94 bot_id:int scope:string public_key:string value_hashes:Vector<SecureValueHash> credentials:SecureCredentialsEncrypted = Bool; account.sendVerifyPhoneCode#823380b4 flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool; account.sendVerifyEmailCode#7011509f email:string = account.SentEmailCode; account.verifyEmail#ecba39db email:string code:string = Bool; account.initTakeoutSession#f05b4804 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?int = account.Takeout; account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool; users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>; users.getFullUser#ca30a5b1 id:InputUser = UserFull; users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector<SecureValueError> = Bool; contacts.getStatuses#c4a353ee = Vector<ContactStatus>; contacts.getContacts#c023849f hash:int = contacts.Contacts; contacts.importContacts#2c800be5 contacts:Vector<InputContact> = contacts.ImportedContacts; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector<InputUser> = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector<int>; contacts.importCard#4fe196fe export_card:Vector<int> = User; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; contacts.resetSaved#879537f1 = Bool; contacts.getSaved#82f1e39f = Vector<SavedContact>; contacts.toggleTopPeers#8514bdda enabled:Bool = Bool; messages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages; messages.getDialogs#b098aee6 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:int = messages.Dialogs; messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.search#8614ef68 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Updates; messages.sendMedia#b8d1262b flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Updates; messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true grouped:flags.9?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.report#bd82b658 peer:InputPeer id:Vector<int> reason:ReportReason = Bool; messages.getChats#3c6aa187 id:Vector<int> = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector<InputUser> title:string = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector<long>; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages; messages.getStickers#43d4f2c emoticon:string hash:int = messages.Stickers; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#8b68b0cc flags:# message:string entities:flags.3?Vector<MessageEntity> = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector<int> increment:Bool = Vector<int>; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector<long> = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector<InputBotInlineResult> cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#c000e4c8 flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> geo_point:flags.13?InputGeoPoint = Updates; messages.editInlineBotMessage#adc3e828 flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> geo_point:flags.13?InputGeoPoint = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#e470bcfd peers:Vector<InputDialogPeer> = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector<MessageEntity> = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector<long> = Bool; messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector<StickerSetCovered>; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector<int> = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; messages.reorderPinnedDialogs#5b51d63f flags:# force:flags.0?true order:Vector<InputDialogPeer> = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia; messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates; messages.getFavedStickers#21ce0b0e hash:int = messages.FavedStickers; messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool; messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory; messages.getRecentLocations#bbc45b09 peer:InputPeer limit:int hash:int = messages.Messages; messages.sendMultiMedia#2095512f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector<InputSingleMedia> = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; messages.searchStickerSets#c2b7d08b flags:# exclude_featured:flags.0?true q:string hash:int = messages.FoundStickerSets; messages.getSplitRanges#1cff7e08 = Vector<MessageRange>; messages.markDialogUnread#c286d98f flags:# unread:flags.0?true peer:InputDialogPeer = Bool; messages.getDialogUnreadMarks#22e24e22 = Vector<DialogPeer>; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector<InputPhoto> = Vector<long>; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; upload.reuploadCdnFile#9b2754a8 file_token:bytes request_token:bytes = Vector<FileHash>; upload.getCdnFileHashes#4da54231 file_token:bytes offset:int = Vector<FileHash>; upload.getFileHashes#c7025931 location:InputFileLocation offset:int = Vector<FileHash>; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#ae2de196 = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector<InputAppEvent> = Bool; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#9010ef6f prev_app_version:string = Updates; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls; help.getProxyData#3d7758e1 = help.ProxyData; help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate; help.acceptTermsOfService#ee72f79a id:DataJSON = Bool; help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector<int> = Bool; channels.getMessages#ad8c9a23 channel:InputChannel id:Vector<InputMessage> = messages.Messages; channels.getParticipants#123e05e9 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#20b88214 channel:InputChannel user_id:InputUser admin_rights:ChannelAdminRights = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector<InputUser> = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; channels.exportMessageLink#ceb77163 channel:InputChannel id:int grouped:Bool = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; channels.editBanned#bfd915cd channel:InputChannel user_id:InputUser banned_rights:ChannelBannedRights = Updates; channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector<InputUser> max_id:long min_id:long limit:int = channels.AdminLogResults; channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool; channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector<int> = Bool; channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool; channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates; channels.getLeftChannels#8341ecc0 offset:int = messages.Chats; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm; payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt; payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult; payments.getSavedInfo#227d824b = payments.SavedInfo; payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector<InputStickerSetItem> = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet; stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; phone.getCallConfig#55451fa9 = DataJSON; phone.requestCall#5b95b3d4 user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = Updates; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; langpack.getLangPack#9ab5c58e lang_code:string = LangPackDifference; langpack.getStrings#2e1ee318 lang_code:string keys:Vector<string> = Vector<LangPackString>; langpack.getDifference#b2e4d7d from_version:int = LangPackDifference; langpack.getLanguages#800fd57d = Vector<LangPackLanguage>; // Core types (no need to gen) //vector#1cb5c415 {t:Type} # [ t ] = Vector t; /////////////////////////////// /////////////////// Layer cons /////////////////////////////// //invokeAfterMsg#cb9f372d msg_id:long query:!X = X; //invokeAfterMsgs#3dc4b4f0 msg_ids:Vector<long> query:!X = X; //invokeWithLayer1#53835315 query:!X = X; //invokeWithLayer2#289dd1f6 query:!X = X; //invokeWithLayer3#b7475268 query:!X = X; //invokeWithLayer4#dea0d430 query:!X = X; //invokeWithLayer5#417a57ae query:!X = X; //invokeWithLayer6#3a64d54d query:!X = X; //invokeWithLayer7#a5be56d3 query:!X = X; //invokeWithLayer8#e9abd9fd query:!X = X; //invokeWithLayer9#76715a63 query:!X = X; //invokeWithLayer10#39620c41 query:!X = X; //invokeWithLayer11#a6b88fdf query:!X = X; //invokeWithLayer12#dda60d3c query:!X = X; //invokeWithLayer13#427c8ea2 query:!X = X; //invokeWithLayer14#2b9b08fa query:!X = X; //invokeWithLayer15#b4418b64 query:!X = X; //invokeWithLayer16#cf5f0987 query:!X = X; //invokeWithLayer17#50858a19 query:!X = X; //invokeWithLayer18#1c900537 query:!X = X; //invokeWithLayer#da9b0d0d layer:int query:!X = X; // after 18 layer /////////////////////////////// /// Authorization key creation /////////////////////////////// resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector<long> = ResPQ; p_q_inner_data#83c95aec pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data; server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params; server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params; server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data; client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data; dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer; dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer; dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer; destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes; destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes; destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes; ---functions--- req_pq#60469778 nonce:int128 = ResPQ; req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params; set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer; destroy_auth_key#d1435160 = DestroyAuthKeyRes; /////////////////////////////// ////////////// System messages /////////////////////////////// ---types--- msgs_ack#62d6b459 msg_ids:Vector<long> = MsgsAck; bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification; bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification; msgs_state_req#da69fb52 msg_ids:Vector<long> = MsgsStateReq; msgs_state_info#04deb57d req_msg_id:long info:string = MsgsStateInfo; msgs_all_info#8cc0d131 msg_ids:Vector<long> info:string = MsgsAllInfo; msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo; msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo; msg_resend_req#7d861a08 msg_ids:Vector<long> = MsgResendReq; //rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult; // parsed manually rpc_error#2144ca19 error_code:int error_message:string = RpcError; rpc_answer_unknown#5e2ad36e = RpcDropAnswer; rpc_answer_dropped_running#cd78e586 = RpcDropAnswer; rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer; future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt; future_salts#ae500895 req_msg_id:long now:int salts:vector<future_salt> = FutureSalts; pong#347773c5 msg_id:long ping_id:long = Pong; destroy_session_ok#e22045fc session_id:long = DestroySessionRes; destroy_session_none#62d350c9 session_id:long = DestroySessionRes; new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession; //message msg_id:long seqno:int bytes:int body:Object = Message; // parsed manually //msg_container#73f1f8dc messages:vector<message> = MessageContainer; // parsed manually //msg_copy#e06046b2 orig_message:Message = MessageCopy; // parsed manually, not used - use msg_container //gzip_packed#3072cfa1 packed_data:string = Object; // parsed manually http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait; ---functions--- rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer; get_future_salts#b921bd04 num:int = FutureSalts; ping#7abe77ec ping_id:long = Pong; ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong; destroy_session#e7512126 session_id:long = DestroySessionRes; contest.saveDeveloperInfo#9a5f6e95 vk_id:int name:string phone_number:string age:int city:string = Bool; /////////////////////////////// ///////// Main application API /////////////////////////////// ---types--- boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#630c9af1 flags:# file:InputFile caption:string stickers:flags.0?Vector<InputDocument> = InputMedia; inputMediaPhoto#e9bfb4f3 id:InputPhoto caption:string = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; inputMediaUploadedDocument#d070f1e9 flags:# file:InputFile mime_type:string attributes:Vector<DocumentAttribute> caption:string stickers:flags.0?Vector<InputDocument> = InputMedia; inputMediaUploadedThumbDocument#50d88cae flags:# file:InputFile thumb:InputFile mime_type:string attributes:Vector<DocumentAttribute> caption:string stickers:flags.0?Vector<InputDocument> = InputMedia; inputMediaDocument#1a77f29c id:InputDocument caption:string = InputMedia; inputMediaVenue#2827a81a geo_point:InputGeoPoint title:string address:string provider:string venue_id:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#b55f4f18 url:string caption:string = InputMedia; inputMediaDocumentExternal#e5e9607c url:string caption:string = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputMediaInvoice#92153685 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string start_param:string = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#fb95c6c4 id:long access_hash:long = InputPhoto; inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#430f0724 id:long access_hash:long version:int = InputFileLocation; inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation; userEmpty#200250ba id:int = User; user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#a14dca52 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true editor:flags.3?true moderator:flags.4?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string = Chat; channelForbidden#8537784f flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> = ChatFull; channelFull#c3d5512f flags:# can_view_participants:flags.3?true can_set_username:flags.6?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector<ChatParticipant> version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#c09be45f flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int edit_date:flags.15?int = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#3d8ce53d photo:Photo caption:string = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#f3e02ea8 document:Document caption:string = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#7912b71f geo:GeoPoint title:string address:string provider:string venue_id:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector<int> = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector<int> = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction; messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; dialog#66ffba14 flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector<PhotoSize> = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#2049d70c long:double lat:double = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#5e002502 flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyAll#a429b886 = InputNotifyPeer; inputPeerNotifyEventsEmpty#f03064d8 = InputPeerNotifyEvents; inputPeerNotifyEventsAll#e86a2c74 = InputPeerNotifyEvents; inputPeerNotifySettings#38935eb2 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = InputPeerNotifySettings; peerNotifyEventsEmpty#add53cb3 = PeerNotifyEvents; peerNotifyEventsAll#6d1ded88 = PeerNotifyEvents; peerNotifySettingsEmpty#70a68512 = PeerNotifySettings; peerNotifySettings#9acda4c0 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = PeerNotifySettings; peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; wallPaper#ccb03657 id:int title:string sizes:Vector<PhotoSize> color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; userFull#f220f3f flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#6f8b8cb2 contacts:Vector<Contact> users:Vector<User> = contacts.Contacts; contacts.importedContacts#ad524315 imported:Vector<ImportedContact> retry_contacts:Vector<long> users:Vector<User> = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs; messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; messages.channelMessages#99262e37 flags:# pts:int count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats; messages.chatsSlice#9cd81144 count:int chats:Vector<Chat> = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterPhotoVideoDocuments#d95e73bb = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter; inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector<int> pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector<DcOption> = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector<MessageEntity> = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector<int> pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector<int> pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector<long> = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updateDialogPinned#d711a2cc flags:# pinned:flags.0?true peer:Peer = Update; updatePinnedDialogs#d8caf68d flags:# order:flags.0?Vector<Peer> = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> intermediate_state:updates.State = updates.Difference; updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates; updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> = Updates; photos.photos#8dca6aa5 photos:Vector<Photo> users:Vector<User> = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector<Photo> users:Vector<User> = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; upload.fileCdnRedirect#1508485a dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes = upload.File; dcOption#5d8c6cc flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true id:int ip_address:string port:int = DcOption; config#cb601684 flags:# phonecalls_enabled:flags.1?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int rating_e_decay:int stickers_recent_limit:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string disabled_features:Vector<DisabledFeature> = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#8987f311 id:int critical:Bool url:string text:string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#18798952 id:long access_hash:long = InputDocument; documentEmpty#36f8c871 id:long = Document; document#87232bc7 id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int version:int attributes:Vector<DocumentAttribute> = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyAll#74d07c60 = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; sendMessageRecordRoundAction#88f27fbc = SendMessageAction; sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; contacts.found#1aa1f784 results:Vector<Peer> chats:Vector<Chat> users:Vector<User> = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector<InputUser> = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector<InputUser> = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector<int> = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector<int> = PrivacyRule; account.privacyRules#554abb6f rules:Vector<PrivacyRule> users:Vector<User> = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#8a8ecd32 hash:string stickers:Vector<Document> = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector<StickerSet> = messages.AllStickers; disabledFeature#ae636f24 feature:string description:string = DisabledFeature; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector<Authorization> = account.Authorizations; account.noPassword#96dabc18 new_salt:bytes email_unconfirmed_pattern:string = account.Password; account.password#7c18141c current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = account.Password; account.passwordSettings#b7b72ab3 email:string = account.PasswordSettings; account.passwordInputSettings#86916deb flags:# new_salt:flags.0?bytes new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector<User> = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#cd303b41 flags:# installed:flags.0?true archived:flags.1?true official:flags.2?true masks:flags.3?true id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#98e81d3a user_id:int description:string commands:Vector<BotCommand> = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector<KeyboardButton> = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector<KeyboardButtonRow> = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector<KeyboardButtonRow> = ReplyMarkup; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector<Chat> users:Vector<User> = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#410dee07 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector<Message> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector<MessageRange> = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantModerator#91057fef user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantEditor#98192d61 user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantKicked#8cc5e69a user_id:int kicked_by:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#3c37bb7a = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelRoleEmpty#b285a0c6 = ChannelParticipantRole; channelRoleModerator#9618d975 = ChannelParticipantRole; channelRoleEditor#820bfe8c = ChannelParticipantRole; channels.channelParticipants#f56ee2a8 count:int participants:Vector<ChannelParticipant> users:Vector<User> = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector<User> = channels.ChannelParticipant; help.termsOfService#f1ee3e90 text:string = help.TermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector<FoundGif> = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector<Document> = messages.SavedGifs; inputBotInlineMessageMediaAuto#292fed13 flags:# caption:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#f4a59de1 flags:# geo_point:InputGeoPoint reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#aaafadc8 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#2daf01a7 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#2cbbe15a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#a74b15b flags:# caption:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#3a8fd8b8 flags:# geo:GeoPoint reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#4366232e flags:# geo:GeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#9bebaeb9 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; messages.botResults#ccd3563d flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector<BotInlineResult> cache_time:int = messages.BotResults; exportedMessageLink#1f486803 link:string = ExportedMessageLink; messageFwdHeader#c786ddcb flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; messages.peerDialogs#3371c354 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> state:updates.State = messages.PeerDialogs; topPeer#edcdc05b peer:Peer rating:double = TopPeer; topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; topPeerCategoryBotsInline#148677e2 = TopPeerCategory; topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector<TopPeer> = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector<TopPeerCategoryPeers> chats:Vector<Chat> users:Vector<User> = contacts.TopPeers; draftMessageEmpty#ba4baec5 = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector<MessageEntity> date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; messages.featuredStickers#f89d88e5 hash:int sets:Vector<StickerSetCovered> unread:Vector<long> = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#5ce20970 hash:int stickers:Vector<Document> = messages.RecentStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector<StickerSetCovered> = messages.ArchivedStickers; messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector<StickerSetCovered> = messages.StickerSetInstallResult; stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector<Document> = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector<HighScore> users:Vector<User> = messages.HighScores; textEmpty#dc3d824f = RichText; textPlain#744694e0 text:string = RichText; textBold#6724abc4 text:RichText = RichText; textItalic#d912a59c text:RichText = RichText; textUnderline#c12622c4 text:RichText = RichText; textStrike#9bf8bb95 text:RichText = RichText; textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector<RichText> = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; pageBlockHeader#bfd064ec text:RichText = PageBlock; pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; pageBlockParagraph#467a0766 text:RichText = PageBlock; pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; pageBlockList#3a58c7f4 ordered:Bool items:Vector<RichText> = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; pageBlockVideo#d9d71866 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:RichText = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; pageBlockEmbed#cde200d1 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:int h:int caption:RichText = PageBlock; pageBlockEmbedPost#292c7be9 url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector<PageBlock> caption:RichText = PageBlock; pageBlockCollage#8b31c4f items:Vector<PageBlock> caption:RichText = PageBlock; pageBlockSlideshow#130c8963 items:Vector<PageBlock> caption:RichText = PageBlock; pageBlockChannel#ef1751b5 channel:Chat = PageBlock; pagePart#8dee6c44 blocks:Vector<PageBlock> photos:Vector<Photo> videos:Vector<Document> = Page; pageFull#d7a19d69 blocks:Vector<PageBlock> photos:Vector<Photo> videos:Vector<Document> = Page; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true currency:string prices:Vector<LabeledPrice> = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; webDocument#c61acbd8 url:string access_hash:long size:int mime_type:string attributes:Vector<DocumentAttribute> dc_id:int = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector<User> = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt; payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; shippingOption#b6213cdf id:string title:string prices:Vector<LabeledPrice> = ShippingOption; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCall#ffe6ab67 id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector<PhoneConnection> start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector<User> = phone.PhoneCall; upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey; cdnConfig#5725e40a public_keys:Vector<CdnPublicKey> = CdnConfig; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector<long> query:!X = X; initConnection#69796de9 {X:Type} api_id:int device_model:string system_version:string app_version:string lang_code:string query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone; auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.sendInvites#771c1d97 phone_numbers:Vector<string> message:string = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector<long> = Bool; account.registerDevice#637ea878 token_type:int token:string = Bool; account.unregisterDevice#65c55b40 token_type:int token:string = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector<WallPaper>; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; account.getTmpPassword#4a82327e password_hash:bytes period:int = account.TmpPassword; users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>; users.getFullUser#ca30a5b1 id:InputUser = UserFull; contacts.getStatuses#c4a353ee = Vector<ContactStatus>; contacts.getContacts#22c6aa08 hash:string = contacts.Contacts; contacts.importContacts#da30b32d contacts:Vector<InputContact> replace:Bool = contacts.ImportedContacts; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector<InputUser> = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector<int>; contacts.importCard#4fe196fe export_card:Vector<int> = User; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; messages.getMessages#4222fa74 id:Vector<int> = messages.Messages; messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs; messages.getHistory#afa92846 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.search#d4569248 flags:# peer:InputPeer q:string filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Updates; messages.sendMedia#c8f16791 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.getChats#3c6aa187 id:Vector<int> = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector<InputUser> title:string = Updates; messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector<long>; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#25223e24 message:string = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector<int> increment:Bool = Vector<int>; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector<long> = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector<InputBotInlineResult> cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#ce91e4ca flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Updates; messages.editInlineBotMessage#130c2c85 flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#2d9776b9 peers:Vector<InputPeer> = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector<MessageEntity> = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector<long> = Bool; messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector<StickerSetCovered>; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector<int> = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#3289be6a flags:# pinned:flags.0?true peer:InputPeer = Bool; messages.reorderPinnedDialogs#959ff644 flags:# force:flags.0?true order:Vector<InputPeer> = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector<InputPhoto> = Vector<long>; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; upload.reuploadCdnFile#2e7a2020 file_token:bytes request_token:bytes = Bool; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#ae2de196 = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector<InputAppEvent> = Bool; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#9010ef6f prev_app_version:string = Updates; help.getTermsOfService#350170f3 = help.TermsOfService; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector<int> = Bool; channels.getMessages#93d7b347 channel:InputChannel id:Vector<int> = messages.Messages; channels.getParticipants#24d98f92 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#eb7611d0 channel:InputChannel user_id:InputUser role:ChannelParticipantRole = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector<InputUser> = Updates; channels.kickFromChannel#a672de14 channel:InputChannel user_id:InputUser kicked:Bool = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; channels.exportMessageLink#c846d22d channel:InputChannel id:int = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm; payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt; payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult; payments.getSavedInfo#227d824b = payments.SavedInfo; payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; phone.getCallConfig#55451fa9 = DataJSON; phone.requestCall#5b95b3d4 user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = Updates; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; // LAYER 66 <?php /** * PTSException module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class PTSException extends \Exception { use TL\PrettyException; public function __toString() { return get_class($this).($this->message !== '' ? ': ' : '').$this->message.PHP_EOL.'TL Trace:'.PHP_EOL.PHP_EOL.$this->getTLTrace().PHP_EOL; } public function __construct($message, $file = '') { parent::__construct($message); $this->prettify_tl($file); } } <?php /** * FileCallbackInterface module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; interface FileCallbackInterface { public function getFile(); public function __invoke($percent); } ---types--- boolFalse#bc799737 = Bool; boolTrue#997275b5 = Bool; true#3fedd339 = True; vector#1cb5c415 {t:Type} # [ t ] = Vector t; error#c4b9f9bb code:int text:string = Error; null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#2f37e231 flags:# file:InputFile caption:string stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia; inputMediaPhoto#81fa373a flags:# id:InputPhoto caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; inputMediaUploadedDocument#e39621fd flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector<DocumentAttribute> caption:string stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia; inputMediaDocument#5acb668e flags:# id:InputDocument caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia; inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#922aec1 flags:# url:string caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaDocumentExternal#b6f74335 flags:# url:string caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia; inputMediaGeoLive#7b1a118f geo_point:InputGeoPoint period:int = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; inputPhoto#fb95c6c4 id:long access_hash:long = InputPhoto; inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; inputDocumentFileLocation#430f0724 id:long access_hash:long version:int = InputFileLocation; inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; storage.fileGif#cae1aadf = storage.FileType; storage.filePng#a4f63c0 = storage.FileType; storage.filePdf#ae1e508d = storage.FileType; storage.fileMp3#528a0677 = storage.FileType; storage.fileMov#4b09ebbc = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation; userEmpty#200250ba id:int = User; user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; userStatusRecently#e26f42f1 = UserStatus; userStatusLastWeek#7bf09fc = UserStatus; userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; channel#450b7115 flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights participants_count:flags.17?int = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> = ChatFull; channelFull#76af5481 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; chatParticipants#3f460fed chat_id:int participants:Vector<ChatParticipant> version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; message#44f9b43d flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#b5223b0f flags:# photo:flags.0?Photo caption:flags.1?string ttl_seconds:flags.2?int = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#7c4414d3 flags:# document:flags.0?Document caption:flags.1?string ttl_seconds:flags.2?int = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia; messageMediaGeoLive#7c3c2609 geo:GeoPoint period:int = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector<int> = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#488a7337 users:Vector<int> = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction; messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; messageActionScreenshotTaken#4792929b = MessageAction; messageActionCustomAction#fae69f56 message:string = MessageAction; dialog#e4def5db flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector<PhotoSize> = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#2049d70c long:double lat:double = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#5e002502 flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyAll#a429b886 = InputNotifyPeer; inputPeerNotifyEventsEmpty#f03064d8 = InputPeerNotifyEvents; inputPeerNotifyEventsAll#e86a2c74 = InputPeerNotifyEvents; inputPeerNotifySettings#38935eb2 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = InputPeerNotifySettings; peerNotifyEventsEmpty#add53cb3 = PeerNotifyEvents; peerNotifyEventsAll#6d1ded88 = PeerNotifyEvents; peerNotifySettingsEmpty#70a68512 = PeerNotifySettings; peerNotifySettings#9acda4c0 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = PeerNotifySettings; peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; wallPaper#ccb03657 id:int title:string sizes:Vector<PhotoSize> color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; userFull#f220f3f flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; importedContact#d0028438 user_id:int client_id:long = ImportedContact; contactBlocked#561bc879 user_id:int date:int = ContactBlocked; contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#eae87e42 contacts:Vector<Contact> saved_count:int users:Vector<User> = contacts.Contacts; contacts.importedContacts#77d01c3b imported:Vector<ImportedContact> popular_invites:Vector<PopularContact> retry_contacts:Vector<long> users:Vector<User> = contacts.ImportedContacts; contacts.blocked#1c138d15 blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked; contacts.blockedSlice#900802a1 count:int blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs; messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; messages.channelMessages#99262e37 flags:# pts:int count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; messages.messagesNotModified#74535f21 count:int = messages.Messages; messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats; messages.chatsSlice#9cd81144 count:int chats:Vector<Chat> = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull; messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; inputMessagesFilterEmpty#57e2f66c = MessagesFilter; inputMessagesFilterPhotos#9609a51c = MessagesFilter; inputMessagesFilterVideo#9fc00e65 = MessagesFilter; inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; inputMessagesFilterDocument#9eddf188 = MessagesFilter; inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter; inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter; inputMessagesFilterGeo#e7026d0d = MessagesFilter; inputMessagesFilterContacts#e062db83 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector<int> pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector<DcOption> = Update; updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector<MessageEntity> = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector<int> pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector<int> pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector<long> = Update; updateStickerSets#43ae3dec = Update; updateSavedGifs#9375341e = Update; updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updateDialogPinned#d711a2cc flags:# pinned:flags.0?true peer:Peer = Update; updatePinnedDialogs#d8caf68d flags:# order:flags.0?Vector<Peer> = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updateLangPackTooLong#10c2404b = Update; updateLangPack#56022f4d difference:LangPackDifference = Update; updateFavedStickers#e511996d = Update; updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector<int> = Update; updateContactsReset#7084a7be = Update; updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> intermediate_state:updates.State = updates.Difference; updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates; updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates; updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> = Updates; photos.photos#8dca6aa5 photos:Vector<Photo> users:Vector<User> = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector<Photo> users:Vector<User> = photos.Photos; photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; upload.fileCdnRedirect#ea52fe5a dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes cdn_file_hashes:Vector<CdnFileHash> = upload.File; dcOption#5d8c6cc flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int = DcOption; config#9c840964 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string suggested_lang_code:flags.2?string lang_pack_version:flags.2?int disabled_features:Vector<DisabledFeature> = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; help.appUpdate#8987f311 id:int critical:Bool url:string text:string = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#18798952 id:long access_hash:long = InputDocument; documentEmpty#36f8c871 id:long = Document; document#87232bc7 id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int version:int attributes:Vector<DocumentAttribute> = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyAll#74d07c60 = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; sendMessageRecordRoundAction#88f27fbc = SendMessageAction; sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; contacts.found#1aa1f784 results:Vector<Peer> chats:Vector<Chat> users:Vector<User> = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector<InputUser> = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector<InputUser> = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#4d5bbe0c users:Vector<int> = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector<int> = PrivacyRule; account.privacyRules#554abb6f rules:Vector<PrivacyRule> users:Vector<User> = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true duration:int w:int h:int = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; messages.stickers#8a8ecd32 hash:string stickers:Vector<Document> = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; messages.allStickers#edfd405f hash:int sets:Vector<StickerSet> = messages.AllStickers; disabledFeature#ae636f24 feature:string description:string = DisabledFeature; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector<Authorization> = account.Authorizations; account.noPassword#96dabc18 new_salt:bytes email_unconfirmed_pattern:string = account.Password; account.password#7c18141c current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = account.Password; account.passwordSettings#b7b72ab3 email:string = account.PasswordSettings; account.passwordInputSettings#86916deb flags:# new_salt:flags.0?bytes new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector<User> = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; stickerSet#cd303b41 flags:# installed:flags.0?true archived:flags.1?true official:flags.2?true masks:flags.3?true id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#98e81d3a user_id:int description:string commands:Vector<BotCommand> = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector<KeyboardButton> = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector<KeyboardButtonRow> = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector<KeyboardButtonRow> = ReplyMarkup; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; messageEntityMention#fa04579d offset:int length:int = MessageEntity; messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector<Chat> users:Vector<User> = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; updates.channelDifferenceTooLong#6a9d7b35 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector<Message> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector<MessageRange> = ChannelMessagesFilter; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantAdmin#a82fa898 flags:# can_edit:flags.0?true user_id:int inviter_id:int promoted_by:int date:int admin_rights:ChannelAdminRights = ChannelParticipant; channelParticipantBanned#222c1886 flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChannelBannedRights = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter; channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter; channels.channelParticipants#f56ee2a8 count:int participants:Vector<ChannelParticipant> users:Vector<User> = channels.ChannelParticipants; channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants; channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector<User> = channels.ChannelParticipant; help.termsOfService#f1ee3e90 text:string = help.TermsOfService; foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; messages.foundGifs#450a1c0a next_offset:int results:Vector<FoundGif> = messages.FoundGifs; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector<Document> = messages.SavedGifs; inputBotInlineMessageMediaAuto#292fed13 flags:# caption:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#c1b15d65 flags:# geo_point:InputGeoPoint period:int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#aaafadc8 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#2daf01a7 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#2cbbe15a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; botInlineMessageMediaAuto#a74b15b flags:# caption:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#b722de65 flags:# geo:GeoPoint period:int reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#4366232e flags:# geo:GeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#9bebaeb9 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector<BotInlineResult> cache_time:int users:Vector<User> = messages.BotResults; exportedMessageLink#1f486803 link:string = ExportedMessageLink; messageFwdHeader#559ebe6d flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; messages.peerDialogs#3371c354 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> state:updates.State = messages.PeerDialogs; topPeer#edcdc05b peer:Peer rating:double = TopPeer; topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; topPeerCategoryBotsInline#148677e2 = TopPeerCategory; topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector<TopPeer> = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector<TopPeerCategoryPeers> chats:Vector<Chat> users:Vector<User> = contacts.TopPeers; draftMessageEmpty#ba4baec5 = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector<MessageEntity> date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; messages.featuredStickers#f89d88e5 hash:int sets:Vector<StickerSetCovered> unread:Vector<long> = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#5ce20970 hash:int stickers:Vector<Document> = messages.RecentStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector<StickerSetCovered> = messages.ArchivedStickers; messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector<StickerSetCovered> = messages.StickerSetInstallResult; stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector<Document> = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector<HighScore> users:Vector<User> = messages.HighScores; textEmpty#dc3d824f = RichText; textPlain#744694e0 text:string = RichText; textBold#6724abc4 text:RichText = RichText; textItalic#d912a59c text:RichText = RichText; textUnderline#c12622c4 text:RichText = RichText; textStrike#9bf8bb95 text:RichText = RichText; textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector<RichText> = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; pageBlockHeader#bfd064ec text:RichText = PageBlock; pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; pageBlockParagraph#467a0766 text:RichText = PageBlock; pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; pageBlockList#3a58c7f4 ordered:Bool items:Vector<RichText> = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; pageBlockVideo#d9d71866 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:RichText = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; pageBlockEmbed#cde200d1 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:int h:int caption:RichText = PageBlock; pageBlockEmbedPost#292c7be9 url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector<PageBlock> caption:RichText = PageBlock; pageBlockCollage#8b31c4f items:Vector<PageBlock> caption:RichText = PageBlock; pageBlockSlideshow#130c8963 items:Vector<PageBlock> caption:RichText = PageBlock; pageBlockChannel#ef1751b5 channel:Chat = PageBlock; pageBlockAudio#31b81a7f audio_id:long caption:RichText = PageBlock; pagePart#8e3f9ebe blocks:Vector<PageBlock> photos:Vector<Photo> documents:Vector<Document> = Page; pageFull#556ec7aa blocks:Vector<PageBlock> photos:Vector<Photo> documents:Vector<Document> = Page; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector<LabeledPrice> = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; webDocument#c61acbd8 url:string access_hash:long size:int mime_type:string attributes:Vector<DocumentAttribute> dc_id:int = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector<User> = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt; payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsAndroidPay#795667a6 payment_token:DataJSON = InputPaymentCredentials; account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; shippingOption#b6213cdf id:string title:string prices:Vector<LabeledPrice> = ShippingOption; inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCall#ffe6ab67 id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector<PhoneConnection> start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector<User> = phone.PhoneCall; upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey; cdnConfig#5725e40a public_keys:Vector<CdnPublicKey> = CdnConfig; langPackString#cad181f6 key:string value:string = LangPackString; langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString; langPackStringDeleted#2979eeb2 key:string = LangPackString; langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector<LangPackString> = LangPackDifference; langPackLanguage#117698f1 name:string native_name:string lang_code:string = LangPackLanguage; channelAdminRights#5d7ceba5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true invite_link:flags.6?true pin_messages:flags.7?true add_admins:flags.9?true = ChannelAdminRights; channelBannedRights#58cf4249 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true until_date:int = ChannelBannedRights; channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangePhoto#b82f55c3 prev_photo:ChatPhoto new_photo:ChatPhoto = ChannelAdminLogEventAction; channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector<ChannelAdminLogEvent> chats:Vector<Chat> users:Vector<User> = channels.AdminLogResults; channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; cdnFileHash#77eec38f offset:int limit:int hash:bytes = CdnFileHash; messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers; messages.favedStickers#f37f2f16 hash:int packs:Vector<StickerPack> stickers:Vector<Document> = messages.FavedStickers; recentMeUrlUnknown#46e1d13d url:string = RecentMeUrl; recentMeUrlUser#8dbc3336 url:string user_id:int = RecentMeUrl; recentMeUrlChat#a01b22f9 url:string chat_id:int = RecentMeUrl; recentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl; recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl; help.recentMeUrls#e0310d7 urls:Vector<RecentMeUrl> chats:Vector<Chat> users:Vector<User> = help.RecentMeUrls; inputSingleMedia#5eaa7809 media:InputMedia random_id:long = InputSingleMedia; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector<long> query:!X = X; initConnection#c7481da6 {X:Type} api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone; auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; auth.resetAuthorizations#9fab0d1a = Bool; auth.sendInvites#771c1d97 phone_numbers:Vector<string> message:string = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector<long> = Bool; account.registerDevice#637ea878 token_type:int token:string = Bool; account.unregisterDevice#65c55b40 token_type:int token:string = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector<WallPaper>; account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules; account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; account.getTmpPassword#4a82327e password_hash:bytes period:int = account.TmpPassword; users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>; users.getFullUser#ca30a5b1 id:InputUser = UserFull; contacts.getStatuses#c4a353ee = Vector<ContactStatus>; contacts.getContacts#c023849f hash:int = contacts.Contacts; contacts.importContacts#2c800be5 contacts:Vector<InputContact> = contacts.ImportedContacts; contacts.deleteContact#8e953744 id:InputUser = contacts.Link; contacts.deleteContacts#59ab389e id:Vector<InputUser> = Bool; contacts.block#332b49fc id:InputUser = Bool; contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector<int>; contacts.importCard#4fe196fe export_card:Vector<int> = User; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; contacts.resetSaved#879537f1 = Bool; messages.getMessages#4222fa74 id:Vector<int> = messages.Messages; messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs; messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.search#39e9ea0 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Updates; messages.sendMedia#c8f16791 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true grouped:flags.9?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.getChats#3c6aa187 id:Vector<int> = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; messages.editChatTitle#dc452855 chat_id:int title:string = Updates; messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector<InputUser> title:string = Updates; messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; messages.discardEncryption#edd923c5 chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector<long>; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#25223e24 message:string = MessageMedia; messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector<int> increment:Bool = Vector<int>; messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector<long> = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector<InputBotInlineResult> cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#5d1b8dd flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true peer:InputPeer id:int message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> geo_point:flags.13?InputGeoPoint = Updates; messages.editInlineBotMessage#b0e08243 flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> geo_point:flags.13?InputGeoPoint = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#2d9776b9 peers:Vector<InputPeer> = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector<MessageEntity> = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector<long> = Bool; messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector<StickerSetCovered>; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector<int> = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#3289be6a flags:# pinned:flags.0?true peer:InputPeer = Bool; messages.reorderPinnedDialogs#959ff644 flags:# force:flags.0?true order:Vector<InputPeer> = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia; messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates; messages.getFavedStickers#21ce0b0e hash:int = messages.FavedStickers; messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool; messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory; messages.getRecentLocations#249431e2 peer:InputPeer limit:int = messages.Messages; messages.sendMultiMedia#2095512f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector<InputSingleMedia> = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector<InputPhoto> = Vector<long>; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; upload.reuploadCdnFile#1af91c09 file_token:bytes request_token:bytes = Vector<CdnFileHash>; upload.getCdnFileHashes#f715c87b file_token:bytes offset:int = Vector<CdnFileHash>; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#ae2de196 = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector<InputAppEvent> = Bool; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#9010ef6f prev_app_version:string = Updates; help.getTermsOfService#350170f3 = help.TermsOfService; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages; channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector<int> = Bool; channels.getMessages#93d7b347 channel:InputChannel id:Vector<int> = messages.Messages; channels.getParticipants#123e05e9 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:int = channels.ChannelParticipants; channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; channels.editAdmin#20b88214 channel:InputChannel user_id:InputUser admin_rights:ChannelAdminRights = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector<InputUser> = Updates; channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; channels.exportMessageLink#c846d22d channel:InputChannel id:int = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; channels.editBanned#bfd915cd channel:InputChannel user_id:InputUser banned_rights:ChannelBannedRights = Updates; channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector<InputUser> max_id:long min_id:long limit:int = channels.AdminLogResults; channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool; channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector<int> = Bool; channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool; channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm; payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt; payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult; payments.getSavedInfo#227d824b = payments.SavedInfo; payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector<InputStickerSetItem> = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet; stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; phone.getCallConfig#55451fa9 = DataJSON; phone.requestCall#5b95b3d4 user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = Updates; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; langpack.getLangPack#9ab5c58e lang_code:string = LangPackDifference; langpack.getStrings#2e1ee318 lang_code:string keys:Vector<string> = Vector<LangPackString>; langpack.getDifference#b2e4d7d from_version:int = LangPackDifference; langpack.getLanguages#800fd57d = Vector<LangPackLanguage>; // LAYER 73 <?php /** * Bug74586Exception module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class Bug74586Exception extends \Exception { } <?php /** * Serialization module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; /** * Manages serialization of the MadelineProto instance. */ class Serialization { public static function serialize_all($exception) { echo $exception.PHP_EOL; return; foreach (self::$instances as $instance) { if (isset($instance->session)) { $instance->serialize(); } } } public static function realpaths($file) { $file = Absolute::absolute($file); return ['file' => $file, 'lockfile' => $file.'.lock', 'tempfile' => $file.'.temp.session']; } /** * Serialize API class. * * @param string $filename the dump file * @param API $instance * @param bool $force * * @return number */ public static function serialize($filename, $instance, $force = false) { if ($filename == '') { throw new \danog\MadelineProto\Exception('Empty filename'); } if (isset($instance->API->setdem) && $instance->API->setdem) { $instance->API->setdem = false; $instance->API->__construct($instance->API->settings); } if ($instance->API === null && !$instance->getting_api_id) { return false; } $instance->serialized = time(); $realpaths = self::realpaths($filename); if (!file_exists($realpaths['lockfile'])) { touch($realpaths['lockfile']); clearstatcache(); } $realpaths['lockfile'] = fopen($realpaths['lockfile'], 'w'); \danog\MadelineProto\Logger::log('Waiting for exclusive lock of serialization lockfile...'); flock($realpaths['lockfile'], LOCK_EX); \danog\MadelineProto\Logger::log('Lock acquired, serializing'); try { if (!$instance->getting_api_id) { $update_closure = $instance->API->settings['updates']['callback']; if ($instance->API->settings['updates']['callback'] instanceof \Closure) { $instance->API->settings['updates']['callback'] = [$instance->API, 'noop']; } $logger_closure = $instance->API->settings['logger']['logger_param']; if ($instance->API->settings['logger']['logger_param'] instanceof \Closure) { $instance->API->settings['logger']['logger_param'] = [$instance->API, 'noop']; } } $wrote = file_put_contents($realpaths['tempfile'], serialize($instance)); rename($realpaths['tempfile'], $realpaths['file']); } finally { if (!$instance->getting_api_id) { $instance->API->settings['updates']['callback'] = $update_closure; $instance->API->settings['logger']['logger_param'] = $logger_closure; } flock($realpaths['lockfile'], LOCK_UN); fclose($realpaths['lockfile']); } return $wrote; } } {"constructors":[{"id":"481674261","predicate":"vector","params":[],"type":"Vector t"},{"id":"85337187","predicate":"resPQ","params":[{"name":"nonce","type":"int128"},{"name":"server_nonce","type":"int128"},{"name":"pq","type":"bytes"},{"name":"server_public_key_fingerprints","type":"Vector<long>"}],"type":"ResPQ"},{"id":"-2083955988","predicate":"p_q_inner_data","params":[{"name":"pq","type":"bytes"},{"name":"p","type":"bytes"},{"name":"q","type":"bytes"},{"name":"nonce","type":"int128"},{"name":"server_nonce","type":"int128"},{"name":"new_nonce","type":"int256"}],"type":"P_Q_inner_data"},{"id":"1013613780","predicate":"p_q_inner_data_temp","params":[{"name":"pq","type":"bytes"},{"name":"p","type":"bytes"},{"name":"q","type":"bytes"},{"name":"nonce","type":"int128"},{"name":"server_nonce","type":"int128"},{"name":"new_nonce","type":"int256"},{"name":"expires_in","type":"int"}],"type":"P_Q_inner_data"},{"id":"2043348061","predicate":"server_DH_params_fail","params":[{"name":"nonce","type":"int128"},{"name":"server_nonce","type":"int128"},{"name":"new_nonce_hash","type":"int128"}],"type":"Server_DH_Params"},{"id":"-790100132","predicate":"server_DH_params_ok","params":[{"name":"nonce","type":"int128"},{"name":"server_nonce","type":"int128"},{"name":"encrypted_answer","type":"bytes"}],"type":"Server_DH_Params"},{"id":"-1249309254","predicate":"server_DH_inner_data","params":[{"name":"nonce","type":"int128"},{"name":"server_nonce","type":"int128"},{"name":"g","type":"int"},{"name":"dh_prime","type":"bytes"},{"name":"g_a","type":"bytes"},{"name":"server_time","type":"int"}],"type":"Server_DH_inner_data"},{"id":"1715713620","predicate":"client_DH_inner_data","params":[{"name":"nonce","type":"int128"},{"name":"server_nonce","type":"int128"},{"name":"retry_id","type":"long"},{"name":"g_b","type":"bytes"}],"type":"Client_DH_Inner_Data"},{"id":"1003222836","predicate":"dh_gen_ok","params":[{"name":"nonce","type":"int128"},{"name":"server_nonce","type":"int128"},{"name":"new_nonce_hash1","type":"int128"}],"type":"Set_client_DH_params_answer"},{"id":"1188831161","predicate":"dh_gen_retry","params":[{"name":"nonce","type":"int128"},{"name":"server_nonce","type":"int128"},{"name":"new_nonce_hash2","type":"int128"}],"type":"Set_client_DH_params_answer"},{"id":"-1499615742","predicate":"dh_gen_fail","params":[{"name":"nonce","type":"int128"},{"name":"server_nonce","type":"int128"},{"name":"new_nonce_hash3","type":"int128"}],"type":"Set_client_DH_params_answer"},{"id":"-212046591","predicate":"rpc_result","params":[{"name":"req_msg_id","type":"long"},{"name":"result","type":"Object"}],"type":"RpcResult"},{"id":"558156313","predicate":"rpc_error","params":[{"name":"error_code","type":"int"},{"name":"error_message","type":"string"}],"type":"RpcError"},{"id":"1579864942","predicate":"rpc_answer_unknown","params":[],"type":"RpcDropAnswer"},{"id":"-847714938","predicate":"rpc_answer_dropped_running","params":[],"type":"RpcDropAnswer"},{"id":"-1539647305","predicate":"rpc_answer_dropped","params":[{"name":"msg_id","type":"long"},{"name":"seq_no","type":"int"},{"name":"bytes","type":"int"}],"type":"RpcDropAnswer"},{"id":"155834844","predicate":"future_salt","params":[{"name":"valid_since","type":"int"},{"name":"valid_until","type":"int"},{"name":"salt","type":"long"}],"type":"FutureSalt"},{"id":"-1370486635","predicate":"future_salts","params":[{"name":"req_msg_id","type":"long"},{"name":"now","type":"int"},{"name":"salts","type":"vector<future_salt>"}],"type":"FutureSalts"},{"id":"880243653","predicate":"pong","params":[{"name":"msg_id","type":"long"},{"name":"ping_id","type":"long"}],"type":"Pong"},{"id":"-501201412","predicate":"destroy_session_ok","params":[{"name":"session_id","type":"long"}],"type":"DestroySessionRes"},{"id":"1658015945","predicate":"destroy_session_none","params":[{"name":"session_id","type":"long"}],"type":"DestroySessionRes"},{"id":"-1631450872","predicate":"new_session_created","params":[{"name":"first_msg_id","type":"long"},{"name":"unique_id","type":"long"},{"name":"server_salt","type":"long"}],"type":"NewSession"},{"id":"1945237724","predicate":"msg_container","params":[{"name":"messages","type":"vector<%Message>"}],"type":"MessageContainer"},{"id":"1538843921","predicate":"message","params":[{"name":"msg_id","type":"long"},{"name":"seqno","type":"int"},{"name":"bytes","type":"int"},{"name":"body","type":"Object"}],"type":"Message"},{"id":"-530561358","predicate":"msg_copy","params":[{"name":"orig_message","type":"Message"}],"type":"MessageCopy"},{"id":"812830625","predicate":"gzip_packed","params":[{"name":"packed_data","type":"bytes"}],"type":"Object"},{"id":"1658238041","predicate":"msgs_ack","params":[{"name":"msg_ids","type":"Vector<long>"}],"type":"MsgsAck"},{"id":"-1477445615","predicate":"bad_msg_notification","params":[{"name":"bad_msg_id","type":"long"},{"name":"bad_msg_seqno","type":"int"},{"name":"error_code","type":"int"}],"type":"BadMsgNotification"},{"id":"-307542917","predicate":"bad_server_salt","params":[{"name":"bad_msg_id","type":"long"},{"name":"bad_msg_seqno","type":"int"},{"name":"error_code","type":"int"},{"name":"new_server_salt","type":"long"}],"type":"BadMsgNotification"},{"id":"2105940488","predicate":"msg_resend_req","params":[{"name":"msg_ids","type":"Vector<long>"}],"type":"MsgResendReq"},{"id":"-630588590","predicate":"msgs_state_req","params":[{"name":"msg_ids","type":"Vector<long>"}],"type":"MsgsStateReq"},{"id":"81704317","predicate":"msgs_state_info","params":[{"name":"req_msg_id","type":"long"},{"name":"info","type":"bytes"}],"type":"MsgsStateInfo"},{"id":"-1933520591","predicate":"msgs_all_info","params":[{"name":"msg_ids","type":"Vector<long>"},{"name":"info","type":"bytes"}],"type":"MsgsAllInfo"},{"id":"661470918","predicate":"msg_detailed_info","params":[{"name":"msg_id","type":"long"},{"name":"answer_msg_id","type":"long"},{"name":"bytes","type":"int"},{"name":"status","type":"int"}],"type":"MsgDetailedInfo"},{"id":"-2137147681","predicate":"msg_new_detailed_info","params":[{"name":"answer_msg_id","type":"long"},{"name":"bytes","type":"int"},{"name":"status","type":"int"}],"type":"MsgDetailedInfo"},{"id":"1973679973","predicate":"bind_auth_key_inner","params":[{"name":"nonce","type":"long"},{"name":"temp_auth_key_id","type":"long"},{"name":"perm_auth_key_id","type":"long"},{"name":"temp_session_id","type":"long"},{"name":"expires_at","type":"int"}],"type":"BindAuthKeyInner"}],"methods":[{"id":"1615239032","method":"req_pq","params":[{"name":"nonce","type":"int128"}],"type":"ResPQ"},{"id":"-1099002127","method":"req_pq_multi","params":[{"name":"nonce","type":"int128"}],"type":"ResPQ"},{"id":"-686627650","method":"req_DH_params","params":[{"name":"nonce","type":"int128"},{"name":"server_nonce","type":"int128"},{"name":"p","type":"bytes"},{"name":"q","type":"bytes"},{"name":"public_key_fingerprint","type":"long"},{"name":"encrypted_data","type":"bytes"}],"type":"Server_DH_Params"},{"id":"-184262881","method":"set_client_DH_params","params":[{"name":"nonce","type":"int128"},{"name":"server_nonce","type":"int128"},{"name":"encrypted_data","type":"bytes"}],"type":"Set_client_DH_params_answer"},{"id":"1491380032","method":"rpc_drop_answer","params":[{"name":"req_msg_id","type":"long"}],"type":"RpcDropAnswer"},{"id":"-1188971260","method":"get_future_salts","params":[{"name":"num","type":"int"}],"type":"FutureSalts"},{"id":"2059302892","method":"ping","params":[{"name":"ping_id","type":"long"}],"type":"Pong"},{"id":"-213746804","method":"ping_delay_disconnect","params":[{"name":"ping_id","type":"long"},{"name":"disconnect_delay","type":"int"}],"type":"Pong"},{"id":"-414113498","method":"destroy_session","params":[{"name":"session_id","type":"long"}],"type":"DestroySessionRes"},{"id":"-1835453025","method":"http_wait","params":[{"name":"max_delay","type":"int"},{"name":"wait_after","type":"int"},{"name":"max_wait","type":"int"}],"type":"HttpWait"}]} <?php /** * AnnotationsBuilder module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; use phpDocumentor\Reflection\DocBlockFactory; class AnnotationsBuilder { use \danog\MadelineProto\TL\TL; use Tools; public function __construct($logger, $settings) { $this->logger = $logger; $this->construct_TL($settings['tl_schema']); $this->settings = $settings; } public function mk_annotations() { \danog\MadelineProto\Logger::log('Generating annotations...', \danog\MadelineProto\Logger::NOTICE); $this->setProperties(); $this->createInternalClasses(); } /** * Open file of class APIFactory * Insert properties * save the file with new content. */ private function setProperties() { \danog\MadelineProto\Logger::log('Generating properties...', \danog\MadelineProto\Logger::NOTICE); $fixture = DocBlockFactory::createInstance(); $class = new \ReflectionClass(APIFactory::class); $content = file_get_contents($filename = $class->getFileName()); foreach ($class->getProperties() as $property) { if ($raw_docblock = $property->getDocComment()) { $docblock = $fixture->create($raw_docblock); if ($docblock->hasTag('internal')) { $content = str_replace("\n ".$raw_docblock."\n public \$".$property->getName().';', '', $content); } } } foreach ($this->get_method_namespaces() as $namespace) { $content = preg_replace('/(class( \\w+[,]?){0,}\\n{\\n)/', '${1}'." /**\n"." * @internal this is a internal property generated by build_docs.php, don't change manually\n"." *\n"." * @var {$namespace}\n"." */\n"." public \${$namespace};\n", $content); } file_put_contents($filename, $content); } /** * Create file InternalDoc with all interfaces. */ private function createInternalClasses() { \danog\MadelineProto\Logger::log('Creating internal classes...', \danog\MadelineProto\Logger::NOTICE); $handle = fopen(dirname(__FILE__).'/InternalDoc.php', 'w'); foreach ($this->methods->by_id as $id => $data) { if (!strpos($data['method'], '.')) { continue; } list($namespace, $method) = explode('.', $data['method']); if (!in_array($namespace, $this->get_method_namespaces())) { continue; } $type = str_replace(['.', '<', '>'], ['_', '_of_', ''], $data['type']); foreach ($data['params'] as $param) { if (in_array($param['name'], ['flags', 'random_id'])) { continue; } $stype = 'type'; if (isset($param['subtype'])) { $stype = 'subtype'; } $ptype = str_replace('.', '_', $param[$stype]); switch ($ptype) { case 'true': case 'false': $ptype = 'boolean'; } $internalDoc[$namespace][$method]['attr'][$param['name']] = $ptype; } if ($type === 'Bool') { $type = strtolower($type); } $internalDoc[$namespace][$method]['return'] = $type; } fwrite($handle, "<?php\n"); fwrite($handle, "/**\n"); fwrite($handle, " * This file is automatic generated by build_docs.php file\n"); fwrite($handle, " * and is used only for autocomplete in multiple IDE\n"); fwrite($handle, " * don't modify manually.\n"); fwrite($handle, " */\n\n"); fwrite($handle, "namespace danog\\MadelineProto;\n"); foreach ($internalDoc as $namespace => $methods) { fwrite($handle, "\ninterface {$namespace}\n{"); foreach ($methods as $method => $properties) { fwrite($handle, "\n /**\n"); if (isset($properties['attr'])) { fwrite($handle, " * @param array params [\n"); foreach ($properties['attr'] as $name => $type) { fwrite($handle, " * {$type} {$name},\n"); } fwrite($handle, " * ]\n"); fwrite($handle, " *\n"); } fwrite($handle, " * @return {$properties['return']}\n"); fwrite($handle, " */\n"); fwrite($handle, " public function {$method}("); if (isset($properties['attr'])) { fwrite($handle, 'array $params'); } fwrite($handle, ");\n"); } fwrite($handle, "}\n"); } fclose($handle); } } <?php /** * Exception module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class Exception extends \Exception { use TL\PrettyException; public static $rollbar = true; public function __toString() { $result = $this->file === 'MadelineProto' ? $this->message : '\\danog\\MadelineProto\\Exception'.($this->message !== '' ? ': ' : '').$this->message.' in '.$this->file.':'.$this->line.PHP_EOL.\danog\MadelineProto\Magic::$revision.PHP_EOL.'TL Trace (YOU ABSOLUTELY MUST READ THE TEXT BELOW):'.PHP_EOL.$this->getTLTrace(); if (php_sapi_name() !== 'cli') { $result = str_replace(PHP_EOL, '<br>'.PHP_EOL, $result); } return $result; } public function __construct($message = null, $code = 0, self $previous = null, $file = null, $line = null) { if (is_array($message) && $message[0] === 'extension') { if ($message[1] === 'libtgvoip') { $additional = 'Follow the instructions @ https://voip.madelineproto.xyz to install it.'; } elseif ($message[1] === 'prime') { $additional = 'Follow the instructions @ https://prime.madelineproto.xyz to install it.'; } else { $additional = 'Try running sudo apt-get install php'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION.'-'.$message[1].'.'; } $message = 'MadelineProto requires the '.$message[1].' extension to run. '.$additional; if (php_sapi_name() !== 'cli') { echo $message.'<br>'; } $file = 'MadelineProto'; $line = 1; } $this->prettify_tl(); if ($file !== null) { if (basename($file) === 'Threaded.php') { $line = debug_backtrace(0)[2]['line']; $file = debug_backtrace(0)[2]['file']; } $this->file = $file; } if ($line !== null) { $this->line = $line; } parent::__construct($message, $code, $previous); if (strpos($message, 'socket_accept') === false) { \danog\MadelineProto\Logger::log($message.' in '.basename($this->file).':'.$this->line, \danog\MadelineProto\Logger::FATAL_ERROR); } if (in_array($message, ['The session is corrupted!', 'Re-executing query...', 'I had to recreate the temporary authorization key', 'This peer is not present in the internal peer database', "Couldn't get response", 'Chat forbidden', 'The php-libtgvoip extension is required to accept and manage calls. See daniil.it/MadelineProto for more info.', 'File does not exist', 'Please install this fork of phpseclib: https://github.com/danog/phpseclib'])) { return; } if (strpos($message, 'pg_query') !== false || strpos($message, 'Undefined variable: ') !== false || strpos($message, 'socket_write') !== false || strpos($message, 'socket_read') !== false || strpos($message, 'Received request to switch to DC ') !== false || strpos($message, "Couldn't get response") !== false || strpos($message, 'Re-executing query...') !== false || strpos($message, "Couldn't find peer by provided") !== false || strpos($message, 'id.pwrtelegram.xyz') !== false || strpos($message, 'Please update ') !== false || strpos($message, 'posix_isatty') !== false) { return; } if (self::$rollbar) { \Rollbar\Rollbar::log(\Rollbar\Payload\Level::error(), $this, debug_backtrace(0)); } } /** * ExceptionErrorHandler. * * Error handler */ public static function ExceptionErrorHandler($errno = 0, $errstr = null, $errfile = null, $errline = null) { // If error is suppressed with @, don't throw an exception if (error_reporting() === 0 || $errfile && strpos($errfile, 'vendor/amphp') !== false) { return false; } throw new self($errstr, $errno, null, $errfile, $errline); } } { "constructors": [ { "id": "-1132882121", "predicate": "boolFalse", "params": [], "type": "Bool" }, { "id": "-1720552011", "predicate": "boolTrue", "params": [], "type": "Bool" }, { "id": "481674261", "predicate": "vector", "params": [], "type": "Vector t" }, { "id": "-994444869", "predicate": "error", "params": [ { "name": "code", "type": "int" }, { "name": "text", "type": "string" } ], "type": "Error" }, { "id": "1450380236", "predicate": "null", "params": [], "type": "Null" }, { "id": "2134579434", "predicate": "inputPeerEmpty", "params": [], "type": "InputPeer" }, { "id": "2107670217", "predicate": "inputPeerSelf", "params": [], "type": "InputPeer" }, { "id": "396093539", "predicate": "inputPeerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1182234929", "predicate": "inputUserEmpty", "params": [], "type": "InputUser" }, { "id": "-138301121", "predicate": "inputUserSelf", "params": [], "type": "InputUser" }, { "id": "-208488460", "predicate": "inputPhoneContact", "params": [ { "name": "client_id", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputContact" }, { "id": "-181407105", "predicate": "inputFile", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" }, { "name": "md5_checksum", "type": "string" } ], "type": "InputFile" }, { "id": "-1771768449", "predicate": "inputMediaEmpty", "params": [], "type": "InputMedia" }, { "id": "-139464256", "predicate": "inputMediaUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-373312269", "predicate": "inputMediaPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-104578748", "predicate": "inputMediaGeoPoint", "params": [ { "name": "geo_point", "type": "InputGeoPoint" } ], "type": "InputMedia" }, { "id": "-1494984313", "predicate": "inputMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputMedia" }, { "id": "-515910468", "predicate": "inputMediaUploadedVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-1761896484", "predicate": "inputMediaUploadedThumbVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-1821749571", "predicate": "inputMediaVideo", "params": [ { "name": "id", "type": "InputVideo" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "480546647", "predicate": "inputChatPhotoEmpty", "params": [], "type": "InputChatPhoto" }, { "id": "-1809496270", "predicate": "inputChatUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-1293828344", "predicate": "inputChatPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-457104426", "predicate": "inputGeoPointEmpty", "params": [], "type": "InputGeoPoint" }, { "id": "-206066487", "predicate": "inputGeoPoint", "params": [ { "name": "lat", "type": "double" }, { "name": "long", "type": "double" } ], "type": "InputGeoPoint" }, { "id": "483901197", "predicate": "inputPhotoEmpty", "params": [], "type": "InputPhoto" }, { "id": "-74070332", "predicate": "inputPhoto", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputPhoto" }, { "id": "1426648181", "predicate": "inputVideoEmpty", "params": [], "type": "InputVideo" }, { "id": "-296249774", "predicate": "inputVideo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputVideo" }, { "id": "342061462", "predicate": "inputFileLocation", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1023632620", "predicate": "inputVideoFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-1377390588", "predicate": "inputPhotoCropAuto", "params": [], "type": "InputPhotoCrop" }, { "id": "-644787419", "predicate": "inputPhotoCrop", "params": [ { "name": "crop_left", "type": "double" }, { "name": "crop_top", "type": "double" }, { "name": "crop_width", "type": "double" } ], "type": "InputPhotoCrop" }, { "id": "1996904104", "predicate": "inputAppEvent", "params": [ { "name": "time", "type": "double" }, { "name": "type", "type": "string" }, { "name": "peer", "type": "long" }, { "name": "data", "type": "string" } ], "type": "InputAppEvent" }, { "id": "-1649296275", "predicate": "peerUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "Peer" }, { "id": "-1160714821", "predicate": "peerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Peer" }, { "id": "-1432995067", "predicate": "storage.fileUnknown", "params": [], "type": "storage.FileType" }, { "id": "8322574", "predicate": "storage.fileJpeg", "params": [], "type": "storage.FileType" }, { "id": "-891180321", "predicate": "storage.fileGif", "params": [], "type": "storage.FileType" }, { "id": "172975040", "predicate": "storage.filePng", "params": [], "type": "storage.FileType" }, { "id": "-1373745011", "predicate": "storage.filePdf", "params": [], "type": "storage.FileType" }, { "id": "1384777335", "predicate": "storage.fileMp3", "params": [], "type": "storage.FileType" }, { "id": "1258941372", "predicate": "storage.fileMov", "params": [], "type": "storage.FileType" }, { "id": "1086091090", "predicate": "storage.filePartial", "params": [], "type": "storage.FileType" }, { "id": "-1278304028", "predicate": "storage.fileMp4", "params": [], "type": "storage.FileType" }, { "id": "276907596", "predicate": "storage.fileWebp", "params": [], "type": "storage.FileType" }, { "id": "2086234950", "predicate": "fileLocationUnavailable", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "1406570614", "predicate": "fileLocation", "params": [ { "name": "dc_id", "type": "int" }, { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "537022650", "predicate": "userEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "User" }, { "id": "1326562017", "predicate": "userProfilePhotoEmpty", "params": [], "type": "UserProfilePhoto" }, { "id": "-715532088", "predicate": "userProfilePhoto", "params": [ { "name": "photo_id", "type": "long" }, { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "UserProfilePhoto" }, { "id": "164646985", "predicate": "userStatusEmpty", "params": [], "type": "UserStatus" }, { "id": "-306628279", "predicate": "userStatusOnline", "params": [ { "name": "expires", "type": "int" } ], "type": "UserStatus" }, { "id": "9203775", "predicate": "userStatusOffline", "params": [ { "name": "was_online", "type": "int" } ], "type": "UserStatus" }, { "id": "-1683826688", "predicate": "chatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Chat" }, { "id": "1855757255", "predicate": "chat", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "left", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Chat" }, { "id": "-83047359", "predicate": "chatForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "date", "type": "int" } ], "type": "Chat" }, { "id": "771925524", "predicate": "chatFull", "params": [ { "name": "id", "type": "int" }, { "name": "participants", "type": "ChatParticipants" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector<BotInfo>" } ], "type": "ChatFull" }, { "id": "-925415106", "predicate": "chatParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "265468810", "predicate": "chatParticipantsForbidden", "params": [ { "name": "chat_id", "type": "int" } ], "type": "ChatParticipants" }, { "id": "2017571861", "predicate": "chatParticipants", "params": [ { "name": "chat_id", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participants", "type": "Vector<ChatParticipant>" }, { "name": "version", "type": "int" } ], "type": "ChatParticipants" }, { "id": "935395612", "predicate": "chatPhotoEmpty", "params": [], "type": "ChatPhoto" }, { "id": "1632839530", "predicate": "chatPhoto", "params": [ { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "ChatPhoto" }, { "id": "-2082087340", "predicate": "messageEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Message" }, { "id": "-1023016155", "predicate": "message", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "to_id", "type": "Peer" }, { "name": "fwd_from_id", "type": "flags.2?int" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" }, { "name": "reply_markup", "type": "flags.6?ReplyMarkup" } ], "type": "Message" }, { "id": "495384334", "predicate": "messageService", "params": [ { "name": "flags", "type": "int" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "Message" }, { "id": "1038967584", "predicate": "messageMediaEmpty", "params": [], "type": "MessageMedia" }, { "id": "1032643901", "predicate": "messageMediaPhoto", "params": [ { "name": "photo", "type": "Photo" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1540298357", "predicate": "messageMediaVideo", "params": [ { "name": "video", "type": "Video" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1457575028", "predicate": "messageMediaGeo", "params": [ { "name": "geo", "type": "GeoPoint" } ], "type": "MessageMedia" }, { "id": "1585262393", "predicate": "messageMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "user_id", "type": "int" } ], "type": "MessageMedia" }, { "id": "-1618676578", "predicate": "messageMediaUnsupported", "params": [], "type": "MessageMedia" }, { "id": "-1230047312", "predicate": "messageActionEmpty", "params": [], "type": "MessageAction" }, { "id": "-1503425638", "predicate": "messageActionChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "users", "type": "Vector<int>" } ], "type": "MessageAction" }, { "id": "-1247687078", "predicate": "messageActionChatEditTitle", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "2144015272", "predicate": "messageActionChatEditPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageAction" }, { "id": "-1780220945", "predicate": "messageActionChatDeletePhoto", "params": [], "type": "MessageAction" }, { "id": "1581055051", "predicate": "messageActionChatAddUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1297179892", "predicate": "messageActionChatDeleteUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1042448310", "predicate": "dialog", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Dialog" }, { "id": "590459437", "predicate": "photoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Photo" }, { "id": "-840088834", "predicate": "photo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "sizes", "type": "Vector<PhotoSize>" } ], "type": "Photo" }, { "id": "236446268", "predicate": "photoSizeEmpty", "params": [ { "name": "type", "type": "string" } ], "type": "PhotoSize" }, { "id": "2009052699", "predicate": "photoSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "size", "type": "int" } ], "type": "PhotoSize" }, { "id": "-374917894", "predicate": "photoCachedSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "PhotoSize" }, { "id": "-1056548696", "predicate": "videoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Video" }, { "id": "-148338733", "predicate": "video", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "Video" }, { "id": "286776671", "predicate": "geoPointEmpty", "params": [], "type": "GeoPoint" }, { "id": "541710092", "predicate": "geoPoint", "params": [ { "name": "long", "type": "double" }, { "name": "lat", "type": "double" } ], "type": "GeoPoint" }, { "id": "-2128698738", "predicate": "auth.checkedPhone", "params": [ { "name": "phone_registered", "type": "Bool" } ], "type": "auth.CheckedPhone" }, { "id": "-269659687", "predicate": "auth.sentCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "-16553231", "predicate": "auth.authorization", "params": [ { "name": "user", "type": "User" } ], "type": "auth.Authorization" }, { "id": "-543777747", "predicate": "auth.exportedAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.ExportedAuthorization" }, { "id": "-1195615476", "predicate": "inputNotifyPeer", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "InputNotifyPeer" }, { "id": "423314455", "predicate": "inputNotifyUsers", "params": [], "type": "InputNotifyPeer" }, { "id": "1251338318", "predicate": "inputNotifyChats", "params": [], "type": "InputNotifyPeer" }, { "id": "-1540769658", "predicate": "inputNotifyAll", "params": [], "type": "InputNotifyPeer" }, { "id": "-265263912", "predicate": "inputPeerNotifyEventsEmpty", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "-395694988", "predicate": "inputPeerNotifyEventsAll", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "1185074840", "predicate": "inputPeerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "InputPeerNotifySettings" }, { "id": "-1378534221", "predicate": "peerNotifyEventsEmpty", "params": [], "type": "PeerNotifyEvents" }, { "id": "1830677896", "predicate": "peerNotifyEventsAll", "params": [], "type": "PeerNotifyEvents" }, { "id": "1889961234", "predicate": "peerNotifySettingsEmpty", "params": [], "type": "PeerNotifySettings" }, { "id": "-1923214866", "predicate": "peerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "PeerNotifySettings" }, { "id": "-860866985", "predicate": "wallPaper", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "sizes", "type": "Vector<PhotoSize>" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "1518971995", "predicate": "userFull", "params": [ { "name": "user", "type": "User" }, { "name": "link", "type": "contacts.Link" }, { "name": "profile_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "blocked", "type": "Bool" }, { "name": "bot_info", "type": "BotInfo" } ], "type": "UserFull" }, { "id": "-116274796", "predicate": "contact", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual", "type": "Bool" } ], "type": "Contact" }, { "id": "-805141448", "predicate": "importedContact", "params": [ { "name": "user_id", "type": "int" }, { "name": "client_id", "type": "long" } ], "type": "ImportedContact" }, { "id": "1444661369", "predicate": "contactBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ContactBlocked" }, { "id": "1038193057", "predicate": "contactSuggested", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual_contacts", "type": "int" } ], "type": "ContactSuggested" }, { "id": "-748155807", "predicate": "contactStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "ContactStatus" }, { "id": "909233996", "predicate": "chatLocated", "params": [ { "name": "chat_id", "type": "int" }, { "name": "distance", "type": "int" } ], "type": "ChatLocated" }, { "id": "986597452", "predicate": "contacts.link", "params": [ { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" }, { "name": "user", "type": "User" } ], "type": "contacts.Link" }, { "id": "-1219778094", "predicate": "contacts.contactsNotModified", "params": [], "type": "contacts.Contacts" }, { "id": "1871416498", "predicate": "contacts.contacts", "params": [ { "name": "contacts", "type": "Vector<Contact>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.Contacts" }, { "id": "-1387117803", "predicate": "contacts.importedContacts", "params": [ { "name": "imported", "type": "Vector<ImportedContact>" }, { "name": "retry_contacts", "type": "Vector<long>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.ImportedContacts" }, { "id": "471043349", "predicate": "contacts.blocked", "params": [ { "name": "blocked", "type": "Vector<ContactBlocked>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.Blocked" }, { "id": "-1878523231", "predicate": "contacts.blockedSlice", "params": [ { "name": "count", "type": "int" }, { "name": "blocked", "type": "Vector<ContactBlocked>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.Blocked" }, { "id": "1447681221", "predicate": "contacts.suggested", "params": [ { "name": "results", "type": "Vector<ContactSuggested>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.Suggested" }, { "id": "364538944", "predicate": "messages.dialogs", "params": [ { "name": "dialogs", "type": "Vector<Dialog>" }, { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.Dialogs" }, { "id": "1910543603", "predicate": "messages.dialogsSlice", "params": [ { "name": "count", "type": "int" }, { "name": "dialogs", "type": "Vector<Dialog>" }, { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.Dialogs" }, { "id": "-1938715001", "predicate": "messages.messages", "params": [ { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.Messages" }, { "id": "189033187", "predicate": "messages.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.Messages" }, { "id": "1062078024", "predicate": "messages.messageEmpty", "params": [], "type": "messages.Message" }, { "id": "1279084531", "predicate": "messages.sentMessage", "params": [ { "name": "id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "media", "type": "MessageMedia" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.SentMessage" }, { "id": "1694474197", "predicate": "messages.chats", "params": [ { "name": "chats", "type": "Vector<Chat>" } ], "type": "messages.Chats" }, { "id": "-438840932", "predicate": "messages.chatFull", "params": [ { "name": "full_chat", "type": "ChatFull" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.ChatFull" }, { "id": "-1269012015", "predicate": "messages.affectedHistory", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "1474492012", "predicate": "inputMessagesFilterEmpty", "params": [], "type": "MessagesFilter" }, { "id": "-1777752804", "predicate": "inputMessagesFilterPhotos", "params": [], "type": "MessagesFilter" }, { "id": "-1614803355", "predicate": "inputMessagesFilterVideo", "params": [], "type": "MessagesFilter" }, { "id": "1458172132", "predicate": "inputMessagesFilterPhotoVideo", "params": [], "type": "MessagesFilter" }, { "id": "-648121413", "predicate": "inputMessagesFilterPhotoVideoDocuments", "params": [], "type": "MessagesFilter" }, { "id": "-1629621880", "predicate": "inputMessagesFilterDocument", "params": [], "type": "MessagesFilter" }, { "id": "-808946398", "predicate": "inputMessagesFilterAudio", "params": [], "type": "MessagesFilter" }, { "id": "1526462308", "predicate": "inputMessagesFilterAudioDocuments", "params": [], "type": "MessagesFilter" }, { "id": "522914557", "predicate": "updateNewMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1318109142", "predicate": "updateMessageID", "params": [ { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Update" }, { "id": "-1576161051", "predicate": "updateDeleteMessages", "params": [ { "name": "messages", "type": "Vector<int>" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1548249383", "predicate": "updateUserTyping", "params": [ { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "-1704596961", "predicate": "updateChatUserTyping", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "125178264", "predicate": "updateChatParticipants", "params": [ { "name": "participants", "type": "ChatParticipants" } ], "type": "Update" }, { "id": "469489699", "predicate": "updateUserStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "Update" }, { "id": "-1489818765", "predicate": "updateUserName", "params": [ { "name": "user_id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "Update" }, { "id": "-1791935732", "predicate": "updateUserPhoto", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "previous", "type": "Bool" } ], "type": "Update" }, { "id": "628472761", "predicate": "updateContactRegistered", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1657903163", "predicate": "updateContactLink", "params": [ { "name": "user_id", "type": "int" }, { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" } ], "type": "Update" }, { "id": "-1895411046", "predicate": "updateNewAuthorization", "params": [ { "name": "auth_key_id", "type": "long" }, { "name": "date", "type": "int" }, { "name": "device", "type": "string" }, { "name": "location", "type": "string" } ], "type": "Update" }, { "id": "-1519637954", "predicate": "updates.state", "params": [ { "name": "pts", "type": "int" }, { "name": "qts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "unread_count", "type": "int" } ], "type": "updates.State" }, { "id": "1567990072", "predicate": "updates.differenceEmpty", "params": [ { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "updates.Difference" }, { "id": "16030880", "predicate": "updates.difference", "params": [ { "name": "new_messages", "type": "Vector<Message>" }, { "name": "new_encrypted_messages", "type": "Vector<EncryptedMessage>" }, { "name": "other_updates", "type": "Vector<Update>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" }, { "name": "state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-1459938943", "predicate": "updates.differenceSlice", "params": [ { "name": "new_messages", "type": "Vector<Message>" }, { "name": "new_encrypted_messages", "type": "Vector<EncryptedMessage>" }, { "name": "other_updates", "type": "Vector<Update>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" }, { "name": "intermediate_state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-484987010", "predicate": "updatesTooLong", "params": [], "type": "Updates" }, { "id": "-312729305", "predicate": "updateShortMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?int" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" } ], "type": "Updates" }, { "id": "1378061116", "predicate": "updateShortChatMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "chat_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from_id", "type": "flags.2?int" }, { "name": "fwd_date", "type": "flags.2?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" } ], "type": "Updates" }, { "id": "2027216577", "predicate": "updateShort", "params": [ { "name": "update", "type": "Update" }, { "name": "date", "type": "int" } ], "type": "Updates" }, { "id": "1918567619", "predicate": "updatesCombined", "params": [ { "name": "updates", "type": "Vector<Update>" }, { "name": "users", "type": "Vector<User>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "date", "type": "int" }, { "name": "seq_start", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "1957577280", "predicate": "updates", "params": [ { "name": "updates", "type": "Vector<Update>" }, { "name": "users", "type": "Vector<User>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "-1916114267", "predicate": "photos.photos", "params": [ { "name": "photos", "type": "Vector<Photo>" }, { "name": "users", "type": "Vector<User>" } ], "type": "photos.Photos" }, { "id": "352657236", "predicate": "photos.photosSlice", "params": [ { "name": "count", "type": "int" }, { "name": "photos", "type": "Vector<Photo>" }, { "name": "users", "type": "Vector<User>" } ], "type": "photos.Photos" }, { "id": "539045032", "predicate": "photos.photo", "params": [ { "name": "photo", "type": "Photo" }, { "name": "users", "type": "Vector<User>" } ], "type": "photos.Photo" }, { "id": "157948117", "predicate": "upload.file", "params": [ { "name": "type", "type": "storage.FileType" }, { "name": "mtime", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "upload.File" }, { "id": "98092748", "predicate": "dcOption", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "ip_address", "type": "string" }, { "name": "port", "type": "int" } ], "type": "DcOption" }, { "id": "1311946900", "predicate": "config", "params": [ { "name": "date", "type": "int" }, { "name": "expires", "type": "int" }, { "name": "test_mode", "type": "Bool" }, { "name": "this_dc", "type": "int" }, { "name": "dc_options", "type": "Vector<DcOption>" }, { "name": "chat_size_max", "type": "int" }, { "name": "broadcast_size_max", "type": "int" }, { "name": "forwarded_count_max", "type": "int" }, { "name": "online_update_period_ms", "type": "int" }, { "name": "offline_blur_timeout_ms", "type": "int" }, { "name": "offline_idle_timeout_ms", "type": "int" }, { "name": "online_cloud_timeout_ms", "type": "int" }, { "name": "notify_cloud_delay_ms", "type": "int" }, { "name": "notify_default_delay_ms", "type": "int" }, { "name": "chat_big_size", "type": "int" }, { "name": "push_chat_period_ms", "type": "int" }, { "name": "push_chat_limit", "type": "int" }, { "name": "disabled_features", "type": "Vector<DisabledFeature>" } ], "type": "Config" }, { "id": "-1910892683", "predicate": "nearestDc", "params": [ { "name": "country", "type": "string" }, { "name": "this_dc", "type": "int" }, { "name": "nearest_dc", "type": "int" } ], "type": "NearestDc" }, { "id": "-1987579119", "predicate": "help.appUpdate", "params": [ { "name": "id", "type": "int" }, { "name": "critical", "type": "Bool" }, { "name": "url", "type": "string" }, { "name": "text", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "-1000708810", "predicate": "help.noAppUpdate", "params": [], "type": "help.AppUpdate" }, { "id": "415997816", "predicate": "help.inviteText", "params": [ { "name": "message", "type": "string" } ], "type": "help.InviteText" }, { "id": "899786339", "predicate": "messages.sentMessageLink", "params": [ { "name": "id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "media", "type": "MessageMedia" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "links", "type": "Vector<contacts.Link>" }, { "name": "seq", "type": "int" } ], "type": "messages.SentMessage" }, { "id": "1960072954", "predicate": "inputGeoChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputGeoChat" }, { "id": "1301143240", "predicate": "inputNotifyGeoChatPeer", "params": [ { "name": "peer", "type": "InputGeoChat" } ], "type": "InputNotifyPeer" }, { "id": "1978329690", "predicate": "geoChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "venue", "type": "string" }, { "name": "geo", "type": "GeoPoint" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "checked_in", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Chat" }, { "id": "1613830811", "predicate": "geoChatMessageEmpty", "params": [ { "name": "chat_id", "type": "int" }, { "name": "id", "type": "int" } ], "type": "GeoChatMessage" }, { "id": "1158019297", "predicate": "geoChatMessage", "params": [ { "name": "chat_id", "type": "int" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" } ], "type": "GeoChatMessage" }, { "id": "-749755826", "predicate": "geoChatMessageService", "params": [ { "name": "chat_id", "type": "int" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "GeoChatMessage" }, { "id": "397498251", "predicate": "geochats.statedMessage", "params": [ { "name": "message", "type": "GeoChatMessage" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" }, { "name": "seq", "type": "int" } ], "type": "geochats.StatedMessage" }, { "id": "1224651367", "predicate": "geochats.located", "params": [ { "name": "results", "type": "Vector<ChatLocated>" }, { "name": "messages", "type": "Vector<GeoChatMessage>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "geochats.Located" }, { "id": "-783127119", "predicate": "geochats.messages", "params": [ { "name": "messages", "type": "Vector<GeoChatMessage>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "geochats.Messages" }, { "id": "-1135057944", "predicate": "geochats.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector<GeoChatMessage>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "geochats.Messages" }, { "id": "1862504124", "predicate": "messageActionGeoChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "address", "type": "string" } ], "type": "MessageAction" }, { "id": "209540062", "predicate": "messageActionGeoChatCheckin", "params": [], "type": "MessageAction" }, { "id": "1516823543", "predicate": "updateNewGeoChatMessage", "params": [ { "name": "message", "type": "GeoChatMessage" } ], "type": "Update" }, { "id": "1662091044", "predicate": "wallPaperSolid", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "bg_color", "type": "int" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "314359194", "predicate": "updateNewEncryptedMessage", "params": [ { "name": "message", "type": "EncryptedMessage" }, { "name": "qts", "type": "int" } ], "type": "Update" }, { "id": "386986326", "predicate": "updateEncryptedChatTyping", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Update" }, { "id": "-1264392051", "predicate": "updateEncryption", "params": [ { "name": "chat", "type": "EncryptedChat" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "956179895", "predicate": "updateEncryptedMessagesRead", "params": [ { "name": "chat_id", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1417756512", "predicate": "encryptedChatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "1006044124", "predicate": "encryptedChatWaiting", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-931638658", "predicate": "encryptedChatRequested", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "-94974410", "predicate": "encryptedChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a_or_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "332848423", "predicate": "encryptedChatDiscarded", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-247351839", "predicate": "inputEncryptedChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedChat" }, { "id": "-1038136962", "predicate": "encryptedFileEmpty", "params": [], "type": "EncryptedFile" }, { "id": "1248893260", "predicate": "encryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "EncryptedFile" }, { "id": "406307684", "predicate": "inputEncryptedFileEmpty", "params": [], "type": "InputEncryptedFile" }, { "id": "1690108678", "predicate": "inputEncryptedFileUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "md5_checksum", "type": "string" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "1511503333", "predicate": "inputEncryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedFile" }, { "id": "-182231723", "predicate": "inputEncryptedFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-317144808", "predicate": "encryptedMessage", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" }, { "name": "file", "type": "EncryptedFile" } ], "type": "EncryptedMessage" }, { "id": "594758406", "predicate": "encryptedMessageService", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "EncryptedMessage" }, { "id": "-1058912715", "predicate": "messages.dhConfigNotModified", "params": [ { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "740433629", "predicate": "messages.dhConfig", "params": [ { "name": "g", "type": "int" }, { "name": "p", "type": "bytes" }, { "name": "version", "type": "int" }, { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "1443858741", "predicate": "messages.sentEncryptedMessage", "params": [ { "name": "date", "type": "int" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1802240206", "predicate": "messages.sentEncryptedFile", "params": [ { "name": "date", "type": "int" }, { "name": "file", "type": "EncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-95482955", "predicate": "inputFileBig", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" } ], "type": "InputFile" }, { "id": "767652808", "predicate": "inputEncryptedFileBigUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "974056226", "predicate": "updateChatParticipantAdd", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1851755554", "predicate": "updateChatParticipantDelete", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1906403213", "predicate": "updateDcOptions", "params": [ { "name": "dc_options", "type": "Vector<DcOption>" } ], "type": "Update" }, { "id": "1313442987", "predicate": "inputMediaUploadedAudio", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1986820223", "predicate": "inputMediaAudio", "params": [ { "name": "id", "type": "InputAudio" } ], "type": "InputMedia" }, { "id": "-1610888", "predicate": "inputMediaUploadedDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector<DocumentAttribute>" } ], "type": "InputMedia" }, { "id": "1095242886", "predicate": "inputMediaUploadedThumbDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector<DocumentAttribute>" } ], "type": "InputMedia" }, { "id": "-779818943", "predicate": "inputMediaDocument", "params": [ { "name": "id", "type": "InputDocument" } ], "type": "InputMedia" }, { "id": "802824708", "predicate": "messageMediaDocument", "params": [ { "name": "document", "type": "Document" } ], "type": "MessageMedia" }, { "id": "-961117440", "predicate": "messageMediaAudio", "params": [ { "name": "audio", "type": "Audio" } ], "type": "MessageMedia" }, { "id": "-648356732", "predicate": "inputAudioEmpty", "params": [], "type": "InputAudio" }, { "id": "2010398975", "predicate": "inputAudio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputAudio" }, { "id": "1928391342", "predicate": "inputDocumentEmpty", "params": [], "type": "InputDocument" }, { "id": "410618194", "predicate": "inputDocument", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputDocument" }, { "id": "1960591437", "predicate": "inputAudioFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1313188841", "predicate": "inputDocumentFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1483311320", "predicate": "audioEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Audio" }, { "id": "-102543275", "predicate": "audio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" } ], "type": "Audio" }, { "id": "922273905", "predicate": "documentEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Document" }, { "id": "-106717361", "predicate": "document", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "attributes", "type": "Vector<DocumentAttribute>" } ], "type": "Document" }, { "id": "398898678", "predicate": "help.support", "params": [ { "name": "phone_number", "type": "string" }, { "name": "user", "type": "User" } ], "type": "help.Support" }, { "id": "-1613493288", "predicate": "notifyPeer", "params": [ { "name": "peer", "type": "Peer" } ], "type": "NotifyPeer" }, { "id": "-1261946036", "predicate": "notifyUsers", "params": [], "type": "NotifyPeer" }, { "id": "-1073230141", "predicate": "notifyChats", "params": [], "type": "NotifyPeer" }, { "id": "1959820384", "predicate": "notifyAll", "params": [], "type": "NotifyPeer" }, { "id": "-2131957734", "predicate": "updateUserBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "blocked", "type": "Bool" } ], "type": "Update" }, { "id": "-1094555409", "predicate": "updateNotifySettings", "params": [ { "name": "peer", "type": "NotifyPeer" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Update" }, { "id": "-484053553", "predicate": "auth.sentAppCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "381645902", "predicate": "sendMessageTypingAction", "params": [], "type": "SendMessageAction" }, { "id": "-44119819", "predicate": "sendMessageCancelAction", "params": [], "type": "SendMessageAction" }, { "id": "-1584933265", "predicate": "sendMessageRecordVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-378127636", "predicate": "sendMessageUploadVideoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-718310409", "predicate": "sendMessageRecordAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-212740181", "predicate": "sendMessageUploadAudioAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-774682074", "predicate": "sendMessageUploadPhotoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-1441998364", "predicate": "sendMessageUploadDocumentAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "393186209", "predicate": "sendMessageGeoLocationAction", "params": [], "type": "SendMessageAction" }, { "id": "1653390447", "predicate": "sendMessageChooseContactAction", "params": [], "type": "SendMessageAction" }, { "id": "-360210539", "predicate": "contactFound", "params": [ { "name": "user_id", "type": "int" } ], "type": "ContactFound" }, { "id": "90570766", "predicate": "contacts.found", "params": [ { "name": "results", "type": "Vector<ContactFound>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.Found" }, { "id": "942527460", "predicate": "updateServiceNotification", "params": [ { "name": "type", "type": "string" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" }, { "name": "popup", "type": "Bool" } ], "type": "Update" }, { "id": "-496024847", "predicate": "userStatusRecently", "params": [], "type": "UserStatus" }, { "id": "129960444", "predicate": "userStatusLastWeek", "params": [], "type": "UserStatus" }, { "id": "2011940674", "predicate": "userStatusLastMonth", "params": [], "type": "UserStatus" }, { "id": "-298113238", "predicate": "updatePrivacy", "params": [ { "name": "key", "type": "PrivacyKey" }, { "name": "rules", "type": "Vector<PrivacyRule>" } ], "type": "Update" }, { "id": "1335282456", "predicate": "inputPrivacyKeyStatusTimestamp", "params": [], "type": "InputPrivacyKey" }, { "id": "-1137792208", "predicate": "privacyKeyStatusTimestamp", "params": [], "type": "PrivacyKey" }, { "id": "218751099", "predicate": "inputPrivacyValueAllowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "407582158", "predicate": "inputPrivacyValueAllowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "320652927", "predicate": "inputPrivacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector<InputUser>" } ], "type": "InputPrivacyRule" }, { "id": "195371015", "predicate": "inputPrivacyValueDisallowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "-697604407", "predicate": "inputPrivacyValueDisallowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "-1877932953", "predicate": "inputPrivacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector<InputUser>" } ], "type": "InputPrivacyRule" }, { "id": "-123988", "predicate": "privacyValueAllowContacts", "params": [], "type": "PrivacyRule" }, { "id": "1698855810", "predicate": "privacyValueAllowAll", "params": [], "type": "PrivacyRule" }, { "id": "1297858060", "predicate": "privacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector<int>" } ], "type": "PrivacyRule" }, { "id": "-125240806", "predicate": "privacyValueDisallowContacts", "params": [], "type": "PrivacyRule" }, { "id": "-1955338397", "predicate": "privacyValueDisallowAll", "params": [], "type": "PrivacyRule" }, { "id": "209668535", "predicate": "privacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector<int>" } ], "type": "PrivacyRule" }, { "id": "1430961007", "predicate": "account.privacyRules", "params": [ { "name": "rules", "type": "Vector<PrivacyRule>" }, { "name": "users", "type": "Vector<User>" } ], "type": "account.PrivacyRules" }, { "id": "-1194283041", "predicate": "accountDaysTTL", "params": [ { "name": "days", "type": "int" } ], "type": "AccountDaysTTL" }, { "id": "-1527411636", "predicate": "account.sentChangePhoneCode", "params": [ { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" } ], "type": "account.SentChangePhoneCode" }, { "id": "314130811", "predicate": "updateUserPhone", "params": [ { "name": "user_id", "type": "int" }, { "name": "phone", "type": "string" } ], "type": "Update" }, { "id": "1815593308", "predicate": "documentAttributeImageSize", "params": [ { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "297109817", "predicate": "documentAttributeAnimated", "params": [], "type": "DocumentAttribute" }, { "id": "978674434", "predicate": "documentAttributeSticker", "params": [ { "name": "alt", "type": "string" }, { "name": "stickerset", "type": "InputStickerSet" } ], "type": "DocumentAttribute" }, { "id": "1494273227", "predicate": "documentAttributeVideo", "params": [ { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "-556656416", "predicate": "documentAttributeAudio", "params": [ { "name": "duration", "type": "int" }, { "name": "title", "type": "string" }, { "name": "performer", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "358154344", "predicate": "documentAttributeFilename", "params": [ { "name": "file_name", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "-244016606", "predicate": "messages.stickersNotModified", "params": [], "type": "messages.Stickers" }, { "id": "-1970352846", "predicate": "messages.stickers", "params": [ { "name": "hash", "type": "string" }, { "name": "stickers", "type": "Vector<Document>" } ], "type": "messages.Stickers" }, { "id": "313694676", "predicate": "stickerPack", "params": [ { "name": "emoticon", "type": "string" }, { "name": "documents", "type": "Vector<long>" } ], "type": "StickerPack" }, { "id": "-395967805", "predicate": "messages.allStickersNotModified", "params": [], "type": "messages.AllStickers" }, { "id": "-719474725", "predicate": "messages.allStickers", "params": [ { "name": "hash", "type": "string" }, { "name": "sets", "type": "Vector<StickerSet>" } ], "type": "messages.AllStickers" }, { "id": "-1369215196", "predicate": "disabledFeature", "params": [ { "name": "feature", "type": "string" }, { "name": "description", "type": "string" } ], "type": "DisabledFeature" }, { "id": "-1721631396", "predicate": "updateReadHistoryInbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "791617983", "predicate": "updateReadHistoryOutbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-2066640507", "predicate": "messages.affectedMessages", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "1599050311", "predicate": "contactLinkUnknown", "params": [], "type": "ContactLink" }, { "id": "-17968211", "predicate": "contactLinkNone", "params": [], "type": "ContactLink" }, { "id": "646922073", "predicate": "contactLinkHasPhone", "params": [], "type": "ContactLink" }, { "id": "-721239344", "predicate": "contactLinkContact", "params": [], "type": "ContactLink" }, { "id": "751004017", "predicate": "updateWebPage", "params": [ { "name": "webpage", "type": "WebPage" } ], "type": "Update" }, { "id": "-350980120", "predicate": "webPageEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "WebPage" }, { "id": "-981018084", "predicate": "webPagePending", "params": [ { "name": "id", "type": "long" }, { "name": "date", "type": "int" } ], "type": "WebPage" }, { "id": "-1558273867", "predicate": "webPage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "long" }, { "name": "url", "type": "string" }, { "name": "display_url", "type": "string" }, { "name": "type", "type": "flags.0?string" }, { "name": "site_name", "type": "flags.1?string" }, { "name": "title", "type": "flags.2?string" }, { "name": "description", "type": "flags.3?string" }, { "name": "photo", "type": "flags.4?Photo" }, { "name": "embed_url", "type": "flags.5?string" }, { "name": "embed_type", "type": "flags.5?string" }, { "name": "embed_width", "type": "flags.6?int" }, { "name": "embed_height", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "author", "type": "flags.8?string" } ], "type": "WebPage" }, { "id": "-1557277184", "predicate": "messageMediaWebPage", "params": [ { "name": "webpage", "type": "WebPage" } ], "type": "MessageMedia" }, { "id": "2079516406", "predicate": "authorization", "params": [ { "name": "hash", "type": "long" }, { "name": "flags", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "platform", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "api_id", "type": "int" }, { "name": "app_name", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "date_created", "type": "int" }, { "name": "date_active", "type": "int" }, { "name": "ip", "type": "string" }, { "name": "country", "type": "string" }, { "name": "region", "type": "string" } ], "type": "Authorization" }, { "id": "307276766", "predicate": "account.authorizations", "params": [ { "name": "authorizations", "type": "Vector<Authorization>" } ], "type": "account.Authorizations" }, { "id": "-1764049896", "predicate": "account.noPassword", "params": [ { "name": "new_salt", "type": "bytes" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "2081952796", "predicate": "account.password", "params": [ { "name": "current_salt", "type": "bytes" }, { "name": "new_salt", "type": "bytes" }, { "name": "hint", "type": "string" }, { "name": "has_recovery", "type": "Bool" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "-1212732749", "predicate": "account.passwordSettings", "params": [ { "name": "email", "type": "string" } ], "type": "account.PasswordSettings" }, { "id": "-1124314324", "predicate": "account.passwordInputSettings", "params": [ { "name": "flags", "type": "#" }, { "name": "new_salt", "type": "flags.0?bytes" }, { "name": "new_password_hash", "type": "flags.0?bytes" }, { "name": "hint", "type": "flags.0?string" }, { "name": "email", "type": "flags.1?string" } ], "type": "account.PasswordInputSettings" }, { "id": "326715557", "predicate": "auth.passwordRecovery", "params": [ { "name": "email_pattern", "type": "string" } ], "type": "auth.PasswordRecovery" }, { "id": "673687578", "predicate": "inputMediaVenue", "params": [ { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "InputMedia" }, { "id": "2031269663", "predicate": "messageMediaVenue", "params": [ { "name": "geo", "type": "GeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "MessageMedia" }, { "id": "-1551583367", "predicate": "receivedNotifyMessage", "params": [ { "name": "id", "type": "int" }, { "name": "flags", "type": "int" } ], "type": "ReceivedNotifyMessage" }, { "id": "1776236393", "predicate": "chatInviteEmpty", "params": [], "type": "ExportedChatInvite" }, { "id": "-64092740", "predicate": "chatInviteExported", "params": [ { "name": "link", "type": "string" } ], "type": "ExportedChatInvite" }, { "id": "1516793212", "predicate": "chatInviteAlready", "params": [ { "name": "chat", "type": "Chat" } ], "type": "ChatInvite" }, { "id": "-829325875", "predicate": "chatInvite", "params": [ { "name": "title", "type": "string" } ], "type": "ChatInvite" }, { "id": "-123931160", "predicate": "messageActionChatJoinedByLink", "params": [ { "name": "inviter_id", "type": "int" } ], "type": "MessageAction" }, { "id": "1757493555", "predicate": "updateReadMessagesContents", "params": [ { "name": "messages", "type": "Vector<int>" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-4838507", "predicate": "inputStickerSetEmpty", "params": [], "type": "InputStickerSet" }, { "id": "-1645763991", "predicate": "inputStickerSetID", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputStickerSet" }, { "id": "-2044933984", "predicate": "inputStickerSetShortName", "params": [ { "name": "short_name", "type": "string" } ], "type": "InputStickerSet" }, { "id": "-852477119", "predicate": "stickerSet", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "short_name", "type": "string" }, { "name": "count", "type": "int" }, { "name": "hash", "type": "int" } ], "type": "StickerSet" }, { "id": "-1240849242", "predicate": "messages.stickerSet", "params": [ { "name": "set", "type": "StickerSet" }, { "name": "packs", "type": "Vector<StickerPack>" }, { "name": "documents", "type": "Vector<Document>" } ], "type": "messages.StickerSet" }, { "id": "585404530", "predicate": "user", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "flags.0?long" }, { "name": "first_name", "type": "flags.1?string" }, { "name": "last_name", "type": "flags.2?string" }, { "name": "username", "type": "flags.3?string" }, { "name": "phone", "type": "flags.4?string" }, { "name": "photo", "type": "flags.5?UserProfilePhoto" }, { "name": "status", "type": "flags.6?UserStatus" }, { "name": "bot_info_version", "type": "flags.14?int" } ], "type": "User" }, { "id": "-1032140601", "predicate": "botCommand", "params": [ { "name": "command", "type": "string" }, { "name": "description", "type": "string" } ], "type": "BotCommand" }, { "id": "-1154598962", "predicate": "botInfoEmpty", "params": [], "type": "BotInfo" }, { "id": "164583517", "predicate": "botInfo", "params": [ { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" }, { "name": "share_text", "type": "string" }, { "name": "description", "type": "string" }, { "name": "commands", "type": "Vector<BotCommand>" } ], "type": "BotInfo" }, { "id": "-1560655744", "predicate": "keyboardButton", "params": [ { "name": "text", "type": "string" } ], "type": "KeyboardButton" }, { "id": "2002815875", "predicate": "keyboardButtonRow", "params": [ { "name": "buttons", "type": "Vector<KeyboardButton>" } ], "type": "KeyboardButtonRow" }, { "id": "-1606526075", "predicate": "replyKeyboardHide", "params": [ { "name": "flags", "type": "#" } ], "type": "ReplyMarkup" }, { "id": "-200242528", "predicate": "replyKeyboardForceReply", "params": [ { "name": "flags", "type": "#" } ], "type": "ReplyMarkup" }, { "id": "889353612", "predicate": "replyKeyboardMarkup", "params": [ { "name": "flags", "type": "#" }, { "name": "rows", "type": "Vector<KeyboardButtonRow>" } ], "type": "ReplyMarkup" }, { "id": "2072935910", "predicate": "inputPeerUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "-668391402", "predicate": "inputUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputUser" }, { "id": "-1350696044", "predicate": "help.appChangelogEmpty", "params": [], "type": "help.AppChangelog" }, { "id": "1181279933", "predicate": "help.appChangelog", "params": [ { "name": "text", "type": "string" } ], "type": "help.AppChangelog" } ], "methods": [ { "id": "-878758099", "method": "invokeAfterMsg", "params": [ { "name": "msg_id", "type": "long" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1036301552", "method": "invokeAfterMsgs", "params": [ { "name": "msg_ids", "type": "Vector<long>" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1877286395", "method": "auth.checkPhone", "params": [ { "name": "phone_number", "type": "string" } ], "type": "auth.CheckedPhone" }, { "id": "1988976461", "method": "auth.sendCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "sms_type", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "auth.SentCode" }, { "id": "63247716", "method": "auth.sendCall", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "453408308", "method": "auth.signUp", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1126886015", "method": "auth.signIn", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "1461180992", "method": "auth.logOut", "params": [], "type": "Bool" }, { "id": "-1616179942", "method": "auth.resetAuthorizations", "params": [], "type": "Bool" }, { "id": "1998331287", "method": "auth.sendInvites", "params": [ { "name": "phone_numbers", "type": "Vector<string>" }, { "name": "message", "type": "string" } ], "type": "Bool" }, { "id": "-440401971", "method": "auth.exportAuthorization", "params": [ { "name": "dc_id", "type": "int" } ], "type": "auth.ExportedAuthorization" }, { "id": "-470837741", "method": "auth.importAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-841733627", "method": "auth.bindTempAuthKey", "params": [ { "name": "perm_auth_key_id", "type": "long" }, { "name": "nonce", "type": "long" }, { "name": "expires_at", "type": "int" }, { "name": "encrypted_message", "type": "bytes" } ], "type": "Bool" }, { "id": "1147957548", "method": "account.registerDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "app_sandbox", "type": "Bool" }, { "name": "lang_code", "type": "string" } ], "type": "Bool" }, { "id": "1707432768", "method": "account.unregisterDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" } ], "type": "Bool" }, { "id": "-2067899501", "method": "account.updateNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" }, { "name": "settings", "type": "InputPeerNotifySettings" } ], "type": "Bool" }, { "id": "313765169", "method": "account.getNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" } ], "type": "PeerNotifySettings" }, { "id": "-612493497", "method": "account.resetNotifySettings", "params": [], "type": "Bool" }, { "id": "-259486360", "method": "account.updateProfile", "params": [ { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "User" }, { "id": "1713919532", "method": "account.updateStatus", "params": [ { "name": "offline", "type": "Bool" } ], "type": "Bool" }, { "id": "-1068696894", "method": "account.getWallPapers", "params": [], "type": "Vector<WallPaper>" }, { "id": "227648840", "method": "users.getUsers", "params": [ { "name": "id", "type": "Vector<InputUser>" } ], "type": "Vector<User>" }, { "id": "-902781519", "method": "users.getFullUser", "params": [ { "name": "id", "type": "InputUser" } ], "type": "UserFull" }, { "id": "-995929106", "method": "contacts.getStatuses", "params": [], "type": "Vector<ContactStatus>" }, { "id": "583445000", "method": "contacts.getContacts", "params": [ { "name": "hash", "type": "string" } ], "type": "contacts.Contacts" }, { "id": "-634342611", "method": "contacts.importContacts", "params": [ { "name": "contacts", "type": "Vector<InputContact>" }, { "name": "replace", "type": "Bool" } ], "type": "contacts.ImportedContacts" }, { "id": "-847825880", "method": "contacts.getSuggested", "params": [ { "name": "limit", "type": "int" } ], "type": "contacts.Suggested" }, { "id": "-1902823612", "method": "contacts.deleteContact", "params": [ { "name": "id", "type": "InputUser" } ], "type": "contacts.Link" }, { "id": "1504393374", "method": "contacts.deleteContacts", "params": [ { "name": "id", "type": "Vector<InputUser>" } ], "type": "Bool" }, { "id": "858475004", "method": "contacts.block", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-448724803", "method": "contacts.unblock", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-176409329", "method": "contacts.getBlocked", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "contacts.Blocked" }, { "id": "-2065352905", "method": "contacts.exportCard", "params": [], "type": "Vector<int>" }, { "id": "1340184318", "method": "contacts.importCard", "params": [ { "name": "export_card", "type": "Vector<int>" } ], "type": "User" }, { "id": "1109588596", "method": "messages.getMessages", "params": [ { "name": "id", "type": "Vector<int>" } ], "type": "messages.Messages" }, { "id": "-321970698", "method": "messages.getDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-1834885329", "method": "messages.getHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "132772523", "method": "messages.search", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "-1336990448", "method": "messages.readHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-185009311", "method": "messages.deleteHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-1510897371", "method": "messages.deleteMessages", "params": [ { "name": "id", "type": "Vector<int>" } ], "type": "messages.AffectedMessages" }, { "id": "94983360", "method": "messages.receivedMessages", "params": [ { "name": "max_id", "type": "int" } ], "type": "Vector<ReceivedNotifyMessage>" }, { "id": "-1551737264", "method": "messages.setTyping", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Bool" }, { "id": "-61479243", "method": "messages.sendMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "messages.SentMessage" }, { "id": "-923703407", "method": "messages.sendMedia", "params": [ { "name": "flags", "type": "#" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "Updates" }, { "id": "1440838285", "method": "messages.forwardMessages", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "Vector<int>" }, { "name": "random_id", "type": "Vector<long>" } ], "type": "Updates" }, { "id": "1013621127", "method": "messages.getChats", "params": [ { "name": "id", "type": "Vector<int>" } ], "type": "messages.Chats" }, { "id": "998448230", "method": "messages.getFullChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "messages.ChatFull" }, { "id": "-599447467", "method": "messages.editChatTitle", "params": [ { "name": "chat_id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-900957736", "method": "messages.editChatPhoto", "params": [ { "name": "chat_id", "type": "int" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-106911223", "method": "messages.addChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "fwd_limit", "type": "int" } ], "type": "Updates" }, { "id": "-530505962", "method": "messages.deleteChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" } ], "type": "Updates" }, { "id": "164303470", "method": "messages.createChat", "params": [ { "name": "users", "type": "Vector<InputUser>" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-304838614", "method": "updates.getState", "params": [], "type": "updates.State" }, { "id": "168039573", "method": "updates.getDifference", "params": [ { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "qts", "type": "int" } ], "type": "updates.Difference" }, { "id": "-285902432", "method": "photos.updateProfilePhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "UserProfilePhoto" }, { "id": "-720397176", "method": "photos.uploadProfilePhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "photos.Photo" }, { "id": "-2016444625", "method": "photos.deletePhotos", "params": [ { "name": "id", "type": "Vector<InputPhoto>" } ], "type": "Vector<long>" }, { "id": "-1291540959", "method": "upload.saveFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "-475607115", "method": "upload.getFile", "params": [ { "name": "location", "type": "InputFileLocation" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "upload.File" }, { "id": "-990308245", "method": "help.getConfig", "params": [], "type": "Config" }, { "id": "531836966", "method": "help.getNearestDc", "params": [], "type": "NearestDc" }, { "id": "-938300290", "method": "help.getAppUpdate", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "1862465352", "method": "help.saveAppLog", "params": [ { "name": "events", "type": "Vector<InputAppEvent>" } ], "type": "Bool" }, { "id": "-1532407418", "method": "help.getInviteText", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.InviteText" }, { "id": "-1848823128", "method": "photos.getUserPhotos", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "long" }, { "name": "limit", "type": "int" } ], "type": "photos.Photos" }, { "id": "865483769", "method": "messages.forwardMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Updates" }, { "id": "-1082919718", "method": "messages.sendBroadcast", "params": [ { "name": "contacts", "type": "Vector<InputUser>" }, { "name": "random_id", "type": "Vector<long>" }, { "name": "message", "type": "string" }, { "name": "media", "type": "InputMedia" } ], "type": "Updates" }, { "id": "2132356495", "method": "geochats.getLocated", "params": [ { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "radius", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "geochats.Located" }, { "id": "-515735953", "method": "geochats.getRecents", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "geochats.Messages" }, { "id": "1437853947", "method": "geochats.checkin", "params": [ { "name": "peer", "type": "InputGeoChat" } ], "type": "geochats.StatedMessage" }, { "id": "1730338159", "method": "geochats.getFullChat", "params": [ { "name": "peer", "type": "InputGeoChat" } ], "type": "messages.ChatFull" }, { "id": "1284383347", "method": "geochats.editChatTitle", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" } ], "type": "geochats.StatedMessage" }, { "id": "903355029", "method": "geochats.editChatPhoto", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "geochats.StatedMessage" }, { "id": "-808598451", "method": "geochats.search", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "geochats.Messages" }, { "id": "-1254131096", "method": "geochats.getHistory", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "geochats.Messages" }, { "id": "146319145", "method": "geochats.setTyping", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "102432836", "method": "geochats.sendMessage", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" } ], "type": "geochats.StatedMessage" }, { "id": "-1192173825", "method": "geochats.sendMedia", "params": [ { "name": "peer", "type": "InputGeoChat" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" } ], "type": "geochats.StatedMessage" }, { "id": "235482646", "method": "geochats.createGeoChat", "params": [ { "name": "title", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "address", "type": "string" }, { "name": "venue", "type": "string" } ], "type": "geochats.StatedMessage" }, { "id": "651135312", "method": "messages.getDhConfig", "params": [ { "name": "version", "type": "int" }, { "name": "random_length", "type": "int" } ], "type": "messages.DhConfig" }, { "id": "-162681021", "method": "messages.requestEncryption", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "random_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "1035731989", "method": "messages.acceptEncryption", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "g_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "-304536635", "method": "messages.discardEncryption", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Bool" }, { "id": "2031374829", "method": "messages.setEncryptedTyping", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "2135648522", "method": "messages.readEncryptedHistory", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "max_date", "type": "int" } ], "type": "Bool" }, { "id": "-1451792525", "method": "messages.sendEncrypted", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1701831834", "method": "messages.sendEncryptedFile", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" }, { "name": "file", "type": "InputEncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "852769188", "method": "messages.sendEncryptedService", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "1436924774", "method": "messages.receivedQueue", "params": [ { "name": "max_qts", "type": "int" } ], "type": "Vector<long>" }, { "id": "-562337987", "method": "upload.saveBigFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "file_total_parts", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "1769565673", "method": "initConnection", "params": [ { "name": "api_id", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-1663104819", "method": "help.getSupport", "params": [], "type": "help.Support" }, { "id": "229241832", "method": "auth.sendSms", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "916930423", "method": "messages.readMessageContents", "params": [ { "name": "id", "type": "Vector<int>" } ], "type": "messages.AffectedMessages" }, { "id": "655677548", "method": "account.checkUsername", "params": [ { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "1040964988", "method": "account.updateUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "301470424", "method": "contacts.search", "params": [ { "name": "q", "type": "string" }, { "name": "limit", "type": "int" } ], "type": "contacts.Found" }, { "id": "-623130288", "method": "account.getPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" } ], "type": "account.PrivacyRules" }, { "id": "-906486552", "method": "account.setPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" }, { "name": "rules", "type": "Vector<InputPrivacyRule>" } ], "type": "account.PrivacyRules" }, { "id": "1099779595", "method": "account.deleteAccount", "params": [ { "name": "reason", "type": "string" } ], "type": "Bool" }, { "id": "150761757", "method": "account.getAccountTTL", "params": [], "type": "AccountDaysTTL" }, { "id": "608323678", "method": "account.setAccountTTL", "params": [ { "name": "ttl", "type": "AccountDaysTTL" } ], "type": "Bool" }, { "id": "-627372787", "method": "invokeWithLayer", "params": [ { "name": "layer", "type": "int" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "200282908", "method": "contacts.resolveUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "-1543001868", "method": "account.sendChangePhoneCode", "params": [ { "name": "phone_number", "type": "string" } ], "type": "account.SentChangePhoneCode" }, { "id": "1891839707", "method": "account.changePhone", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "User" }, { "id": "-1373446075", "method": "messages.getStickers", "params": [ { "name": "emoticon", "type": "string" }, { "name": "hash", "type": "string" } ], "type": "messages.Stickers" }, { "id": "-1438922648", "method": "messages.getAllStickers", "params": [ { "name": "hash", "type": "string" } ], "type": "messages.AllStickers" }, { "id": "954152242", "method": "account.updateDeviceLocked", "params": [ { "name": "period", "type": "int" } ], "type": "Bool" }, { "id": "1738800940", "method": "auth.importBotAuthorization", "params": [ { "name": "flags", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "bot_auth_token", "type": "string" } ], "type": "auth.Authorization" }, { "id": "623001124", "method": "messages.getWebPagePreview", "params": [ { "name": "message", "type": "string" } ], "type": "MessageMedia" }, { "id": "-484392616", "method": "account.getAuthorizations", "params": [], "type": "account.Authorizations" }, { "id": "-545786948", "method": "account.resetAuthorization", "params": [ { "name": "hash", "type": "long" } ], "type": "Bool" }, { "id": "1418342645", "method": "account.getPassword", "params": [], "type": "account.Password" }, { "id": "-1131605573", "method": "account.getPasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" } ], "type": "account.PasswordSettings" }, { "id": "-92517498", "method": "account.updatePasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" }, { "name": "new_settings", "type": "account.PasswordInputSettings" } ], "type": "Bool" }, { "id": "174260510", "method": "auth.checkPassword", "params": [ { "name": "password_hash", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-661144474", "method": "auth.requestPasswordRecovery", "params": [], "type": "auth.PasswordRecovery" }, { "id": "1319464594", "method": "auth.recoverPassword", "params": [ { "name": "code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1080796745", "method": "invokeWithoutUpdates", "params": [ { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "2106086025", "method": "messages.exportChatInvite", "params": [ { "name": "chat_id", "type": "int" } ], "type": "ExportedChatInvite" }, { "id": "1051570619", "method": "messages.checkChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "ChatInvite" }, { "id": "1817183516", "method": "messages.importChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "Updates" }, { "id": "639215886", "method": "messages.getStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "messages.StickerSet" }, { "id": "2066793382", "method": "messages.installStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" }, { "name": "disabled", "type": "Bool" } ], "type": "Bool" }, { "id": "-110209570", "method": "messages.uninstallStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "Bool" }, { "id": "457052156", "method": "messages.startBot", "params": [ { "name": "bot", "type": "InputUser" }, { "name": "chat_id", "type": "int" }, { "name": "random_id", "type": "long" }, { "name": "start_param", "type": "string" } ], "type": "Updates" }, { "id": "1537966002", "method": "help.getAppChangelog", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppChangelog" } ] }<?php /** * CombinedAPI module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; use Amp\Loop; use function Amp\Promise\all; class CombinedAPI { use \danog\Serializable; use Tools; public $session; public $instance_paths = []; public $instances = []; public $timeout = 5; public $serialization_interval = 30; public $serialized = 0; protected $async; public function __magic_construct($session, $paths = []) { set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']); $realpaths = Serialization::realpaths($session); $this->session = $realpaths['file']; \danog\MadelineProto\Magic::class_exists(); foreach ($paths as $path => $settings) { $this->addInstance($path, $settings); } if (file_exists($realpaths['file'])) { if (!file_exists($realpaths['lockfile'])) { touch($realpaths['lockfile']); clearstatcache(); } $realpaths['lockfile'] = fopen($realpaths['lockfile'], 'r'); \danog\MadelineProto\Logger::log('Waiting for shared lock of serialization lockfile...'); flock($realpaths['lockfile'], LOCK_SH); \danog\MadelineProto\Logger::log('Shared lock acquired, deserializing...'); try { $tounserialize = file_get_contents($realpaths['file']); } finally { flock($realpaths['lockfile'], LOCK_UN); fclose($realpaths['lockfile']); } $deserialized = unserialize($tounserialize); /*foreach ($deserialized['instance_paths'] as $path) { $this->addInstance($path, isset($paths[$path]) ? $paths[$path] : []); }*/ $this->event_handler = $deserialized['event_handler']; $this->event_handler_instance = $deserialized['event_handler_instance']; if ($this->event_handler !== null) { $this->setEventHandler($this->event_handler); } } foreach ($paths as $path => $settings) { $this->addInstance($path, $settings); } } public function addInstance($path, $settings = []) { if (isset($this->instances[$path]) && isset($this->instance_paths[$path])) { if (isset($this->event_handler_instance)) { $this->event_handler_instance->referenceInstance($path); } return; } \danog\MadelineProto\Logger::constructor(3); \danog\MadelineProto\Logger::log("INSTANTIATING $path..."); $instance = new \danog\MadelineProto\API($path, $settings); $this->instance_paths[$path] = $path; $this->instances[$path] = $instance; if (isset($this->event_handler_instance)) { $this->event_handler_instance->referenceInstance($path); } } public function removeInstance($path) { if (isset($this->instance_paths[$path])) { unset($this->instance_paths[$path]); } if (isset($this->instances[$path])) { unset($this->instances[$path]); } if (isset($this->event_handler_instance)) { $this->event_handler_instance->removeInstance($path); } } public function __destruct() { if (\danog\MadelineProto\Magic::$has_thread && is_object(\Thread::getCurrentThread()) || Magic::is_fork()) { return; } $this->serialize(); } public function serialize($filename = '') { /*foreach ($this->instances as $instance) { $instance->serialize(); }*/ if (is_null($this->session)) { return; } if ($filename === '') { $filename = $this->session; } Logger::log(\danog\MadelineProto\Lang::$current_lang['serializing_madelineproto']); $realpaths = Serialization::realpaths($filename); if (!file_exists($realpaths['lockfile'])) { touch($realpaths['lockfile']); clearstatcache(); } $realpaths['lockfile'] = fopen($realpaths['lockfile'], 'w'); \danog\MadelineProto\Logger::log('Waiting for exclusive lock of serialization lockfile...'); flock($realpaths['lockfile'], LOCK_EX); \danog\MadelineProto\Logger::log('Lock acquired, serializing'); try { $wrote = file_put_contents($realpaths['tempfile'], serialize(['event_handler' => $this->event_handler, 'event_handler_instance' => $this->event_handler_instance, 'instance_paths' => $this->instance_paths])); rename($realpaths['tempfile'], $realpaths['file']); } finally { flock($realpaths['lockfile'], LOCK_UN); fclose($realpaths['lockfile']); } $this->serialized = time(); return $wrote; } public $event_handler; private $event_handler_instance; private $event_handler_methods = []; public function setEventHandler($event_handler) { if (!class_exists($event_handler) || !is_subclass_of($event_handler, '\danog\MadelineProto\CombinedEventHandler')) { throw new \danog\MadelineProto\Exception('Wrong event handler was defined'); } $this->event_handler = $event_handler; if (!($this->event_handler_instance instanceof $this->event_handler)) { $class_name = $this->event_handler; $this->event_handler_instance = new $class_name($this); } elseif ($this->event_handler_instance) { $this->event_handler_instance->__construct($this); } $this->event_handler_methods = []; foreach (\get_class_methods($this->event_handler) as $method) { if ($method === 'onLoop') { $this->loop_callback = [$this->event_handler_instance, 'onLoop']; } elseif ($method === 'onAny') { foreach (end($this->instances)->API->constructors->by_id as $id => $constructor) { if ($constructor['type'] === 'Update' && !isset($this->event_handler_methods[$constructor['predicate']])) { $this->event_handler_methods[$constructor['predicate']] = [$this->event_handler_instance, 'onAny']; } } } else { $method_name = lcfirst(substr($method, 2)); $this->event_handler_methods[$method_name] = [$this->event_handler_instance, $method]; } } } public function event_update_handler($update, $instance) { if (isset($this->event_handler_methods[$update['_']])) { return $this->event_handler_methods[$update['_']]($update, $instance); } } private $loop_callback; public function async($async) { $this->async = $async; foreach ($this->instances as $instance) { $instance->async($async); } } public function setLoopCallback($callback) { $this->loop_callback = $callback; } public function get_updates($params = []) { } public function loop($max_forks = 0) { if (php_sapi_name() !== 'cli') { try { set_time_limit(-1); } catch (\danog\MadelineProto\Exception $e) { register_shutdown_function(function () { \danog\MadelineProto\Logger::log(['Restarting script...']); $a = fsockopen((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'tls' : 'tcp').'://'.$_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']); fwrite($a, $_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI'].' '.$_SERVER['SERVER_PROTOCOL']."\r\n".'Host: '.$_SERVER['SERVER_NAME']."\r\n\r\n"); }); } } $loops = []; foreach ($this->instances as $path => $instance) { if ($instance->API->authorized !== MTProto::LOGGED_IN) { continue; } if (!$instance->API->settings['updates']['handle_updates']) { $instance->API->settings['updates']['handle_updates'] = true; $instance->API->datacenter->sockets[$instance->API->settings['connection_settings']['default_dc']]->updater->start(); } $instance->setCallback(function ($update) use ($path) { return $this->event_update_handler($update, $path); }); if ($this->loop_callback !== null) { $instance->setLoopCallback($this->loop_callback); } $loops[] = $this->call($instance->loop(0, ['async' => true])); } Loop::repeat($this->serialization_interval * 1000, function () { \danog\MadelineProto\Logger::log('Serializing combined event handler'); $this->serialize(); }); \danog\MadelineProto\Logger::log('Started update loop', \danog\MadelineProto\Logger::NOTICE); $this->wait(all($loops)); } } { "constructors": [ { "id": "-1132882121", "predicate": "boolFalse", "params": [], "type": "Bool" }, { "id": "-1720552011", "predicate": "boolTrue", "params": [], "type": "Bool" }, { "id": "1072550713", "predicate": "true", "params": [], "type": "True" }, { "id": "481674261", "predicate": "vector", "params": [], "type": "Vector t" }, { "id": "-994444869", "predicate": "error", "params": [ { "name": "code", "type": "int" }, { "name": "text", "type": "string" } ], "type": "Error" }, { "id": "1450380236", "predicate": "null", "params": [], "type": "Null" }, { "id": "2134579434", "predicate": "inputPeerEmpty", "params": [], "type": "InputPeer" }, { "id": "2107670217", "predicate": "inputPeerSelf", "params": [], "type": "InputPeer" }, { "id": "396093539", "predicate": "inputPeerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1182234929", "predicate": "inputUserEmpty", "params": [], "type": "InputUser" }, { "id": "-138301121", "predicate": "inputUserSelf", "params": [], "type": "InputUser" }, { "id": "-208488460", "predicate": "inputPhoneContact", "params": [ { "name": "client_id", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputContact" }, { "id": "-181407105", "predicate": "inputFile", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" }, { "name": "md5_checksum", "type": "string" } ], "type": "InputFile" }, { "id": "-1771768449", "predicate": "inputMediaEmpty", "params": [], "type": "InputMedia" }, { "id": "-139464256", "predicate": "inputMediaUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-373312269", "predicate": "inputMediaPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-104578748", "predicate": "inputMediaGeoPoint", "params": [ { "name": "geo_point", "type": "InputGeoPoint" } ], "type": "InputMedia" }, { "id": "-1494984313", "predicate": "inputMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputMedia" }, { "id": "480546647", "predicate": "inputChatPhotoEmpty", "params": [], "type": "InputChatPhoto" }, { "id": "-1809496270", "predicate": "inputChatUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-1293828344", "predicate": "inputChatPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-457104426", "predicate": "inputGeoPointEmpty", "params": [], "type": "InputGeoPoint" }, { "id": "-206066487", "predicate": "inputGeoPoint", "params": [ { "name": "lat", "type": "double" }, { "name": "long", "type": "double" } ], "type": "InputGeoPoint" }, { "id": "483901197", "predicate": "inputPhotoEmpty", "params": [], "type": "InputPhoto" }, { "id": "-74070332", "predicate": "inputPhoto", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputPhoto" }, { "id": "342061462", "predicate": "inputFileLocation", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-1377390588", "predicate": "inputPhotoCropAuto", "params": [], "type": "InputPhotoCrop" }, { "id": "-644787419", "predicate": "inputPhotoCrop", "params": [ { "name": "crop_left", "type": "double" }, { "name": "crop_top", "type": "double" }, { "name": "crop_width", "type": "double" } ], "type": "InputPhotoCrop" }, { "id": "1996904104", "predicate": "inputAppEvent", "params": [ { "name": "time", "type": "double" }, { "name": "type", "type": "string" }, { "name": "peer", "type": "long" }, { "name": "data", "type": "string" } ], "type": "InputAppEvent" }, { "id": "-1649296275", "predicate": "peerUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "Peer" }, { "id": "-1160714821", "predicate": "peerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Peer" }, { "id": "-1432995067", "predicate": "storage.fileUnknown", "params": [], "type": "storage.FileType" }, { "id": "8322574", "predicate": "storage.fileJpeg", "params": [], "type": "storage.FileType" }, { "id": "-891180321", "predicate": "storage.fileGif", "params": [], "type": "storage.FileType" }, { "id": "172975040", "predicate": "storage.filePng", "params": [], "type": "storage.FileType" }, { "id": "-1373745011", "predicate": "storage.filePdf", "params": [], "type": "storage.FileType" }, { "id": "1384777335", "predicate": "storage.fileMp3", "params": [], "type": "storage.FileType" }, { "id": "1258941372", "predicate": "storage.fileMov", "params": [], "type": "storage.FileType" }, { "id": "1086091090", "predicate": "storage.filePartial", "params": [], "type": "storage.FileType" }, { "id": "-1278304028", "predicate": "storage.fileMp4", "params": [], "type": "storage.FileType" }, { "id": "276907596", "predicate": "storage.fileWebp", "params": [], "type": "storage.FileType" }, { "id": "2086234950", "predicate": "fileLocationUnavailable", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "1406570614", "predicate": "fileLocation", "params": [ { "name": "dc_id", "type": "int" }, { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "537022650", "predicate": "userEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "User" }, { "id": "1326562017", "predicate": "userProfilePhotoEmpty", "params": [], "type": "UserProfilePhoto" }, { "id": "-715532088", "predicate": "userProfilePhoto", "params": [ { "name": "photo_id", "type": "long" }, { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "UserProfilePhoto" }, { "id": "164646985", "predicate": "userStatusEmpty", "params": [], "type": "UserStatus" }, { "id": "-306628279", "predicate": "userStatusOnline", "params": [ { "name": "expires", "type": "int" } ], "type": "UserStatus" }, { "id": "9203775", "predicate": "userStatusOffline", "params": [ { "name": "was_online", "type": "int" } ], "type": "UserStatus" }, { "id": "-1683826688", "predicate": "chatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Chat" }, { "id": "-652419756", "predicate": "chat", "params": [ { "name": "flags", "type": "#" }, { "name": "creator", "type": "flags.0?true" }, { "name": "kicked", "type": "flags.1?true" }, { "name": "left", "type": "flags.2?true" }, { "name": "admins_enabled", "type": "flags.3?true" }, { "name": "admin", "type": "flags.4?true" }, { "name": "deactivated", "type": "flags.5?true" }, { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" }, { "name": "migrated_to", "type": "flags.6?InputChannel" } ], "type": "Chat" }, { "id": "120753115", "predicate": "chatForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Chat" }, { "id": "771925524", "predicate": "chatFull", "params": [ { "name": "id", "type": "int" }, { "name": "participants", "type": "ChatParticipants" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector<BotInfo>" } ], "type": "ChatFull" }, { "id": "-925415106", "predicate": "chatParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "-57668565", "predicate": "chatParticipantsForbidden", "params": [ { "name": "flags", "type": "#" }, { "name": "chat_id", "type": "int" }, { "name": "self_participant", "type": "flags.0?ChatParticipant" } ], "type": "ChatParticipants" }, { "id": "1061556205", "predicate": "chatParticipants", "params": [ { "name": "chat_id", "type": "int" }, { "name": "participants", "type": "Vector<ChatParticipant>" }, { "name": "version", "type": "int" } ], "type": "ChatParticipants" }, { "id": "935395612", "predicate": "chatPhotoEmpty", "params": [], "type": "ChatPhoto" }, { "id": "1632839530", "predicate": "chatPhoto", "params": [ { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "ChatPhoto" }, { "id": "-2082087340", "predicate": "messageEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Message" }, { "id": "-1063525281", "predicate": "message", "params": [ { "name": "flags", "type": "#" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "silent", "type": "flags.13?true" }, { "name": "post", "type": "flags.14?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "fwd_from", "type": "flags.2?MessageFwdHeader" }, { "name": "via_bot_id", "type": "flags.11?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "reply_markup", "type": "flags.6?ReplyMarkup" }, { "name": "entities", "type": "flags.7?Vector<MessageEntity>" }, { "name": "views", "type": "flags.10?int" }, { "name": "edit_date", "type": "flags.15?int" } ], "type": "Message" }, { "id": "-1642487306", "predicate": "messageService", "params": [ { "name": "flags", "type": "#" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "silent", "type": "flags.13?true" }, { "name": "post", "type": "flags.14?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "flags.8?int" }, { "name": "to_id", "type": "Peer" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "Message" }, { "id": "1038967584", "predicate": "messageMediaEmpty", "params": [], "type": "MessageMedia" }, { "id": "1032643901", "predicate": "messageMediaPhoto", "params": [ { "name": "photo", "type": "Photo" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1457575028", "predicate": "messageMediaGeo", "params": [ { "name": "geo", "type": "GeoPoint" } ], "type": "MessageMedia" }, { "id": "1585262393", "predicate": "messageMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "user_id", "type": "int" } ], "type": "MessageMedia" }, { "id": "-1618676578", "predicate": "messageMediaUnsupported", "params": [], "type": "MessageMedia" }, { "id": "-1230047312", "predicate": "messageActionEmpty", "params": [], "type": "MessageAction" }, { "id": "-1503425638", "predicate": "messageActionChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "users", "type": "Vector<int>" } ], "type": "MessageAction" }, { "id": "-1247687078", "predicate": "messageActionChatEditTitle", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "2144015272", "predicate": "messageActionChatEditPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageAction" }, { "id": "-1780220945", "predicate": "messageActionChatDeletePhoto", "params": [], "type": "MessageAction" }, { "id": "1217033015", "predicate": "messageActionChatAddUser", "params": [ { "name": "users", "type": "Vector<int>" } ], "type": "MessageAction" }, { "id": "-1297179892", "predicate": "messageActionChatDeleteUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "1728035348", "predicate": "dialog", "params": [ { "name": "flags", "type": "#" }, { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "read_outbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "pts", "type": "flags.0?int" }, { "name": "draft", "type": "flags.1?DraftMessage" } ], "type": "Dialog" }, { "id": "590459437", "predicate": "photoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Photo" }, { "id": "-840088834", "predicate": "photo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "sizes", "type": "Vector<PhotoSize>" } ], "type": "Photo" }, { "id": "236446268", "predicate": "photoSizeEmpty", "params": [ { "name": "type", "type": "string" } ], "type": "PhotoSize" }, { "id": "2009052699", "predicate": "photoSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "size", "type": "int" } ], "type": "PhotoSize" }, { "id": "-374917894", "predicate": "photoCachedSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "PhotoSize" }, { "id": "286776671", "predicate": "geoPointEmpty", "params": [], "type": "GeoPoint" }, { "id": "541710092", "predicate": "geoPoint", "params": [ { "name": "long", "type": "double" }, { "name": "lat", "type": "double" } ], "type": "GeoPoint" }, { "id": "-2128698738", "predicate": "auth.checkedPhone", "params": [ { "name": "phone_registered", "type": "Bool" } ], "type": "auth.CheckedPhone" }, { "id": "1577067778", "predicate": "auth.sentCode", "params": [ { "name": "flags", "type": "#" }, { "name": "phone_registered", "type": "flags.0?true" }, { "name": "type", "type": "auth.SentCodeType" }, { "name": "phone_code_hash", "type": "string" }, { "name": "next_type", "type": "flags.1?auth.CodeType" }, { "name": "timeout", "type": "flags.2?int" } ], "type": "auth.SentCode" }, { "id": "-16553231", "predicate": "auth.authorization", "params": [ { "name": "user", "type": "User" } ], "type": "auth.Authorization" }, { "id": "-543777747", "predicate": "auth.exportedAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.ExportedAuthorization" }, { "id": "-1195615476", "predicate": "inputNotifyPeer", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "InputNotifyPeer" }, { "id": "423314455", "predicate": "inputNotifyUsers", "params": [], "type": "InputNotifyPeer" }, { "id": "1251338318", "predicate": "inputNotifyChats", "params": [], "type": "InputNotifyPeer" }, { "id": "-1540769658", "predicate": "inputNotifyAll", "params": [], "type": "InputNotifyPeer" }, { "id": "-265263912", "predicate": "inputPeerNotifyEventsEmpty", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "-395694988", "predicate": "inputPeerNotifyEventsAll", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "949182130", "predicate": "inputPeerNotifySettings", "params": [ { "name": "flags", "type": "#" }, { "name": "show_previews", "type": "flags.0?true" }, { "name": "silent", "type": "flags.1?true" }, { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" } ], "type": "InputPeerNotifySettings" }, { "id": "-1378534221", "predicate": "peerNotifyEventsEmpty", "params": [], "type": "PeerNotifyEvents" }, { "id": "1830677896", "predicate": "peerNotifyEventsAll", "params": [], "type": "PeerNotifyEvents" }, { "id": "1889961234", "predicate": "peerNotifySettingsEmpty", "params": [], "type": "PeerNotifySettings" }, { "id": "-1697798976", "predicate": "peerNotifySettings", "params": [ { "name": "flags", "type": "#" }, { "name": "show_previews", "type": "flags.0?true" }, { "name": "silent", "type": "flags.1?true" }, { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" } ], "type": "PeerNotifySettings" }, { "id": "-2122045747", "predicate": "peerSettings", "params": [ { "name": "flags", "type": "#" }, { "name": "report_spam", "type": "flags.0?true" } ], "type": "PeerSettings" }, { "id": "-860866985", "predicate": "wallPaper", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "sizes", "type": "Vector<PhotoSize>" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "1490799288", "predicate": "inputReportReasonSpam", "params": [], "type": "ReportReason" }, { "id": "505595789", "predicate": "inputReportReasonViolence", "params": [], "type": "ReportReason" }, { "id": "777640226", "predicate": "inputReportReasonPornography", "params": [], "type": "ReportReason" }, { "id": "-512463606", "predicate": "inputReportReasonOther", "params": [ { "name": "text", "type": "string" } ], "type": "ReportReason" }, { "id": "1496513539", "predicate": "userFull", "params": [ { "name": "flags", "type": "#" }, { "name": "blocked", "type": "flags.0?true" }, { "name": "user", "type": "User" }, { "name": "about", "type": "flags.1?string" }, { "name": "link", "type": "contacts.Link" }, { "name": "profile_photo", "type": "flags.2?Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "bot_info", "type": "flags.3?BotInfo" } ], "type": "UserFull" }, { "id": "-116274796", "predicate": "contact", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual", "type": "Bool" } ], "type": "Contact" }, { "id": "-805141448", "predicate": "importedContact", "params": [ { "name": "user_id", "type": "int" }, { "name": "client_id", "type": "long" } ], "type": "ImportedContact" }, { "id": "1444661369", "predicate": "contactBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ContactBlocked" }, { "id": "-748155807", "predicate": "contactStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "ContactStatus" }, { "id": "986597452", "predicate": "contacts.link", "params": [ { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" }, { "name": "user", "type": "User" } ], "type": "contacts.Link" }, { "id": "-1219778094", "predicate": "contacts.contactsNotModified", "params": [], "type": "contacts.Contacts" }, { "id": "1871416498", "predicate": "contacts.contacts", "params": [ { "name": "contacts", "type": "Vector<Contact>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.Contacts" }, { "id": "-1387117803", "predicate": "contacts.importedContacts", "params": [ { "name": "imported", "type": "Vector<ImportedContact>" }, { "name": "retry_contacts", "type": "Vector<long>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.ImportedContacts" }, { "id": "471043349", "predicate": "contacts.blocked", "params": [ { "name": "blocked", "type": "Vector<ContactBlocked>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.Blocked" }, { "id": "-1878523231", "predicate": "contacts.blockedSlice", "params": [ { "name": "count", "type": "int" }, { "name": "blocked", "type": "Vector<ContactBlocked>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.Blocked" }, { "id": "364538944", "predicate": "messages.dialogs", "params": [ { "name": "dialogs", "type": "Vector<Dialog>" }, { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.Dialogs" }, { "id": "1910543603", "predicate": "messages.dialogsSlice", "params": [ { "name": "count", "type": "int" }, { "name": "dialogs", "type": "Vector<Dialog>" }, { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.Dialogs" }, { "id": "-1938715001", "predicate": "messages.messages", "params": [ { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.Messages" }, { "id": "189033187", "predicate": "messages.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.Messages" }, { "id": "1694474197", "predicate": "messages.chats", "params": [ { "name": "chats", "type": "Vector<Chat>" } ], "type": "messages.Chats" }, { "id": "-438840932", "predicate": "messages.chatFull", "params": [ { "name": "full_chat", "type": "ChatFull" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.ChatFull" }, { "id": "-1269012015", "predicate": "messages.affectedHistory", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "1474492012", "predicate": "inputMessagesFilterEmpty", "params": [], "type": "MessagesFilter" }, { "id": "-1777752804", "predicate": "inputMessagesFilterPhotos", "params": [], "type": "MessagesFilter" }, { "id": "-1614803355", "predicate": "inputMessagesFilterVideo", "params": [], "type": "MessagesFilter" }, { "id": "1458172132", "predicate": "inputMessagesFilterPhotoVideo", "params": [], "type": "MessagesFilter" }, { "id": "-648121413", "predicate": "inputMessagesFilterPhotoVideoDocuments", "params": [], "type": "MessagesFilter" }, { "id": "-1629621880", "predicate": "inputMessagesFilterDocument", "params": [], "type": "MessagesFilter" }, { "id": "2129714567", "predicate": "inputMessagesFilterUrl", "params": [], "type": "MessagesFilter" }, { "id": "-3644025", "predicate": "inputMessagesFilterGif", "params": [], "type": "MessagesFilter" }, { "id": "522914557", "predicate": "updateNewMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1318109142", "predicate": "updateMessageID", "params": [ { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Update" }, { "id": "-1576161051", "predicate": "updateDeleteMessages", "params": [ { "name": "messages", "type": "Vector<int>" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1548249383", "predicate": "updateUserTyping", "params": [ { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "-1704596961", "predicate": "updateChatUserTyping", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "125178264", "predicate": "updateChatParticipants", "params": [ { "name": "participants", "type": "ChatParticipants" } ], "type": "Update" }, { "id": "469489699", "predicate": "updateUserStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "Update" }, { "id": "-1489818765", "predicate": "updateUserName", "params": [ { "name": "user_id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "Update" }, { "id": "-1791935732", "predicate": "updateUserPhoto", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "previous", "type": "Bool" } ], "type": "Update" }, { "id": "628472761", "predicate": "updateContactRegistered", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1657903163", "predicate": "updateContactLink", "params": [ { "name": "user_id", "type": "int" }, { "name": "my_link", "type": "ContactLink" }, { "name": "foreign_link", "type": "ContactLink" } ], "type": "Update" }, { "id": "-1895411046", "predicate": "updateNewAuthorization", "params": [ { "name": "auth_key_id", "type": "long" }, { "name": "date", "type": "int" }, { "name": "device", "type": "string" }, { "name": "location", "type": "string" } ], "type": "Update" }, { "id": "-1519637954", "predicate": "updates.state", "params": [ { "name": "pts", "type": "int" }, { "name": "qts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "unread_count", "type": "int" } ], "type": "updates.State" }, { "id": "1567990072", "predicate": "updates.differenceEmpty", "params": [ { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "updates.Difference" }, { "id": "16030880", "predicate": "updates.difference", "params": [ { "name": "new_messages", "type": "Vector<Message>" }, { "name": "new_encrypted_messages", "type": "Vector<EncryptedMessage>" }, { "name": "other_updates", "type": "Vector<Update>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" }, { "name": "state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-1459938943", "predicate": "updates.differenceSlice", "params": [ { "name": "new_messages", "type": "Vector<Message>" }, { "name": "new_encrypted_messages", "type": "Vector<EncryptedMessage>" }, { "name": "other_updates", "type": "Vector<Update>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" }, { "name": "intermediate_state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-484987010", "predicate": "updatesTooLong", "params": [], "type": "Updates" }, { "id": "-1857044719", "predicate": "updateShortMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "silent", "type": "flags.13?true" }, { "name": "id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from", "type": "flags.2?MessageFwdHeader" }, { "name": "via_bot_id", "type": "flags.11?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector<MessageEntity>" } ], "type": "Updates" }, { "id": "377562760", "predicate": "updateShortChatMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "out", "type": "flags.1?true" }, { "name": "mentioned", "type": "flags.4?true" }, { "name": "media_unread", "type": "flags.5?true" }, { "name": "silent", "type": "flags.13?true" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "chat_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "fwd_from", "type": "flags.2?MessageFwdHeader" }, { "name": "via_bot_id", "type": "flags.11?int" }, { "name": "reply_to_msg_id", "type": "flags.3?int" }, { "name": "entities", "type": "flags.7?Vector<MessageEntity>" } ], "type": "Updates" }, { "id": "2027216577", "predicate": "updateShort", "params": [ { "name": "update", "type": "Update" }, { "name": "date", "type": "int" } ], "type": "Updates" }, { "id": "1918567619", "predicate": "updatesCombined", "params": [ { "name": "updates", "type": "Vector<Update>" }, { "name": "users", "type": "Vector<User>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "date", "type": "int" }, { "name": "seq_start", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "1957577280", "predicate": "updates", "params": [ { "name": "updates", "type": "Vector<Update>" }, { "name": "users", "type": "Vector<User>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "-1916114267", "predicate": "photos.photos", "params": [ { "name": "photos", "type": "Vector<Photo>" }, { "name": "users", "type": "Vector<User>" } ], "type": "photos.Photos" }, { "id": "352657236", "predicate": "photos.photosSlice", "params": [ { "name": "count", "type": "int" }, { "name": "photos", "type": "Vector<Photo>" }, { "name": "users", "type": "Vector<User>" } ], "type": "photos.Photos" }, { "id": "539045032", "predicate": "photos.photo", "params": [ { "name": "photo", "type": "Photo" }, { "name": "users", "type": "Vector<User>" } ], "type": "photos.Photo" }, { "id": "157948117", "predicate": "upload.file", "params": [ { "name": "type", "type": "storage.FileType" }, { "name": "mtime", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "upload.File" }, { "id": "98092748", "predicate": "dcOption", "params": [ { "name": "flags", "type": "#" }, { "name": "ipv6", "type": "flags.0?true" }, { "name": "media_only", "type": "flags.1?true" }, { "name": "tcpo_only", "type": "flags.2?true" }, { "name": "id", "type": "int" }, { "name": "ip_address", "type": "string" }, { "name": "port", "type": "int" } ], "type": "DcOption" }, { "id": "-918482040", "predicate": "config", "params": [ { "name": "date", "type": "int" }, { "name": "expires", "type": "int" }, { "name": "test_mode", "type": "Bool" }, { "name": "this_dc", "type": "int" }, { "name": "dc_options", "type": "Vector<DcOption>" }, { "name": "chat_size_max", "type": "int" }, { "name": "megagroup_size_max", "type": "int" }, { "name": "forwarded_count_max", "type": "int" }, { "name": "online_update_period_ms", "type": "int" }, { "name": "offline_blur_timeout_ms", "type": "int" }, { "name": "offline_idle_timeout_ms", "type": "int" }, { "name": "online_cloud_timeout_ms", "type": "int" }, { "name": "notify_cloud_delay_ms", "type": "int" }, { "name": "notify_default_delay_ms", "type": "int" }, { "name": "chat_big_size", "type": "int" }, { "name": "push_chat_period_ms", "type": "int" }, { "name": "push_chat_limit", "type": "int" }, { "name": "saved_gifs_limit", "type": "int" }, { "name": "edit_time_limit", "type": "int" }, { "name": "rating_e_decay", "type": "int" }, { "name": "disabled_features", "type": "Vector<DisabledFeature>" } ], "type": "Config" }, { "id": "-1910892683", "predicate": "nearestDc", "params": [ { "name": "country", "type": "string" }, { "name": "this_dc", "type": "int" }, { "name": "nearest_dc", "type": "int" } ], "type": "NearestDc" }, { "id": "-1987579119", "predicate": "help.appUpdate", "params": [ { "name": "id", "type": "int" }, { "name": "critical", "type": "Bool" }, { "name": "url", "type": "string" }, { "name": "text", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "-1000708810", "predicate": "help.noAppUpdate", "params": [], "type": "help.AppUpdate" }, { "id": "415997816", "predicate": "help.inviteText", "params": [ { "name": "message", "type": "string" } ], "type": "help.InviteText" }, { "id": "1662091044", "predicate": "wallPaperSolid", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "bg_color", "type": "int" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "314359194", "predicate": "updateNewEncryptedMessage", "params": [ { "name": "message", "type": "EncryptedMessage" }, { "name": "qts", "type": "int" } ], "type": "Update" }, { "id": "386986326", "predicate": "updateEncryptedChatTyping", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Update" }, { "id": "-1264392051", "predicate": "updateEncryption", "params": [ { "name": "chat", "type": "EncryptedChat" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "956179895", "predicate": "updateEncryptedMessagesRead", "params": [ { "name": "chat_id", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1417756512", "predicate": "encryptedChatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "1006044124", "predicate": "encryptedChatWaiting", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-931638658", "predicate": "encryptedChatRequested", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "-94974410", "predicate": "encryptedChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a_or_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "332848423", "predicate": "encryptedChatDiscarded", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-247351839", "predicate": "inputEncryptedChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedChat" }, { "id": "-1038136962", "predicate": "encryptedFileEmpty", "params": [], "type": "EncryptedFile" }, { "id": "1248893260", "predicate": "encryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "EncryptedFile" }, { "id": "406307684", "predicate": "inputEncryptedFileEmpty", "params": [], "type": "InputEncryptedFile" }, { "id": "1690108678", "predicate": "inputEncryptedFileUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "md5_checksum", "type": "string" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "1511503333", "predicate": "inputEncryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedFile" }, { "id": "-182231723", "predicate": "inputEncryptedFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-317144808", "predicate": "encryptedMessage", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" }, { "name": "file", "type": "EncryptedFile" } ], "type": "EncryptedMessage" }, { "id": "594758406", "predicate": "encryptedMessageService", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "EncryptedMessage" }, { "id": "-1058912715", "predicate": "messages.dhConfigNotModified", "params": [ { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "740433629", "predicate": "messages.dhConfig", "params": [ { "name": "g", "type": "int" }, { "name": "p", "type": "bytes" }, { "name": "version", "type": "int" }, { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "1443858741", "predicate": "messages.sentEncryptedMessage", "params": [ { "name": "date", "type": "int" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1802240206", "predicate": "messages.sentEncryptedFile", "params": [ { "name": "date", "type": "int" }, { "name": "file", "type": "EncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-95482955", "predicate": "inputFileBig", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" } ], "type": "InputFile" }, { "id": "767652808", "predicate": "inputEncryptedFileBigUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "-364179876", "predicate": "updateChatParticipantAdd", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1851755554", "predicate": "updateChatParticipantDelete", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1906403213", "predicate": "updateDcOptions", "params": [ { "name": "dc_options", "type": "Vector<DcOption>" } ], "type": "Update" }, { "id": "495530093", "predicate": "inputMediaUploadedDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector<DocumentAttribute>" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-1386138479", "predicate": "inputMediaUploadedThumbDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "mime_type", "type": "string" }, { "name": "attributes", "type": "Vector<DocumentAttribute>" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "444068508", "predicate": "inputMediaDocument", "params": [ { "name": "id", "type": "InputDocument" }, { "name": "caption", "type": "string" } ], "type": "InputMedia" }, { "id": "-203411800", "predicate": "messageMediaDocument", "params": [ { "name": "document", "type": "Document" }, { "name": "caption", "type": "string" } ], "type": "MessageMedia" }, { "id": "1928391342", "predicate": "inputDocumentEmpty", "params": [], "type": "InputDocument" }, { "id": "410618194", "predicate": "inputDocument", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputDocument" }, { "id": "1313188841", "predicate": "inputDocumentFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "922273905", "predicate": "documentEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Document" }, { "id": "-106717361", "predicate": "document", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "attributes", "type": "Vector<DocumentAttribute>" } ], "type": "Document" }, { "id": "398898678", "predicate": "help.support", "params": [ { "name": "phone_number", "type": "string" }, { "name": "user", "type": "User" } ], "type": "help.Support" }, { "id": "-1613493288", "predicate": "notifyPeer", "params": [ { "name": "peer", "type": "Peer" } ], "type": "NotifyPeer" }, { "id": "-1261946036", "predicate": "notifyUsers", "params": [], "type": "NotifyPeer" }, { "id": "-1073230141", "predicate": "notifyChats", "params": [], "type": "NotifyPeer" }, { "id": "1959820384", "predicate": "notifyAll", "params": [], "type": "NotifyPeer" }, { "id": "-2131957734", "predicate": "updateUserBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "blocked", "type": "Bool" } ], "type": "Update" }, { "id": "-1094555409", "predicate": "updateNotifySettings", "params": [ { "name": "peer", "type": "NotifyPeer" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Update" }, { "id": "381645902", "predicate": "sendMessageTypingAction", "params": [], "type": "SendMessageAction" }, { "id": "-44119819", "predicate": "sendMessageCancelAction", "params": [], "type": "SendMessageAction" }, { "id": "-1584933265", "predicate": "sendMessageRecordVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-378127636", "predicate": "sendMessageUploadVideoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-718310409", "predicate": "sendMessageRecordAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-212740181", "predicate": "sendMessageUploadAudioAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-774682074", "predicate": "sendMessageUploadPhotoAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "-1441998364", "predicate": "sendMessageUploadDocumentAction", "params": [ { "name": "progress", "type": "int" } ], "type": "SendMessageAction" }, { "id": "393186209", "predicate": "sendMessageGeoLocationAction", "params": [], "type": "SendMessageAction" }, { "id": "1653390447", "predicate": "sendMessageChooseContactAction", "params": [], "type": "SendMessageAction" }, { "id": "446822276", "predicate": "contacts.found", "params": [ { "name": "results", "type": "Vector<Peer>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.Found" }, { "id": "942527460", "predicate": "updateServiceNotification", "params": [ { "name": "type", "type": "string" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" }, { "name": "popup", "type": "Bool" } ], "type": "Update" }, { "id": "-496024847", "predicate": "userStatusRecently", "params": [], "type": "UserStatus" }, { "id": "129960444", "predicate": "userStatusLastWeek", "params": [], "type": "UserStatus" }, { "id": "2011940674", "predicate": "userStatusLastMonth", "params": [], "type": "UserStatus" }, { "id": "-298113238", "predicate": "updatePrivacy", "params": [ { "name": "key", "type": "PrivacyKey" }, { "name": "rules", "type": "Vector<PrivacyRule>" } ], "type": "Update" }, { "id": "1335282456", "predicate": "inputPrivacyKeyStatusTimestamp", "params": [], "type": "InputPrivacyKey" }, { "id": "-1137792208", "predicate": "privacyKeyStatusTimestamp", "params": [], "type": "PrivacyKey" }, { "id": "218751099", "predicate": "inputPrivacyValueAllowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "407582158", "predicate": "inputPrivacyValueAllowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "320652927", "predicate": "inputPrivacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector<InputUser>" } ], "type": "InputPrivacyRule" }, { "id": "195371015", "predicate": "inputPrivacyValueDisallowContacts", "params": [], "type": "InputPrivacyRule" }, { "id": "-697604407", "predicate": "inputPrivacyValueDisallowAll", "params": [], "type": "InputPrivacyRule" }, { "id": "-1877932953", "predicate": "inputPrivacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector<InputUser>" } ], "type": "InputPrivacyRule" }, { "id": "-123988", "predicate": "privacyValueAllowContacts", "params": [], "type": "PrivacyRule" }, { "id": "1698855810", "predicate": "privacyValueAllowAll", "params": [], "type": "PrivacyRule" }, { "id": "1297858060", "predicate": "privacyValueAllowUsers", "params": [ { "name": "users", "type": "Vector<int>" } ], "type": "PrivacyRule" }, { "id": "-125240806", "predicate": "privacyValueDisallowContacts", "params": [], "type": "PrivacyRule" }, { "id": "-1955338397", "predicate": "privacyValueDisallowAll", "params": [], "type": "PrivacyRule" }, { "id": "209668535", "predicate": "privacyValueDisallowUsers", "params": [ { "name": "users", "type": "Vector<int>" } ], "type": "PrivacyRule" }, { "id": "1430961007", "predicate": "account.privacyRules", "params": [ { "name": "rules", "type": "Vector<PrivacyRule>" }, { "name": "users", "type": "Vector<User>" } ], "type": "account.PrivacyRules" }, { "id": "-1194283041", "predicate": "accountDaysTTL", "params": [ { "name": "days", "type": "int" } ], "type": "AccountDaysTTL" }, { "id": "314130811", "predicate": "updateUserPhone", "params": [ { "name": "user_id", "type": "int" }, { "name": "phone", "type": "string" } ], "type": "Update" }, { "id": "1815593308", "predicate": "documentAttributeImageSize", "params": [ { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "297109817", "predicate": "documentAttributeAnimated", "params": [], "type": "DocumentAttribute" }, { "id": "978674434", "predicate": "documentAttributeSticker", "params": [ { "name": "alt", "type": "string" }, { "name": "stickerset", "type": "InputStickerSet" } ], "type": "DocumentAttribute" }, { "id": "1494273227", "predicate": "documentAttributeVideo", "params": [ { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "DocumentAttribute" }, { "id": "-1739392570", "predicate": "documentAttributeAudio", "params": [ { "name": "flags", "type": "#" }, { "name": "voice", "type": "flags.10?true" }, { "name": "duration", "type": "int" }, { "name": "title", "type": "flags.0?string" }, { "name": "performer", "type": "flags.1?string" }, { "name": "waveform", "type": "flags.2?bytes" } ], "type": "DocumentAttribute" }, { "id": "358154344", "predicate": "documentAttributeFilename", "params": [ { "name": "file_name", "type": "string" } ], "type": "DocumentAttribute" }, { "id": "-244016606", "predicate": "messages.stickersNotModified", "params": [], "type": "messages.Stickers" }, { "id": "-1970352846", "predicate": "messages.stickers", "params": [ { "name": "hash", "type": "string" }, { "name": "stickers", "type": "Vector<Document>" } ], "type": "messages.Stickers" }, { "id": "313694676", "predicate": "stickerPack", "params": [ { "name": "emoticon", "type": "string" }, { "name": "documents", "type": "Vector<long>" } ], "type": "StickerPack" }, { "id": "-395967805", "predicate": "messages.allStickersNotModified", "params": [], "type": "messages.AllStickers" }, { "id": "-302170017", "predicate": "messages.allStickers", "params": [ { "name": "hash", "type": "int" }, { "name": "sets", "type": "Vector<StickerSet>" } ], "type": "messages.AllStickers" }, { "id": "-1369215196", "predicate": "disabledFeature", "params": [ { "name": "feature", "type": "string" }, { "name": "description", "type": "string" } ], "type": "DisabledFeature" }, { "id": "-1721631396", "predicate": "updateReadHistoryInbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "791617983", "predicate": "updateReadHistoryOutbox", "params": [ { "name": "peer", "type": "Peer" }, { "name": "max_id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-2066640507", "predicate": "messages.affectedMessages", "params": [ { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "1599050311", "predicate": "contactLinkUnknown", "params": [], "type": "ContactLink" }, { "id": "-17968211", "predicate": "contactLinkNone", "params": [], "type": "ContactLink" }, { "id": "646922073", "predicate": "contactLinkHasPhone", "params": [], "type": "ContactLink" }, { "id": "-721239344", "predicate": "contactLinkContact", "params": [], "type": "ContactLink" }, { "id": "2139689491", "predicate": "updateWebPage", "params": [ { "name": "webpage", "type": "WebPage" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-350980120", "predicate": "webPageEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "WebPage" }, { "id": "-981018084", "predicate": "webPagePending", "params": [ { "name": "id", "type": "long" }, { "name": "date", "type": "int" } ], "type": "WebPage" }, { "id": "-897446185", "predicate": "webPage", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "long" }, { "name": "url", "type": "string" }, { "name": "display_url", "type": "string" }, { "name": "type", "type": "flags.0?string" }, { "name": "site_name", "type": "flags.1?string" }, { "name": "title", "type": "flags.2?string" }, { "name": "description", "type": "flags.3?string" }, { "name": "photo", "type": "flags.4?Photo" }, { "name": "embed_url", "type": "flags.5?string" }, { "name": "embed_type", "type": "flags.5?string" }, { "name": "embed_width", "type": "flags.6?int" }, { "name": "embed_height", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "author", "type": "flags.8?string" }, { "name": "document", "type": "flags.9?Document" } ], "type": "WebPage" }, { "id": "-1557277184", "predicate": "messageMediaWebPage", "params": [ { "name": "webpage", "type": "WebPage" } ], "type": "MessageMedia" }, { "id": "2079516406", "predicate": "authorization", "params": [ { "name": "hash", "type": "long" }, { "name": "flags", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "platform", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "api_id", "type": "int" }, { "name": "app_name", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "date_created", "type": "int" }, { "name": "date_active", "type": "int" }, { "name": "ip", "type": "string" }, { "name": "country", "type": "string" }, { "name": "region", "type": "string" } ], "type": "Authorization" }, { "id": "307276766", "predicate": "account.authorizations", "params": [ { "name": "authorizations", "type": "Vector<Authorization>" } ], "type": "account.Authorizations" }, { "id": "-1764049896", "predicate": "account.noPassword", "params": [ { "name": "new_salt", "type": "bytes" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "2081952796", "predicate": "account.password", "params": [ { "name": "current_salt", "type": "bytes" }, { "name": "new_salt", "type": "bytes" }, { "name": "hint", "type": "string" }, { "name": "has_recovery", "type": "Bool" }, { "name": "email_unconfirmed_pattern", "type": "string" } ], "type": "account.Password" }, { "id": "-1212732749", "predicate": "account.passwordSettings", "params": [ { "name": "email", "type": "string" } ], "type": "account.PasswordSettings" }, { "id": "-2037289493", "predicate": "account.passwordInputSettings", "params": [ { "name": "flags", "type": "#" }, { "name": "new_salt", "type": "flags.0?bytes" }, { "name": "new_password_hash", "type": "flags.0?bytes" }, { "name": "hint", "type": "flags.0?string" }, { "name": "email", "type": "flags.1?string" } ], "type": "account.PasswordInputSettings" }, { "id": "326715557", "predicate": "auth.passwordRecovery", "params": [ { "name": "email_pattern", "type": "string" } ], "type": "auth.PasswordRecovery" }, { "id": "673687578", "predicate": "inputMediaVenue", "params": [ { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "InputMedia" }, { "id": "2031269663", "predicate": "messageMediaVenue", "params": [ { "name": "geo", "type": "GeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" } ], "type": "MessageMedia" }, { "id": "-1551583367", "predicate": "receivedNotifyMessage", "params": [ { "name": "id", "type": "int" }, { "name": "flags", "type": "int" } ], "type": "ReceivedNotifyMessage" }, { "id": "1776236393", "predicate": "chatInviteEmpty", "params": [], "type": "ExportedChatInvite" }, { "id": "-64092740", "predicate": "chatInviteExported", "params": [ { "name": "link", "type": "string" } ], "type": "ExportedChatInvite" }, { "id": "1516793212", "predicate": "chatInviteAlready", "params": [ { "name": "chat", "type": "Chat" } ], "type": "ChatInvite" }, { "id": "-1813406880", "predicate": "chatInvite", "params": [ { "name": "flags", "type": "#" }, { "name": "channel", "type": "flags.0?true" }, { "name": "broadcast", "type": "flags.1?true" }, { "name": "public", "type": "flags.2?true" }, { "name": "megagroup", "type": "flags.3?true" }, { "name": "title", "type": "string" } ], "type": "ChatInvite" }, { "id": "-123931160", "predicate": "messageActionChatJoinedByLink", "params": [ { "name": "inviter_id", "type": "int" } ], "type": "MessageAction" }, { "id": "1757493555", "predicate": "updateReadMessagesContents", "params": [ { "name": "messages", "type": "Vector<int>" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-4838507", "predicate": "inputStickerSetEmpty", "params": [], "type": "InputStickerSet" }, { "id": "-1645763991", "predicate": "inputStickerSetID", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputStickerSet" }, { "id": "-2044933984", "predicate": "inputStickerSetShortName", "params": [ { "name": "short_name", "type": "string" } ], "type": "InputStickerSet" }, { "id": "-852477119", "predicate": "stickerSet", "params": [ { "name": "flags", "type": "#" }, { "name": "installed", "type": "flags.0?true" }, { "name": "disabled", "type": "flags.1?true" }, { "name": "official", "type": "flags.2?true" }, { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" }, { "name": "short_name", "type": "string" }, { "name": "count", "type": "int" }, { "name": "hash", "type": "int" } ], "type": "StickerSet" }, { "id": "-1240849242", "predicate": "messages.stickerSet", "params": [ { "name": "set", "type": "StickerSet" }, { "name": "packs", "type": "Vector<StickerPack>" }, { "name": "documents", "type": "Vector<Document>" } ], "type": "messages.StickerSet" }, { "id": "-787638374", "predicate": "user", "params": [ { "name": "flags", "type": "#" }, { "name": "self", "type": "flags.10?true" }, { "name": "contact", "type": "flags.11?true" }, { "name": "mutual_contact", "type": "flags.12?true" }, { "name": "deleted", "type": "flags.13?true" }, { "name": "bot", "type": "flags.14?true" }, { "name": "bot_chat_history", "type": "flags.15?true" }, { "name": "bot_nochats", "type": "flags.16?true" }, { "name": "verified", "type": "flags.17?true" }, { "name": "restricted", "type": "flags.18?true" }, { "name": "min", "type": "flags.20?true" }, { "name": "bot_inline_geo", "type": "flags.21?true" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "flags.0?long" }, { "name": "first_name", "type": "flags.1?string" }, { "name": "last_name", "type": "flags.2?string" }, { "name": "username", "type": "flags.3?string" }, { "name": "phone", "type": "flags.4?string" }, { "name": "photo", "type": "flags.5?UserProfilePhoto" }, { "name": "status", "type": "flags.6?UserStatus" }, { "name": "bot_info_version", "type": "flags.14?int" }, { "name": "restriction_reason", "type": "flags.18?string" }, { "name": "bot_inline_placeholder", "type": "flags.19?string" } ], "type": "User" }, { "id": "-1032140601", "predicate": "botCommand", "params": [ { "name": "command", "type": "string" }, { "name": "description", "type": "string" } ], "type": "BotCommand" }, { "id": "-1729618630", "predicate": "botInfo", "params": [ { "name": "user_id", "type": "int" }, { "name": "description", "type": "string" }, { "name": "commands", "type": "Vector<BotCommand>" } ], "type": "BotInfo" }, { "id": "-1560655744", "predicate": "keyboardButton", "params": [ { "name": "text", "type": "string" } ], "type": "KeyboardButton" }, { "id": "2002815875", "predicate": "keyboardButtonRow", "params": [ { "name": "buttons", "type": "Vector<KeyboardButton>" } ], "type": "KeyboardButtonRow" }, { "id": "-1606526075", "predicate": "replyKeyboardHide", "params": [ { "name": "flags", "type": "#" }, { "name": "selective", "type": "flags.2?true" } ], "type": "ReplyMarkup" }, { "id": "-200242528", "predicate": "replyKeyboardForceReply", "params": [ { "name": "flags", "type": "#" }, { "name": "single_use", "type": "flags.1?true" }, { "name": "selective", "type": "flags.2?true" } ], "type": "ReplyMarkup" }, { "id": "889353612", "predicate": "replyKeyboardMarkup", "params": [ { "name": "flags", "type": "#" }, { "name": "resize", "type": "flags.0?true" }, { "name": "single_use", "type": "flags.1?true" }, { "name": "selective", "type": "flags.2?true" }, { "name": "rows", "type": "Vector<KeyboardButtonRow>" } ], "type": "ReplyMarkup" }, { "id": "2072935910", "predicate": "inputPeerUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "-668391402", "predicate": "inputUser", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputUser" }, { "id": "-1350696044", "predicate": "help.appChangelogEmpty", "params": [], "type": "help.AppChangelog" }, { "id": "1181279933", "predicate": "help.appChangelog", "params": [ { "name": "text", "type": "string" } ], "type": "help.AppChangelog" }, { "id": "-1148011883", "predicate": "messageEntityUnknown", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-100378723", "predicate": "messageEntityMention", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1868782349", "predicate": "messageEntityHashtag", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1827637959", "predicate": "messageEntityBotCommand", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1859134776", "predicate": "messageEntityUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1692693954", "predicate": "messageEntityEmail", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-1117713463", "predicate": "messageEntityBold", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "-2106619040", "predicate": "messageEntityItalic", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "681706865", "predicate": "messageEntityCode", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" } ], "type": "MessageEntity" }, { "id": "1938967520", "predicate": "messageEntityPre", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "language", "type": "string" } ], "type": "MessageEntity" }, { "id": "1990644519", "predicate": "messageEntityTextUrl", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "url", "type": "string" } ], "type": "MessageEntity" }, { "id": "301019932", "predicate": "updateShortSentMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "out", "type": "flags.1?true" }, { "name": "id", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "media", "type": "flags.9?MessageMedia" }, { "name": "entities", "type": "flags.7?Vector<MessageEntity>" } ], "type": "Updates" }, { "id": "-292807034", "predicate": "inputChannelEmpty", "params": [], "type": "InputChannel" }, { "id": "-1343524562", "predicate": "inputChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputChannel" }, { "id": "-1109531342", "predicate": "peerChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Peer" }, { "id": "548253432", "predicate": "inputPeerChannel", "params": [ { "name": "channel_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "-1588737454", "predicate": "channel", "params": [ { "name": "flags", "type": "#" }, { "name": "creator", "type": "flags.0?true" }, { "name": "kicked", "type": "flags.1?true" }, { "name": "left", "type": "flags.2?true" }, { "name": "editor", "type": "flags.3?true" }, { "name": "moderator", "type": "flags.4?true" }, { "name": "broadcast", "type": "flags.5?true" }, { "name": "verified", "type": "flags.7?true" }, { "name": "megagroup", "type": "flags.8?true" }, { "name": "restricted", "type": "flags.9?true" }, { "name": "democracy", "type": "flags.10?true" }, { "name": "signatures", "type": "flags.11?true" }, { "name": "min", "type": "flags.12?true" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "flags.13?long" }, { "name": "title", "type": "string" }, { "name": "username", "type": "flags.6?string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "date", "type": "int" }, { "name": "version", "type": "int" }, { "name": "restriction_reason", "type": "flags.9?string" } ], "type": "Chat" }, { "id": "-2059962289", "predicate": "channelForbidden", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.5?true" }, { "name": "megagroup", "type": "flags.8?true" }, { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "title", "type": "string" } ], "type": "Chat" }, { "id": "2131196633", "predicate": "contacts.resolvedPeer", "params": [ { "name": "peer", "type": "Peer" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.ResolvedPeer" }, { "id": "-1009430225", "predicate": "channelFull", "params": [ { "name": "flags", "type": "#" }, { "name": "can_view_participants", "type": "flags.3?true" }, { "name": "can_set_username", "type": "flags.6?true" }, { "name": "id", "type": "int" }, { "name": "about", "type": "string" }, { "name": "participants_count", "type": "flags.0?int" }, { "name": "admins_count", "type": "flags.1?int" }, { "name": "kicked_count", "type": "flags.2?int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "read_outbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "exported_invite", "type": "ExportedChatInvite" }, { "name": "bot_info", "type": "Vector<BotInfo>" }, { "name": "migrated_from_chat_id", "type": "flags.4?int" }, { "name": "migrated_from_max_id", "type": "flags.4?int" }, { "name": "pinned_msg_id", "type": "flags.5?int" } ], "type": "ChatFull" }, { "id": "182649427", "predicate": "messageRange", "params": [ { "name": "min_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "MessageRange" }, { "id": "-1725551049", "predicate": "messages.channelMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "pts", "type": "int" }, { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.Messages" }, { "id": "-1781355374", "predicate": "messageActionChannelCreate", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "-352032773", "predicate": "updateChannelTooLong", "params": [ { "name": "flags", "type": "#" }, { "name": "channel_id", "type": "int" }, { "name": "pts", "type": "flags.0?int" } ], "type": "Update" }, { "id": "-1227598250", "predicate": "updateChannel", "params": [ { "name": "channel_id", "type": "int" } ], "type": "Update" }, { "id": "1656358105", "predicate": "updateNewChannelMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "1108669311", "predicate": "updateReadChannelInbox", "params": [ { "name": "channel_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "Update" }, { "id": "-1015733815", "predicate": "updateDeleteChannelMessages", "params": [ { "name": "channel_id", "type": "int" }, { "name": "messages", "type": "Vector<int>" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-1734268085", "predicate": "updateChannelMessageViews", "params": [ { "name": "channel_id", "type": "int" }, { "name": "id", "type": "int" }, { "name": "views", "type": "int" } ], "type": "Update" }, { "id": "1041346555", "predicate": "updates.channelDifferenceEmpty", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" } ], "type": "updates.ChannelDifference" }, { "id": "1091431943", "predicate": "updates.channelDifferenceTooLong", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "top_message", "type": "int" }, { "name": "read_inbox_max_id", "type": "int" }, { "name": "read_outbox_max_id", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "updates.ChannelDifference" }, { "id": "543450958", "predicate": "updates.channelDifference", "params": [ { "name": "flags", "type": "#" }, { "name": "final", "type": "flags.0?true" }, { "name": "pts", "type": "int" }, { "name": "timeout", "type": "flags.1?int" }, { "name": "new_messages", "type": "Vector<Message>" }, { "name": "other_updates", "type": "Vector<Update>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "updates.ChannelDifference" }, { "id": "-1798033689", "predicate": "channelMessagesFilterEmpty", "params": [], "type": "ChannelMessagesFilter" }, { "id": "-847783593", "predicate": "channelMessagesFilter", "params": [ { "name": "flags", "type": "#" }, { "name": "exclude_new_messages", "type": "flags.1?true" }, { "name": "ranges", "type": "Vector<MessageRange>" } ], "type": "ChannelMessagesFilter" }, { "id": "367766557", "predicate": "channelParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1557620115", "predicate": "channelParticipantSelf", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1861910545", "predicate": "channelParticipantModerator", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1743180447", "predicate": "channelParticipantEditor", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-1933187430", "predicate": "channelParticipantKicked", "params": [ { "name": "user_id", "type": "int" }, { "name": "kicked_by", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-471670279", "predicate": "channelParticipantCreator", "params": [ { "name": "user_id", "type": "int" } ], "type": "ChannelParticipant" }, { "id": "-566281095", "predicate": "channelParticipantsRecent", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-1268741783", "predicate": "channelParticipantsAdmins", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "1010285434", "predicate": "channelParticipantsKicked", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-1299865402", "predicate": "channelRoleEmpty", "params": [], "type": "ChannelParticipantRole" }, { "id": "-1776756363", "predicate": "channelRoleModerator", "params": [], "type": "ChannelParticipantRole" }, { "id": "-2113143156", "predicate": "channelRoleEditor", "params": [], "type": "ChannelParticipantRole" }, { "id": "-177282392", "predicate": "channels.channelParticipants", "params": [ { "name": "count", "type": "int" }, { "name": "participants", "type": "Vector<ChannelParticipant>" }, { "name": "users", "type": "Vector<User>" } ], "type": "channels.ChannelParticipants" }, { "id": "-791039645", "predicate": "channels.channelParticipant", "params": [ { "name": "participant", "type": "ChannelParticipant" }, { "name": "users", "type": "Vector<User>" } ], "type": "channels.ChannelParticipant" }, { "id": "-636267638", "predicate": "chatParticipantCreator", "params": [ { "name": "user_id", "type": "int" } ], "type": "ChatParticipant" }, { "id": "-489233354", "predicate": "chatParticipantAdmin", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "1855224129", "predicate": "updateChatAdmins", "params": [ { "name": "chat_id", "type": "int" }, { "name": "enabled", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1232070311", "predicate": "updateChatParticipantAdmin", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "is_admin", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1371385889", "predicate": "messageActionChatMigrateTo", "params": [ { "name": "channel_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1336546578", "predicate": "messageActionChannelMigrateFrom", "params": [ { "name": "title", "type": "string" }, { "name": "chat_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1328445861", "predicate": "channelParticipantsBots", "params": [], "type": "ChannelParticipantsFilter" }, { "id": "-236044656", "predicate": "help.termsOfService", "params": [ { "name": "text", "type": "string" } ], "type": "help.TermsOfService" }, { "id": "1753886890", "predicate": "updateNewStickerSet", "params": [ { "name": "stickerset", "type": "messages.StickerSet" } ], "type": "Update" }, { "id": "-253774767", "predicate": "updateStickerSetsOrder", "params": [ { "name": "order", "type": "Vector<long>" } ], "type": "Update" }, { "id": "1135492588", "predicate": "updateStickerSets", "params": [], "type": "Update" }, { "id": "372165663", "predicate": "foundGif", "params": [ { "name": "url", "type": "string" }, { "name": "thumb_url", "type": "string" }, { "name": "content_url", "type": "string" }, { "name": "content_type", "type": "string" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "FoundGif" }, { "id": "-1670052855", "predicate": "foundGifCached", "params": [ { "name": "url", "type": "string" }, { "name": "photo", "type": "Photo" }, { "name": "document", "type": "Document" } ], "type": "FoundGif" }, { "id": "1212395773", "predicate": "inputMediaGifExternal", "params": [ { "name": "url", "type": "string" }, { "name": "q", "type": "string" } ], "type": "InputMedia" }, { "id": "1158290442", "predicate": "messages.foundGifs", "params": [ { "name": "next_offset", "type": "int" }, { "name": "results", "type": "Vector<FoundGif>" } ], "type": "messages.FoundGifs" }, { "id": "-402498398", "predicate": "messages.savedGifsNotModified", "params": [], "type": "messages.SavedGifs" }, { "id": "772213157", "predicate": "messages.savedGifs", "params": [ { "name": "hash", "type": "int" }, { "name": "gifs", "type": "Vector<Document>" } ], "type": "messages.SavedGifs" }, { "id": "-1821035490", "predicate": "updateSavedGifs", "params": [], "type": "Update" }, { "id": "691006739", "predicate": "inputBotInlineMessageMediaAuto", "params": [ { "name": "flags", "type": "#" }, { "name": "caption", "type": "string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "InputBotInlineMessage" }, { "id": "1036876423", "predicate": "inputBotInlineMessageText", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.0?true" }, { "name": "message", "type": "string" }, { "name": "entities", "type": "flags.1?Vector<MessageEntity>" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "InputBotInlineMessage" }, { "id": "750510426", "predicate": "inputBotInlineResult", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "string" }, { "name": "type", "type": "string" }, { "name": "title", "type": "flags.1?string" }, { "name": "description", "type": "flags.2?string" }, { "name": "url", "type": "flags.3?string" }, { "name": "thumb_url", "type": "flags.4?string" }, { "name": "content_url", "type": "flags.5?string" }, { "name": "content_type", "type": "flags.5?string" }, { "name": "w", "type": "flags.6?int" }, { "name": "h", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "send_message", "type": "InputBotInlineMessage" } ], "type": "InputBotInlineResult" }, { "id": "175419739", "predicate": "botInlineMessageMediaAuto", "params": [ { "name": "flags", "type": "#" }, { "name": "caption", "type": "string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "BotInlineMessage" }, { "id": "-1937807902", "predicate": "botInlineMessageText", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.0?true" }, { "name": "message", "type": "string" }, { "name": "entities", "type": "flags.1?Vector<MessageEntity>" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "BotInlineMessage" }, { "id": "-1679053127", "predicate": "botInlineResult", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "string" }, { "name": "type", "type": "string" }, { "name": "title", "type": "flags.1?string" }, { "name": "description", "type": "flags.2?string" }, { "name": "url", "type": "flags.3?string" }, { "name": "thumb_url", "type": "flags.4?string" }, { "name": "content_url", "type": "flags.5?string" }, { "name": "content_type", "type": "flags.5?string" }, { "name": "w", "type": "flags.6?int" }, { "name": "h", "type": "flags.6?int" }, { "name": "duration", "type": "flags.7?int" }, { "name": "send_message", "type": "BotInlineMessage" } ], "type": "BotInlineResult" }, { "id": "627509670", "predicate": "messages.botResults", "params": [ { "name": "flags", "type": "#" }, { "name": "gallery", "type": "flags.0?true" }, { "name": "query_id", "type": "long" }, { "name": "next_offset", "type": "flags.1?string" }, { "name": "switch_pm", "type": "flags.2?InlineBotSwitchPM" }, { "name": "results", "type": "Vector<BotInlineResult>" } ], "type": "messages.BotResults" }, { "id": "1417832080", "predicate": "updateBotInlineQuery", "params": [ { "name": "flags", "type": "#" }, { "name": "query_id", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "query", "type": "string" }, { "name": "geo", "type": "flags.0?GeoPoint" }, { "name": "offset", "type": "string" } ], "type": "Update" }, { "id": "239663460", "predicate": "updateBotInlineSend", "params": [ { "name": "flags", "type": "#" }, { "name": "user_id", "type": "int" }, { "name": "query", "type": "string" }, { "name": "geo", "type": "flags.0?GeoPoint" }, { "name": "id", "type": "string" }, { "name": "msg_id", "type": "flags.1?InputBotInlineMessageID" } ], "type": "Update" }, { "id": "1358283666", "predicate": "inputMessagesFilterVoice", "params": [], "type": "MessagesFilter" }, { "id": "928101534", "predicate": "inputMessagesFilterMusic", "params": [], "type": "MessagesFilter" }, { "id": "-1107622874", "predicate": "inputPrivacyKeyChatInvite", "params": [], "type": "InputPrivacyKey" }, { "id": "1343122938", "predicate": "privacyKeyChatInvite", "params": [], "type": "PrivacyKey" }, { "id": "524838915", "predicate": "exportedMessageLink", "params": [ { "name": "link", "type": "string" } ], "type": "ExportedMessageLink" }, { "id": "-947462709", "predicate": "messageFwdHeader", "params": [ { "name": "flags", "type": "#" }, { "name": "from_id", "type": "flags.0?int" }, { "name": "date", "type": "int" }, { "name": "channel_id", "type": "flags.1?int" }, { "name": "channel_post", "type": "flags.2?int" } ], "type": "MessageFwdHeader" }, { "id": "457133559", "predicate": "updateEditChannelMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-1738988427", "predicate": "updateChannelPinnedMessage", "params": [ { "name": "channel_id", "type": "int" }, { "name": "id", "type": "int" } ], "type": "Update" }, { "id": "-1799538451", "predicate": "messageActionPinMessage", "params": [], "type": "MessageAction" }, { "id": "1923290508", "predicate": "auth.codeTypeSms", "params": [], "type": "auth.CodeType" }, { "id": "1948046307", "predicate": "auth.codeTypeCall", "params": [], "type": "auth.CodeType" }, { "id": "577556219", "predicate": "auth.codeTypeFlashCall", "params": [], "type": "auth.CodeType" }, { "id": "1035688326", "predicate": "auth.sentCodeTypeApp", "params": [ { "name": "length", "type": "int" } ], "type": "auth.SentCodeType" }, { "id": "-1073693790", "predicate": "auth.sentCodeTypeSms", "params": [ { "name": "length", "type": "int" } ], "type": "auth.SentCodeType" }, { "id": "1398007207", "predicate": "auth.sentCodeTypeCall", "params": [ { "name": "length", "type": "int" } ], "type": "auth.SentCodeType" }, { "id": "-1425815847", "predicate": "auth.sentCodeTypeFlashCall", "params": [ { "name": "pattern", "type": "string" } ], "type": "auth.SentCodeType" }, { "id": "629866245", "predicate": "keyboardButtonUrl", "params": [ { "name": "text", "type": "string" }, { "name": "url", "type": "string" } ], "type": "KeyboardButton" }, { "id": "1748655686", "predicate": "keyboardButtonCallback", "params": [ { "name": "text", "type": "string" }, { "name": "data", "type": "bytes" } ], "type": "KeyboardButton" }, { "id": "-1318425559", "predicate": "keyboardButtonRequestPhone", "params": [ { "name": "text", "type": "string" } ], "type": "KeyboardButton" }, { "id": "-59151553", "predicate": "keyboardButtonRequestGeoLocation", "params": [ { "name": "text", "type": "string" } ], "type": "KeyboardButton" }, { "id": "-367298028", "predicate": "keyboardButtonSwitchInline", "params": [ { "name": "text", "type": "string" }, { "name": "query", "type": "string" } ], "type": "KeyboardButton" }, { "id": "1218642516", "predicate": "replyInlineMarkup", "params": [ { "name": "rows", "type": "Vector<KeyboardButtonRow>" } ], "type": "ReplyMarkup" }, { "id": "308605382", "predicate": "messages.botCallbackAnswer", "params": [ { "name": "flags", "type": "#" }, { "name": "alert", "type": "flags.1?true" }, { "name": "message", "type": "flags.0?string" } ], "type": "messages.BotCallbackAnswer" }, { "id": "-1500747636", "predicate": "updateBotCallbackQuery", "params": [ { "name": "query_id", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "peer", "type": "Peer" }, { "name": "msg_id", "type": "int" }, { "name": "data", "type": "bytes" } ], "type": "Update" }, { "id": "649453030", "predicate": "messages.messageEditData", "params": [ { "name": "flags", "type": "#" }, { "name": "caption", "type": "flags.0?true" } ], "type": "messages.MessageEditData" }, { "id": "-469536605", "predicate": "updateEditMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" }, { "name": "pts_count", "type": "int" } ], "type": "Update" }, { "id": "-190472735", "predicate": "inputBotInlineMessageMediaGeo", "params": [ { "name": "flags", "type": "#" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "InputBotInlineMessage" }, { "id": "-1431327288", "predicate": "inputBotInlineMessageMediaVenue", "params": [ { "name": "flags", "type": "#" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "InputBotInlineMessage" }, { "id": "766443943", "predicate": "inputBotInlineMessageMediaContact", "params": [ { "name": "flags", "type": "#" }, { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "InputBotInlineMessage" }, { "id": "982505656", "predicate": "botInlineMessageMediaGeo", "params": [ { "name": "flags", "type": "#" }, { "name": "geo", "type": "GeoPoint" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "BotInlineMessage" }, { "id": "1130767150", "predicate": "botInlineMessageMediaVenue", "params": [ { "name": "flags", "type": "#" }, { "name": "geo", "type": "GeoPoint" }, { "name": "title", "type": "string" }, { "name": "address", "type": "string" }, { "name": "provider", "type": "string" }, { "name": "venue_id", "type": "string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "BotInlineMessage" }, { "id": "904770772", "predicate": "botInlineMessageMediaContact", "params": [ { "name": "flags", "type": "#" }, { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "BotInlineMessage" }, { "id": "-1462213465", "predicate": "inputBotInlineResultPhoto", "params": [ { "name": "id", "type": "string" }, { "name": "type", "type": "string" }, { "name": "photo", "type": "InputPhoto" }, { "name": "send_message", "type": "InputBotInlineMessage" } ], "type": "InputBotInlineResult" }, { "id": "-459324", "predicate": "inputBotInlineResultDocument", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "string" }, { "name": "type", "type": "string" }, { "name": "title", "type": "flags.1?string" }, { "name": "description", "type": "flags.2?string" }, { "name": "document", "type": "InputDocument" }, { "name": "send_message", "type": "InputBotInlineMessage" } ], "type": "InputBotInlineResult" }, { "id": "400266251", "predicate": "botInlineMediaResult", "params": [ { "name": "flags", "type": "#" }, { "name": "id", "type": "string" }, { "name": "type", "type": "string" }, { "name": "photo", "type": "flags.0?Photo" }, { "name": "document", "type": "flags.1?Document" }, { "name": "title", "type": "flags.2?string" }, { "name": "description", "type": "flags.3?string" }, { "name": "send_message", "type": "BotInlineMessage" } ], "type": "BotInlineResult" }, { "id": "-1995686519", "predicate": "inputBotInlineMessageID", "params": [ { "name": "dc_id", "type": "int" }, { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputBotInlineMessageID" }, { "id": "750622127", "predicate": "updateInlineBotCallbackQuery", "params": [ { "name": "query_id", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "msg_id", "type": "InputBotInlineMessageID" }, { "name": "data", "type": "bytes" } ], "type": "Update" }, { "id": "1008755359", "predicate": "inlineBotSwitchPM", "params": [ { "name": "text", "type": "string" }, { "name": "start_param", "type": "string" } ], "type": "InlineBotSwitchPM" }, { "id": "863093588", "predicate": "messages.peerDialogs", "params": [ { "name": "dialogs", "type": "Vector<Dialog>" }, { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" }, { "name": "state", "type": "updates.State" } ], "type": "messages.PeerDialogs" }, { "id": "-305282981", "predicate": "topPeer", "params": [ { "name": "peer", "type": "Peer" }, { "name": "rating", "type": "double" } ], "type": "TopPeer" }, { "id": "-1419371685", "predicate": "topPeerCategoryBotsPM", "params": [], "type": "TopPeerCategory" }, { "id": "344356834", "predicate": "topPeerCategoryBotsInline", "params": [], "type": "TopPeerCategory" }, { "id": "104314861", "predicate": "topPeerCategoryCorrespondents", "params": [], "type": "TopPeerCategory" }, { "id": "-1122524854", "predicate": "topPeerCategoryGroups", "params": [], "type": "TopPeerCategory" }, { "id": "371037736", "predicate": "topPeerCategoryChannels", "params": [], "type": "TopPeerCategory" }, { "id": "-75283823", "predicate": "topPeerCategoryPeers", "params": [ { "name": "category", "type": "TopPeerCategory" }, { "name": "count", "type": "int" }, { "name": "peers", "type": "Vector<TopPeer>" } ], "type": "TopPeerCategoryPeers" }, { "id": "-567906571", "predicate": "contacts.topPeersNotModified", "params": [], "type": "contacts.TopPeers" }, { "id": "1891070632", "predicate": "contacts.topPeers", "params": [ { "name": "categories", "type": "Vector<TopPeerCategoryPeers>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.TopPeers" }, { "id": "892193368", "predicate": "messageEntityMentionName", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "user_id", "type": "int" } ], "type": "MessageEntity" }, { "id": "546203849", "predicate": "inputMessageEntityMentionName", "params": [ { "name": "offset", "type": "int" }, { "name": "length", "type": "int" }, { "name": "user_id", "type": "InputUser" } ], "type": "MessageEntity" }, { "id": "975236280", "predicate": "inputMessagesFilterChatPhotos", "params": [], "type": "MessagesFilter" }, { "id": "634833351", "predicate": "updateReadChannelOutbox", "params": [ { "name": "channel_id", "type": "int" }, { "name": "max_id", "type": "int" } ], "type": "Update" }, { "id": "-299124375", "predicate": "updateDraftMessage", "params": [ { "name": "peer", "type": "Peer" }, { "name": "draft", "type": "DraftMessage" } ], "type": "Update" }, { "id": "-1169445179", "predicate": "draftMessageEmpty", "params": [], "type": "DraftMessage" }, { "id": "-40996577", "predicate": "draftMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.1?true" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "message", "type": "string" }, { "name": "entities", "type": "flags.3?Vector<MessageEntity>" }, { "name": "date", "type": "int" } ], "type": "DraftMessage" }, { "id": "-1615153660", "predicate": "messageActionHistoryClear", "params": [], "type": "MessageAction" } ], "methods": [ { "id": "-878758099", "method": "invokeAfterMsg", "params": [ { "name": "msg_id", "type": "long" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1036301552", "method": "invokeAfterMsgs", "params": [ { "name": "msg_ids", "type": "Vector<long>" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1877286395", "method": "auth.checkPhone", "params": [ { "name": "phone_number", "type": "string" } ], "type": "auth.CheckedPhone" }, { "id": "-2035355412", "method": "auth.sendCode", "params": [ { "name": "flags", "type": "#" }, { "name": "allow_flashcall", "type": "flags.0?true" }, { "name": "phone_number", "type": "string" }, { "name": "current_number", "type": "flags.0?Bool" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" } ], "type": "auth.SentCode" }, { "id": "453408308", "method": "auth.signUp", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1126886015", "method": "auth.signIn", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "1461180992", "method": "auth.logOut", "params": [], "type": "Bool" }, { "id": "-1616179942", "method": "auth.resetAuthorizations", "params": [], "type": "Bool" }, { "id": "1998331287", "method": "auth.sendInvites", "params": [ { "name": "phone_numbers", "type": "Vector<string>" }, { "name": "message", "type": "string" } ], "type": "Bool" }, { "id": "-440401971", "method": "auth.exportAuthorization", "params": [ { "name": "dc_id", "type": "int" } ], "type": "auth.ExportedAuthorization" }, { "id": "-470837741", "method": "auth.importAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-841733627", "method": "auth.bindTempAuthKey", "params": [ { "name": "perm_auth_key_id", "type": "long" }, { "name": "nonce", "type": "long" }, { "name": "expires_at", "type": "int" }, { "name": "encrypted_message", "type": "bytes" } ], "type": "Bool" }, { "id": "1669245048", "method": "account.registerDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" } ], "type": "Bool" }, { "id": "1707432768", "method": "account.unregisterDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" } ], "type": "Bool" }, { "id": "-2067899501", "method": "account.updateNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" }, { "name": "settings", "type": "InputPeerNotifySettings" } ], "type": "Bool" }, { "id": "313765169", "method": "account.getNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" } ], "type": "PeerNotifySettings" }, { "id": "-612493497", "method": "account.resetNotifySettings", "params": [], "type": "Bool" }, { "id": "2018596725", "method": "account.updateProfile", "params": [ { "name": "flags", "type": "#" }, { "name": "first_name", "type": "flags.0?string" }, { "name": "last_name", "type": "flags.1?string" }, { "name": "about", "type": "flags.2?string" } ], "type": "User" }, { "id": "1713919532", "method": "account.updateStatus", "params": [ { "name": "offline", "type": "Bool" } ], "type": "Bool" }, { "id": "-1068696894", "method": "account.getWallPapers", "params": [], "type": "Vector<WallPaper>" }, { "id": "-1374118561", "method": "account.reportPeer", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "reason", "type": "ReportReason" } ], "type": "Bool" }, { "id": "227648840", "method": "users.getUsers", "params": [ { "name": "id", "type": "Vector<InputUser>" } ], "type": "Vector<User>" }, { "id": "-902781519", "method": "users.getFullUser", "params": [ { "name": "id", "type": "InputUser" } ], "type": "UserFull" }, { "id": "-995929106", "method": "contacts.getStatuses", "params": [], "type": "Vector<ContactStatus>" }, { "id": "583445000", "method": "contacts.getContacts", "params": [ { "name": "hash", "type": "string" } ], "type": "contacts.Contacts" }, { "id": "-634342611", "method": "contacts.importContacts", "params": [ { "name": "contacts", "type": "Vector<InputContact>" }, { "name": "replace", "type": "Bool" } ], "type": "contacts.ImportedContacts" }, { "id": "-1902823612", "method": "contacts.deleteContact", "params": [ { "name": "id", "type": "InputUser" } ], "type": "contacts.Link" }, { "id": "1504393374", "method": "contacts.deleteContacts", "params": [ { "name": "id", "type": "Vector<InputUser>" } ], "type": "Bool" }, { "id": "858475004", "method": "contacts.block", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-448724803", "method": "contacts.unblock", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-176409329", "method": "contacts.getBlocked", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "contacts.Blocked" }, { "id": "-2065352905", "method": "contacts.exportCard", "params": [], "type": "Vector<int>" }, { "id": "1340184318", "method": "contacts.importCard", "params": [ { "name": "export_card", "type": "Vector<int>" } ], "type": "User" }, { "id": "1109588596", "method": "messages.getMessages", "params": [ { "name": "id", "type": "Vector<int>" } ], "type": "messages.Messages" }, { "id": "1799878989", "method": "messages.getDialogs", "params": [ { "name": "offset_date", "type": "int" }, { "name": "offset_id", "type": "int" }, { "name": "offset_peer", "type": "InputPeer" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-1347868602", "method": "messages.getHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset_id", "type": "int" }, { "name": "offset_date", "type": "int" }, { "name": "add_offset", "type": "int" }, { "name": "limit", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "min_id", "type": "int" } ], "type": "messages.Messages" }, { "id": "-732523960", "method": "messages.search", "params": [ { "name": "flags", "type": "#" }, { "name": "peer", "type": "InputPeer" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "238054714", "method": "messages.readHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" } ], "type": "messages.AffectedMessages" }, { "id": "469850889", "method": "messages.deleteHistory", "params": [ { "name": "flags", "type": "#" }, { "name": "just_clear", "type": "flags.0?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "-1510897371", "method": "messages.deleteMessages", "params": [ { "name": "id", "type": "Vector<int>" } ], "type": "messages.AffectedMessages" }, { "id": "94983360", "method": "messages.receivedMessages", "params": [ { "name": "max_id", "type": "int" } ], "type": "Vector<ReceivedNotifyMessage>" }, { "id": "-1551737264", "method": "messages.setTyping", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Bool" }, { "id": "-91733382", "method": "messages.sendMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.1?true" }, { "name": "silent", "type": "flags.5?true" }, { "name": "background", "type": "flags.6?true" }, { "name": "clear_draft", "type": "flags.7?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" }, { "name": "entities", "type": "flags.3?Vector<MessageEntity>" } ], "type": "Updates" }, { "id": "-923703407", "method": "messages.sendMedia", "params": [ { "name": "flags", "type": "#" }, { "name": "silent", "type": "flags.5?true" }, { "name": "background", "type": "flags.6?true" }, { "name": "clear_draft", "type": "flags.7?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" } ], "type": "Updates" }, { "id": "1888354709", "method": "messages.forwardMessages", "params": [ { "name": "flags", "type": "#" }, { "name": "silent", "type": "flags.5?true" }, { "name": "background", "type": "flags.6?true" }, { "name": "from_peer", "type": "InputPeer" }, { "name": "id", "type": "Vector<int>" }, { "name": "random_id", "type": "Vector<long>" }, { "name": "to_peer", "type": "InputPeer" } ], "type": "Updates" }, { "id": "-820669733", "method": "messages.reportSpam", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "Bool" }, { "id": "-1460572005", "method": "messages.hideReportSpam", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "Bool" }, { "id": "913498268", "method": "messages.getPeerSettings", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "PeerSettings" }, { "id": "1013621127", "method": "messages.getChats", "params": [ { "name": "id", "type": "Vector<int>" } ], "type": "messages.Chats" }, { "id": "998448230", "method": "messages.getFullChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "messages.ChatFull" }, { "id": "-599447467", "method": "messages.editChatTitle", "params": [ { "name": "chat_id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-900957736", "method": "messages.editChatPhoto", "params": [ { "name": "chat_id", "type": "int" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "-106911223", "method": "messages.addChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "fwd_limit", "type": "int" } ], "type": "Updates" }, { "id": "-530505962", "method": "messages.deleteChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" } ], "type": "Updates" }, { "id": "164303470", "method": "messages.createChat", "params": [ { "name": "users", "type": "Vector<InputUser>" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-304838614", "method": "updates.getState", "params": [], "type": "updates.State" }, { "id": "168039573", "method": "updates.getDifference", "params": [ { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "qts", "type": "int" } ], "type": "updates.Difference" }, { "id": "-285902432", "method": "photos.updateProfilePhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "UserProfilePhoto" }, { "id": "-720397176", "method": "photos.uploadProfilePhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "photos.Photo" }, { "id": "-2016444625", "method": "photos.deletePhotos", "params": [ { "name": "id", "type": "Vector<InputPhoto>" } ], "type": "Vector<long>" }, { "id": "-1291540959", "method": "upload.saveFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "-475607115", "method": "upload.getFile", "params": [ { "name": "location", "type": "InputFileLocation" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "upload.File" }, { "id": "-990308245", "method": "help.getConfig", "params": [], "type": "Config" }, { "id": "531836966", "method": "help.getNearestDc", "params": [], "type": "NearestDc" }, { "id": "-1372724842", "method": "help.getAppUpdate", "params": [], "type": "help.AppUpdate" }, { "id": "1862465352", "method": "help.saveAppLog", "params": [ { "name": "events", "type": "Vector<InputAppEvent>" } ], "type": "Bool" }, { "id": "1295590211", "method": "help.getInviteText", "params": [], "type": "help.InviteText" }, { "id": "-1848823128", "method": "photos.getUserPhotos", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "long" }, { "name": "limit", "type": "int" } ], "type": "photos.Photos" }, { "id": "865483769", "method": "messages.forwardMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Updates" }, { "id": "-1082919718", "method": "messages.sendBroadcast", "params": [ { "name": "contacts", "type": "Vector<InputUser>" }, { "name": "random_id", "type": "Vector<long>" }, { "name": "message", "type": "string" }, { "name": "media", "type": "InputMedia" } ], "type": "Updates" }, { "id": "651135312", "method": "messages.getDhConfig", "params": [ { "name": "version", "type": "int" }, { "name": "random_length", "type": "int" } ], "type": "messages.DhConfig" }, { "id": "-162681021", "method": "messages.requestEncryption", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "random_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "1035731989", "method": "messages.acceptEncryption", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "g_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "-304536635", "method": "messages.discardEncryption", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Bool" }, { "id": "2031374829", "method": "messages.setEncryptedTyping", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "2135648522", "method": "messages.readEncryptedHistory", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "max_date", "type": "int" } ], "type": "Bool" }, { "id": "-1451792525", "method": "messages.sendEncrypted", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1701831834", "method": "messages.sendEncryptedFile", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" }, { "name": "file", "type": "InputEncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "852769188", "method": "messages.sendEncryptedService", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "1436924774", "method": "messages.receivedQueue", "params": [ { "name": "max_qts", "type": "int" } ], "type": "Vector<long>" }, { "id": "-562337987", "method": "upload.saveBigFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "file_total_parts", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "1769565673", "method": "initConnection", "params": [ { "name": "api_id", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-1663104819", "method": "help.getSupport", "params": [], "type": "help.Support" }, { "id": "916930423", "method": "messages.readMessageContents", "params": [ { "name": "id", "type": "Vector<int>" } ], "type": "messages.AffectedMessages" }, { "id": "655677548", "method": "account.checkUsername", "params": [ { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "1040964988", "method": "account.updateUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "301470424", "method": "contacts.search", "params": [ { "name": "q", "type": "string" }, { "name": "limit", "type": "int" } ], "type": "contacts.Found" }, { "id": "-623130288", "method": "account.getPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" } ], "type": "account.PrivacyRules" }, { "id": "-906486552", "method": "account.setPrivacy", "params": [ { "name": "key", "type": "InputPrivacyKey" }, { "name": "rules", "type": "Vector<InputPrivacyRule>" } ], "type": "account.PrivacyRules" }, { "id": "1099779595", "method": "account.deleteAccount", "params": [ { "name": "reason", "type": "string" } ], "type": "Bool" }, { "id": "150761757", "method": "account.getAccountTTL", "params": [], "type": "AccountDaysTTL" }, { "id": "608323678", "method": "account.setAccountTTL", "params": [ { "name": "ttl", "type": "AccountDaysTTL" } ], "type": "Bool" }, { "id": "-627372787", "method": "invokeWithLayer", "params": [ { "name": "layer", "type": "int" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-113456221", "method": "contacts.resolveUsername", "params": [ { "name": "username", "type": "string" } ], "type": "contacts.ResolvedPeer" }, { "id": "149257707", "method": "account.sendChangePhoneCode", "params": [ { "name": "flags", "type": "#" }, { "name": "allow_flashcall", "type": "flags.0?true" }, { "name": "phone_number", "type": "string" }, { "name": "current_number", "type": "flags.0?Bool" } ], "type": "auth.SentCode" }, { "id": "1891839707", "method": "account.changePhone", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "User" }, { "id": "-1373446075", "method": "messages.getStickers", "params": [ { "name": "emoticon", "type": "string" }, { "name": "hash", "type": "string" } ], "type": "messages.Stickers" }, { "id": "479598769", "method": "messages.getAllStickers", "params": [ { "name": "hash", "type": "int" } ], "type": "messages.AllStickers" }, { "id": "954152242", "method": "account.updateDeviceLocked", "params": [ { "name": "period", "type": "int" } ], "type": "Bool" }, { "id": "1738800940", "method": "auth.importBotAuthorization", "params": [ { "name": "flags", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "bot_auth_token", "type": "string" } ], "type": "auth.Authorization" }, { "id": "623001124", "method": "messages.getWebPagePreview", "params": [ { "name": "message", "type": "string" } ], "type": "MessageMedia" }, { "id": "-484392616", "method": "account.getAuthorizations", "params": [], "type": "account.Authorizations" }, { "id": "-545786948", "method": "account.resetAuthorization", "params": [ { "name": "hash", "type": "long" } ], "type": "Bool" }, { "id": "1418342645", "method": "account.getPassword", "params": [], "type": "account.Password" }, { "id": "-1131605573", "method": "account.getPasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" } ], "type": "account.PasswordSettings" }, { "id": "-92517498", "method": "account.updatePasswordSettings", "params": [ { "name": "current_password_hash", "type": "bytes" }, { "name": "new_settings", "type": "account.PasswordInputSettings" } ], "type": "Bool" }, { "id": "174260510", "method": "auth.checkPassword", "params": [ { "name": "password_hash", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-661144474", "method": "auth.requestPasswordRecovery", "params": [], "type": "auth.PasswordRecovery" }, { "id": "1319464594", "method": "auth.recoverPassword", "params": [ { "name": "code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1080796745", "method": "invokeWithoutUpdates", "params": [ { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "2106086025", "method": "messages.exportChatInvite", "params": [ { "name": "chat_id", "type": "int" } ], "type": "ExportedChatInvite" }, { "id": "1051570619", "method": "messages.checkChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "ChatInvite" }, { "id": "1817183516", "method": "messages.importChatInvite", "params": [ { "name": "hash", "type": "string" } ], "type": "Updates" }, { "id": "639215886", "method": "messages.getStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "messages.StickerSet" }, { "id": "2066793382", "method": "messages.installStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" }, { "name": "disabled", "type": "Bool" } ], "type": "Bool" }, { "id": "-110209570", "method": "messages.uninstallStickerSet", "params": [ { "name": "stickerset", "type": "InputStickerSet" } ], "type": "Bool" }, { "id": "-421563528", "method": "messages.startBot", "params": [ { "name": "bot", "type": "InputUser" }, { "name": "peer", "type": "InputPeer" }, { "name": "random_id", "type": "long" }, { "name": "start_param", "type": "string" } ], "type": "Updates" }, { "id": "-1189013126", "method": "help.getAppChangelog", "params": [], "type": "help.AppChangelog" }, { "id": "-993483427", "method": "messages.getMessagesViews", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "Vector<int>" }, { "name": "increment", "type": "Bool" } ], "type": "Vector<int>" }, { "id": "-871347913", "method": "channels.readHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "max_id", "type": "int" } ], "type": "Bool" }, { "id": "-2067661490", "method": "channels.deleteMessages", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "Vector<int>" } ], "type": "messages.AffectedMessages" }, { "id": "-787622117", "method": "channels.deleteUserHistory", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" } ], "type": "messages.AffectedHistory" }, { "id": "-32999408", "method": "channels.reportSpam", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "id", "type": "Vector<int>" } ], "type": "Bool" }, { "id": "-1814580409", "method": "channels.getMessages", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "Vector<int>" } ], "type": "messages.Messages" }, { "id": "618237842", "method": "channels.getParticipants", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "filter", "type": "ChannelParticipantsFilter" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "channels.ChannelParticipants" }, { "id": "1416484774", "method": "channels.getParticipant", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" } ], "type": "channels.ChannelParticipant" }, { "id": "176122811", "method": "channels.getChannels", "params": [ { "name": "id", "type": "Vector<InputChannel>" } ], "type": "messages.Chats" }, { "id": "141781513", "method": "channels.getFullChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "messages.ChatFull" }, { "id": "-192332417", "method": "channels.createChannel", "params": [ { "name": "flags", "type": "#" }, { "name": "broadcast", "type": "flags.0?true" }, { "name": "megagroup", "type": "flags.1?true" }, { "name": "title", "type": "string" }, { "name": "about", "type": "string" } ], "type": "Updates" }, { "id": "333610782", "method": "channels.editAbout", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "about", "type": "string" } ], "type": "Bool" }, { "id": "-344583728", "method": "channels.editAdmin", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "role", "type": "ChannelParticipantRole" } ], "type": "Updates" }, { "id": "1450044624", "method": "channels.editTitle", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "title", "type": "string" } ], "type": "Updates" }, { "id": "-248621111", "method": "channels.editPhoto", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "Updates" }, { "id": "283557164", "method": "channels.checkUsername", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "890549214", "method": "channels.updateUsername", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "615851205", "method": "channels.joinChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "-130635115", "method": "channels.leaveChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "429865580", "method": "channels.inviteToChannel", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "users", "type": "Vector<InputUser>" } ], "type": "Updates" }, { "id": "-1502421484", "method": "channels.kickFromChannel", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "user_id", "type": "InputUser" }, { "name": "kicked", "type": "Bool" } ], "type": "Updates" }, { "id": "-950663035", "method": "channels.exportInvite", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "ExportedChatInvite" }, { "id": "-1072619549", "method": "channels.deleteChannel", "params": [ { "name": "channel", "type": "InputChannel" } ], "type": "Updates" }, { "id": "-1154295872", "method": "updates.getChannelDifference", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "filter", "type": "ChannelMessagesFilter" }, { "name": "pts", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "updates.ChannelDifference" }, { "id": "-326379039", "method": "messages.toggleChatAdmins", "params": [ { "name": "chat_id", "type": "int" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "-1444503762", "method": "messages.editChatAdmin", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "is_admin", "type": "Bool" } ], "type": "Bool" }, { "id": "363051235", "method": "messages.migrateChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Updates" }, { "id": "-1640190800", "method": "messages.searchGlobal", "params": [ { "name": "q", "type": "string" }, { "name": "offset_date", "type": "int" }, { "name": "offset_peer", "type": "InputPeer" }, { "name": "offset_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "889286899", "method": "help.getTermsOfService", "params": [], "type": "help.TermsOfService" }, { "id": "-1613775824", "method": "messages.reorderStickerSets", "params": [ { "name": "order", "type": "Vector<long>" } ], "type": "Bool" }, { "id": "864953444", "method": "messages.getDocumentByHash", "params": [ { "name": "sha256", "type": "bytes" }, { "name": "size", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "Document" }, { "id": "-1080395925", "method": "messages.searchGifs", "params": [ { "name": "q", "type": "string" }, { "name": "offset", "type": "int" } ], "type": "messages.FoundGifs" }, { "id": "-2084618926", "method": "messages.getSavedGifs", "params": [ { "name": "hash", "type": "int" } ], "type": "messages.SavedGifs" }, { "id": "846868683", "method": "messages.saveGif", "params": [ { "name": "id", "type": "InputDocument" }, { "name": "unsave", "type": "Bool" } ], "type": "Bool" }, { "id": "1364105629", "method": "messages.getInlineBotResults", "params": [ { "name": "flags", "type": "#" }, { "name": "bot", "type": "InputUser" }, { "name": "peer", "type": "InputPeer" }, { "name": "geo_point", "type": "flags.0?InputGeoPoint" }, { "name": "query", "type": "string" }, { "name": "offset", "type": "string" } ], "type": "messages.BotResults" }, { "id": "-346119674", "method": "messages.setInlineBotResults", "params": [ { "name": "flags", "type": "#" }, { "name": "gallery", "type": "flags.0?true" }, { "name": "private", "type": "flags.1?true" }, { "name": "query_id", "type": "long" }, { "name": "results", "type": "Vector<InputBotInlineResult>" }, { "name": "cache_time", "type": "int" }, { "name": "next_offset", "type": "flags.2?string" }, { "name": "switch_pm", "type": "flags.3?InlineBotSwitchPM" } ], "type": "Bool" }, { "id": "-1318189314", "method": "messages.sendInlineBotResult", "params": [ { "name": "flags", "type": "#" }, { "name": "silent", "type": "flags.5?true" }, { "name": "background", "type": "flags.6?true" }, { "name": "clear_draft", "type": "flags.7?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "random_id", "type": "long" }, { "name": "query_id", "type": "long" }, { "name": "id", "type": "string" } ], "type": "Updates" }, { "id": "1231065863", "method": "channels.toggleInvites", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "-934882771", "method": "channels.exportMessageLink", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "int" } ], "type": "ExportedMessageLink" }, { "id": "527021574", "method": "channels.toggleSignatures", "params": [ { "name": "channel", "type": "InputChannel" }, { "name": "enabled", "type": "Bool" } ], "type": "Updates" }, { "id": "-1490162350", "method": "channels.updatePinnedMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "silent", "type": "flags.0?true" }, { "name": "channel", "type": "InputChannel" }, { "name": "id", "type": "int" } ], "type": "Updates" }, { "id": "1056025023", "method": "auth.resendCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "auth.SentCode" }, { "id": "520357240", "method": "auth.cancelCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "-39416522", "method": "messages.getMessageEditData", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" } ], "type": "messages.MessageEditData" }, { "id": "-829299510", "method": "messages.editMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.1?true" }, { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "message", "type": "flags.11?string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" }, { "name": "entities", "type": "flags.3?Vector<MessageEntity>" } ], "type": "Updates" }, { "id": "319564933", "method": "messages.editInlineBotMessage", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.1?true" }, { "name": "id", "type": "InputBotInlineMessageID" }, { "name": "message", "type": "flags.11?string" }, { "name": "reply_markup", "type": "flags.2?ReplyMarkup" }, { "name": "entities", "type": "flags.3?Vector<MessageEntity>" } ], "type": "Bool" }, { "id": "-1494659324", "method": "messages.getBotCallbackAnswer", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "msg_id", "type": "int" }, { "name": "data", "type": "bytes" } ], "type": "messages.BotCallbackAnswer" }, { "id": "1209817370", "method": "messages.setBotCallbackAnswer", "params": [ { "name": "flags", "type": "#" }, { "name": "alert", "type": "flags.1?true" }, { "name": "query_id", "type": "long" }, { "name": "message", "type": "flags.0?string" } ], "type": "Bool" }, { "id": "-728224331", "method": "contacts.getTopPeers", "params": [ { "name": "flags", "type": "#" }, { "name": "correspondents", "type": "flags.0?true" }, { "name": "bots_pm", "type": "flags.1?true" }, { "name": "bots_inline", "type": "flags.2?true" }, { "name": "groups", "type": "flags.10?true" }, { "name": "channels", "type": "flags.15?true" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" }, { "name": "hash", "type": "int" } ], "type": "contacts.TopPeers" }, { "id": "451113900", "method": "contacts.resetTopPeerRating", "params": [ { "name": "category", "type": "TopPeerCategory" }, { "name": "peer", "type": "InputPeer" } ], "type": "Bool" }, { "id": "764901049", "method": "messages.getPeerDialogs", "params": [ { "name": "peers", "type": "Vector<InputPeer>" } ], "type": "messages.PeerDialogs" }, { "id": "-1137057461", "method": "messages.saveDraft", "params": [ { "name": "flags", "type": "#" }, { "name": "no_webpage", "type": "flags.1?true" }, { "name": "reply_to_msg_id", "type": "flags.0?int" }, { "name": "peer", "type": "InputPeer" }, { "name": "message", "type": "string" }, { "name": "entities", "type": "flags.3?Vector<MessageEntity>" } ], "type": "Bool" }, { "id": "1782549861", "method": "messages.getAllDrafts", "params": [], "type": "Updates" } ] }{ "constructors": [ { "id": "-1132882121", "predicate": "boolFalse", "params": [], "type": "Bool" }, { "id": "-1720552011", "predicate": "boolTrue", "params": [], "type": "Bool" }, { "id": "1072550713", "predicate": "true", "params": [], "type": "True" }, { "id": "481674261", "predicate": "vector", "params": [], "type": "Vector t" }, { "id": "-994444869", "predicate": "error", "params": [ { "name": "code", "type": "int" }, { "name": "text", "type": "string" } ], "type": "Error" }, { "id": "1450380236", "predicate": "null", "params": [], "type": "Null" }, { "id": "2134579434", "predicate": "inputPeerEmpty", "params": [], "type": "InputPeer" }, { "id": "2107670217", "predicate": "inputPeerSelf", "params": [], "type": "InputPeer" }, { "id": "270785512", "predicate": "inputPeerContact", "params": [ { "name": "user_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1690012891", "predicate": "inputPeerForeign", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputPeer" }, { "id": "396093539", "predicate": "inputPeerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "InputPeer" }, { "id": "-1182234929", "predicate": "inputUserEmpty", "params": [], "type": "InputUser" }, { "id": "-138301121", "predicate": "inputUserSelf", "params": [], "type": "InputUser" }, { "id": "-2031530139", "predicate": "inputUserContact", "params": [ { "name": "user_id", "type": "int" } ], "type": "InputUser" }, { "id": "1700689151", "predicate": "inputUserForeign", "params": [ { "name": "user_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputUser" }, { "id": "-208488460", "predicate": "inputPhoneContact", "params": [ { "name": "client_id", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputContact" }, { "id": "-181407105", "predicate": "inputFile", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" }, { "name": "md5_checksum", "type": "string" } ], "type": "InputFile" }, { "id": "-1771768449", "predicate": "inputMediaEmpty", "params": [], "type": "InputMedia" }, { "id": "767900285", "predicate": "inputMediaUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" } ], "type": "InputMedia" }, { "id": "-1893027092", "predicate": "inputMediaPhoto", "params": [ { "name": "id", "type": "InputPhoto" } ], "type": "InputMedia" }, { "id": "-104578748", "predicate": "inputMediaGeoPoint", "params": [ { "name": "geo_point", "type": "InputGeoPoint" } ], "type": "InputMedia" }, { "id": "-1494984313", "predicate": "inputMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "InputMedia" }, { "id": "322623222", "predicate": "inputMediaUploadedVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1726817601", "predicate": "inputMediaUploadedThumbVideo", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "2130852582", "predicate": "inputMediaVideo", "params": [ { "name": "id", "type": "InputVideo" } ], "type": "InputMedia" }, { "id": "480546647", "predicate": "inputChatPhotoEmpty", "params": [], "type": "InputChatPhoto" }, { "id": "-1809496270", "predicate": "inputChatUploadedPhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-1293828344", "predicate": "inputChatPhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "InputChatPhoto" }, { "id": "-457104426", "predicate": "inputGeoPointEmpty", "params": [], "type": "InputGeoPoint" }, { "id": "-206066487", "predicate": "inputGeoPoint", "params": [ { "name": "lat", "type": "double" }, { "name": "long", "type": "double" } ], "type": "InputGeoPoint" }, { "id": "483901197", "predicate": "inputPhotoEmpty", "params": [], "type": "InputPhoto" }, { "id": "-74070332", "predicate": "inputPhoto", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputPhoto" }, { "id": "1426648181", "predicate": "inputVideoEmpty", "params": [], "type": "InputVideo" }, { "id": "-296249774", "predicate": "inputVideo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputVideo" }, { "id": "342061462", "predicate": "inputFileLocation", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1023632620", "predicate": "inputVideoFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-1377390588", "predicate": "inputPhotoCropAuto", "params": [], "type": "InputPhotoCrop" }, { "id": "-644787419", "predicate": "inputPhotoCrop", "params": [ { "name": "crop_left", "type": "double" }, { "name": "crop_top", "type": "double" }, { "name": "crop_width", "type": "double" } ], "type": "InputPhotoCrop" }, { "id": "1996904104", "predicate": "inputAppEvent", "params": [ { "name": "time", "type": "double" }, { "name": "type", "type": "string" }, { "name": "peer", "type": "long" }, { "name": "data", "type": "string" } ], "type": "InputAppEvent" }, { "id": "-1649296275", "predicate": "peerUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "Peer" }, { "id": "-1160714821", "predicate": "peerChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Peer" }, { "id": "-1432995067", "predicate": "storage.fileUnknown", "params": [], "type": "storage.FileType" }, { "id": "8322574", "predicate": "storage.fileJpeg", "params": [], "type": "storage.FileType" }, { "id": "-891180321", "predicate": "storage.fileGif", "params": [], "type": "storage.FileType" }, { "id": "172975040", "predicate": "storage.filePng", "params": [], "type": "storage.FileType" }, { "id": "-1373745011", "predicate": "storage.filePdf", "params": [], "type": "storage.FileType" }, { "id": "1384777335", "predicate": "storage.fileMp3", "params": [], "type": "storage.FileType" }, { "id": "1258941372", "predicate": "storage.fileMov", "params": [], "type": "storage.FileType" }, { "id": "1086091090", "predicate": "storage.filePartial", "params": [], "type": "storage.FileType" }, { "id": "-1278304028", "predicate": "storage.fileMp4", "params": [], "type": "storage.FileType" }, { "id": "276907596", "predicate": "storage.fileWebp", "params": [], "type": "storage.FileType" }, { "id": "2086234950", "predicate": "fileLocationUnavailable", "params": [ { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "1406570614", "predicate": "fileLocation", "params": [ { "name": "dc_id", "type": "int" }, { "name": "volume_id", "type": "long" }, { "name": "local_id", "type": "int" }, { "name": "secret", "type": "long" } ], "type": "FileLocation" }, { "id": "537022650", "predicate": "userEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "User" }, { "id": "1879553105", "predicate": "userSelf", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "phone", "type": "string" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" }, { "name": "inactive", "type": "Bool" } ], "type": "User" }, { "id": "-894214632", "predicate": "userContact", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "access_hash", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" } ], "type": "User" }, { "id": "-640891665", "predicate": "userRequest", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "access_hash", "type": "long" }, { "name": "phone", "type": "string" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" } ], "type": "User" }, { "id": "123533224", "predicate": "userForeign", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" }, { "name": "access_hash", "type": "long" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "status", "type": "UserStatus" } ], "type": "User" }, { "id": "-704549510", "predicate": "userDeleted", "params": [ { "name": "id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "User" }, { "id": "1326562017", "predicate": "userProfilePhotoEmpty", "params": [], "type": "UserProfilePhoto" }, { "id": "-715532088", "predicate": "userProfilePhoto", "params": [ { "name": "photo_id", "type": "long" }, { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "UserProfilePhoto" }, { "id": "164646985", "predicate": "userStatusEmpty", "params": [], "type": "UserStatus" }, { "id": "-306628279", "predicate": "userStatusOnline", "params": [ { "name": "expires", "type": "int" } ], "type": "UserStatus" }, { "id": "9203775", "predicate": "userStatusOffline", "params": [ { "name": "was_online", "type": "int" } ], "type": "UserStatus" }, { "id": "-1683826688", "predicate": "chatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Chat" }, { "id": "1855757255", "predicate": "chat", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "photo", "type": "ChatPhoto" }, { "name": "participants_count", "type": "int" }, { "name": "date", "type": "int" }, { "name": "left", "type": "Bool" }, { "name": "version", "type": "int" } ], "type": "Chat" }, { "id": "-83047359", "predicate": "chatForbidden", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "date", "type": "int" } ], "type": "Chat" }, { "id": "1661886910", "predicate": "chatFull", "params": [ { "name": "id", "type": "int" }, { "name": "participants", "type": "ChatParticipants" }, { "name": "chat_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "ChatFull" }, { "id": "-925415106", "predicate": "chatParticipant", "params": [ { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ChatParticipant" }, { "id": "265468810", "predicate": "chatParticipantsForbidden", "params": [ { "name": "chat_id", "type": "int" } ], "type": "ChatParticipants" }, { "id": "2017571861", "predicate": "chatParticipants", "params": [ { "name": "chat_id", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participants", "type": "Vector<ChatParticipant>" }, { "name": "version", "type": "int" } ], "type": "ChatParticipants" }, { "id": "935395612", "predicate": "chatPhotoEmpty", "params": [], "type": "ChatPhoto" }, { "id": "1632839530", "predicate": "chatPhoto", "params": [ { "name": "photo_small", "type": "FileLocation" }, { "name": "photo_big", "type": "FileLocation" } ], "type": "ChatPhoto" }, { "id": "-2082087340", "predicate": "messageEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "Message" }, { "id": "1450613171", "predicate": "message", "params": [ { "name": "flags", "type": "int" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" } ], "type": "Message" }, { "id": "-1553471722", "predicate": "messageForwarded", "params": [ { "name": "flags", "type": "int" }, { "name": "id", "type": "int" }, { "name": "fwd_from_id", "type": "int" }, { "name": "fwd_date", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" } ], "type": "Message" }, { "id": "495384334", "predicate": "messageService", "params": [ { "name": "flags", "type": "int" }, { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "to_id", "type": "Peer" }, { "name": "date", "type": "int" }, { "name": "action", "type": "MessageAction" } ], "type": "Message" }, { "id": "1038967584", "predicate": "messageMediaEmpty", "params": [], "type": "MessageMedia" }, { "id": "-926655958", "predicate": "messageMediaPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageMedia" }, { "id": "-1563278704", "predicate": "messageMediaVideo", "params": [ { "name": "video", "type": "Video" } ], "type": "MessageMedia" }, { "id": "1457575028", "predicate": "messageMediaGeo", "params": [ { "name": "geo", "type": "GeoPoint" } ], "type": "MessageMedia" }, { "id": "1585262393", "predicate": "messageMediaContact", "params": [ { "name": "phone_number", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "user_id", "type": "int" } ], "type": "MessageMedia" }, { "id": "694364726", "predicate": "messageMediaUnsupported", "params": [ { "name": "bytes", "type": "bytes" } ], "type": "MessageMedia" }, { "id": "-1230047312", "predicate": "messageActionEmpty", "params": [], "type": "MessageAction" }, { "id": "-1503425638", "predicate": "messageActionChatCreate", "params": [ { "name": "title", "type": "string" }, { "name": "users", "type": "Vector<int>" } ], "type": "MessageAction" }, { "id": "-1247687078", "predicate": "messageActionChatEditTitle", "params": [ { "name": "title", "type": "string" } ], "type": "MessageAction" }, { "id": "2144015272", "predicate": "messageActionChatEditPhoto", "params": [ { "name": "photo", "type": "Photo" } ], "type": "MessageAction" }, { "id": "-1780220945", "predicate": "messageActionChatDeletePhoto", "params": [], "type": "MessageAction" }, { "id": "1581055051", "predicate": "messageActionChatAddUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1297179892", "predicate": "messageActionChatDeleteUser", "params": [ { "name": "user_id", "type": "int" } ], "type": "MessageAction" }, { "id": "-1422222932", "predicate": "dialog", "params": [ { "name": "peer", "type": "Peer" }, { "name": "top_message", "type": "int" }, { "name": "unread_count", "type": "int" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Dialog" }, { "id": "590459437", "predicate": "photoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Photo" }, { "id": "582313809", "predicate": "photo", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "caption", "type": "string" }, { "name": "geo", "type": "GeoPoint" }, { "name": "sizes", "type": "Vector<PhotoSize>" } ], "type": "Photo" }, { "id": "236446268", "predicate": "photoSizeEmpty", "params": [ { "name": "type", "type": "string" } ], "type": "PhotoSize" }, { "id": "2009052699", "predicate": "photoSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "size", "type": "int" } ], "type": "PhotoSize" }, { "id": "-374917894", "predicate": "photoCachedSize", "params": [ { "name": "type", "type": "string" }, { "name": "location", "type": "FileLocation" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "PhotoSize" }, { "id": "-1056548696", "predicate": "videoEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Video" }, { "id": "948937617", "predicate": "video", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "caption", "type": "string" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" }, { "name": "w", "type": "int" }, { "name": "h", "type": "int" } ], "type": "Video" }, { "id": "286776671", "predicate": "geoPointEmpty", "params": [], "type": "GeoPoint" }, { "id": "541710092", "predicate": "geoPoint", "params": [ { "name": "long", "type": "double" }, { "name": "lat", "type": "double" } ], "type": "GeoPoint" }, { "id": "-486486981", "predicate": "auth.checkedPhone", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_invited", "type": "Bool" } ], "type": "auth.CheckedPhone" }, { "id": "-269659687", "predicate": "auth.sentCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "-155815004", "predicate": "auth.authorization", "params": [ { "name": "expires", "type": "int" }, { "name": "user", "type": "User" } ], "type": "auth.Authorization" }, { "id": "-543777747", "predicate": "auth.exportedAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.ExportedAuthorization" }, { "id": "-1195615476", "predicate": "inputNotifyPeer", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "InputNotifyPeer" }, { "id": "423314455", "predicate": "inputNotifyUsers", "params": [], "type": "InputNotifyPeer" }, { "id": "1251338318", "predicate": "inputNotifyChats", "params": [], "type": "InputNotifyPeer" }, { "id": "-1540769658", "predicate": "inputNotifyAll", "params": [], "type": "InputNotifyPeer" }, { "id": "-265263912", "predicate": "inputPeerNotifyEventsEmpty", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "-395694988", "predicate": "inputPeerNotifyEventsAll", "params": [], "type": "InputPeerNotifyEvents" }, { "id": "1185074840", "predicate": "inputPeerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "InputPeerNotifySettings" }, { "id": "-1378534221", "predicate": "peerNotifyEventsEmpty", "params": [], "type": "PeerNotifyEvents" }, { "id": "1830677896", "predicate": "peerNotifyEventsAll", "params": [], "type": "PeerNotifyEvents" }, { "id": "1889961234", "predicate": "peerNotifySettingsEmpty", "params": [], "type": "PeerNotifySettings" }, { "id": "-1923214866", "predicate": "peerNotifySettings", "params": [ { "name": "mute_until", "type": "int" }, { "name": "sound", "type": "string" }, { "name": "show_previews", "type": "Bool" }, { "name": "events_mask", "type": "int" } ], "type": "PeerNotifySettings" }, { "id": "-860866985", "predicate": "wallPaper", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "sizes", "type": "Vector<PhotoSize>" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "1997575642", "predicate": "userFull", "params": [ { "name": "user", "type": "User" }, { "name": "link", "type": "contacts.Link" }, { "name": "profile_photo", "type": "Photo" }, { "name": "notify_settings", "type": "PeerNotifySettings" }, { "name": "blocked", "type": "Bool" }, { "name": "real_first_name", "type": "string" }, { "name": "real_last_name", "type": "string" } ], "type": "UserFull" }, { "id": "-116274796", "predicate": "contact", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual", "type": "Bool" } ], "type": "Contact" }, { "id": "-805141448", "predicate": "importedContact", "params": [ { "name": "user_id", "type": "int" }, { "name": "client_id", "type": "long" } ], "type": "ImportedContact" }, { "id": "1444661369", "predicate": "contactBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "ContactBlocked" }, { "id": "1038193057", "predicate": "contactSuggested", "params": [ { "name": "user_id", "type": "int" }, { "name": "mutual_contacts", "type": "int" } ], "type": "ContactSuggested" }, { "id": "-1434994573", "predicate": "contactStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "expires", "type": "int" } ], "type": "ContactStatus" }, { "id": "322183672", "predicate": "contacts.foreignLinkUnknown", "params": [], "type": "contacts.ForeignLink" }, { "id": "-1484775609", "predicate": "contacts.foreignLinkRequested", "params": [ { "name": "has_phone", "type": "Bool" } ], "type": "contacts.ForeignLink" }, { "id": "468356321", "predicate": "contacts.foreignLinkMutual", "params": [], "type": "contacts.ForeignLink" }, { "id": "-768992160", "predicate": "contacts.myLinkEmpty", "params": [], "type": "contacts.MyLink" }, { "id": "1818882030", "predicate": "contacts.myLinkRequested", "params": [ { "name": "contact", "type": "Bool" } ], "type": "contacts.MyLink" }, { "id": "-1035932711", "predicate": "contacts.myLinkContact", "params": [], "type": "contacts.MyLink" }, { "id": "-322001931", "predicate": "contacts.link", "params": [ { "name": "my_link", "type": "contacts.MyLink" }, { "name": "foreign_link", "type": "contacts.ForeignLink" }, { "name": "user", "type": "User" } ], "type": "contacts.Link" }, { "id": "-1219778094", "predicate": "contacts.contactsNotModified", "params": [], "type": "contacts.Contacts" }, { "id": "1871416498", "predicate": "contacts.contacts", "params": [ { "name": "contacts", "type": "Vector<Contact>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.Contacts" }, { "id": "-1387117803", "predicate": "contacts.importedContacts", "params": [ { "name": "imported", "type": "Vector<ImportedContact>" }, { "name": "retry_contacts", "type": "Vector<long>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.ImportedContacts" }, { "id": "471043349", "predicate": "contacts.blocked", "params": [ { "name": "blocked", "type": "Vector<ContactBlocked>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.Blocked" }, { "id": "-1878523231", "predicate": "contacts.blockedSlice", "params": [ { "name": "count", "type": "int" }, { "name": "blocked", "type": "Vector<ContactBlocked>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.Blocked" }, { "id": "1447681221", "predicate": "contacts.suggested", "params": [ { "name": "results", "type": "Vector<ContactSuggested>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.Suggested" }, { "id": "364538944", "predicate": "messages.dialogs", "params": [ { "name": "dialogs", "type": "Vector<Dialog>" }, { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.Dialogs" }, { "id": "1910543603", "predicate": "messages.dialogsSlice", "params": [ { "name": "count", "type": "int" }, { "name": "dialogs", "type": "Vector<Dialog>" }, { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.Dialogs" }, { "id": "-1938715001", "predicate": "messages.messages", "params": [ { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.Messages" }, { "id": "189033187", "predicate": "messages.messagesSlice", "params": [ { "name": "count", "type": "int" }, { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.Messages" }, { "id": "-1768654661", "predicate": "messages.statedMessages", "params": [ { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" }, { "name": "pts", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "messages.StatedMessages" }, { "id": "-797251802", "predicate": "messages.statedMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" }, { "name": "pts", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "messages.StatedMessage" }, { "id": "-772484260", "predicate": "messages.sentMessage", "params": [ { "name": "id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "messages.SentMessage" }, { "id": "-2125411368", "predicate": "messages.chats", "params": [ { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.Chats" }, { "id": "-438840932", "predicate": "messages.chatFull", "params": [ { "name": "full_chat", "type": "ChatFull" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" } ], "type": "messages.ChatFull" }, { "id": "-1210173710", "predicate": "messages.affectedHistory", "params": [ { "name": "pts", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "1474492012", "predicate": "inputMessagesFilterEmpty", "params": [], "type": "MessagesFilter" }, { "id": "-1777752804", "predicate": "inputMessagesFilterPhotos", "params": [], "type": "MessagesFilter" }, { "id": "-1614803355", "predicate": "inputMessagesFilterVideo", "params": [], "type": "MessagesFilter" }, { "id": "1458172132", "predicate": "inputMessagesFilterPhotoVideo", "params": [], "type": "MessagesFilter" }, { "id": "-648121413", "predicate": "inputMessagesFilterPhotoVideoDocuments", "params": [], "type": "MessagesFilter" }, { "id": "-1629621880", "predicate": "inputMessagesFilterDocument", "params": [], "type": "MessagesFilter" }, { "id": "-808946398", "predicate": "inputMessagesFilterAudio", "params": [], "type": "MessagesFilter" }, { "id": "1526462308", "predicate": "inputMessagesFilterAudioDocuments", "params": [], "type": "MessagesFilter" }, { "id": "2129714567", "predicate": "inputMessagesFilterUrl", "params": [], "type": "MessagesFilter" }, { "id": "20626867", "predicate": "updateNewMessage", "params": [ { "name": "message", "type": "Message" }, { "name": "pts", "type": "int" } ], "type": "Update" }, { "id": "1318109142", "predicate": "updateMessageID", "params": [ { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "Update" }, { "id": "-966484431", "predicate": "updateReadMessages", "params": [ { "name": "messages", "type": "Vector<int>" }, { "name": "pts", "type": "int" } ], "type": "Update" }, { "id": "-1456734682", "predicate": "updateDeleteMessages", "params": [ { "name": "messages", "type": "Vector<int>" }, { "name": "pts", "type": "int" } ], "type": "Update" }, { "id": "1548249383", "predicate": "updateUserTyping", "params": [ { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "-1704596961", "predicate": "updateChatUserTyping", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Update" }, { "id": "125178264", "predicate": "updateChatParticipants", "params": [ { "name": "participants", "type": "ChatParticipants" } ], "type": "Update" }, { "id": "469489699", "predicate": "updateUserStatus", "params": [ { "name": "user_id", "type": "int" }, { "name": "status", "type": "UserStatus" } ], "type": "Update" }, { "id": "-1489818765", "predicate": "updateUserName", "params": [ { "name": "user_id", "type": "int" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" }, { "name": "username", "type": "string" } ], "type": "Update" }, { "id": "-1791935732", "predicate": "updateUserPhoto", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "photo", "type": "UserProfilePhoto" }, { "name": "previous", "type": "Bool" } ], "type": "Update" }, { "id": "628472761", "predicate": "updateContactRegistered", "params": [ { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "1369737882", "predicate": "updateContactLink", "params": [ { "name": "user_id", "type": "int" }, { "name": "my_link", "type": "contacts.MyLink" }, { "name": "foreign_link", "type": "contacts.ForeignLink" } ], "type": "Update" }, { "id": "-1895411046", "predicate": "updateNewAuthorization", "params": [ { "name": "auth_key_id", "type": "long" }, { "name": "date", "type": "int" }, { "name": "device", "type": "string" }, { "name": "location", "type": "string" } ], "type": "Update" }, { "id": "-1519637954", "predicate": "updates.state", "params": [ { "name": "pts", "type": "int" }, { "name": "qts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "unread_count", "type": "int" } ], "type": "updates.State" }, { "id": "1567990072", "predicate": "updates.differenceEmpty", "params": [ { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "updates.Difference" }, { "id": "16030880", "predicate": "updates.difference", "params": [ { "name": "new_messages", "type": "Vector<Message>" }, { "name": "new_encrypted_messages", "type": "Vector<EncryptedMessage>" }, { "name": "other_updates", "type": "Vector<Update>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" }, { "name": "state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-1459938943", "predicate": "updates.differenceSlice", "params": [ { "name": "new_messages", "type": "Vector<Message>" }, { "name": "new_encrypted_messages", "type": "Vector<EncryptedMessage>" }, { "name": "other_updates", "type": "Vector<Update>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" }, { "name": "intermediate_state", "type": "updates.State" } ], "type": "updates.Difference" }, { "id": "-484987010", "predicate": "updatesTooLong", "params": [], "type": "Updates" }, { "id": "-738961532", "predicate": "updateShortMessage", "params": [ { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "724548942", "predicate": "updateShortChatMessage", "params": [ { "name": "id", "type": "int" }, { "name": "from_id", "type": "int" }, { "name": "chat_id", "type": "int" }, { "name": "message", "type": "string" }, { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "2027216577", "predicate": "updateShort", "params": [ { "name": "update", "type": "Update" }, { "name": "date", "type": "int" } ], "type": "Updates" }, { "id": "1918567619", "predicate": "updatesCombined", "params": [ { "name": "updates", "type": "Vector<Update>" }, { "name": "users", "type": "Vector<User>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "date", "type": "int" }, { "name": "seq_start", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "1957577280", "predicate": "updates", "params": [ { "name": "updates", "type": "Vector<Update>" }, { "name": "users", "type": "Vector<User>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "date", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "Updates" }, { "id": "-1916114267", "predicate": "photos.photos", "params": [ { "name": "photos", "type": "Vector<Photo>" }, { "name": "users", "type": "Vector<User>" } ], "type": "photos.Photos" }, { "id": "352657236", "predicate": "photos.photosSlice", "params": [ { "name": "count", "type": "int" }, { "name": "photos", "type": "Vector<Photo>" }, { "name": "users", "type": "Vector<User>" } ], "type": "photos.Photos" }, { "id": "539045032", "predicate": "photos.photo", "params": [ { "name": "photo", "type": "Photo" }, { "name": "users", "type": "Vector<User>" } ], "type": "photos.Photo" }, { "id": "157948117", "predicate": "upload.file", "params": [ { "name": "type", "type": "storage.FileType" }, { "name": "mtime", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "upload.File" }, { "id": "784507964", "predicate": "dcOption", "params": [ { "name": "id", "type": "int" }, { "name": "hostname", "type": "string" }, { "name": "ip_address", "type": "string" }, { "name": "port", "type": "int" } ], "type": "DcOption" }, { "id": "777313652", "predicate": "config", "params": [ { "name": "date", "type": "int" }, { "name": "test_mode", "type": "Bool" }, { "name": "this_dc", "type": "int" }, { "name": "dc_options", "type": "Vector<DcOption>" }, { "name": "chat_size_max", "type": "int" }, { "name": "broadcast_size_max", "type": "int" } ], "type": "Config" }, { "id": "-1910892683", "predicate": "nearestDc", "params": [ { "name": "country", "type": "string" }, { "name": "this_dc", "type": "int" }, { "name": "nearest_dc", "type": "int" } ], "type": "NearestDc" }, { "id": "-1987579119", "predicate": "help.appUpdate", "params": [ { "name": "id", "type": "int" }, { "name": "critical", "type": "Bool" }, { "name": "url", "type": "string" }, { "name": "text", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "-1000708810", "predicate": "help.noAppUpdate", "params": [], "type": "help.AppUpdate" }, { "id": "415997816", "predicate": "help.inviteText", "params": [ { "name": "message", "type": "string" } ], "type": "help.InviteText" }, { "id": "1047852486", "predicate": "messages.statedMessagesLinks", "params": [ { "name": "messages", "type": "Vector<Message>" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" }, { "name": "links", "type": "Vector<contacts.Link>" }, { "name": "pts", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "messages.StatedMessages" }, { "id": "-1448138623", "predicate": "messages.statedMessageLink", "params": [ { "name": "message", "type": "Message" }, { "name": "chats", "type": "Vector<Chat>" }, { "name": "users", "type": "Vector<User>" }, { "name": "links", "type": "Vector<contacts.Link>" }, { "name": "pts", "type": "int" }, { "name": "seq", "type": "int" } ], "type": "messages.StatedMessage" }, { "id": "-371504577", "predicate": "messages.sentMessageLink", "params": [ { "name": "id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "pts", "type": "int" }, { "name": "seq", "type": "int" }, { "name": "links", "type": "Vector<contacts.Link>" } ], "type": "messages.SentMessage" }, { "id": "1662091044", "predicate": "wallPaperSolid", "params": [ { "name": "id", "type": "int" }, { "name": "title", "type": "string" }, { "name": "bg_color", "type": "int" }, { "name": "color", "type": "int" } ], "type": "WallPaper" }, { "id": "314359194", "predicate": "updateNewEncryptedMessage", "params": [ { "name": "message", "type": "EncryptedMessage" }, { "name": "qts", "type": "int" } ], "type": "Update" }, { "id": "386986326", "predicate": "updateEncryptedChatTyping", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Update" }, { "id": "-1264392051", "predicate": "updateEncryption", "params": [ { "name": "chat", "type": "EncryptedChat" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "956179895", "predicate": "updateEncryptedMessagesRead", "params": [ { "name": "chat_id", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "date", "type": "int" } ], "type": "Update" }, { "id": "-1417756512", "predicate": "encryptedChatEmpty", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "1006044124", "predicate": "encryptedChatWaiting", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-931638658", "predicate": "encryptedChatRequested", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "-94974410", "predicate": "encryptedChat", "params": [ { "name": "id", "type": "int" }, { "name": "access_hash", "type": "long" }, { "name": "date", "type": "int" }, { "name": "admin_id", "type": "int" }, { "name": "participant_id", "type": "int" }, { "name": "g_a_or_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "332848423", "predicate": "encryptedChatDiscarded", "params": [ { "name": "id", "type": "int" } ], "type": "EncryptedChat" }, { "id": "-247351839", "predicate": "inputEncryptedChat", "params": [ { "name": "chat_id", "type": "int" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedChat" }, { "id": "-1038136962", "predicate": "encryptedFileEmpty", "params": [], "type": "EncryptedFile" }, { "id": "1248893260", "predicate": "encryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "EncryptedFile" }, { "id": "406307684", "predicate": "inputEncryptedFileEmpty", "params": [], "type": "InputEncryptedFile" }, { "id": "1690108678", "predicate": "inputEncryptedFileUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "md5_checksum", "type": "string" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "1511503333", "predicate": "inputEncryptedFile", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputEncryptedFile" }, { "id": "-182231723", "predicate": "inputEncryptedFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "-317144808", "predicate": "encryptedMessage", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" }, { "name": "file", "type": "EncryptedFile" } ], "type": "EncryptedMessage" }, { "id": "594758406", "predicate": "encryptedMessageService", "params": [ { "name": "random_id", "type": "long" }, { "name": "chat_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "EncryptedMessage" }, { "id": "-1058912715", "predicate": "messages.dhConfigNotModified", "params": [ { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "740433629", "predicate": "messages.dhConfig", "params": [ { "name": "g", "type": "int" }, { "name": "p", "type": "bytes" }, { "name": "version", "type": "int" }, { "name": "random", "type": "bytes" } ], "type": "messages.DhConfig" }, { "id": "1443858741", "predicate": "messages.sentEncryptedMessage", "params": [ { "name": "date", "type": "int" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1802240206", "predicate": "messages.sentEncryptedFile", "params": [ { "name": "date", "type": "int" }, { "name": "file", "type": "EncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-95482955", "predicate": "inputFileBig", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "name", "type": "string" } ], "type": "InputFile" }, { "id": "767652808", "predicate": "inputEncryptedFileBigUploaded", "params": [ { "name": "id", "type": "long" }, { "name": "parts", "type": "int" }, { "name": "key_fingerprint", "type": "int" } ], "type": "InputEncryptedFile" }, { "id": "974056226", "predicate": "updateChatParticipantAdd", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "inviter_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "1851755554", "predicate": "updateChatParticipantDelete", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "int" }, { "name": "version", "type": "int" } ], "type": "Update" }, { "id": "-1906403213", "predicate": "updateDcOptions", "params": [ { "name": "dc_options", "type": "Vector<DcOption>" } ], "type": "Update" }, { "id": "1313442987", "predicate": "inputMediaUploadedAudio", "params": [ { "name": "file", "type": "InputFile" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-1986820223", "predicate": "inputMediaAudio", "params": [ { "name": "id", "type": "InputAudio" } ], "type": "InputMedia" }, { "id": "887592125", "predicate": "inputMediaUploadedDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "file_name", "type": "string" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "1044831837", "predicate": "inputMediaUploadedThumbDocument", "params": [ { "name": "file", "type": "InputFile" }, { "name": "thumb", "type": "InputFile" }, { "name": "file_name", "type": "string" }, { "name": "mime_type", "type": "string" } ], "type": "InputMedia" }, { "id": "-779818943", "predicate": "inputMediaDocument", "params": [ { "name": "id", "type": "InputDocument" } ], "type": "InputMedia" }, { "id": "802824708", "predicate": "messageMediaDocument", "params": [ { "name": "document", "type": "Document" } ], "type": "MessageMedia" }, { "id": "-961117440", "predicate": "messageMediaAudio", "params": [ { "name": "audio", "type": "Audio" } ], "type": "MessageMedia" }, { "id": "-648356732", "predicate": "inputAudioEmpty", "params": [], "type": "InputAudio" }, { "id": "2010398975", "predicate": "inputAudio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputAudio" }, { "id": "1928391342", "predicate": "inputDocumentEmpty", "params": [], "type": "InputDocument" }, { "id": "410618194", "predicate": "inputDocument", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputDocument" }, { "id": "1960591437", "predicate": "inputAudioFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1313188841", "predicate": "inputDocumentFileLocation", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" } ], "type": "InputFileLocation" }, { "id": "1483311320", "predicate": "audioEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Audio" }, { "id": "-945003370", "predicate": "audio", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "duration", "type": "int" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "dc_id", "type": "int" } ], "type": "Audio" }, { "id": "922273905", "predicate": "documentEmpty", "params": [ { "name": "id", "type": "long" } ], "type": "Document" }, { "id": "-1627626714", "predicate": "document", "params": [ { "name": "id", "type": "long" }, { "name": "access_hash", "type": "long" }, { "name": "user_id", "type": "int" }, { "name": "date", "type": "int" }, { "name": "file_name", "type": "string" }, { "name": "mime_type", "type": "string" }, { "name": "size", "type": "int" }, { "name": "thumb", "type": "PhotoSize" }, { "name": "dc_id", "type": "int" } ], "type": "Document" }, { "id": "398898678", "predicate": "help.support", "params": [ { "name": "phone_number", "type": "string" }, { "name": "user", "type": "User" } ], "type": "help.Support" }, { "id": "-1613493288", "predicate": "notifyPeer", "params": [ { "name": "peer", "type": "Peer" } ], "type": "NotifyPeer" }, { "id": "-1261946036", "predicate": "notifyUsers", "params": [], "type": "NotifyPeer" }, { "id": "-1073230141", "predicate": "notifyChats", "params": [], "type": "NotifyPeer" }, { "id": "1959820384", "predicate": "notifyAll", "params": [], "type": "NotifyPeer" }, { "id": "-2131957734", "predicate": "updateUserBlocked", "params": [ { "name": "user_id", "type": "int" }, { "name": "blocked", "type": "Bool" } ], "type": "Update" }, { "id": "-1094555409", "predicate": "updateNotifySettings", "params": [ { "name": "peer", "type": "NotifyPeer" }, { "name": "notify_settings", "type": "PeerNotifySettings" } ], "type": "Update" }, { "id": "-484053553", "predicate": "auth.sentAppCode", "params": [ { "name": "phone_registered", "type": "Bool" }, { "name": "phone_code_hash", "type": "string" }, { "name": "send_call_timeout", "type": "int" }, { "name": "is_password", "type": "Bool" } ], "type": "auth.SentCode" }, { "id": "381645902", "predicate": "sendMessageTypingAction", "params": [], "type": "SendMessageAction" }, { "id": "-44119819", "predicate": "sendMessageCancelAction", "params": [], "type": "SendMessageAction" }, { "id": "-1584933265", "predicate": "sendMessageRecordVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-1845219337", "predicate": "sendMessageUploadVideoAction", "params": [], "type": "SendMessageAction" }, { "id": "-718310409", "predicate": "sendMessageRecordAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-424899985", "predicate": "sendMessageUploadAudioAction", "params": [], "type": "SendMessageAction" }, { "id": "-1727382502", "predicate": "sendMessageUploadPhotoAction", "params": [], "type": "SendMessageAction" }, { "id": "-1884362354", "predicate": "sendMessageUploadDocumentAction", "params": [], "type": "SendMessageAction" }, { "id": "393186209", "predicate": "sendMessageGeoLocationAction", "params": [], "type": "SendMessageAction" }, { "id": "1653390447", "predicate": "sendMessageChooseContactAction", "params": [], "type": "SendMessageAction" }, { "id": "-360210539", "predicate": "contactFound", "params": [ { "name": "user_id", "type": "int" } ], "type": "ContactFound" }, { "id": "90570766", "predicate": "contacts.found", "params": [ { "name": "results", "type": "Vector<ContactFound>" }, { "name": "users", "type": "Vector<User>" } ], "type": "contacts.Found" }, { "id": "942527460", "predicate": "updateServiceNotification", "params": [ { "name": "type", "type": "string" }, { "name": "message", "type": "string" }, { "name": "media", "type": "MessageMedia" }, { "name": "popup", "type": "Bool" } ], "type": "Update" } ], "methods": [ { "id": "-878758099", "method": "invokeAfterMsg", "params": [ { "name": "msg_id", "type": "long" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1036301552", "method": "invokeAfterMsgs", "params": [ { "name": "msg_ids", "type": "Vector<long>" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "1877286395", "method": "auth.checkPhone", "params": [ { "name": "phone_number", "type": "string" } ], "type": "auth.CheckedPhone" }, { "id": "1988976461", "method": "auth.sendCode", "params": [ { "name": "phone_number", "type": "string" }, { "name": "sms_type", "type": "int" }, { "name": "api_id", "type": "int" }, { "name": "api_hash", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "auth.SentCode" }, { "id": "63247716", "method": "auth.sendCall", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "453408308", "method": "auth.signUp", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" }, { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "auth.Authorization" }, { "id": "-1126886015", "method": "auth.signIn", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" }, { "name": "phone_code", "type": "string" } ], "type": "auth.Authorization" }, { "id": "1461180992", "method": "auth.logOut", "params": [], "type": "Bool" }, { "id": "-1616179942", "method": "auth.resetAuthorizations", "params": [], "type": "Bool" }, { "id": "1998331287", "method": "auth.sendInvites", "params": [ { "name": "phone_numbers", "type": "Vector<string>" }, { "name": "message", "type": "string" } ], "type": "Bool" }, { "id": "-440401971", "method": "auth.exportAuthorization", "params": [ { "name": "dc_id", "type": "int" } ], "type": "auth.ExportedAuthorization" }, { "id": "-470837741", "method": "auth.importAuthorization", "params": [ { "name": "id", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "auth.Authorization" }, { "id": "-841733627", "method": "auth.bindTempAuthKey", "params": [ { "name": "perm_auth_key_id", "type": "long" }, { "name": "nonce", "type": "long" }, { "name": "expires_at", "type": "int" }, { "name": "encrypted_message", "type": "bytes" } ], "type": "Bool" }, { "id": "1147957548", "method": "account.registerDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "app_sandbox", "type": "Bool" }, { "name": "lang_code", "type": "string" } ], "type": "Bool" }, { "id": "1707432768", "method": "account.unregisterDevice", "params": [ { "name": "token_type", "type": "int" }, { "name": "token", "type": "string" } ], "type": "Bool" }, { "id": "-2067899501", "method": "account.updateNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" }, { "name": "settings", "type": "InputPeerNotifySettings" } ], "type": "Bool" }, { "id": "313765169", "method": "account.getNotifySettings", "params": [ { "name": "peer", "type": "InputNotifyPeer" } ], "type": "PeerNotifySettings" }, { "id": "-612493497", "method": "account.resetNotifySettings", "params": [], "type": "Bool" }, { "id": "-259486360", "method": "account.updateProfile", "params": [ { "name": "first_name", "type": "string" }, { "name": "last_name", "type": "string" } ], "type": "User" }, { "id": "1713919532", "method": "account.updateStatus", "params": [ { "name": "offline", "type": "Bool" } ], "type": "Bool" }, { "id": "-1068696894", "method": "account.getWallPapers", "params": [], "type": "Vector<WallPaper>" }, { "id": "227648840", "method": "users.getUsers", "params": [ { "name": "id", "type": "Vector<InputUser>" } ], "type": "Vector<User>" }, { "id": "-902781519", "method": "users.getFullUser", "params": [ { "name": "id", "type": "InputUser" } ], "type": "UserFull" }, { "id": "-995929106", "method": "contacts.getStatuses", "params": [], "type": "Vector<ContactStatus>" }, { "id": "583445000", "method": "contacts.getContacts", "params": [ { "name": "hash", "type": "string" } ], "type": "contacts.Contacts" }, { "id": "-634342611", "method": "contacts.importContacts", "params": [ { "name": "contacts", "type": "Vector<InputContact>" }, { "name": "replace", "type": "Bool" } ], "type": "contacts.ImportedContacts" }, { "id": "-847825880", "method": "contacts.getSuggested", "params": [ { "name": "limit", "type": "int" } ], "type": "contacts.Suggested" }, { "id": "-1902823612", "method": "contacts.deleteContact", "params": [ { "name": "id", "type": "InputUser" } ], "type": "contacts.Link" }, { "id": "1504393374", "method": "contacts.deleteContacts", "params": [ { "name": "id", "type": "Vector<InputUser>" } ], "type": "Bool" }, { "id": "858475004", "method": "contacts.block", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-448724803", "method": "contacts.unblock", "params": [ { "name": "id", "type": "InputUser" } ], "type": "Bool" }, { "id": "-176409329", "method": "contacts.getBlocked", "params": [ { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "contacts.Blocked" }, { "id": "-2065352905", "method": "contacts.exportCard", "params": [], "type": "Vector<int>" }, { "id": "1340184318", "method": "contacts.importCard", "params": [ { "name": "export_card", "type": "Vector<int>" } ], "type": "User" }, { "id": "1109588596", "method": "messages.getMessages", "params": [ { "name": "id", "type": "Vector<int>" } ], "type": "messages.Messages" }, { "id": "-321970698", "method": "messages.getDialogs", "params": [ { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Dialogs" }, { "id": "-1834885329", "method": "messages.getHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "132772523", "method": "messages.search", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "q", "type": "string" }, { "name": "filter", "type": "MessagesFilter" }, { "name": "min_date", "type": "int" }, { "name": "max_date", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "messages.Messages" }, { "id": "-287800122", "method": "messages.readHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "max_id", "type": "int" }, { "name": "offset", "type": "int" }, { "name": "read_contents", "type": "Bool" } ], "type": "messages.AffectedHistory" }, { "id": "-185009311", "method": "messages.deleteHistory", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "offset", "type": "int" } ], "type": "messages.AffectedHistory" }, { "id": "351460618", "method": "messages.deleteMessages", "params": [ { "name": "id", "type": "Vector<int>" } ], "type": "Vector<int>" }, { "id": "682347368", "method": "messages.receivedMessages", "params": [ { "name": "max_id", "type": "int" } ], "type": "Vector<int>" }, { "id": "-1551737264", "method": "messages.setTyping", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "action", "type": "SendMessageAction" } ], "type": "Bool" }, { "id": "1289620139", "method": "messages.sendMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "message", "type": "string" }, { "name": "random_id", "type": "long" } ], "type": "messages.SentMessage" }, { "id": "-1547149962", "method": "messages.sendMedia", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "media", "type": "InputMedia" }, { "name": "random_id", "type": "long" } ], "type": "messages.StatedMessage" }, { "id": "1363988751", "method": "messages.forwardMessages", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "Vector<int>" } ], "type": "messages.StatedMessages" }, { "id": "-820669733", "method": "messages.reportSpam", "params": [ { "name": "peer", "type": "InputPeer" } ], "type": "Bool" }, { "id": "1013621127", "method": "messages.getChats", "params": [ { "name": "id", "type": "Vector<int>" } ], "type": "messages.Chats" }, { "id": "998448230", "method": "messages.getFullChat", "params": [ { "name": "chat_id", "type": "int" } ], "type": "messages.ChatFull" }, { "id": "-1262720843", "method": "messages.editChatTitle", "params": [ { "name": "chat_id", "type": "int" }, { "name": "title", "type": "string" } ], "type": "messages.StatedMessage" }, { "id": "-662601187", "method": "messages.editChatPhoto", "params": [ { "name": "chat_id", "type": "int" }, { "name": "photo", "type": "InputChatPhoto" } ], "type": "messages.StatedMessage" }, { "id": "787082910", "method": "messages.addChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" }, { "name": "fwd_limit", "type": "int" } ], "type": "messages.StatedMessage" }, { "id": "-1010447069", "method": "messages.deleteChatUser", "params": [ { "name": "chat_id", "type": "int" }, { "name": "user_id", "type": "InputUser" } ], "type": "messages.StatedMessage" }, { "id": "1100847854", "method": "messages.createChat", "params": [ { "name": "users", "type": "Vector<InputUser>" }, { "name": "title", "type": "string" } ], "type": "messages.StatedMessage" }, { "id": "-304838614", "method": "updates.getState", "params": [], "type": "updates.State" }, { "id": "168039573", "method": "updates.getDifference", "params": [ { "name": "pts", "type": "int" }, { "name": "date", "type": "int" }, { "name": "qts", "type": "int" } ], "type": "updates.Difference" }, { "id": "-285902432", "method": "photos.updateProfilePhoto", "params": [ { "name": "id", "type": "InputPhoto" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "UserProfilePhoto" }, { "id": "-720397176", "method": "photos.uploadProfilePhoto", "params": [ { "name": "file", "type": "InputFile" }, { "name": "caption", "type": "string" }, { "name": "geo_point", "type": "InputGeoPoint" }, { "name": "crop", "type": "InputPhotoCrop" } ], "type": "photos.Photo" }, { "id": "-2016444625", "method": "photos.deletePhotos", "params": [ { "name": "id", "type": "Vector<InputPhoto>" } ], "type": "Vector<long>" }, { "id": "-1291540959", "method": "upload.saveFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "-475607115", "method": "upload.getFile", "params": [ { "name": "location", "type": "InputFileLocation" }, { "name": "offset", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "upload.File" }, { "id": "-990308245", "method": "help.getConfig", "params": [], "type": "Config" }, { "id": "531836966", "method": "help.getNearestDc", "params": [], "type": "NearestDc" }, { "id": "-938300290", "method": "help.getAppUpdate", "params": [ { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" } ], "type": "help.AppUpdate" }, { "id": "1862465352", "method": "help.saveAppLog", "params": [ { "name": "events", "type": "Vector<InputAppEvent>" } ], "type": "Bool" }, { "id": "-1532407418", "method": "help.getInviteText", "params": [ { "name": "lang_code", "type": "string" } ], "type": "help.InviteText" }, { "id": "-1209117380", "method": "photos.getUserPhotos", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "offset", "type": "int" }, { "name": "max_id", "type": "int" }, { "name": "limit", "type": "int" } ], "type": "photos.Photos" }, { "id": "66319602", "method": "messages.forwardMessage", "params": [ { "name": "peer", "type": "InputPeer" }, { "name": "id", "type": "int" }, { "name": "random_id", "type": "long" } ], "type": "messages.StatedMessage" }, { "id": "1102776690", "method": "messages.sendBroadcast", "params": [ { "name": "contacts", "type": "Vector<InputUser>" }, { "name": "message", "type": "string" }, { "name": "media", "type": "InputMedia" } ], "type": "messages.StatedMessages" }, { "id": "651135312", "method": "messages.getDhConfig", "params": [ { "name": "version", "type": "int" }, { "name": "random_length", "type": "int" } ], "type": "messages.DhConfig" }, { "id": "-162681021", "method": "messages.requestEncryption", "params": [ { "name": "user_id", "type": "InputUser" }, { "name": "random_id", "type": "int" }, { "name": "g_a", "type": "bytes" } ], "type": "EncryptedChat" }, { "id": "1035731989", "method": "messages.acceptEncryption", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "g_b", "type": "bytes" }, { "name": "key_fingerprint", "type": "long" } ], "type": "EncryptedChat" }, { "id": "-304536635", "method": "messages.discardEncryption", "params": [ { "name": "chat_id", "type": "int" } ], "type": "Bool" }, { "id": "2031374829", "method": "messages.setEncryptedTyping", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "typing", "type": "Bool" } ], "type": "Bool" }, { "id": "2135648522", "method": "messages.readEncryptedHistory", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "max_date", "type": "int" } ], "type": "Bool" }, { "id": "-1451792525", "method": "messages.sendEncrypted", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "-1701831834", "method": "messages.sendEncryptedFile", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" }, { "name": "file", "type": "InputEncryptedFile" } ], "type": "messages.SentEncryptedMessage" }, { "id": "852769188", "method": "messages.sendEncryptedService", "params": [ { "name": "peer", "type": "InputEncryptedChat" }, { "name": "random_id", "type": "long" }, { "name": "data", "type": "bytes" } ], "type": "messages.SentEncryptedMessage" }, { "id": "1436924774", "method": "messages.receivedQueue", "params": [ { "name": "max_qts", "type": "int" } ], "type": "Vector<long>" }, { "id": "-562337987", "method": "upload.saveBigFilePart", "params": [ { "name": "file_id", "type": "long" }, { "name": "file_part", "type": "int" }, { "name": "file_total_parts", "type": "int" }, { "name": "bytes", "type": "bytes" } ], "type": "Bool" }, { "id": "1769565673", "method": "initConnection", "params": [ { "name": "api_id", "type": "int" }, { "name": "device_model", "type": "string" }, { "name": "system_version", "type": "string" }, { "name": "app_version", "type": "string" }, { "name": "lang_code", "type": "string" }, { "name": "query", "type": "!X" } ], "type": "X" }, { "id": "-1663104819", "method": "help.getSupport", "params": [], "type": "help.Support" }, { "id": "229241832", "method": "auth.sendSms", "params": [ { "name": "phone_number", "type": "string" }, { "name": "phone_code_hash", "type": "string" } ], "type": "Bool" }, { "id": "894131138", "method": "messages.readMessageContents", "params": [ { "name": "id", "type": "Vector<int>" } ], "type": "Vector<int>" }, { "id": "655677548", "method": "account.checkUsername", "params": [ { "name": "username", "type": "string" } ], "type": "Bool" }, { "id": "1040964988", "method": "account.updateUsername", "params": [ { "name": "username", "type": "string" } ], "type": "User" }, { "id": "301470424", "method": "contacts.search", "params": [ { "name": "q", "type": "string" }, { "name": "limit", "type": "int" } ], "type": "contacts.Found" }, { "id": "479200567", "method": "invokeWithLayer18", "params": [ { "name": "query", "type": "!X" } ], "type": "X" } ] }MadelineProto.main flags:# encrypted_layer:int settings:MadelineProto.settings config:Config authorization:flags.0?auth.Authorization authorized:int rsa_keys:Vector<MadelineProto.RSA> last_recv:int dh_config:messages.DhConfig chats:Vector<Chat> last_stored:int qres:Vector<PWR.Chat> pending_updates:Vector<Update> updates_state:MadelineProto.Updates_state got_state:flags.1?true channels_state:MadelineProto.Channel_states updates:Vector<Update> updates_key:int getting_state:flags.2?true full_chats:MadelineProto.FullChat msg_ids:Vector<long> dialog_params:MadelineProto.DialogParams datacenter:MadelineProto.DataCenter v:int constructors:MadelineProto.Constructors td_constructors:flags.3?MadelineProto.Constructors methods:MadelineProto.Methods td_methods:flags.4?MadelineProto.Methods td_descriptions:flags.5?MadelineProto.Descriptions twoe1984:Serialized twoe2047:Serialized twoe2048:Serialized zero:Serialized one:Serialized two:Serialized three:Serialized four:Serialized = MadelineProto.Main; MadelineProto.settings = MadelineProto.Settings; MadelineProto.connection_settings = MadelineProto.Settings; MadelineProto.channel_states = pts:int pending_pts_updates:Vector<Update> sync_loading:Bool MadelineProto.Channel_states; MadelineProto.update_state = pts:int qts:int seq:int date:int pending_seq_updates:Vector<Update> pending_pts_updates:Vector<Update> sync_loading:Bool MadelineProto.Update_state; MadelineProto.rsa e:Serialized n:Serialized fp:string = MadelineProto.RSA; MadelineProto.dialogParams flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = MadelineProto.DialogParams; MadelineProto.dataCenter sockets:Vector<MadelineProto.Connection> curdc:int dclist:Vector<dcOption> settings:MadelineProto.Settings = MadelineProto.DataCenter; MadelineProto.connection flags:# protocol:string ip:string port:int timeout:int parsed:flags.0?MadelineProto.ParsedUrl temp_auth_key:MadelineProto.AuthKey auth_key:MadelineProto.AuthKey ipv6:flags.1?true incoming_messages:Vector<MadelineProto.Messages> outgoing_messages:Vector<MadelineProto.Messages> new_incoming:Vector<long> new_outgoing:Vector<long> MadelineProto.descriptions = MadelineProto.Descriptions; MadelineProto.methods = MadelineProto.Methods; MadelineProto.constructors = MadelineProto.Constructors; MadelineProto.parsedUrl = MadelineProto.ParsedUrl; MadelineProto.authKey server_salt:long id:long auth_key:string = MadelineProto.AuthKey; MadelineProto.messages flags:# seq_no:flags.0?int content:Object response:int = MadelineProto.Messages; pwr.chat flags:# type:string id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string lang_code:flags.3?string username:flags.4?string verified:flags.5?true restricted:flags.6?true restriction_reason:flags.7?string status:flags.8?UserStatus bot_inline_placeholder:flags.9?string about:flags.10?string bot_info:flags.11?BotInfo phone_calls_available:flags.12?true phone_calls_private:flags.13?true common_chats_count:flags.14?int photo:flags.15?string title:flags.16?string participants_count:flags.17?int kicked_count:flags.18?int admin_count:flags.19?int admin:flags.20?true all_members_are_administrators:flags.21?true invite:flags.22?string participants:flags.23?Vector<PWRParticipant> democracy:flags.24?true signatures:flags.25?true can_view_participants:flags.26?true can_set_username:flags.27?true migrated_from_chat_id:flags.28?int migrated_from_max_id:flags.29?int pinned_msg_id:flags.30?int = PWR.Chat; pwr.participant flags:# user:PWR.Chat inviter:flags.0?PWR.Chat date:int role:string = PWR.Participant; //auth.sentCodeMP flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int phone_number:flags.3?string phone_code:flags.4?string = auth.Authorization; //auth.noPasswordMP new_salt:bytes email_unconfirmed_pattern:string = auth.Authorization; //auth.passwordMP current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = auth.Authorization; <?php /** * ResponseException module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class ResponseException extends \Exception { } <?php /** * Methods module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\DocsBuilder; trait Methods { public function mk_methods() { $bots = json_decode(file_get_contents('https://rpc.pwrtelegram.xyz/?bot'), true)['result']; $errors = json_decode(file_get_contents('https://rpc.pwrtelegram.xyz/?all'), true); $errors['result'] = array_merge_recursive(...$errors['result']); foreach (glob('methods/'.$this->any) as $unlink) { unlink($unlink); } if (file_exists('methods')) { rmdir('methods'); } mkdir('methods'); $this->docs_methods = []; $this->human_docs_methods = []; $this->logger->logger('Generating methods documentation...', \danog\MadelineProto\Logger::NOTICE); foreach ($this->methods->by_id as $id => $data) { $method = str_replace('.', '_', $data['method']); $php_method = str_replace('.', '->', $data['method']); $type = str_replace(['.', '<', '>'], ['_', '_of_', ''], $data['type']); $php_type = preg_replace('/.*_of_/', '', $type); if (!isset($this->types[$php_type])) { $this->types[$php_type] = ['methods' => [], 'constructors' => []]; } if (!in_array($data, $this->types[$php_type]['methods'])) { $this->types[$php_type]['methods'][] = $data; } $params = ''; foreach ($data['params'] as $param) { if (in_array($param['name'], ['flags', 'random_id', 'random_bytes'])) { continue; } if ($param['name'] === 'data' && $type === 'messages_SentEncryptedMessage' && !isset($this->settings['td'])) { $param['name'] = 'message'; $param['type'] = 'DecryptedMessage'; } if ($param['name'] === 'chat_id' && $data['method'] !== 'messages.discardEncryption' && !isset($this->settings['td'])) { $param['type'] = 'InputPeer'; } $type_or_subtype = isset($param['subtype']) ? 'subtype' : 'type'; $type_or_bare_type = ctype_upper($this->end(explode('.', $param[$type_or_subtype]))[0]) || in_array($param[$type_or_subtype], ['!X', 'X', 'bytes', 'true', 'false', 'double', 'string', 'Bool', 'int', 'long', 'int128', 'int256', 'int512', 'int53']) ? 'types' : 'constructors'; $param[$type_or_subtype] = str_replace(['.', 'true', 'false'], ['_', 'Bool', 'Bool'], $param[$type_or_subtype]); $param[$type_or_subtype] = '['.$this->escape($param[$type_or_subtype]).'](../'.$type_or_bare_type.'/'.$param[$type_or_subtype].'.md)'; $params .= "'".$param['name']."' => ".(isset($param['subtype']) ? '\\['.$param[$type_or_subtype].'\\]' : $param[$type_or_subtype]).', '; } if (!isset($this->td_descriptions['methods'][$data['method']])) { $this->add_to_lang('method_'.$data['method']); if (\danog\MadelineProto\Lang::$lang['en']['method_'.$data['method']] !== '') { $this->td_descriptions['methods'][$data['method']]['description'] = \danog\MadelineProto\Lang::$lang['en']['method_'.$data['method']]; } } $md_method = '['.$php_method.']('.$method.'.md)'; $this->docs_methods[$method] = '$MadelineProto->'.$md_method.'(\\['.$params.'\\]) === [$'.str_replace('_', '\\_', $type).'](../types/'.$php_type.'.md)<a name="'.$method.'"></a> '; if (!isset(\danog\MadelineProto\MTProto::DISALLOWED_METHODS[$data['method']]) && isset($this->td_descriptions['methods'][$data['method']])) { $this->human_docs_methods[$this->td_descriptions['methods'][$data['method']]['description'].': '.$data['method']] = '* <a href="'.$method.'.html" name="'.$method.'">'.$this->td_descriptions['methods'][$data['method']]['description'].': '.$data['method'].'</a> '; } $params = ''; $lua_params = ''; $pwr_params = ''; $json_params = ''; $table = empty($data['params']) ? '' : '### Parameters: | Name | Type | Required | |----------|---------------|----------| '; if (isset($this->td_descriptions['methods'][$data['method']]) && !empty($data['params'])) { $table = '### Parameters: | Name | Type | Description | Required | |----------|---------------|-------------|----------| '; } $hasentities = false; $hasreplymarkup = false; $hasmessage = false; foreach ($data['params'] as $param) { if (in_array($param['name'], ['flags', 'random_id', 'random_bytes'])) { continue; } if ($param['name'] === 'data' && $type === 'messages_SentEncryptedMessage' && !isset($this->settings['td'])) { $param['name'] = 'message'; $param['type'] = 'DecryptedMessage'; } if ($param['name'] === 'chat_id' && $data['method'] !== 'messages.discardEncryption' && !isset($this->settings['td'])) { $param['type'] = 'InputPeer'; } if ($param['name'] === 'hash' && $param['type'] === 'int') { $param['pow'] = 'hi'; $param['type'] = 'Vector t'; $param['subtype'] = 'int'; } $ptype = str_replace('.', '_', $param[$type_or_subtype = isset($param['subtype']) ? 'subtype' : 'type']); switch ($ptype) { case 'true': case 'false': $ptype = 'Bool'; } $human_ptype = $ptype; if (in_array($ptype, ['InputDialogPeer', 'DialogPeer', 'NotifyPeer', 'InputNotifyPeer', 'User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputPeer']) && !isset($this->settings['td'])) { $human_ptype = 'Username, chat ID, Update, Message or '.$ptype; } if (in_array($ptype, ['InputMedia', 'InputPhoto', 'InputDocument']) && !isset($this->settings['td'])) { $human_ptype = 'MessageMedia, Update, Message or '.$ptype; } if (in_array($ptype, ['InputMessage']) && !isset($this->settings['td'])) { $human_ptype = 'Message ID or '.$ptype; } if (in_array($ptype, ['InputEncryptedChat']) && !isset($this->settings['td'])) { $human_ptype = 'Secret chat ID, Update, EncryptedMessage or '.$ptype; } if (in_array($ptype, ['InputFile']) && !isset($this->settings['td'])) { $human_ptype = 'File path or '.$ptype; } if (in_array($ptype, ['InputEncryptedFile']) && !isset($this->settings['td'])) { $human_ptype = 'File path or '.$ptype; } $type_or_bare_type = ctype_upper($this->end(explode('.', $param[$type_or_subtype]))[0]) || in_array($param[$type_or_subtype], ['!X', 'X', 'bytes', 'true', 'false', 'double', 'string', 'Bool', 'int', 'long', 'int128', 'int256', 'int512', 'int53']) ? 'types' : 'constructors'; if (!isset($this->td_descriptions['methods'][$data['method']]['params'][$param['name']])) { $this->add_to_lang('method_'.$data['method'].'_param_'.$param['name'].'_type_'.$param['type']); if (isset($this->td_descriptions['methods'][$data['method']]['description'])) { $this->td_descriptions['methods'][$data['method']]['params'][$param['name']] = \danog\MadelineProto\Lang::$lang['en']['method_'.$data['method'].'_param_'.$param['name'].'_type_'.$param['type']]; } } if (isset($this->td_descriptions['methods'][$data['method']])) { $table .= '|'.str_replace('_', '\\_', $param['name']).'|'.(isset($param['subtype']) ? 'Array of ' : '').'['.str_replace('_', '\\_', $human_ptype).'](../'.$type_or_bare_type.'/'.$ptype.'.md) | '.$this->td_descriptions['methods'][$data['method']]['params'][$param['name']].' | '.(isset($param['pow']) || (($id = $this->constructors->find_by_predicate(lcfirst($param['type']).'Empty')) && $id['type'] === $param['type']) || (($id = $this->constructors->find_by_predicate('input'.$param['type'].'Empty')) && $id['type'] === $param['type']) ? 'Optional' : 'Yes').'|'; } else { $table .= '|'.str_replace('_', '\\_', $param['name']).'|'.(isset($param['subtype']) ? 'Array of ' : '').'['.str_replace('_', '\\_', $human_ptype).'](../'.$type_or_bare_type.'/'.$ptype.'.md) | '.(isset($param['pow']) || (($id = $this->constructors->find_by_predicate(lcfirst($param['type']).'Empty')) && $id['type'] === $param['type']) || (($id = $this->constructors->find_by_predicate('input'.$param['type'].'Empty')) && $id['type'] === $param['type']) ? 'Optional' : 'Yes').'|'; } $table .= PHP_EOL; $pptype = in_array($ptype, ['string', 'bytes']) ? "'".$ptype."'" : $ptype; $ppptype = in_array($ptype, ['string']) ? '"'.$ptype.'"' : $ptype; $ppptype = in_array($ptype, ['bytes']) ? '{"_": "bytes", "bytes":"base64 encoded '.$ptype.'"}' : $ppptype; $params .= "'".$param['name']."' => "; $params .= (isset($param['subtype']) ? '['.$pptype.', '.$pptype.']' : $pptype).', '; $json_params .= '"'.$param['name'].'": '.(isset($param['subtype']) ? '['.$ppptype.']' : $ppptype).', '; $pwr_params .= $param['name'].' - Json encoded '.(isset($param['subtype']) ? ' array of '.$ptype : $ptype)."\n\n"; $lua_params .= $param['name'].'='; $lua_params .= (isset($param['subtype']) ? '{'.$pptype.'}' : $pptype).', '; if ($param['name'] === 'reply_markup') { $hasreplymarkup = true; } if ($param['name'] === 'message') { $hasmessage = true; } if ($param['name'] === 'entities') { $hasentities = true; $table .= '|parse\\_mode| [string](../types/string.md) | Whether to parse HTML or Markdown markup in the message| Optional | '; $params .= "'parse_mode' => 'string', "; $lua_params .= "parse_mode='string', "; $json_params .= '"parse_mode": "string"'; $pwr_params = "parse_mode - string\n"; } } $description = isset($this->td_descriptions['methods'][$data['method']]) ? $this->td_descriptions['methods'][$data['method']]['description'] : $data['method'].' parameters, return type and example'; $header = '--- title: '.$data['method'].' description: '.$description.' image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- # Method: '.str_replace('_', '\\_', $data['method']).' [Back to methods index](index.md) '; if (isset(\danog\MadelineProto\MTProto::DISALLOWED_METHODS[$data['method']])) { $header .= '**'.\danog\MadelineProto\MTProto::DISALLOWED_METHODS[$data['method']]."**\n\n\n\n\n"; file_put_contents('methods/'.$method.'.md', $header); continue; } if ($this->td) { $header .= 'YOU CANNOT USE THIS METHOD IN MADELINEPROTO '; } $header .= isset($this->td_descriptions['methods'][$data['method']]) ? $this->td_descriptions['methods'][$data['method']]['description'].PHP_EOL.PHP_EOL : ''; $table .= ' '; $return = '### Return type: ['.str_replace('_', '\\_', $type).'](../types/'.$php_type.'.md) '; $bot = !in_array($data['method'], $bots); $example = ''; if (!isset($this->settings['td'])) { $example .= '### Can bots use this method: **'.($bot ? 'YES' : 'NO')."**\n\n\n"; $example .= str_replace('[]', '', '### MadelineProto Example: ```php if (!file_exists(\'madeline.php\')) { copy(\'https://phar.madelineproto.xyz/madeline.php\', \'madeline.php\'); } include \'madeline.php\'; $MadelineProto = new \danog\MadelineProto\API(\'session.madeline\'); $MadelineProto->start(); $'.$type.' = $MadelineProto->'.$php_method.'(['.$params.']); ``` ### [PWRTelegram HTTP API](https://pwrtelegram.xyz) example (NOT FOR MadelineProto): '.($bot ? '### As a bot: POST/GET to `https://api.pwrtelegram.xyz/botTOKEN/madeline` Parameters: * method - '.$data['method'].' * params - `{'.$json_params.'}` ' : '').' ### As a user: POST/GET to `https://api.pwrtelegram.xyz/userTOKEN/'.$data['method'].'` Parameters: '.$pwr_params.' Or, if you\'re into Lua: ```lua '.$type.' = '.$data['method'].'({'.$lua_params.'}) ``` '); if ($hasreplymarkup) { $example .= ' ## Usage of reply_markup You can provide bot API reply_markup objects here. '; } if ($hasmessage) { $example .= ' ## Return value If the length of the provided message is bigger than 4096, the message will be split in chunks and the method will be called multiple times, with the same parameters (except for the message), and an array of ['.str_replace('_', '\\_', $type).'](../types/'.$php_type.'.md) will be returned instead. '; } if ($hasentities) { $example .= ' ## Usage of parse_mode: Set parse_mode to html to enable HTML parsing of the message. Set parse_mode to Markdown to enable markown AND html parsing of the message. The following tags are currently supported: ```html <br>a newline <b><i>bold works ok, internal tags are stripped</i> </b> <strong>bold</strong> <em>italic</em> <i>italic</i> <code>inline fixed-width code</code> <pre>pre-formatted fixed-width code block</pre> <a href="https://github.com">URL</a> <a href="mention:@danogentili">Mention by username</a> <a href="mention:186785362">Mention by user id</a> <pre language="json">Pre tags can have a language attribute</pre> ``` You can also use normal markdown, note that to create mentions you must use the `mention:` syntax like in html: ```markdown [Mention by username](mention:@danogentili) [Mention by user id](mention:186785362) ``` MadelineProto supports all html entities supported by [html_entity_decode](http://php.net/manual/en/function.html-entity-decode.php). '; } if (isset($errors['result'][$data['method']])) { $example .= '### Errors this method can return: | Error | Description | |----------|---------------| '; foreach ($errors['result'][$data['method']] as $error) { $example .= '|'.$error.'|'.$errors['human_result'][$error][0].'|'."\n"; } $example .= "\n\n"; } } file_put_contents('methods/'.$method.'.md', $header.$table.$return.$example); } $this->logger->logger('Generating methods index...', \danog\MadelineProto\Logger::NOTICE); ksort($this->docs_methods); ksort($this->human_docs_methods); $last_namespace = ''; foreach ($this->docs_methods as $method => &$value) { $new_namespace = preg_replace('/_.*/', '', $method); $br = $new_namespace != $last_namespace ? '*** <br><br> ' : ''; $value = $br.$value; $last_namespace = $new_namespace; } file_put_contents('methods/api_'.$this->index, '--- title: Methods description: List of methods image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- # Methods [Back to API documentation index](..) [Go to the new description-version method index]('.$this->index.') $MadelineProto->[logout](https://docs.madelineproto.xyz/logout.html)(); $MadelineProto->[phone_login](https://docs.madelineproto.xyz/phone_login.html)($number); $MadelineProto->[complete_phone_login](https://docs.madelineproto.xyz/complete_phone_login.html)($code); $MadelineProto->[complete_2FA_login](https://docs.madelineproto.xyz/complete_2FA_login.html)($password); $MadelineProto->[bot_login](https://docs.madelineproto.xyz/bot_login.html)($token); $MadelineProto->[get_dialogs](https://docs.madelineproto.xyz/get_dialogs.html)(); $MadelineProto->[get_pwr_chat](https://docs.madelineproto.xyz/get_pwr_chat.html)($id); $MadelineProto->[get_info](https://docs.madelineproto.xyz/get_info.html)($id); $MadelineProto->[get_full_info](https://docs.madelineproto.xyz/get_full_info.html)($id); $MadelineProto->[get_self](https://docs.madelineproto.xyz/get_self.html)(); $MadelineProto->[request_call](https://docs.madelineproto.xyz/request_call.html)($id); $MadelineProto->[request_secret_chat](https://docs.madelineproto.xyz/request_secret_chat.html)($id); '.implode('', $this->docs_methods)); file_put_contents('methods/'.$this->index, '--- title: Methods description: What do you want to do? image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- # What do you want to do? [Go back to API documentation index](..) [Go to the old code-version method index](api_'.$this->index.') * [Logout](https://docs.madelineproto.xyz/logout.html) * [Login](https://docs.madelineproto.xyz/docs/LOGIN.html) * [Get all chats, broadcast a message to all chats](https://docs.madelineproto.xyz/docs/DIALOGS.html) * [Get the full participant list of a channel/group/supergroup](https://docs.madelineproto.xyz/get_pwr_chat.html) * [Get full info about a user/chat/supergroup/channel](https://docs.madelineproto.xyz/get_full_info.html) * [Get info about a user/chat/supergroup/channel](https://docs.madelineproto.xyz/get_info.html) * [Get info about the currently logged-in user](https://docs.madelineproto.xyz/get_self.html) * [Upload or download files up to 1.5 GB](https://docs.madelineproto.xyz/docs/FILES.html) * [Make a phone call and play a song](https://docs.madelineproto.xyz/docs/CALLS.html) * [Create a secret chat bot](https://docs.madelineproto.xyz/docs/SECRET_CHATS.html) '.implode('', $this->human_docs_methods)); } } <?php /** * Constructors module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\DocsBuilder; trait Constructors { public function mk_constructors() { foreach (glob('constructors/'.$this->any) as $unlink) { unlink($unlink); } if (file_exists('constructors')) { rmdir('constructors'); } mkdir('constructors'); $this->docs_constructors = []; $this->logger->logger('Generating constructors documentation...', \danog\MadelineProto\Logger::NOTICE); $got = []; foreach ($this->constructors->by_predicate_and_layer as $predicate => $id) { $data = $this->constructors->by_id[$id]; if (isset($got[$id])) { $data['layer'] = ''; } $got[$id] = ''; /* if (preg_match('/%/', $type)) { $type = $this->constructors->find_by_type(str_replace('%', '', $type))['predicate']; }*/ $layer = isset($data['layer']) && $data['layer'] !== '' ? '_'.$data['layer'] : ''; $type = str_replace(['.', '<', '>'], ['_', '_of_', ''], $data['type']); $php_type = preg_replace('/.*_of_/', '', $type); $constructor = str_replace(['.', '<', '>'], ['_', '_of_', ''], $data['predicate']); $php_constructor = preg_replace('/.*_of_/', '', $constructor); if (!isset($this->types[$php_type])) { $this->types[$php_type] = ['constructors' => [], 'methods' => []]; } if (!in_array($data, $this->types[$php_type]['constructors'])) { $this->types[$php_type]['constructors'][] = $data; } $params = ''; foreach ($data['params'] as $param) { if (in_array($param['name'], ['flags', 'random_id', 'random_bytes'])) { continue; } if ($type === 'EncryptedMessage' && $param['name'] === 'bytes' && !isset($this->settings['td'])) { $param['name'] = 'decrypted_message'; $param['type'] = 'DecryptedMessage'; } $type_or_subtype = isset($param['subtype']) ? 'subtype' : 'type'; $type_or_bare_type = ctype_upper($this->end(explode('.', $param[$type_or_subtype]))[0]) || in_array($param[$type_or_subtype], ['!X', 'X', 'bytes', 'true', 'false', 'double', 'string', 'Bool', 'int53', 'int', 'long', 'int128', 'int256', 'int512']) ? 'types' : 'constructors'; $param[$type_or_subtype] = str_replace(['.', 'true', 'false'], ['_', 'Bool', 'Bool'], $param[$type_or_subtype]); if (preg_match('/%/', $param[$type_or_subtype])) { $param[$type_or_subtype] = $this->constructors->find_by_type(str_replace('%', '', $param[$type_or_subtype]))['predicate']; } if (substr($param[$type_or_subtype], -1) === '>') { $param[$type_or_subtype] = substr($param[$type_or_subtype], 0, -1); } $params .= "'".$param['name']."' => "; $param[$type_or_subtype] = '['.$this->escape($param[$type_or_subtype]).'](../'.$type_or_bare_type.'/'.$param[$type_or_subtype].'.md)'; $params .= (isset($param['subtype']) ? '\\['.$param[$type_or_subtype].'\\]' : $param[$type_or_subtype]).', '; } $md_constructor = str_replace('_', '\\_', $constructor.$layer); $this->docs_constructors[$constructor] = '[$'.$md_constructor.'](../constructors/'.$php_constructor.$layer.'.md) = \\['.$params.'\\];<a name="'.$constructor.$layer.'"></a> '; $table = empty($data['params']) ? '' : '### Attributes: | Name | Type | Required | |----------|---------------|----------| '; if (!isset($this->td_descriptions['constructors'][$data['predicate']])) { $this->add_to_lang('object_'.$data['predicate']); if (\danog\MadelineProto\Lang::$lang['en']['object_'.$data['predicate']] !== '') { $this->td_descriptions['constructors'][$data['predicate']]['description'] = \danog\MadelineProto\Lang::$lang['en']['object_'.$data['predicate']]; } } if (isset($this->td_descriptions['constructors'][$data['predicate']]) && !empty($data['params'])) { $table = '### Attributes: | Name | Type | Required | Description | |----------|---------------|----------|-------------| '; } $params = ''; $lua_params = ''; $pwr_params = ''; $hasreplymarkup = false; $hasentities = false; foreach ($data['params'] as $param) { if (in_array($param['name'], ['flags', 'random_id', 'random_bytes'])) { continue; } if ($type === 'EncryptedMessage' && $param['name'] === 'bytes' && !isset($this->settings['td'])) { $param['name'] = 'decrypted_message'; $param['type'] = 'DecryptedMessage'; } if ($type === 'DecryptedMessageMedia' && in_array($param['name'], ['key', 'iv'])) { unset(\danog\MadelineProto\Lang::$lang['en']['object_'.$data['predicate'].'_param_'.$param['name'].'_type_'.$param['type']]); continue; } $ptype = str_replace('.', '_', $param[isset($param['subtype']) ? 'subtype' : 'type']); //$type_or_bare_type = 'types'; /*if (isset($param['subtype'])) { if ($param['type'] === 'vector') { $type_or_bare_type = 'constructors'; } }*/ if (preg_match('/%/', $ptype)) { $ptype = $this->constructors->find_by_type(str_replace('%', '', $ptype))['predicate']; } $type_or_bare_type = (ctype_upper($this->end(explode('_', $ptype))[0]) || in_array($ptype, ['!X', 'X', 'bytes', 'true', 'false', 'double', 'string', 'Bool', 'int53', 'int', 'long', 'int128', 'int256', 'int512'])) && $ptype !== 'MTmessage' ? 'types' : 'constructors'; if (substr($ptype, -1) === '>') { $ptype = substr($ptype, 0, -1); } switch ($ptype) { case 'true': case 'false': $ptype = 'Bool'; } $human_ptype = $ptype; if (strpos($type, 'Input') === 0 && in_array($ptype, ['User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputDialogPeer', 'DialogPeer', 'NotifyPeer', 'InputNotifyPeer', 'InputPeer']) && !isset($this->settings['td'])) { $human_ptype = 'Username, chat ID, Update, Message or '.$ptype; } if (strpos($type, 'Input') === 0 && in_array($ptype, ['InputMedia', 'InputDocument', 'InputPhoto']) && !isset($this->settings['td'])) { $human_ptype = 'MessageMedia, Message, Update or '.$ptype; } if (in_array($ptype, ['InputMessage']) && !isset($this->settings['td'])) { $human_ptype = 'Message ID or '.$ptype; } if (in_array($ptype, ['InputEncryptedChat']) && !isset($this->settings['td'])) { $human_ptype = 'Secret chat ID, Update, EncryptedMessage or '.$ptype; } if (in_array($ptype, ['InputFile']) && !isset($this->settings['td'])) { $human_ptype = 'File path or '.$ptype; } if (in_array($ptype, ['InputEncryptedFile']) && !isset($this->settings['td'])) { $human_ptype = 'File path or '.$ptype; } $table .= '|'.str_replace('_', '\\_', $param['name']).'|'.(isset($param['subtype']) ? 'Array of ' : '').'['.str_replace('_', '\\_', $human_ptype).'](../'.$type_or_bare_type.'/'.$ptype.'.md) | '.(isset($param['pow']) || $this->constructors->find_by_predicate(lcfirst($param['type']).'Empty') || ($data['type'] === 'InputMedia' && $param['name'] === 'mime_type') || ($data['type'] === 'DocumentAttribute' && in_array($param['name'], ['w', 'h', 'duration'])) ? 'Optional' : 'Yes').'|'; if (!isset($this->td_descriptions['constructors'][$data['predicate']]['params'][$param['name']])) { $this->add_to_lang('object_'.$data['predicate'].'_param_'.$param['name'].'_type_'.$param['type']); if (isset($this->td_descriptions['constructors'][$data['predicate']]['description'])) { $this->td_descriptions['constructors'][$data['predicate']]['params'][$param['name']] = \danog\MadelineProto\Lang::$lang['en']['object_'.$data['predicate'].'_param_'.$param['name'].'_type_'.$param['type']]; } } if (isset($this->td_descriptions['constructors'][$data['predicate']]['params'][$param['name']])) { $table .= $this->td_descriptions['constructors'][$data['predicate']]['params'][$param['name']].'|'; } $table .= PHP_EOL; $pptype = in_array($ptype, ['string', 'bytes']) ? "'".$ptype."'" : $ptype; $ppptype = in_array($ptype, ['string']) ? '"'.$ptype.'"' : $ptype; $ppptype = in_array($ptype, ['bytes']) ? '{"_": "bytes", "bytes":"base64 encoded '.$ptype.'"}' : $ppptype; $params .= ", '".$param['name']."' => "; $params .= isset($param['subtype']) ? '['.$pptype.', '.$pptype.']' : $pptype; $lua_params .= ', '.$param['name'].'='; $lua_params .= isset($param['subtype']) ? '{'.$pptype.'}' : $pptype; $pwr_params .= ', "'.$param['name'].'": '.(isset($param['subtype']) ? '['.$ppptype.']' : $ppptype); if ($param['name'] === 'reply_markup') { $hasreplymarkup = true; } } $params = "['_' => '".$data['predicate']."'".$params.']'; $lua_params = "{_='".$data['predicate']."'".$lua_params.'}'; $pwr_params = '{"_": "'.$data['predicate'].'"'.$pwr_params.'}'; $description = isset($this->td_descriptions['constructors'][$data['predicate']]) ? $this->td_descriptions['constructors'][$data['predicate']]['description'] : $constructor.' attributes, type and example'; $header = '--- title: '.$data['predicate'].' description: '.$description.' image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- # Constructor: '.str_replace('_', '\\_', $data['predicate'].$layer).' [Back to constructors index](index.md) '; $table .= ' '; if (isset($this->td_descriptions['constructors'][$data['predicate']])) { $header .= $this->td_descriptions['constructors'][$data['predicate']]['description'].PHP_EOL.PHP_EOL; } $type = '### Type: ['.str_replace('_', '\\_', $php_type).'](../types/'.$php_type.'.md) '; $example = ''; if (!isset($this->settings['td'])) { $example = '### Example: ```php $'.$constructor.$layer.' = '.$params.'; ``` [PWRTelegram](https://pwrtelegram.xyz) json-encoded version: ``` '.$pwr_params.' ``` Or, if you\'re into Lua: ```lua '.$constructor.$layer.'='.$lua_params.' ``` '; if ($hasreplymarkup) { $example .= ' ## Usage of reply_markup You can provide bot API reply_markup objects here. '; } if ($hasentities) { $example .= ' ## Usage of parse_mode: Set parse_mode to html to enable HTML parsing of the message. Set parse_mode to Markdown to enable markown AND html parsing of the message. The following tags are currently supported: ```html <br>a newline <b><i>bold works ok, internal tags are stripped</i> </b> <strong>bold</strong> <em>italic</em> <i>italic</i> <code>inline fixed-width code</code> <pre>pre-formatted fixed-width code block</pre> <a href="https://github.com">URL</a> <a href="mention:@danogentili">Mention by username</a> <a href="mention:186785362">Mention by user id</a> <pre language="json">Pre tags can have a language attribute</pre> ``` You can also use normal markdown, note that to create mentions you must use the `mention:` syntax like in html: ```markdown [Mention by username](mention:@danogentili) [Mention by user id](mention:186785362) ``` MadelineProto supports all html entities supported by [html_entity_decode](http://php.net/manual/en/function.html-entity-decode.php). '; } } file_put_contents('constructors/'.$constructor.$layer.'.md', $header.$table.$type.$example); } $this->logger->logger('Generating constructors index...', \danog\MadelineProto\Logger::NOTICE); ksort($this->docs_constructors); $last_namespace = ''; foreach ($this->docs_constructors as $constructor => &$value) { $new_namespace = preg_replace('/_.*/', '', $constructor); $br = $new_namespace != $last_namespace ? '*** <br><br>' : ''; $value = $br.$value; $last_namespace = $new_namespace; } file_put_contents('constructors/'.$this->index, '--- title: Constructors description: List of constructors image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- # Constructors [Back to API documentation index](..) '.implode('', $this->docs_constructors)); } } <?php /** * TL callback module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\TL; interface TLCallback { const METHOD_CALLBACK = 0; const METHOD_BEFORE_CALLBACK = 1; const CONSTRUCTOR_CALLBACK = 2; const CONSTRUCTOR_BEFORE_CALLBACK = 3; const CONSTRUCTOR_SERIALIZE_CALLBACK = 4; const TYPE_MISMATCH_CALLBACK = 5; public function getMethodCallbacks(): array; public function getMethodBeforeCallbacks(): array; public function getConstructorCallbacks(): array; public function getConstructorBeforeCallbacks(): array; public function getConstructorSerializeCallbacks(): array; public function getTypeMismatchCallbacks(): array; } <?php /** * TL module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\TL; trait TL { public $encrypted_layer = -1; public $constructors; public $methods; public $td_constructors; public $td_methods; public $td_descriptions; public $tl_callbacks = []; public function construct_tl($files, $objects = []) { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['TL_loading'], \danog\MadelineProto\Logger::VERBOSE); $this->update_callbacks($objects); $this->constructors = new TLConstructor(); $this->methods = new TLMethod(); $this->td_constructors = new TLConstructor(); $this->td_methods = new TLMethod(); $this->td_descriptions = ['types' => [], 'constructors' => [], 'methods' => []]; foreach ($files as $scheme_type => $file) { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['file_parsing'], basename($file)), \danog\MadelineProto\Logger::VERBOSE); $filec = file_get_contents(\danog\MadelineProto\Absolute::absolute($file)); $TL_dict = json_decode($filec, true); if ($TL_dict === null) { $TL_dict = ['methods' => [], 'constructors' => []]; $type = 'constructors'; $layer = null; $tl_file = explode("\n", $filec); $key = 0; $e = null; $class = null; $dparams = []; foreach ($tl_file as $line_number => $line) { $line = rtrim($line); if (preg_match('|^//@|', $line)) { $list = explode(' @', str_replace('//', ' ', $line)); foreach ($list as $elem) { if ($elem === '') { continue; } $elem = explode(' ', $elem, 2); if ($elem[0] === 'class') { $elem = explode(' ', $elem[1], 2); $class = $elem[0]; continue; } if ($elem[0] === 'description') { if (!is_null($class)) { $this->td_descriptions['types'][$class] = $elem[1]; $class = null; } else { $e = $elem[1]; } continue; } if ($elem[0] === 'param_description') { $elem[0] = 'description'; } $dparams[$elem[0]] = $elem[1]; } continue; } $line = preg_replace(['|//.*|', '|^\\s+$|'], '', $line); if ($line === '') { continue; } if ($line === '---functions---') { $type = 'methods'; continue; } if ($line === '---types---') { $type = 'constructors'; continue; } if (preg_match('|^===(\d*)===|', $line, $matches)) { $layer = (int) $matches[1]; continue; } if (strpos($line, 'vector#') === 0) { continue; } if (strpos($line, ' ?= ') !== false) { continue; } $name = preg_replace(['/#.*/', '/\\s.*/'], '', $line); if (in_array($name, ['bytes', 'int128', 'int256', 'int512'])) { continue; } $clean = preg_replace(['/:bytes /', '/;/', '/#[a-f0-9]+ /', '/ [a-zA-Z0-9_]+\\:flags\\.[0-9]+\\?true/', '/[<]/', '/[>]/', '/ /', '/^ /', '/ $/', '/\\?bytes /', '/{/', '/}/'], [':string ', '', ' ', '', ' ', ' ', ' ', '', '', '?string ', '', ''], $line); $id = hash('crc32b', $clean); if (preg_match('/^[^\s]+#([a-f0-9]*)/i', $line, $matches)) { $nid = str_pad($matches[1], 8, '0', \STR_PAD_LEFT); if ($id !== $nid && $scheme_type !== 'botAPI') { $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['crc32_mismatch'], $id, $nid, $line), \danog\MadelineProto\Logger::ERROR); } $id = $nid; } if (!is_null($e)) { $this->td_descriptions[$type][$name] = ['description' => $e, 'params' => $dparams]; $e = null; $dparams = []; } $TL_dict[$type][$key][$type === 'constructors' ? 'predicate' : 'method'] = $name; $TL_dict[$type][$key]['id'] = strrev(hex2bin($id)); $TL_dict[$type][$key]['params'] = []; $TL_dict[$type][$key]['type'] = preg_replace(['/.+\\s+=\\s+/', '/;/'], '', $line); if ($layer !== null) { $TL_dict[$type][$key]['layer'] = $layer; } if ($name !== 'vector' && $TL_dict[$type][$key]['type'] !== 'Vector t') { foreach (explode(' ', preg_replace(['/^[^\\s]+\\s/', '/=\\s[^\\s]+/', '/\\s$/'], '', $line)) as $param) { if ($param === '') { continue; } if ($param[0] === '{') { continue; } if ($param === '#') { continue; } $explode = explode(':', $param); $TL_dict[$type][$key]['params'][] = ['name' => $explode[0], 'type' => $explode[1]]; } } $key++; } } else { foreach ($TL_dict['constructors'] as $key => $value) { $TL_dict['constructors'][$key]['id'] = $this->pack_signed_int($TL_dict['constructors'][$key]['id']); } foreach ($TL_dict['methods'] as $key => $value) { $TL_dict['methods'][$key]['id'] = $this->pack_signed_int($TL_dict['methods'][$key]['id']); } } if (empty($TL_dict) || empty($TL_dict['constructors']) || !isset($TL_dict['methods'])) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['src_file_invalid'].$file); } $orig = $this->encrypted_layer; $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['translating_obj'], \danog\MadelineProto\Logger::ULTRA_VERBOSE); foreach ($TL_dict['constructors'] as $elem) { if ($scheme_type === 'secret') { $this->encrypted_layer = max($this->encrypted_layer, $elem['layer']); } $this->{($scheme_type === 'td' ? 'td_' : '').'constructors'}->add($elem, $scheme_type); } $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['translating_methods'], \danog\MadelineProto\Logger::ULTRA_VERBOSE); foreach ($TL_dict['methods'] as $elem) { $this->{($scheme_type === 'td' ? 'td_' : '').'methods'}->add($elem); if ($scheme_type === 'secret') { $this->encrypted_layer = max($this->encrypted_layer, $elem['layer']); } } } if (isset($files['td']) && isset($files['telegram'])) { foreach ($this->td_constructors->by_id as $id => $data) { $name = $data['predicate']; if ($this->constructors->find_by_id($id) === false) { unset($this->td_descriptions['constructors'][$name]); } else { if (!count($this->td_descriptions['constructors'][$name]['params'])) { continue; } foreach ($this->td_descriptions['constructors'][$name]['params'] as $k => $param) { $this->td_descriptions['constructors'][$name]['params'][$k] = str_replace('nullable', 'optional', $param); } } } foreach ($this->td_methods->by_id as $id => $data) { $name = $data['method']; if ($this->methods->find_by_id($id) === false) { unset($this->td_descriptions['methods'][$name]); } else { foreach ($this->td_descriptions['methods'][$name]['params'] as $k => $param) { $this->td_descriptions['constructors'][$name]['params'][$k] = str_replace('nullable', 'optional', $param); } } } } } public function get_method_namespaces() { $res = []; foreach ($this->methods->method_namespace as $pair) { $a = key($pair); $res[$a] = $a; } return $res; } public function get_methods_namespaced() { return $this->methods->method_namespace; } public function update_callbacks($objects) { $this->tl_callbacks = []; foreach ($objects as $object) { if (!isset(class_implements(get_class($object))['danog\\MadelineProto\\TL\\TLCallback'])) { throw new Exception('Invalid callback object provided!'); } $new = [ TLCallback::METHOD_BEFORE_CALLBACK => $object->getMethodBeforeCallbacks(), TLCallback::METHOD_CALLBACK => $object->getMethodCallbacks(), TLCallback::CONSTRUCTOR_BEFORE_CALLBACK => $object->getConstructorBeforeCallbacks(), TLCallback::CONSTRUCTOR_CALLBACK => $object->getConstructorCallbacks(), TLCallback::CONSTRUCTOR_SERIALIZE_CALLBACK => $object->getConstructorSerializeCallbacks(), TLCallback::TYPE_MISMATCH_CALLBACK => $object->getTypeMismatchCallbacks(), ]; foreach ($new as $type => $values) { foreach ($values as $match => $callback) { if (!isset($this->tl_callbacks[$type][$match])) { $this->tl_callbacks[$type][$match] = []; } if (in_array($type, [TLCallback::TYPE_MISMATCH_CALLBACK, TLCallback::CONSTRUCTOR_SERIALIZE_CALLBACK])) { $this->tl_callbacks[$type][$match] = $callback; } else { $this->tl_callbacks[$type][$match] = array_merge($callback, $this->tl_callbacks[$type][$match]); } } } } } public function deserialize_bool($id) { $tl_elem = $this->constructors->find_by_id($id); if ($tl_elem === false) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['bool_error']); } return $tl_elem['predicate'] === 'boolTrue'; } public function serialize_object($type, $object, $ctx, $layer = -1) { switch ($type['type']) { case 'int': if (!is_numeric($object)) { if (is_array($object) && $type['name'] === 'hash') { $object = $this->gen_vector_hash($object); } else { throw new Exception(\danog\MadelineProto\Lang::$current_lang['not_numeric']); } } return $this->pack_signed_int($object); case '#': if (!is_numeric($object)) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['not_numeric']); } return $this->pack_unsigned_int($object); case 'long': if (is_object($object)) { return str_pad(strrev($object->toBytes()), 8, chr(0)); } if (is_string($object) && strlen($object) === 8) { return $object; } if (is_string($object) && strlen($object) === 9 && $object[0] === 'a') { return substr($object, 1); } if (!is_numeric($object)) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['not_numeric']); } return $this->pack_signed_long($object); case 'int128': if (strlen($object) !== 16) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['long_not_16']); } return (string) $object; case 'int256': if (strlen($object) !== 32) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['long_not_32']); } return (string) $object; case 'int512': if (strlen($object) !== 64) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['long_not_64']); } return (string) $object; case 'double': return $this->pack_double($object); case 'string': if (!is_string($object)) { throw new Exception("You didn't provide a valid string"); } $object = pack('C*',...unpack('C*', $object)); $l = strlen($object); $concat = ''; if ($l <= 253) { $concat .= chr($l); $concat .= $object; $concat .= pack('@'.$this->posmod(-$l - 1, 4)); } else { $concat .= chr(254); $concat .= substr($this->pack_signed_int($l), 0, 3); $concat .= $object; $concat .= pack('@'.$this->posmod(-$l, 4)); } return $concat; case 'bytes': if (is_array($object) && isset($object['_']) && $object['_'] === 'bytes') { $object = base64_decode($object['bytes']); } if (!is_string($object) && !$object instanceof \danog\MadelineProto\TL\Types\Bytes) { throw new Exception("You didn't provide a valid string"); } $l = strlen($object); $concat = ''; if ($l <= 253) { $concat .= chr($l); $concat .= $object; $concat .= pack('@'.$this->posmod(-$l - 1, 4)); } else { $concat .= chr(254); $concat .= substr($this->pack_signed_int($l), 0, 3); $concat .= $object; $concat .= pack('@'.$this->posmod(-$l, 4)); } return $concat; case 'Bool': return $this->constructors->find_by_predicate((bool) $object ? 'boolTrue' : 'boolFalse')['id']; case 'true': return; case '!X': return $object; case 'Vector t': if (!is_array($object)) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['array_invalid']); } if (isset($object['_'])) { throw new Exception('You must provide an array of '.$type['subtype'].' objects, not a '.$type['subtype']." object. Example: [['_' => ".$type['subtype'].',... ]]'); } $concat = $this->constructors->find_by_predicate('vector')['id']; $concat .= $this->pack_unsigned_int(count($object)); foreach ($object as $k => $current_object) { $concat .= $this->serialize_object(['type' => $type['subtype']], $current_object, $k); } return $concat; case 'vector': if (!is_array($object)) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['array_invalid']); } $concat = $this->pack_unsigned_int(count($object)); foreach ($object as $k => $current_object) { $concat .= $this->serialize_object(['type' => $type['subtype']], $current_object, $k); } return $concat; case 'Object': if (is_string($object)) { return $object; } } $auto = false; if ($type['type'] === 'InputMessage' && !is_array($object)) { $object = ['_' => 'inputMessageID', 'id' => $object]; } elseif (isset($this->tl_callbacks[TLCallback::TYPE_MISMATCH_CALLBACK][$type['type']]) && (!is_array($object) || isset($object['_']) && $this->constructors->find_by_predicate($object['_'])['type'] !== $type['type'])) { $object = $this->tl_callbacks[TLCallback::TYPE_MISMATCH_CALLBACK][$type['type']]($object); if (!isset($object[$type['type']])) { throw new \danog\MadelineProto\Exception("Could not convert {$type['type']} object"); } $object = $object[$type['type']]; } if (!isset($object['_'])) { $constructorData = $this->constructors->find_by_predicate($type['type'], $layer); if ($constructorData === false) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['predicate_not_set']); } $auto = true; $object['_'] = $constructorData['predicate']; } if (isset($this->tl_callbacks[TLCallback::CONSTRUCTOR_SERIALIZE_CALLBACK][$object['_']])) { $object = $this->tl_callbacks[TLCallback::CONSTRUCTOR_SERIALIZE_CALLBACK][$object['_']]($object); } $predicate = $object['_']; $constructorData = $this->constructors->find_by_predicate($predicate, $layer); if ($constructorData === false) { $this->logger->logger($object, \danog\MadelineProto\Logger::FATAL_ERROR); throw new Exception(sprintf(\danog\MadelineProto\Lang::$current_lang['type_extract_error'], $predicate)); } if ($bare = $type['type'] != '' && $type['type'][0] === '%') { $type['type'] = substr($type['type'], 1); } if ($predicate === $type['type'] && !$auto) { $bare = true; } if ($predicate === 'messageEntityMentionName') { $constructorData = $this->constructors->find_by_predicate('inputMessageEntityMentionName'); } $concat = ''; if (!$bare) { $concat = $constructorData['id']; } return $concat.$this->serialize_params($constructorData, $object, '', $layer); } public function serialize_method($method, $arguments) { if ($method === 'messages.importChatInvite' && isset($arguments['hash']) && is_string($arguments['hash']) && preg_match('@(?:t|telegram)\.(?:me|dog)/(joinchat/)?([a-z0-9_-]*)@i', $arguments['hash'], $matches)) { if ($matches[1] === '') { $method = 'channels.joinChannel'; $arguments['channel'] = $matches[2]; } else { $arguments['hash'] = $matches[2]; } } elseif ($method === 'messages.checkChatInvite' && isset($arguments['hash']) && is_string($arguments['hash']) && preg_match('@(?:t|telegram)\.(?:me|dog)/joinchat/([a-z0-9_-]*)@i', $arguments['hash'], $matches)) { $arguments['hash'] = $matches[1]; } elseif ($method === 'channels.joinChannel' && isset($arguments['channel']) && is_string($arguments['channel']) && preg_match('@(?:t|telegram)\.(?:me|dog)/(joinchat/)?([a-z0-9_-]*)@i', $arguments['channel'], $matches)) { if ($matches[1] !== '') { $method = 'messages.importChatInvite'; $arguments['hash'] = $matches[2]; } } elseif ($method === 'messages.sendMessage' && isset($arguments['peer']['_']) && $arguments['peer']['_'] === 'inputEncryptedChat') { $method = 'messages.sendEncrypted'; $arguments = ['peer' => $arguments['peer'], 'message' => $arguments]; if (!isset($arguments['message']['_'])) { $arguments['message']['_'] = 'decryptedMessage'; } if (!isset($arguments['message']['ttl'])) { $arguments['message']['ttl'] = 0; } if (isset($arguments['message']['reply_to_msg_id'])) { $arguments['message']['reply_to_random_id'] = $arguments['message']['reply_to_msg_id']; } } elseif ($method === 'messages.sendEncryptedFile') { if (isset($arguments['file'])) { if (!is_array($arguments['file']) && $this->settings['upload']['allow_automatic_upload']) { $arguments['file'] = $this->upload_encrypted($arguments['file']); } if (isset($arguments['file']['key'])) { $arguments['message']['media']['key'] = $arguments['file']['key']; } if (isset($arguments['file']['iv'])) { $arguments['message']['media']['iv'] = $arguments['file']['iv']; } } } elseif (in_array($method, ['messages.addChatUser', 'messages.deleteChatUser', 'messages.editChatAdmin', 'messages.editChatPhoto', 'messages.editChatTitle', 'messages.getFullChat', 'messages.exportChatInvite', 'messages.editChatAdmin', 'messages.migrateChat']) && isset($arguments['chat_id']) && (!is_numeric($arguments['chat_id']) || $arguments['chat_id'] < 0)) { $res = $this->get_info($arguments['chat_id']); if ($res['type'] !== 'chat') { throw new \danog\MadelineProto\Exception('chat_id is not a chat id (only normal groups allowed, not supergroups)!'); } $arguments['chat_id'] = $res['chat_id']; } elseif ($method === 'photos.updateProfilePhoto') { if (isset($arguments['id'])) { if (!is_array($arguments['id'])) { $method = 'photos.uploadProfilePhoto'; $arguments['file'] = $arguments['id']; } } elseif (isset($arguments['file'])) { $method = 'photos.uploadProfilePhoto'; } } elseif ($method === 'photos.uploadProfilePhoto') { if (isset($arguments['file'])) { if (is_array($arguments['file']) && !in_array($arguments['file']['_'], ['inputFile', 'inputFileBig'])) { $method = 'photos.uploadProfilePhoto'; $arguments['id'] = $arguments['file']; } } elseif (isset($arguments['id'])) { $method = 'photos.updateProfilePhoto'; } } $tl = $this->methods->find_by_method($method); if ($tl === false) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['method_not_found'].$method); } return $tl['id'].$this->serialize_params($tl, $arguments, $method); } public function serialize_params($tl, $arguments, $ctx, $layer = -1) { $serialized = ''; $arguments = $this->botAPI_to_MTProto($arguments); $flags = 0; foreach ($tl['params'] as $cur_flag) { if (isset($cur_flag['pow'])) { switch ($cur_flag['type']) { case 'true': case 'false': $flags = isset($arguments[$cur_flag['name']]) && $arguments[$cur_flag['name']] ? $flags | $cur_flag['pow'] : $flags & ~$cur_flag['pow']; unset($arguments[$cur_flag['name']]); break; case 'Bool': $arguments[$cur_flag['name']] = isset($arguments[$cur_flag['name']]) && $arguments[$cur_flag['name']] && ($flags & $cur_flag['pow']) != 0; if (($flags & $cur_flag['pow']) === 0) { unset($arguments[$cur_flag['name']]); } break; default: $flags = isset($arguments[$cur_flag['name']]) && $arguments[$cur_flag['name']] !== null ? $flags | $cur_flag['pow'] : $flags & ~$cur_flag['pow']; break; } } } $arguments['flags'] = $flags; foreach ($tl['params'] as $current_argument) { if (!isset($arguments[$current_argument['name']])) { if (isset($current_argument['pow']) && (in_array($current_argument['type'], ['true', 'false']) || ($flags & $current_argument['pow']) === 0)) { //$this->logger->logger('Skipping '.$current_argument['name'].' of type '.$current_argument['type'); continue; } if ($current_argument['name'] === 'random_bytes') { $serialized .= $this->serialize_object(['type' => 'bytes'], $this->random(15 + 4 * $this->random_int($modulus = 3)), 'random_bytes'); continue; } if ($current_argument['name'] === 'data' && isset($tl['method']) && in_array($tl['method'], ['messages.sendEncrypted', 'messages.sendEncryptedFile', 'messages.sendEncryptedService']) && isset($arguments['message'])) { $serialized .= $this->serialize_object($current_argument, $this->encrypt_secret_message($arguments['peer']['chat_id'], $arguments['message']), 'data'); continue; } if ($current_argument['name'] === 'random_id') { switch ($current_argument['type']) { case 'long': $serialized .= $this->random(8); continue 2; case 'int': $serialized .= $this->random(4); continue 2; case 'Vector t': if (isset($arguments['id'])) { $serialized .= $this->constructors->find_by_predicate('vector')['id']; $serialized .= $this->pack_unsigned_int(count($arguments['id'])); $serialized .= $this->random(8 * count($arguments['id'])); continue 2; } } } if ($current_argument['name'] === 'hash' && $current_argument['type'] === 'int') { $serialized .= pack('@4'); continue; } if ($tl['type'] === 'InputMedia' && $current_argument['name'] === 'mime_type') { $serialized .= $this->serialize_object($current_argument, $arguments['file']['mime_type'], $current_argument['name'], $layer); continue; } if ($tl['type'] === 'DocumentAttribute' && in_array($current_argument['name'], ['w', 'h', 'duration'])) { $serialized .= pack('@4'); continue; } if (in_array($current_argument['type'], ['bytes', 'string', 'Vector t'])) { $serialized .= pack('@4'); continue; } if (($id = $this->constructors->find_by_predicate(lcfirst($current_argument['type']).'Empty', isset($tl['layer']) ? $tl['layer'] : -1)) && $id['type'] === $current_argument['type']) { $serialized .= $id['id']; continue; } if (($id = $this->constructors->find_by_predicate('input'.$current_argument['type'].'Empty', isset($tl['layer']) ? $tl['layer'] : -1)) && $id['type'] === $current_argument['type']) { $serialized .= $id['id']; continue; } throw new Exception(\danog\MadelineProto\Lang::$current_lang['params_missing'], $current_argument['name']); } if (in_array($current_argument['type'], ['DataJSON', '%DataJSON'])) { $arguments[$current_argument['name']] = ['_' => 'dataJSON', 'data' => json_encode($arguments[$current_argument['name']])]; } if (isset($current_argument['subtype']) && in_array($current_argument['subtype'], ['DataJSON', '%DataJSON'])) { array_walk($arguments[$current_argument['name']], function (&$arg) { $arg = ['_' => 'dataJSON', 'data' => json_encode($arg)]; }); } if (!is_array($arguments[$current_argument['name']]) && $current_argument['type'] === 'InputFile' && $this->settings['upload']['allow_automatic_upload']) { $arguments[$current_argument['name']] = $this->upload($arguments[$current_argument['name']]); } if ($current_argument['type'] === 'InputEncryptedChat' && (!is_array($arguments[$current_argument['name']]) || isset($arguments[$current_argument['name']]['_']) && $this->constructors->find_by_predicate($arguments[$current_argument['name']]['_'])['type'] !== $current_argument['type'])) { if (is_array($arguments[$current_argument['name']])) { $arguments[$current_argument['name']] = $this->get_info($arguments[$current_argument['name']])['InputEncryptedChat']; } else { if (!isset($this->secret_chats[$arguments[$current_argument['name']]])) { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['sec_peer_not_in_db']); } $arguments[$current_argument['name']] = $this->secret_chats[$arguments[$current_argument['name']]]['InputEncryptedChat']; } } //$this->logger->logger('Serializing '.$current_argument['name'].' of type '.$current_argument['type'); $serialized .= $this->serialize_object($current_argument, $arguments[$current_argument['name']], $current_argument['name'], $layer); } return $serialized; } public function get_length($stream, $type = ['type' => '']) { if (is_string($stream)) { $res = fopen('php://memory', 'rw+b'); fwrite($res, $stream); fseek($res, 0); $stream = $res; } elseif (!is_resource($stream)) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['stream_handle_invalid']); } $this->deserialize($stream, $type); return ftell($stream); } /** * :type stream: io.BytesIO object. */ public function deserialize($stream, $type = ['type' => '']) { if (is_string($stream)) { $res = fopen('php://memory', 'rw+b'); fwrite($res, $stream); fseek($res, 0); $stream = $res; } elseif (!is_resource($stream)) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['stream_handle_invalid']); } switch ($type['type']) { case 'Bool': return $this->deserialize_bool(stream_get_contents($stream, 4)); case 'int': return $this->unpack_signed_int(stream_get_contents($stream, 4)); case '#': return unpack('V', stream_get_contents($stream, 4))[1]; case 'long': if (isset($type['idstrlong'])) { return stream_get_contents($stream, 8); } return \danog\MadelineProto\Magic::$bigint || isset($type['strlong']) ? stream_get_contents($stream, 8) : $this->unpack_signed_long(stream_get_contents($stream, 8)); case 'double': return $this->unpack_double(stream_get_contents($stream, 8)); case 'int128': return stream_get_contents($stream, 16); case 'int256': return stream_get_contents($stream, 32); case 'int512': return stream_get_contents($stream, 64); case 'string': case 'bytes': $l = ord(stream_get_contents($stream, 1)); if ($l > 254) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['length_too_big']); } if ($l === 254) { $long_len = unpack('V', stream_get_contents($stream, 3).chr(0))[1]; $x = stream_get_contents($stream, $long_len); $resto = $this->posmod(-$long_len, 4); if ($resto > 0) { stream_get_contents($stream, $resto); } } else { $x = $l ? stream_get_contents($stream, $l) : ''; $resto = $this->posmod(-($l + 1), 4); if ($resto > 0) { stream_get_contents($stream, $resto); } } if (!is_string($x)) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['deserialize_not_str']); } return $type['type'] === 'bytes' ? new Types\Bytes($x) : $x; case 'Vector t': $id = stream_get_contents($stream, 4); $constructorData = $this->constructors->find_by_id($id); if ($constructorData === false) { $constructorData = $this->methods->find_by_id($id); $constructorData['predicate'] = 'method_'.$constructorData['method']; } if ($constructorData === false) { throw new Exception(sprintf(\danog\MadelineProto\Lang::$current_lang['type_extract_error_id'], $type['type'], bin2hex(strrev($id)))); } switch ($constructorData['predicate']) { case 'gzip_packed': return $this->deserialize(gzdecode($this->deserialize($stream, ['type' => 'bytes', 'datacenter' => $type['datacenter']])), ['type' => '', 'datacenter' => $type['datacenter']]); case 'Vector t': case 'vector': break; default: throw new Exception(\danog\MadelineProto\Lang::$current_lang['vector_invalid'].$constructorData['predicate']); } case 'vector': $count = unpack('V', stream_get_contents($stream, 4))[1]; $result = []; $type['type'] = $type['subtype']; for ($i = 0; $i < $count; $i++) { $result[] = $this->deserialize($stream, $type); } return $result; } if ($type['type'] != '' && $type['type'][0] === '%') { $checkType = substr($type['type'], 1); $constructorData = $this->constructors->find_by_type($checkType); if ($constructorData === false) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['constructor_not_found'].$checkType); } } else { $constructorData = $this->constructors->find_by_predicate($type['type']); if ($constructorData === false) { $id = stream_get_contents($stream, 4); $constructorData = $this->constructors->find_by_id($id); if ($constructorData === false) { $constructorData = $this->methods->find_by_id($id); if ($constructorData === false) { throw new Exception(sprintf(\danog\MadelineProto\Lang::$current_lang['type_extract_error_id'], $type['type'], bin2hex(strrev($id)))); } $constructorData['predicate'] = 'method_'.$constructorData['method']; } } } if ($constructorData['predicate'] === 'gzip_packed') { if (!isset($type['subtype'])) { $type['subtype'] = ''; } return $this->deserialize(gzdecode($this->deserialize($stream, ['type' => 'bytes'])), ['type' => '', 'datacenter' => $type['datacenter'], 'subtype' => $type['subtype']]); } if ($constructorData['type'] === 'Vector t') { $constructorData['datacenter'] = $type['datacenter']; $constructorData['subtype'] = isset($type['subtype']) ? $type['subtype'] : ''; $constructorData['type'] = 'vector'; return $this->deserialize($stream, $constructorData); } if ($constructorData['predicate'] === 'boolTrue') { return true; } if ($constructorData['predicate'] === 'boolFalse') { return false; } $x = ['_' => $constructorData['predicate']]; if (isset($this->tl_callbacks[TLCallback::CONSTRUCTOR_BEFORE_CALLBACK][$x['_']])) { foreach ($this->tl_callbacks[TLCallback::CONSTRUCTOR_BEFORE_CALLBACK][$x['_']] as $callback) { $callback($x['_']); } } foreach ($constructorData['params'] as $arg) { if (isset($arg['pow'])) { switch ($arg['type']) { case 'true': case 'false': $x[$arg['name']] = ($x['flags'] & $arg['pow']) !== 0; continue 2; case 'Bool': if (($x['flags'] & $arg['pow']) === 0) { $x[$arg['name']] = false; continue 2; } default: if (($x['flags'] & $arg['pow']) === 0) { continue 2; } } } if (in_array($arg['name'], ['msg_ids', 'msg_id', 'bad_msg_id', 'req_msg_id', 'answer_msg_id', 'first_msg_id'])) { $arg['idstrlong'] = true; } if (in_array($arg['name'], ['key_fingerprint', 'server_salt', 'new_server_salt', 'server_public_key_fingerprints', 'ping_id', 'exchange_id'])) { $arg['strlong'] = true; } if (in_array($arg['name'], ['peer_tag', 'file_token', 'cdn_key', 'cdn_iv'])) { $arg['type'] = 'string'; } if ($x['_'] === 'rpc_result' && $arg['name'] === 'result') { if (isset($this->datacenter->sockets[$type['datacenter']]->outgoing_messages[$x['req_msg_id']]['_']) && isset($this->tl_callbacks[TLCallback::METHOD_BEFORE_CALLBACK][$this->datacenter->sockets[$type['datacenter']]->outgoing_messages[$x['req_msg_id']]['_']]) ) { foreach ($this->tl_callbacks[TLCallback::METHOD_BEFORE_CALLBACK][$this->datacenter->sockets[$type['datacenter']]->outgoing_messages[$x['req_msg_id']]['_']] as $callback) { $callback($this->datacenter->sockets[$type['datacenter']]->outgoing_messages[$x['req_msg_id']]['_']); } } if (isset($this->datacenter->sockets[$type['datacenter']]->outgoing_messages[$x['req_msg_id']]['type']) && stripos($this->datacenter->sockets[$type['datacenter']]->outgoing_messages[$x['req_msg_id']]['type'], '<') !== false ) { $arg['subtype'] = str_replace(['Vector<', '>'], '', $this->datacenter->sockets[$type['datacenter']]->outgoing_messages[$x['req_msg_id']]['type']); } } if (isset($type['datacenter'])) { $arg['datacenter'] = $type['datacenter']; } $x[$arg['name']] = $this->deserialize($stream, $arg); if ($arg['name'] === 'random_bytes') { if (strlen($x[$arg['name']]) < 15) { throw new \danog\MadelineProto\SecurityException(\danog\MadelineProto\Lang::$current_lang['rand_bytes_too_small']); } else { unset($x[$arg['name']]); } } } if (isset($x['flags'])) { // I don't think we need this anymore unset($x['flags']); } if ($x['_'] === 'dataJSON') { return json_decode($x['data'], true); } elseif ($constructorData['type'] === 'JSONValue') { switch ($x['_']) { case 'jsonNull': return; case 'jsonObject': $res = []; foreach ($x['value'] as $pair) { $res[$pair['key']] = $pair['value']; } return $res; default: return $x['value']; } } if (isset($this->tl_callbacks[TLCallback::CONSTRUCTOR_CALLBACK][$x['_']])) { foreach ($this->tl_callbacks[TLCallback::CONSTRUCTOR_CALLBACK][$x['_']] as $callback) { $callback($x); } } elseif ($x['_'] === 'rpc_result' && isset($this->datacenter->sockets[$type['datacenter']]->outgoing_messages[$x['req_msg_id']]['_']) && isset($this->tl_callbacks[TLCallback::METHOD_CALLBACK][$this->datacenter->sockets[$type['datacenter']]->outgoing_messages[$x['req_msg_id']]['_']]) ) { foreach ($this->tl_callbacks[TLCallback::METHOD_CALLBACK][$this->datacenter->sockets[$type['datacenter']]->outgoing_messages[$x['req_msg_id']]['_']] as $callback) { $callback($this->datacenter->sockets[$type['datacenter']]->outgoing_messages[$x['req_msg_id']], $x['result']); } } if ($x['_'] === 'message' && isset($x['reply_markup']['rows'])) { foreach ($x['reply_markup']['rows'] as $key => $row) { foreach ($row['buttons'] as $bkey => $button) { $x['reply_markup']['rows'][$key]['buttons'][$bkey] = new Types\Button($this, $x, $button); } } } return $x; } } <?php /** * Button module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\TL\Types; class Button implements \JsonSerializable, \ArrayAccess { use \danog\Serializable; private $info = []; private $data = []; public function __magic_construct($API, $message, $button) { $this->data = $button; $this->info['peer'] = $message['to_id'] === ['_' => 'peerUser', 'user_id' => $API->authorization['user']['id']] ? $message['from_id'] : $message['to_id']; $this->info['id'] = $message['id']; $this->info['API'] = $API; } public function __sleep() { return ['data', 'info']; } public function click($donotwait = false) { switch ($this->data['_']) { default: return false; case 'keyboardButtonUrl': return $this->data['url']; case 'keyboardButton': return $this->info['API']->method_call('messages.sendMessage', ['peer' => $this->info['peer'], 'message' => $this->data['text'], 'reply_to_msg_id' => $this->info['id']], ['datacenter' => $this->info['API']->datacenter->curdc]); case 'keyboardButtonCallback': return $this->info['API']->method_call('messages.getBotCallbackAnswer', ['peer' => $this->info['peer'], 'msg_id' => $this->info['id'], 'data' => $this->data['data']], ['noResponse' => $donotwait, 'datacenter' => $this->info['API']->datacenter->curdc]); case 'keyboardButtonGame': return $this->info['API']->method_call('messages.getBotCallbackAnswer', ['peer' => $this->info['peer'], 'msg_id' => $this->info['id'], 'game' => true], ['noResponse' => $donotwait, 'datacenter' => $this->info['API']->datacenter->curdc]); } } public function __debugInfo() { return ['data' => $this->data, 'info' => ['peer' => $this->info['peer'], 'id' => $this->info['id']]]; } public function jsonSerialize() { return (array) $this->data; } public function offsetSet($name, $value) { if ($name === null) { $this->data[] = $value; } else { $this->data[$name] = $value; } } public function offsetGet($name) { return $this->data[$name]; } public function offsetUnset($name) { unset($this->data[$name]); } public function offsetExists($name) { return isset($this->data[$name]); } } <?php /** * Bytes module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\TL\Types; class Bytes extends \Volatile implements \JsonSerializable { use \danog\Serializable; private $bytes = []; public function __magic_construct($bytes) { $this->bytes = $bytes; } public function __sleep() { return ['bytes']; } public function __toString() { return $this->bytes; } public function jsonSerialize() { return ['_' => 'bytes', 'bytes' => base64_encode($this->bytes)]; } } <?php /** * TLParams module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\TL; trait TLParams { public function parse_params($key, $mtproto = false) { foreach ($this->by_id[$key]['params'] as $kkey => $param) { if (preg_match('/(\w*)\.(\d*)\?(.*)/', $param['type'], $matches)) { $param['pow'] = pow(2, $matches[2]); $param['type'] = $matches[3]; } if (preg_match('/^(v|V)ector\<(.*)\>$/', $param['type'], $matches)) { $param['type'] = $matches[1] === 'v' ? 'vector' : 'Vector t'; $param['subtype'] = $matches[2]; $param['subtype'] = ($mtproto && $param['subtype'] === 'Message' ? 'MT' : '').$param['subtype']; $param['subtype'] = $mtproto && $param['subtype'] === '%Message' ? '%MTMessage' : $param['subtype']; } $param['type'] = ($mtproto && $param['type'] === 'Message' ? 'MT' : '').$param['type']; $param['type'] = $mtproto && $param['type'] === '%Message' ? '%MTMessage' : $param['type']; $this->by_id[$key]['params'][$kkey] = $param; } } } <?php /** * PrettyException module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\TL; trait PrettyException { public $tl_trace; public function getTLTrace() { return $this->tl_trace; } public function prettify_tl($init = '') { $tl = false; foreach (array_reverse($this->getTrace()) as $k => $frame) { if (isset($frame['function']) && in_array($frame['function'], ['serialize_params', 'serialize_object'])) { if ($frame['args'][2] !== '') { $this->tl_trace .= $tl ? "['".$frame['args'][2]."']" : "While serializing: \t".$frame['args'][2]; $tl = true; } } else { if ($tl) { $this->tl_trace .= PHP_EOL; } if (isset($frame['function']) && ($frame['function'] === 'handle_rpc_error' && $k === count($this->getTrace()) - 1) || $frame['function'] === 'unserialize') { continue; } $this->tl_trace .= isset($frame['file']) ? str_pad(basename($frame['file']).'('.$frame['line'].'):', 20)."\t" : ''; $this->tl_trace .= isset($frame['function']) ? $frame['function'].'(' : ''; $this->tl_trace .= isset($frame['args']) ? substr(json_encode($frame['args']), 1, -1) : ''; $this->tl_trace .= ')'; $this->tl_trace .= PHP_EOL; $tl = false; } } $this->tl_trace .= $init !== '' ? "['".$init."']" : ''; $this->tl_trace = implode(PHP_EOL, array_reverse(explode(PHP_EOL, $this->tl_trace))); } } <?php /** * TLConstructor module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\TL; class TLConstructor { use \danog\Serializable; use \danog\MadelineProto\Tools; use TLParams; public $by_id = []; public $by_predicate_and_layer = []; public $layers = []; public function __sleep() { return ['by_predicate_and_layer', 'by_id', 'layers']; } public function add($json_dict, $scheme_type) { if (isset($this->by_id[$json_dict['id']]) && (!isset($this->by_id[$json_dict['id']]['layer']) || $this->by_id[$json_dict['id']]['layer'] > $json_dict['layer'])) { return false; } $predicate = (string) (($scheme_type === 'mtproto' && $json_dict['predicate'] === 'message' ? 'MT' : '').$json_dict['predicate']); $this->by_id[$json_dict['id']] = ['predicate' => $predicate, 'params' => $json_dict['params'], 'type' => ($scheme_type === 'mtproto' && $json_dict['type'] === 'Message' ? 'MT' : '').$json_dict['type']]; if ($scheme_type === 'secret') { $this->by_id[$json_dict['id']]['layer'] = $json_dict['layer']; $this->layers[$json_dict['layer']] = $json_dict['layer']; ksort($this->layers); } else { $json_dict['layer'] = ''; } $this->by_predicate_and_layer[$predicate.$json_dict['layer']] = $json_dict['id']; $this->parse_params($json_dict['id'], $scheme_type === 'mtproto'); } public function find_by_type($type) { foreach ($this->by_id as $id => $constructor) { if ($constructor['type'] === $type) { $constructor['id'] = $id; return $constructor; } } return false; } public function find_by_predicate($predicate, $layer = -1) { if ($layer !== -1) { foreach ($this->layers as $alayer) { if ($alayer <= $layer) { if (isset($this->by_predicate_and_layer[$predicate.$alayer])) { $chosenid = $this->by_predicate_and_layer[$predicate.$alayer]; } } elseif (!isset($chosenid)) { $chosenid = $this->by_predicate_and_layer[$predicate.$alayer]; } } if (!isset($chosenid)) { return false; } $constructor = $this->by_id[$chosenid]; $constructor['id'] = $chosenid; return $constructor; } if (isset($this->by_predicate_and_layer[$predicate])) { $constructor = $this->by_id[$this->by_predicate_and_layer[$predicate]]; $constructor['id'] = $this->by_predicate_and_layer[$predicate]; return $constructor; } return false; } public function find_by_id($id) { if (isset($this->by_id[$id])) { $constructor = $this->by_id[$id]; $constructor['id'] = $id; return $constructor; } return false; } } <?php /** * TD module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\TL\Conversion; trait TD { public function tdcli_to_td(&$params, $key = null) { if (!is_array($params)) { return $params; } if (!isset($params['ID'])) { array_walk($params, [$this, 'tdcli_to_td']); return $params; } foreach ($params as $key => $value) { $value = $this->tdcli_to_td($value); if (preg_match('/_$/', $key)) { $params[preg_replace('/_$/', '', $key)] = $value; unset($params[$key]); } } $params['_'] = lcfirst($params['ID']); unset($params['ID']); return $params; } public function td_to_mtproto($params) { $newparams = ['_' => self::REVERSE[$params['_']]]; foreach (self::TD_PARAMS_CONVERSION[$newparams['_']] as $td => $mtproto) { if (is_array($mtproto)) { switch (end($mtproto)) { case 'choose_message_content': switch ($params[$td]['_']) { case 'inputMessageText': $params[$td]['_'] = 'messages.sendMessage'; if (isset($params['disable_web_page_preview'])) { $newparams['no_webpage'] = $params[$td]['disable_web_page_preview']; } $newparams = array_merge($params[$td], $newparams); break; default: throw new Exception(\danog\MadelineProto\Lang::$current_lang['non_text_conversion']); } break; default: $newparams[$mtproto[0]] = isset($params[$td]) ? $params[$td] : null; if (is_array($newparams[$mtproto[0]])) { $newparams[$mtproto[0]] = $this->mtproto_to_td($newparams[$mtproto[0]]); } } } } return $newparams; } public function mtproto_to_tdcli($params) { return $this->td_to_tdcli($this->mtproto_to_td($params)); } public function mtproto_to_td(&$params) { if (!is_array($params)) { return $params; } if (!isset($params['_'])) { array_walk($params, [$this, 'mtproto_to_td']); return $params; } $newparams = ['_' => $params['_']]; if (in_array($params['_'], self::TD_IGNORE)) { return $params; } foreach (self::TD_PARAMS_CONVERSION[$params['_']] as $td => $mtproto) { if (is_string($mtproto)) { $newparams[$td] = $mtproto; } else { switch (end($mtproto)) { case 'choose_chat_id_from_botapi': $newparams[$td] = $this->get_info($params[$mtproto[0]])['bot_api_id'] == $this->authorization['user']['id'] ? $params['from_id'] : $this->get_info($params[$mtproto[0]])['bot_api_id']; break; case 'choose_incoming_or_sent': $newparams[$td] = ['_' => $params['out'] ? 'messageIsSuccessfullySent' : 'messageIsIncoming']; break; case 'choose_can_edit': $newparams[$td] = !isset($params['fwd_from']) && $params['out']; break; case 'choose_can_delete': $newparams[$td] = $params['out']; break; case 'choose_forward_info': if (isset($params['fwd_from'])) { $newparams[$td] = ['_' => 'messageForwardedFromUser']; if (isset($params['fwd_from']['channel_id'])) { $newparams[$td] = ['_' => 'messageForwardedPost', 'chat_id' => '-100'.$params['fwd_from']['channel_id']]; } $newparams[$td]['date'] = $params['fwd_from']['date']; if (isset($params['fwd_from']['channel_post'])) { $newparams[$td]['channel_post'] = $params['fwd_from']['channel_post']; } if (isset($params['fwd_from']['from_id'])) { $newparams[$td]['sender_user_id'] = $params['fwd_from']['from_id']; } } else { $newparams[$td] = null; } break; case 'choose_ttl': $newparams[$td] = isset($params['ttl']) ? $params['ttl'] : 0; break; case 'choose_ttl_expires_in': $newparams[$td] = $newparams['ttl'] - microtime(true); break; case 'choose_message_content': if ($params['message'] !== '') { $newparams[$td] = ['_' => 'messageText', 'text' => $params['message']]; if (isset($params['media']['_']) && $params['media']['_'] === 'messageMediaWebPage') { $newparams[$td]['web_page'] = $this->mtproto_to_td($params['media']['webpage']); } if (isset($params['entities'])) { $newparams[$td]['entities'] = $params['entities']; } } else { throw new Exception(\danog\MadelineProto\Lang::$current_lang['non_text_conversion']); } break; default: if (isset($mtproto[1])) { $newparams[$td] = isset($params[$mtproto[0]][$mtproto[1]]) ? $params[$mtproto[0]][$mtproto[1]] : null; } else { $newparams[$td] = isset($params[$mtproto[0]]) ? $params[$mtproto[0]] : null; } if (is_array($newparams[$td])) { $newparams[$td] = $this->mtproto_to_td($newparams[$td]); } } } } return $newparams; } public function td_to_tdcli($params) { if (!is_array($params)) { return $params; } $newparams = []; foreach ($params as $key => $value) { if ($key === '_') { $newparams['ID'] = ucfirst($value); } else { if (!is_numeric($key) && !preg_match('/_^/', $key)) { $key = $key.'_'; } $newparams[$key] = $this->td_to_tdcli($value); } } return $newparams; } } <?php /** * BotAPIFiles module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\TL\Conversion; trait BotAPIFiles { public function base64url_decode($data) { return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT)); } public function base64url_encode($data) { return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); } public function rle_decode($string) { $new = ''; $last = ''; $null = chr(0); foreach (str_split($string) as $cur) { if ($last === $null) { $new .= str_repeat($last, ord($cur)); $last = ''; } else { $new .= $last; $last = $cur; } } $string = $new.$last; return $string; } public function rle_encode($string) { $new = ''; $count = 0; $null = chr(0); foreach (str_split($string) as $cur) { if ($cur === $null) { $count++; } else { if ($count > 0) { $new .= $null.chr($count); $count = 0; } $new .= $cur; } } return $new; } public function photosize_to_botapi($photoSize, $photo, $thumbnail = false) { $ext = $this->get_extension_from_location(['_' => 'inputFileLocation', 'volume_id' => $photoSize['location']['volume_id'], 'local_id' => $photoSize['location']['local_id'], 'secret' => $photoSize['location']['secret'], 'dc_id' => $photoSize['location']['dc_id']], '.jpg'); $photoSize['location']['access_hash'] = isset($photo['access_hash']) ? $photo['access_hash'] : 0; $photoSize['location']['id'] = isset($photo['id']) ? $photo['id'] : 0; $photoSize['location']['_'] = $thumbnail ? 'bot_thumbnail' : 'bot_photo'; $data = $this->serialize_object(['type' => 'File'], $photoSize['location'], 'File').chr(2); return ['file_id' => $this->base64url_encode($this->rle_encode($data)), 'width' => $photoSize['w'], 'height' => $photoSize['h'], 'file_size' => isset($photoSize['size']) ? $photoSize['size'] : strlen($photoSize['bytes']), 'mime_type' => 'image/jpeg', 'file_name' => $photoSize['location']['volume_id'].'_'.$photoSize['location']['local_id'].$ext]; } public function unpack_file_id($file_id) { $file_id = $this->rle_decode($this->base64url_decode($file_id)); if ($file_id[strlen($file_id) - 1] !== chr(2)) { throw new Exception(\danog\MadelineProto\Lang::$current_lang['last_byte_invalid']); } $deserialized = $this->deserialize($file_id); $res = ['type' => str_replace('bot_', '', $deserialized['_'])]; switch ($deserialized['_']) { case 'bot_thumbnail': case 'bot_photo': $constructor = ['_' => 'photo', 'sizes' => []]; $constructor['id'] = $deserialized['id']; $constructor['access_hash'] = $deserialized['access_hash']; unset($deserialized['id']); unset($deserialized['access_hash']); unset($deserialized['_']); $deserialized['_'] = 'fileLocation'; $constructor['sizes'][0] = ['_' => 'photoSize', 'location' => $deserialized]; $res['MessageMedia'] = ['_' => 'messageMediaPhoto', 'photo' => $constructor, 'caption' => '']; return $res; case 'bot_voice': unset($deserialized['_']); $constructor = array_merge($deserialized, ['_' => 'document', 'mime_type' => '', 'attributes' => [['_' => 'documentAttributeAudio', 'voice' => true]]]); $res['MessageMedia'] = ['_' => 'messageMediaDocument', 'document' => $constructor, 'caption' => '']; return $res; case 'bot_video': unset($deserialized['_']); $constructor = array_merge($deserialized, ['_' => 'document', 'mime_type' => '', 'attributes' => [['_' => 'documentAttributeVideo', 'round_message' => false]]]); $res['MessageMedia'] = ['_' => 'messageMediaDocument', 'document' => $constructor, 'caption' => '']; return $res; case 'bot_video_note': unset($deserialized['_']); $constructor = array_merge($deserialized, ['_' => 'document', 'mime_type' => '', 'attributes' => [['_' => 'documentAttributeVideo', 'round_message' => true]]]); $res['MessageMedia'] = ['_' => 'messageMediaDocument', 'document' => $constructor, 'caption' => '']; return $res; case 'bot_document': unset($deserialized['_']); $constructor = array_merge($deserialized, ['_' => 'document', 'mime_type' => '', 'attributes' => []]); $res['MessageMedia'] = ['_' => 'messageMediaDocument', 'document' => $constructor, 'caption' => '']; return $res; case 'bot_sticker': unset($deserialized['_']); $constructor = array_merge($deserialized, ['_' => 'document', 'mime_type' => '', 'attributes' => [['_' => 'documentAttributeSticker']]]); $res['MessageMedia'] = ['_' => 'messageMediaDocument', 'document' => $constructor, 'caption' => '']; return $res; case 'bot_gif': unset($deserialized['_']); $constructor = array_merge($deserialized, ['_' => 'document', 'mime_type' => '', 'attributes' => [['_' => 'documentAttributeAnimated']]]); $res['MessageMedia'] = ['_' => 'messageMediaDocument', 'document' => $constructor, 'caption' => '']; return $res; case 'bot_audio': unset($deserialized['_']); $constructor = array_merge($deserialized, ['_' => 'document', 'mime_type' => '', 'attributes' => [['_' => 'documentAttributeAudio', 'voice' => false]]]); $res['MessageMedia'] = ['_' => 'messageMediaDocument', 'document' => $constructor, 'caption' => '']; return $res; default: throw new Exception(sprintf(\danog\MadelineProto\Lang::$current_lang['file_type_invalid'], $type)); } } } <?php /** * BotAPI module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\TL\Conversion; trait BotAPI { public function html_entity_decode($stuff) { return html_entity_decode(preg_replace('#< *br */? *>#', "\n", $stuff)); } public function mb_strlen($text) { $length = 0; $textlength = strlen($text); for ($x = 0; $x < $textlength; $x++) { $char = ord($text[$x]); if (($char & 0xC0) != 0x80) { $length += 1 + ($char >= 0xf0); } } return $length; } public function mb_substr($text, $offset, $length = null) { $mb_text_length = $this->mb_strlen($text); if ($offset < 0) { $offset = $mb_text_length + $offset; } if ($length < 0) { $length = ($mb_text_length - $offset) + $length; } elseif ($length === null) { $length = $mb_text_length - $offset; } $new_text = ''; $current_offset = 0; $current_length = 0; $text_length = strlen($text); for ($x = 0; $x < $text_length; $x++) { $char = ord($text[$x]); if (($char & 0xC0) != 0x80) { $current_offset += 1 + ($char >= 0xf0); if ($current_offset > $offset) { $current_length += 1 + ($char >= 0xf0); } } if ($current_offset > $offset) { if ($current_length <= $length) { $new_text .= $text[$x]; } } } return $new_text; } public function mb_str_split($text, $length) { $tlength = $this->mb_strlen($text); $result = []; for ($x = 0; $x < $tlength; $x += $length) { $result[] = $this->mb_substr($text, $x, $length); } return $result; } public function parse_buttons($rows) { $newrows = []; $key = 0; $button_key = 0; foreach ($rows as $row) { $newrows[$key] = ['_' => 'keyboardButtonRow', 'buttons' => []]; foreach ($row as $button) { $newrows[$key]['buttons'][$button_key] = ['_' => 'keyboardButton', 'text' => $button['text']]; if (isset($button['url'])) { $newrows[$key]['buttons'][$button_key]['_'] = 'keyboardButtonUrl'; $newrows[$key]['buttons'][$button_key]['url'] = $button['url']; } elseif (isset($button['callback_data'])) { $newrows[$key]['buttons'][$button_key]['_'] = 'keyboardButtonCallback'; $newrows[$key]['buttons'][$button_key]['data'] = $button['callback_data']; } elseif (isset($button['switch_inline_query'])) { $newrows[$key]['buttons'][$button_key]['_'] = 'keyboardButtonSwitchInline'; $newrows[$key]['buttons'][$button_key]['same_peer'] = false; $newrows[$key]['buttons'][$button_key]['query'] = $button['switch_inline_query']; } elseif (isset($button['switch_inline_query_current_chat'])) { $newrows[$key]['buttons'][$button_key]['_'] = 'keyboardButtonSwitchInline'; $newrows[$key]['buttons'][$button_key]['same_peer'] = true; $newrows[$key]['buttons'][$button_key]['query'] = $button['switch_inline_query_current_chat']; } elseif (isset($button['callback_game'])) { $newrows[$key]['buttons'][$button_key]['_'] = 'keyboardButtonGame'; $newrows[$key]['buttons'][$button_key]['text'] = $button['callback_game']; } elseif (isset($button['request_contact']) && $button['request_contact']) { $newrows[$key]['buttons'][$button_key]['_'] = 'keyboardButtonRequestPhone'; } elseif (isset($button['request_location']) && $button['request_location']) { $newrows[$key]['buttons'][$button_key]['_'] = 'keyboardButtonRequestGeoLocation'; } $button_key++; } $key++; } return $newrows; } public function parse_reply_markup($markup) { if (isset($markup['force_reply']) && $markup['force_reply']) { $markup['_'] = 'replyKeyboardForceReply'; unset($markup['force_reply']); } if (isset($markup['remove_keyboard']) && $markup['remove_keyboard']) { $markup['_'] = 'replyKeyboardHide'; unset($markup['remove_keyboard']); } if (isset($markup['keyboard'])) { $markup['_'] = 'replyKeyboardMarkup'; if (isset($markup['resize_keyboard'])) { $markup['resize'] = $markup['resize_keyboard']; unset($markup['resize_keyboard']); } if (isset($markup['one_time_keyboard'])) { $markup['single_use'] = $markup['one_time_keyboard']; unset($markup['one_time_keyboard']); } $markup['rows'] = $this->parse_buttons($markup['keyboard']); unset($markup['keyboard']); } if (isset($markup['inline_keyboard'])) { $markup['_'] = 'replyInlineMarkup'; $markup['rows'] = $this->parse_buttons($markup['inline_keyboard']); unset($markup['inline_keyboard']); } return $markup; } public function MTProto_to_botAPI($data, $sent_arguments = []) { $newd = []; if (!isset($data['_'])) { foreach ($data as $key => $element) { $newd[$key] = $this->MTProto_to_botAPI($element, $sent_arguments); } return $newd; } switch ($data['_']) { case 'updateShortSentMessage': $newd['message_id'] = $data['id']; $newd['date'] = $data['date']; $newd['text'] = $sent_arguments['message']; if ($data['out']) { $newd['from'] = $this->get_pwr_chat($this->authorization['user']); } $newd['chat'] = $this->get_pwr_chat($sent_arguments['peer']); if (isset($data['entities'])) { $newd['entities'] = $this->MTProto_to_botAPI($data['entities'], $sent_arguments); } if (isset($data['media'])) { $newd = array_merge($newd, $this->MTProto_to_botAPI($data['media'], $sent_arguments)); } return $newd; case 'updateNewChannelMessage': case 'updateNewMessage': return $this->MTProto_to_botAPI($data['message']); case 'message': $newd['message_id'] = $data['id']; $newd['date'] = $data['date']; $newd['text'] = $data['message']; $newd['post'] = $data['post']; $newd['silent'] = $data['silent']; if (isset($data['from_id'])) { $newd['from'] = $this->get_pwr_chat($data['from_id']); } $newd['chat'] = $this->get_pwr_chat($data['to_id']); if (isset($data['entities'])) { $newd['entities'] = $this->MTProto_to_botAPI($data['entities'], $sent_arguments); } if (isset($data['views'])) { $newd['views'] = $data['views']; } if (isset($data['edit_date'])) { $newd['edit_date'] = $data['edit_date']; } if (isset($data['via_bot_id'])) { $newd['via_bot'] = $this->get_pwr_chat($data['via_bot_id']); } if (isset($data['fwd_from']['from_id'])) { $newd['froward_from'] = $this->get_pwr_chat($data['fwd_from']['from_id']); } if (isset($data['fwd_from']['channel_id'])) { $newd['forward_from_chat'] = $this->get_pwr_chat($data['fwd_from']['channel_id']); } if (isset($data['fwd_from']['date'])) { $newd['forward_date'] = $data['fwd_from']['date']; } if (isset($data['fwd_from']['channel_post'])) { $newd['forward_from_message_id'] = $data['fwd_from']['channel_post']; } if (isset($data['media'])) { $newd = array_merge($newd, $this->MTProto_to_botAPI($data['media'], $sent_arguments)); } return $newd; case 'messageEntityMention': unset($data['_']); $data['type'] = 'mention'; return $data; case 'messageEntityHashtag': unset($data['_']); $data['type'] = 'hashtag'; return $data; case 'messageEntityBotCommand': unset($data['_']); $data['type'] = 'bot_command'; return $data; case 'messageEntityUrl': unset($data['_']); $data['type'] = 'url'; return $data; case 'messageEntityEmail': unset($data['_']); $data['type'] = 'email'; return $data; case 'messageEntityBold': unset($data['_']); $data['type'] = 'bold'; return $data; case 'messageEntityItalic': unset($data['_']); $data['type'] = 'italic'; return $data; case 'messageEntityCode': unset($data['_']); $data['type'] = 'code'; return $data; case 'messageEntityPre': unset($data['_']); $data['type'] = 'pre'; return $data; case 'messageEntityTextUrl': unset($data['_']); $data['type'] = 'text_url'; return $data; case 'messageEntityMentionName': unset($data['_']); $data['type'] = 'text_mention'; $data['user'] = $this->get_pwr_chat($data['user_id']); unset($data['user_id']); return $data; case 'messageMediaPhoto': if (isset($data['caption'])) { $res['caption'] = $data['caption']; } $res['photo'] = []; foreach ($data['photo']['sizes'] as $key => $photo) { $res['photo'][$key] = $this->photosize_to_botapi($photo, $data['photo']); } return $res; case 'messageMediaEmpty': return []; case 'messageMediaDocument': $type_name = 'document'; $res = []; if ($data['document']['thumb']['_'] === 'photoSize') { $res['thumb'] = $this->photosize_to_botapi($data['document']['thumb'], [], true); } foreach ($data['document']['attributes'] as $attribute) { switch ($attribute['_']) { case 'documentAttributeFilename': $pathinfo = pathinfo($attribute['file_name']); $res['ext'] = isset($pathinfo['extension']) ? '.'.$pathinfo['extension'] : ''; $res['file_name'] = $pathinfo['filename']; break; case 'documentAttributeAudio': $audio = $attribute; $type_name = 'audio'; if ($attribute['voice']) { $type_name = 'voice'; } $res['duration'] = $attribute['duration']; if (isset($attribute['performer'])) { $res['performer'] = $attribute['performer']; } if (isset($attribute['title'])) { $res['title'] = $attribute['title']; } if (isset($attribute['waveform'])) { $res['title'] = $attribute['waveform']; } break; case 'documentAttributeVideo': $type_name = $attribute['round_message'] ? 'video_note' : 'video'; $res['width'] = $attribute['w']; $res['height'] = $attribute['h']; $res['duration'] = $attribute['duration']; break; case 'documentAttributeImageSize': $res['width'] = $attribute['w']; $res['height'] = $attribute['h']; break; case 'documentAttributeAnimated': $type_name = 'gif'; $res['animated'] = true; break; case 'documentAttributeHasStickers': $res['has_stickers'] = true; break; case 'documentAttributeSticker': $type_name = 'sticker'; $res['mask'] = $attribute['mask']; $res['emoji'] = $attribute['alt']; $res['sticker_set'] = $attribute['stickerset']; if (isset($attribute['mask_coords'])) { $res['mask_coords'] = $attribute['mask_coords']; } break; } } if (isset($audio) && isset($audio['title']) && !isset($res['file_name'])) { $res['file_name'] = $audio['title']; if (isset($audio['performer'])) { $res['file_name'] .= ' - '.$audio['performer']; } } if (!isset($res['file_name'])) { $res['file_name'] = $data['document']['access_hash']; } $res['file_name'] .= '_'.$data['document']['id']; if (isset($res['ext'])) { $res['file_name'] .= $res['ext']; unset($res['ext']); } else { $res['file_name'] .= $this->get_extension_from_mime($data['document']['mime_type']); } $data['document']['_'] = 'bot_'.$type_name; $res['file_size'] = $data['document']['size']; $res['mime_type'] = $data['document']['mime_type']; $res['file_id'] = $this->base64url_encode($this->rle_encode($this->serialize_object(['type' => 'File'], $data['document'], 'File').chr(2))); return [$type_name => $res, 'caption' => isset($data['caption']) ? $data['caption'] : '']; default: throw new Exception(sprintf(\danog\MadelineProto\Lang::$current_lang['botapi_conversion_error'], $data['_'])); } } public function botAPI_to_MTProto($arguments) { foreach (self::BOTAPI_PARAMS_CONVERSION as $bot => $mtproto) { if (isset($arguments[$bot]) && !isset($arguments[$mtproto])) { $arguments[$mtproto] = $arguments[$bot]; //unset($arguments[$bot]); } } if (isset($arguments['reply_markup'])) { $arguments['reply_markup'] = $this->parse_reply_markup($arguments['reply_markup']); } if (isset($arguments['parse_mode'])) { $arguments = $this->parse_mode($arguments); } return $arguments; } public function parse_node($node, &$entities, &$new_message, &$offset) { switch ($node->nodeName) { case 'br': $new_message .= "\n"; $offset++; break; case 'b': case 'strong': $text = $this->html_entity_decode($node->textContent); $length = $this->mb_strlen($text); $entities[] = ['_' => 'messageEntityBold', 'offset' => $offset, 'length' => $length]; $new_message .= $text; $offset += $length; break; case 'i': case 'em': $text = $this->html_entity_decode($node->textContent); $length = $this->mb_strlen($text); $entities[] = ['_' => 'messageEntityItalic', 'offset' => $offset, 'length' => $length]; $new_message .= $text; $offset += $length; break; case 'code': $text = $this->html_entity_decode($node->textContent); $length = $this->mb_strlen($text); $entities[] = ['_' => 'messageEntityCode', 'offset' => $offset, 'length' => $length]; $new_message .= $text; $offset += $length; break; case 'pre': $text = $this->html_entity_decode($node->textContent); $length = $this->mb_strlen($text); $language = $node->getAttribute('language'); if ($language === null) { $language = ''; } $entities[] = ['_' => 'messageEntityPre', 'offset' => $offset, 'length' => $length, 'language' => $language]; $new_message .= $text; $offset += $length; break; case 'p': foreach ($node->childNodes as $node) { $this->parse_node($node, $entities, $new_message, $offset); } break; case 'a': $text = $this->html_entity_decode($node->textContent); $length = $this->mb_strlen($text); $href = $node->getAttribute('href'); if (preg_match('|mention:(.*)|', $href, $matches) || preg_match('|tg://user\?id=(.*)|', $href, $matches)) { $mention = $this->get_info($matches[1]); if (!isset($mention['InputUser'])) { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['peer_not_in_db']); } $entities[] = ['_' => 'inputMessageEntityMentionName', 'offset' => $offset, 'length' => $length, 'user_id' => $mention['InputUser']]; } elseif (preg_match('|buttonurl:(.*)|', $href)) { if (!isset($entities['buttons'])) { $entities['buttons'] = []; } if (strpos(substr($href, -4), '|:new|') !== false) { $entities['buttons'][] = ['_' => 'keyboardButtonUrl', 'text' => $text, 'url' => str_replace(['buttonurl:', ':new'], '', $href), 'new' => true]; } else { $entities['buttons'][] = ['_' => 'keyboardButtonUrl', 'text' => $text, 'url' => str_replace('buttonurl:', '', $href)]; } break; } else { $entities[] = ['_' => 'messageEntityTextUrl', 'offset' => $offset, 'length' => $length, 'url' => $href]; } $new_message .= $text; $offset += $length; break; default: $text = $this->html_entity_decode($node->textContent); $length = $this->mb_strlen($text); $new_message .= $text; $offset += $length; break; } } public function parse_mode($arguments) { if ($arguments['message'] === '' || !isset($arguments['message']) || !isset($arguments['parse_mode'])) { return $arguments; } if (isset($arguments['parse_mode']['_'])) { $arguments['parse_mode'] = str_replace('textParseMode', '', $arguments['parse_mode']['_']); } if (stripos($arguments['parse_mode'], 'markdown') !== false) { $arguments['message'] = \Parsedown::instance()->line($arguments['message']); $arguments['parse_mode'] = 'HTML'; } if (stripos($arguments['parse_mode'], 'html') !== false) { $new_message = ''; $arguments['message'] = rtrim($this->html_fixtags($arguments['message'])); $dom = new \DOMDocument(); if (!extension_loaded('mbstring')) { throw new \danog\MadelineProto\Exception(['extension', 'mbstring']); } $dom->loadHTML(mb_convert_encoding($arguments['message'], 'HTML-ENTITIES', 'UTF-8')); if (!isset($arguments['entities'])) { $arguments['entities'] = []; } $offset = 0; foreach ($dom->getElementsByTagName('body')->item(0)->childNodes as $node) { $this->parse_node($node, $arguments['entities'], $new_message, $offset); } if (isset($arguments['entities']['buttons'])) { $arguments['reply_markup'] = $this->build_rows($arguments['entities']['buttons']); unset($arguments['entities']['buttons']); } unset($arguments['parse_mode']); $arguments['message'] = $new_message; } return $arguments; } public function split_to_chunks($args) { $args = $this->parse_mode($args); if (!isset($args['entities'])) { $args['entities'] = []; } $multiple_args_base = array_merge($args, ['entities' => [], 'parse_mode' => 'text', 'message' => '']); $multiple_args = [$multiple_args_base]; $max_length = isset($args['media']) ? $this->config['caption_length_max'] : $this->config['message_length_max']; $text_arr = []; foreach ($this->multipleExplodeKeepDelimiters(["\n"], $args['message']) as $word) { if ($this->mb_strlen($word) > $max_length) { foreach ($this->mb_str_split($word, $max_length) as $vv) { $text_arr[] = $vv; } } else { $text_arr[] = $word; } } $i = 0; foreach ($text_arr as $word) { if ($this->mb_strlen($multiple_args[$i]['message'].$word) <= $max_length) { $multiple_args[$i]['message'] .= $word; } else { $i++; $multiple_args[$i] = $multiple_args_base; $multiple_args[$i]['message'] .= $word; } } $i = 0; $offset = 0; foreach ($args['entities'] as $entity) { do { while ($entity['offset'] > $offset + $this->mb_strlen($multiple_args[$i]['message'])) { $offset += $this->mb_strlen($multiple_args[$i]['message']); $i++; } $entity['offset'] -= $offset; if ($entity['offset'] + $entity['length'] > $this->mb_strlen($multiple_args[$i]['message'])) { $newentity = $entity; $newentity['length'] = $entity['length'] - ($this->mb_strlen($multiple_args[$i]['message']) - $entity['offset']); $entity['length'] = $this->mb_strlen($multiple_args[$i]['message']) - $entity['offset']; $offset += $this->mb_strlen($multiple_args[$i]['message']); $newentity['offset'] = $offset; $prev_length = $this->mb_strlen($multiple_args[$i]['message']); $multiple_args[$i]['message'] = rtrim($multiple_args[$i]['message']); $entity['length'] -= $prev_length - $this->mb_strlen($multiple_args[$i]['message']); $multiple_args[$i]['entities'][] = $entity; $i++; $entity = $newentity; continue; } else { $prev_length = $this->mb_strlen($multiple_args[$i]['message']); $multiple_args[$i]['message'] = rtrim($multiple_args[$i]['message']); $entity['length'] -= $prev_length - $this->mb_strlen($multiple_args[$i]['message']); $multiple_args[$i]['entities'][] = $entity; break; } } while (true); } return $multiple_args; } public function multipleExplodeKeepDelimiters($delimiters, $string) { $initialArray = explode(chr(1), str_replace($delimiters, chr(1), $string)); $finalArray = []; $delimOffset = 0; foreach ($initialArray as $item) { $delimOffset += $this->mb_strlen($item); //if ($this->mb_strlen($item) > 0) { $finalArray[] = $item.($delimOffset < $this->mb_strlen($string) ? $string[$delimOffset] : ''); //} $delimOffset++; } return $finalArray; } public function html_fixtags($text) { preg_match_all('#(.*?)(<(a|b|\bstrong\b|\bem\b|i|\bcode\b|\bpre\b)[^>]*>)([^<]*?)(<\\/\\3>)(.*)?#is', $text, $matches, PREG_SET_ORDER); if ($matches) { $last = count($matches) - 1; foreach ($matches as $val) { if (trim($val[1]) != '') { $text = str_replace($val[1], htmlentities($val[1]), $text); } $text = str_replace($val[4], htmlentities(trim($val[4])), $text); if ($val == $matches[$last]) { $text = str_replace($val[6], $this->html_fixtags($val[6]), $text); } } preg_match_all('#<a href="(.+?)">#is', $text, $matches); foreach ($matches[1] as $match) { $text = str_replace($match, htmlentities($match), $text); } return $text; } else { return htmlentities($text); } } public function build_rows($button_list) { $end = false; $rows = []; $buttons = []; $cols = 0; foreach ($button_list as $button) { if (isset($button['new'])) { if (count($buttons) == 0) { $buttons[] = $button; } else { $row = ['_' => 'keyboardButtonRow', 'buttons' => $buttons]; $rows[] = $row; $buttons = [$button]; } } else { $buttons[] = $button; $end = true; } } if ($end) { $row = ['_' => 'keyboardButtonRow', 'buttons' => $buttons]; $rows[] = $row; } return ['_' => 'replyInlineMarkup', 'rows' => $rows]; } } <?php /* Copyright 2016-2018 Daniil Gentili (https://daniil.it) This file is part of MadelineProto. MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU General Public License along with MadelineProto. If not, see <http://www.gnu.org/licenses/>. */ namespace danog\MadelineProto\TL\Conversion; /** * Manages generation of extensions for files. */ trait Extension { public function get_mime_from_extension($extension, $default) { $ext = ltrim($extension, '.'); if (isset(self::ALL_MIMES[$ext])) { return self::ALL_MIMES[$ext][0]; } return $default; } public function get_extension_from_mime($mime) { foreach (self::ALL_MIMES as $key => $value) { if (array_search($mime, $value) !== false) { return '.'.$key; } } return ''; } public function get_extension_from_location($location, $default) { return $default; $res = $this->method_call('upload.getFile', ['location' => $location, 'offset' => 0, 'limit' => 2], ['heavy' => true, 'datacenter' => $location['dc_id']]); if (!isset($res['type']['_'])) { return $default; } switch ($res['type']['_']) { case 'storage.fileJpeg': return '.jpg'; case 'storage.fileGif': return '.gif'; case 'storage.filePng': return '.png'; case 'storage.filePdf': return '.pdf'; case 'storage.fileMp3': return '.mp3'; case 'storage.fileMov': return '.mov'; case 'storage.fileMp4': return '.mp4'; case 'storage.fileWebp': return '.webp'; default: return $default; } } public function get_mime_from_file($file) { $finfo = new \finfo(FILEINFO_MIME_TYPE); return $finfo->file($file); } public function get_mime_from_buffer($buffer) { $finfo = new \finfo(FILEINFO_MIME_TYPE); return $finfo->buffer($buffer); } } <?php /** * Exception module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\TL\Conversion; class Exception extends \Exception { use \danog\MadelineProto\TL\PrettyException; public function __toString() { $result = get_class($this).($this->message !== '' ? ': ' : '').$this->message.PHP_EOL.\danog\MadelineProto\Magic::$revision.PHP_EOL.'TL Trace (YOU ABSOLUTELY MUST READ THE TEXT BELOW):'.PHP_EOL.PHP_EOL.$this->getTLTrace().PHP_EOL; if (php_sapi_name() !== 'cli') { $result = str_replace(PHP_EOL, '<br>'.PHP_EOL, $result); } return $result; } public function __construct($message, $file = '') { parent::__construct($message); $this->prettify_tl($file); } } <?php /** * Exception module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\TL; class Exception extends \Exception { use PrettyException; public function __toString() { $result = get_class($this).($this->message !== '' ? ': ' : '').$this->message.PHP_EOL.\danog\MadelineProto\Magic::$revision.PHP_EOL.'TL Trace (YOU ABSOLUTELY MUST READ THE TEXT BELOW):'.PHP_EOL.PHP_EOL.$this->getTLTrace().PHP_EOL; if (php_sapi_name() !== 'cli') { $result = str_replace(PHP_EOL, '<br>'.PHP_EOL, $result); } return $result; } public function __construct($message, $file = '') { parent::__construct($message); $this->prettify_tl($file); } } <?php /** * TLMethod module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\TL; class TLMethod { use \danog\Serializable; use \danog\MadelineProto\Tools; use TLParams; public $by_id = []; public $by_method = []; public $method_namespace = []; public function __sleep() { return ['by_id', 'by_method', 'method_namespace']; } public function add($json_dict) { $this->by_id[$json_dict['id']] = ['method' => $json_dict['method'], 'type' => $json_dict['type'], 'params' => $json_dict['params']]; $this->by_method[$json_dict['method']] = $json_dict['id']; $namespace = explode('.', $json_dict['method']); if (isset($namespace[1])) { $this->method_namespace[] = [$namespace[0] => $namespace[1]]; } $this->parse_params($json_dict['id']); } public function find_by_id($id) { if (isset($this->by_id[$id])) { $method = $this->by_id[$id]; $method['id'] = $id; $method['params'] = $method['params']; return $method; } return false; } public function find_by_method($method_name) { if (isset($this->by_method[$method_name])) { $method = $this->by_id[$this->by_method[$method_name]]; $method['id'] = $this->by_method[$method_name]; $method['params'] = $method['params']; return $method; } return false; } } <?php /** * Handler module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Server; /* * Socket handler for server */ class Handler extends \danog\MadelineProto\Connection { use \danog\MadelineProto\TL\TL; use \danog\MadelineProto\TL\Conversion\BotAPI; use \danog\MadelineProto\TL\Conversion\BotAPIFiles; use \danog\MadelineProto\TL\Conversion\Extension; use \danog\MadelineProto\TL\Conversion\TD; use \danog\MadelineProto\Tools; private $madeline; public function __magic_construct($socket, $extra, $ip, $port, $protocol, $timeout, $ipv6) { \danog\MadelineProto\Magic::$pid = getmypid(); $this->sock = $socket; $this->sock->setBlocking(true); $this->must_open = false; $timeout = 2; $this->sock->setOption(\SOL_SOCKET, \SO_RCVTIMEO, $timeout); $this->sock->setOption(\SOL_SOCKET, \SO_SNDTIMEO, $timeout); $this->logger = new \danog\MadelineProto\Logger(3); $this->construct_TL(['socket' => __DIR__.'/../TL_socket.tl']); } public function __destruct() { echo 'Closing socket in fork '.getmypid().PHP_EOL; unset($this->sock); $this->destruct_madeline(); } public function destruct_madeline() { if (isset($this->madeline) && $this->madeline !== null) { $this->madeline->API->settings['logger'] = ['logger' => 0, 'logger_param' => '']; $this->madeline->API->settings['updates']['callback'] = []; unset($this->madeline); return true; } return false; } public function loop() { $buffer = ''; $first_byte = $this->sock->read(1); if ($first_byte === chr(239)) { $this->protocol = 'tcp_abridged'; } else { $first_byte .= $this->sock->read(3); if ($first_byte === str_repeat(chr(238), 4)) { $this->protocol = 'tcp_intermediate'; } else { $this->protocol = 'tcp_full'; $packet_length = unpack('V', $first_byte)[1]; $packet = $this->read($packet_length - 4); if (strrev(hash('crc32b', $first_byte.substr($packet, 0, -4), true)) !== substr($packet, -4)) { throw new Exception('CRC32 was not correct!'); } $this->in_seq_no++; $in_seq_no = unpack('V', substr($packet, 0, 4))[1]; if ($in_seq_no != $this->in_seq_no) { throw new Exception('Incoming seq_no mismatch'); } $buffer = substr($packet, 4, $packet_length - 12); } } while (true) { pcntl_signal_dispatch(); $request_id = 0; try { if ($buffer) { $message = $buffer; $buffer = ''; } else { $time = time(); $message = $this->read_message(); } } catch (\danog\MadelineProto\NothingInTheSocketException $e) { echo $e; if (time() - $time < 2) { $this->sock = null; } continue; } try { $message = $this->deserialize($message, ['type' => '', 'datacenter' => '']); if ($message['_'] !== 'socketMessageRequest') { throw new \danog\MadelineProto\Exception('Invalid object received'); } $request_id = $message['request_id']; $this->send_response($request_id, $this->on_request($request_id, $message['method'], $message['args'])); } catch (\danog\MadelineProto\TL\Exception $e) { $this->send_exception($request_id, $e); continue; } catch (\danog\MadelineProto\Exception $e) { $this->send_exception($request_id, $e); continue; } catch (\danog\MadelineProto\RPCErrorException $e) { $this->send_exception($request_id, $e); continue; } catch (\DOMException $e) { $this->send_exception($request_id, $e); continue; } } } public function on_request($request_id, $method, $args) { if (count($method) === 0 || count($method) > 2) { throw new \danog\MadelineProto\Exception('Invalid method called'); } array_walk($args, [$this, 'walker']); if ($method[0] === '__construct') { if (count($args) === 1 && is_array($args[0])) { $args[0]['logger'] = ['logger' => 4, 'logger_param' => [$this, 'logger']]; $args[0]['updates']['callback'] = [$this, 'update_handler']; } elseif (count($args) === 2 && is_array($args[1])) { $args[1]['logger'] = ['logger' => 4, 'logger_param' => [$this, 'logger']]; $args[1]['updates']['callback'] = [$this, 'update_handler']; } $this->madeline = new \danog\MadelineProto\API(...$args); return true; } if ($method[0] === '__destruct') { $this->__destruct(); exit(); } if ($this->madeline === null) { throw new \danog\MadelineProto\Exception('__construct was not called'); } if (count($method) === 1) { return $this->madeline->{$method[0]}(...$args); } if (count($method) === 2) { return $this->madeline->{$method[0]}->{$method[1]}(...$args); } } private function walker(&$arg) { if (is_array($arg)) { if (isset($arg['_'])) { if ($arg['_'] === 'fileCallback' && isset($arg['callback']) && isset($arg['file']) && !method_exists($this, $arg['callback']['callback'])) { if (isset($arg['file']['_']) && $arg['file']['_'] === 'stream') { $arg['file'] = fopen('madelineSocket://', 'r+b', false, Stream::getContext($this, $arg['file']['stream_id'])); } $arg = new \danog\MadelineProto\FileCallback($arg['file'], [$this, $arg['callback']['callback']]); return; } elseif ($arg['_'] === 'callback' && isset($arg['callback']) && !method_exists($this, $arg['callback'])) { $arg = [$this, $arg['callback']]; return; } elseif ($arg['_'] === 'stream' && isset($arg['stream_id'])) { $arg = fopen('madelineSocket://', 'r+b', false, Stream::getContext($this, $arg['stream_id'])); return; } elseif ($arg['_'] === 'bytes' && isset($arg['bytes'])) { $arg = base64_decode($args['bytes']); return; } else { array_walk($arg, [$this, 'walker']); } } else { array_walk($arg, [$this, 'walker']); } } } public function send_exception($request_id, $e) { echo $e.PHP_EOL; if ($e instanceof \danog\MadelineProto\RPCErrorException) { $exception = ['_' => 'socketRPCErrorException']; if ($e->getMessage() === $e->rpc) { $exception['rpc_message'] = $e->rpc; } else { $exception['rpc_message'] = $e->rpc; $exception['message'] = $e->getMessage(); } } elseif ($e instanceof \danog\MadelineProto\TL\Exception) { $exception = ['_' => 'socketTLException', 'message' => $e->getMessage()]; } elseif ($e instanceof \DOMException) { $exception = ['_' => 'socketDOMException', 'message' => $e->getMessage()]; } else { $exception = ['_' => 'socketException', 'message' => $e->getMessage()]; } $exception['code'] = $e->getCode(); $exception['trace'] = ['_' => 'socketTLTrace', 'frames' => []]; $tl = false; foreach (array_reverse($e->getTrace()) as $k => $frame) { $tl_frame = ['_' => 'socketTLFrame']; if (isset($frame['function']) && in_array($frame['function'], ['serialize_params', 'serialize_object'])) { if ($frame['args'][2] !== '') { $tl_frame['tl_param'] = (string) $frame['args'][2]; $tl = true; } } else { if (isset($frame['function']) && ($frame['function'] === 'handle_rpc_error' && $k === count($this->getTrace()) - 1) || $frame['function'] === 'unserialize') { continue; } if (isset($frame['file'])) { $tl_frame['file'] = $frame['file']; $tl_frame['line'] = $frame['line']; } if (isset($frame['function'])) { $tl_frame['function'] = $frame['function']; } if (isset($frame['args'])) { $args = json_encode($frame['args']); if ($args !== false) { $tl_frame['args'] = $args; } } $tl = false; } $exception['trace']['frames'][] = $tl_frame; } $this->send_message_safe($this->serialize_object(['type' => ''], ['_' => 'socketMessageException', 'request_id' => $request_id, 'exception' => $exception], 'exception')); } public function send_response($request_id, $response) { $this->send_message_safe($this->serialize_object(['type' => ''], ['_' => 'socketMessageResponse', 'request_id' => $request_id, 'data' => $response], 'exception')); } public function send_data($stream_id, $data) { $this->send_message_safe($this->serialize_object(['type' => ''], ['_' => 'socketMessageRawData', 'stream_id' => $stream_id, 'data' => $data], 'data')); } public $logging = false; public function logger($message, $level) { if (!$this->logging) { try { $this->logging = true; $message = ['_' => 'socketMessageLog', 'data' => $message, 'level' => $level, 'thread' => \danog\MadelineProto\Magic::$has_thread && is_object(\Thread::getCurrentThread()), 'process' => \danog\MadelineProto\Magic::is_fork(), 'file' => basename(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['file'], '.php')]; $this->send_message_safe($this->serialize_object(['type' => ''], $message, 'log')); } finally { $this->logging = false; } } } public function send_message_safe($message) { if (!isset($this->sock)) { return false; } try { $this->send_message($message); } catch (\danog\MadelineProto\Exception $e) { $this->__destruct(); die; } } public function update_handler($update) { $this->send_message_safe($this->serialize_object(['type' => ''], ['_' => 'socketMessageUpdate', 'data' => $update], 'update')); } public function __call($method, $args) { $this->send_message_safe($this->serialize_object(['type' => ''], ['_' => 'socketMessageRequest', 'request_id' => 0, 'method' => [$method], 'args' => $args], 'method')); } } <?php /** * Proxy module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Server; /* * Socket handler for server */ class Proxy extends \danog\MadelineProto\Connection { public function __magic_construct($socket, $extra, $ip, $port, $protocol, $timeout, $ipv6) { \danog\MadelineProto\Logger::log('Got connection '.getmypid().'!'); \danog\MadelineProto\Magic::$pid = getmypid(); \danog\MadelineProto\Lang::$current_lang = []; $this->sock = $socket; $this->sock->setBlocking(true); $this->must_open = false; $this->sock->setOption(\SOL_SOCKET, \SO_RCVTIMEO, $extra['timeout']); $this->sock->setOption(\SOL_SOCKET, \SO_SNDTIMEO, $extra['timeout']); $this->logger = new \danog\MadelineProto\Logger(3); $this->extra = $extra; if ($this->extra['madeline'] instanceof \danog\MadelineProto\API) { $this->extra['madeline'] = $this->extra['madeline']->API->datacenter->sockets; } } public function __destruct() { \danog\MadelineProto\Logger::log('Closing fork '.getmypid().'!'); unset($this->sock); } public function loop() { $this->protocol = 'obfuscated2'; $random = $this->sock->read(64); $reversed = strrev(substr($random, 8, 48)); $key = substr($random, 8, 32); $keyRev = substr($reversed, 0, 32); if (isset($this->extra['secret'])) { $key = hash('sha256', $key.$this->extra['secret'], true); $keyRev = hash('sha256', $keyRev.$this->extra['secret'], true); } $this->obfuscated = ['encryption' => new \phpseclib\Crypt\AES('ctr'), 'decryption' => new \phpseclib\Crypt\AES('ctr')]; $this->obfuscated['encryption']->enableContinuousBuffer(); $this->obfuscated['decryption']->enableContinuousBuffer(); $this->obfuscated['decryption']->setKey($key); $this->obfuscated['decryption']->setIV(substr($random, 40, 16)); $this->obfuscated['encryption']->setKey($keyRev); $this->obfuscated['encryption']->setIV(substr($reversed, 32, 16)); $random = substr_replace($random, substr(@$this->obfuscated['decryption']->encrypt($random), 56, 8), 56, 8); if (substr($random, 56, 4) !== str_repeat(chr(0xef), 4)) { throw new \danog\MadelineProto\Exception('Wrong protocol version'); } $dc = abs(unpack('s', substr($random, 60, 2))[1]); $socket = $this->extra['madeline'][$dc]; $socket->__construct($socket->proxy, $socket->extra, $socket->ip, $socket->port, $socket->protocol, $timeout = $this->extra['timeout'], $socket->ipv6); unset($this->extra); $write = []; $except = []; while (true) { pcntl_signal_dispatch(); try { $read = [$this->getSocket(), $socket->getSocket()]; \Socket::select($read, $write, $except, $timeout); if (isset($read[0])) { //\danog\MadelineProto\Logger::log("Will write to DC $dc on ".\danog\MadelineProto\Magic::$pid); $socket->send_message($this->read_message()); } if (isset($read[1])) { //\danog\MadelineProto\Logger::log("Will read from DC $dc on ".\danog\MadelineProto\Magic::$pid); $this->send_message($socket->read_message()); } if (empty($read)) { throw new \danog\MadelineProto\NothingInTheSocketException('Inactivity'); } } catch (\danog\MadelineProto\NothingInTheSocketException $e) { exit(); } } } } <?php /** * Stream module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\Server; class Stream { const WRAPPER_NAME = 'madelineSocket'; public $context; private $_handler; private $_stream_id; private static $_isRegistered = false; public static function getContext($handler, $stream_id) { if (!self::$_isRegistered) { stream_wrapper_register(self::WRAPPER_NAME, get_class()); self::$_isRegistered = true; } return stream_context_create([self::WRAPPER_NAME => ['handler' => $handler, 'stream_id' => $stream_id]]); } public function stream_open($path, $mode, $options, &$opened_path) { $opt = stream_context_get_options($this->context); if (!is_array($opt[self::WRAPPER_NAME]) || !isset($opt[self::WRAPPER_NAME]['handler']) || !($opt[self::WRAPPER_NAME]['handler'] instanceof Handler) || !isset($opt[self::WRAPPER_NAME]['stream_id'])) { return false; } $this->_handler = $opt[self::WRAPPER_NAME]['handler']; $this->_stream_id = $opt[self::WRAPPER_NAME]['stream_id']; return true; } public function stream_write($data) { $this->_handler->send_data($this->_stream_id, $data); } public function stream_lock($mode) { } } <?php /** * Server module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; /* * Socket server for multi-language API */ class Server { private $settings; private $pids = []; private $mypid; public function __construct($settings) { set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']); \danog\MadelineProto\Logger::constructor(3); if (!extension_loaded('sockets')) { throw new Exception(['extension', 'sockets']); } if (!extension_loaded('pcntl')) { throw new Exception(['extension', 'pcntl']); } $this->settings = $settings; $this->mypid = getmypid(); } public function start() { pcntl_signal(SIGTERM, [$this, 'sig_handler']); pcntl_signal(SIGINT, [$this, 'sig_handler']); pcntl_signal(SIGCHLD, [$this, 'sig_handler']); $this->sock = new \Socket($this->settings['type'], SOCK_STREAM, $this->settings['protocol']); $this->sock->bind($this->settings['address'], $this->settings['port']); $this->sock->listen(); $this->sock->setBlocking(true); $timeout = 2; $this->sock->setOption(\SOL_SOCKET, \SO_RCVTIMEO, $timeout); $this->sock->setOption(\SOL_SOCKET, \SO_SNDTIMEO, $timeout); \danog\MadelineProto\Logger::log('Server started! Listening on '.$this->settings['address'].':'.$this->settings['port']); while (true) { pcntl_signal_dispatch(); try { if ($sock = $this->sock->accept()) { $this->handle($sock); } } catch (\danog\MadelineProto\Exception $e) { } } } private function handle($socket) { $pid = pcntl_fork(); if ($pid == -1) { die('could not fork'); } elseif ($pid) { return $this->pids[] = $pid; } $handler = new $this->settings['handler']($socket, $this->settings['extra'], null, null, null, null, null); $handler->loop(); die; } public function __destruct() { if ($this->mypid === getmypid()) { \danog\MadelineProto\Logger::log('Shutting main process '.$this->mypid.' down'); unset($this->sock); foreach ($this->pids as $pid) { \danog\MadelineProto\Logger::log("Waiting for $pid"); pcntl_wait($pid); } \danog\MadelineProto\Logger::log('Done, closing main process'); return; } } public function sig_handler($sig) { switch ($sig) { case SIGTERM: case SIGINT: exit(); case SIGCHLD: pcntl_waitpid(-1, $status); break; } } } {"constructors":[{"id":"-1132882121","predicate":"boolFalse","params":[],"type":"Bool"},{"id":"-1720552011","predicate":"boolTrue","params":[],"type":"Bool"},{"id":"1072550713","predicate":"true","params":[],"type":"True"},{"id":"481674261","predicate":"vector","params":[],"type":"Vector t"},{"id":"-994444869","predicate":"error","params":[{"name":"code","type":"int"},{"name":"text","type":"string"}],"type":"Error"},{"id":"1450380236","predicate":"null","params":[],"type":"Null"},{"id":"2134579434","predicate":"inputPeerEmpty","params":[],"type":"InputPeer"},{"id":"2107670217","predicate":"inputPeerSelf","params":[],"type":"InputPeer"},{"id":"396093539","predicate":"inputPeerChat","params":[{"name":"chat_id","type":"int"}],"type":"InputPeer"},{"id":"-1182234929","predicate":"inputUserEmpty","params":[],"type":"InputUser"},{"id":"-138301121","predicate":"inputUserSelf","params":[],"type":"InputUser"},{"id":"-208488460","predicate":"inputPhoneContact","params":[{"name":"client_id","type":"long"},{"name":"phone","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"}],"type":"InputContact"},{"id":"-181407105","predicate":"inputFile","params":[{"name":"id","type":"long"},{"name":"parts","type":"int"},{"name":"name","type":"string"},{"name":"md5_checksum","type":"string"}],"type":"InputFile"},{"id":"-1771768449","predicate":"inputMediaEmpty","params":[],"type":"InputMedia"},{"id":"1661770481","predicate":"inputMediaUploadedPhoto","params":[{"name":"flags","type":"#"},{"name":"file","type":"InputFile"},{"name":"caption","type":"string"},{"name":"stickers","type":"flags.0?Vector<InputDocument>"}],"type":"InputMedia"},{"id":"-373312269","predicate":"inputMediaPhoto","params":[{"name":"id","type":"InputPhoto"},{"name":"caption","type":"string"}],"type":"InputMedia"},{"id":"-104578748","predicate":"inputMediaGeoPoint","params":[{"name":"geo_point","type":"InputGeoPoint"}],"type":"InputMedia"},{"id":"-1494984313","predicate":"inputMediaContact","params":[{"name":"phone_number","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"}],"type":"InputMedia"},{"id":"480546647","predicate":"inputChatPhotoEmpty","params":[],"type":"InputChatPhoto"},{"id":"-1837345356","predicate":"inputChatUploadedPhoto","params":[{"name":"file","type":"InputFile"}],"type":"InputChatPhoto"},{"id":"-1991004873","predicate":"inputChatPhoto","params":[{"name":"id","type":"InputPhoto"}],"type":"InputChatPhoto"},{"id":"-457104426","predicate":"inputGeoPointEmpty","params":[],"type":"InputGeoPoint"},{"id":"-206066487","predicate":"inputGeoPoint","params":[{"name":"lat","type":"double"},{"name":"long","type":"double"}],"type":"InputGeoPoint"},{"id":"483901197","predicate":"inputPhotoEmpty","params":[],"type":"InputPhoto"},{"id":"-74070332","predicate":"inputPhoto","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputPhoto"},{"id":"342061462","predicate":"inputFileLocation","params":[{"name":"volume_id","type":"long"},{"name":"local_id","type":"int"},{"name":"secret","type":"long"}],"type":"InputFileLocation"},{"id":"1996904104","predicate":"inputAppEvent","params":[{"name":"time","type":"double"},{"name":"type","type":"string"},{"name":"peer","type":"long"},{"name":"data","type":"string"}],"type":"InputAppEvent"},{"id":"-1649296275","predicate":"peerUser","params":[{"name":"user_id","type":"int"}],"type":"Peer"},{"id":"-1160714821","predicate":"peerChat","params":[{"name":"chat_id","type":"int"}],"type":"Peer"},{"id":"-1432995067","predicate":"storage.fileUnknown","params":[],"type":"storage.FileType"},{"id":"8322574","predicate":"storage.fileJpeg","params":[],"type":"storage.FileType"},{"id":"-891180321","predicate":"storage.fileGif","params":[],"type":"storage.FileType"},{"id":"172975040","predicate":"storage.filePng","params":[],"type":"storage.FileType"},{"id":"-1373745011","predicate":"storage.filePdf","params":[],"type":"storage.FileType"},{"id":"1384777335","predicate":"storage.fileMp3","params":[],"type":"storage.FileType"},{"id":"1258941372","predicate":"storage.fileMov","params":[],"type":"storage.FileType"},{"id":"1086091090","predicate":"storage.filePartial","params":[],"type":"storage.FileType"},{"id":"-1278304028","predicate":"storage.fileMp4","params":[],"type":"storage.FileType"},{"id":"276907596","predicate":"storage.fileWebp","params":[],"type":"storage.FileType"},{"id":"2086234950","predicate":"fileLocationUnavailable","params":[{"name":"volume_id","type":"long"},{"name":"local_id","type":"int"},{"name":"secret","type":"long"}],"type":"FileLocation"},{"id":"1406570614","predicate":"fileLocation","params":[{"name":"dc_id","type":"int"},{"name":"volume_id","type":"long"},{"name":"local_id","type":"int"},{"name":"secret","type":"long"}],"type":"FileLocation"},{"id":"537022650","predicate":"userEmpty","params":[{"name":"id","type":"int"}],"type":"User"},{"id":"1326562017","predicate":"userProfilePhotoEmpty","params":[],"type":"UserProfilePhoto"},{"id":"-715532088","predicate":"userProfilePhoto","params":[{"name":"photo_id","type":"long"},{"name":"photo_small","type":"FileLocation"},{"name":"photo_big","type":"FileLocation"}],"type":"UserProfilePhoto"},{"id":"164646985","predicate":"userStatusEmpty","params":[],"type":"UserStatus"},{"id":"-306628279","predicate":"userStatusOnline","params":[{"name":"expires","type":"int"}],"type":"UserStatus"},{"id":"9203775","predicate":"userStatusOffline","params":[{"name":"was_online","type":"int"}],"type":"UserStatus"},{"id":"-1683826688","predicate":"chatEmpty","params":[{"name":"id","type":"int"}],"type":"Chat"},{"id":"-652419756","predicate":"chat","params":[{"name":"flags","type":"#"},{"name":"creator","type":"flags.0?true"},{"name":"kicked","type":"flags.1?true"},{"name":"left","type":"flags.2?true"},{"name":"admins_enabled","type":"flags.3?true"},{"name":"admin","type":"flags.4?true"},{"name":"deactivated","type":"flags.5?true"},{"name":"id","type":"int"},{"name":"title","type":"string"},{"name":"photo","type":"ChatPhoto"},{"name":"participants_count","type":"int"},{"name":"date","type":"int"},{"name":"version","type":"int"},{"name":"migrated_to","type":"flags.6?InputChannel"}],"type":"Chat"},{"id":"120753115","predicate":"chatForbidden","params":[{"name":"id","type":"int"},{"name":"title","type":"string"}],"type":"Chat"},{"id":"771925524","predicate":"chatFull","params":[{"name":"id","type":"int"},{"name":"participants","type":"ChatParticipants"},{"name":"chat_photo","type":"Photo"},{"name":"notify_settings","type":"PeerNotifySettings"},{"name":"exported_invite","type":"ExportedChatInvite"},{"name":"bot_info","type":"Vector<BotInfo>"}],"type":"ChatFull"},{"id":"-925415106","predicate":"chatParticipant","params":[{"name":"user_id","type":"int"},{"name":"inviter_id","type":"int"},{"name":"date","type":"int"}],"type":"ChatParticipant"},{"id":"-57668565","predicate":"chatParticipantsForbidden","params":[{"name":"flags","type":"#"},{"name":"chat_id","type":"int"},{"name":"self_participant","type":"flags.0?ChatParticipant"}],"type":"ChatParticipants"},{"id":"1061556205","predicate":"chatParticipants","params":[{"name":"chat_id","type":"int"},{"name":"participants","type":"Vector<ChatParticipant>"},{"name":"version","type":"int"}],"type":"ChatParticipants"},{"id":"935395612","predicate":"chatPhotoEmpty","params":[],"type":"ChatPhoto"},{"id":"1632839530","predicate":"chatPhoto","params":[{"name":"photo_small","type":"FileLocation"},{"name":"photo_big","type":"FileLocation"}],"type":"ChatPhoto"},{"id":"-2082087340","predicate":"messageEmpty","params":[{"name":"id","type":"int"}],"type":"Message"},{"id":"-1063525281","predicate":"message","params":[{"name":"flags","type":"#"},{"name":"out","type":"flags.1?true"},{"name":"mentioned","type":"flags.4?true"},{"name":"media_unread","type":"flags.5?true"},{"name":"silent","type":"flags.13?true"},{"name":"post","type":"flags.14?true"},{"name":"id","type":"int"},{"name":"from_id","type":"flags.8?int"},{"name":"to_id","type":"Peer"},{"name":"fwd_from","type":"flags.2?MessageFwdHeader"},{"name":"via_bot_id","type":"flags.11?int"},{"name":"reply_to_msg_id","type":"flags.3?int"},{"name":"date","type":"int"},{"name":"message","type":"string"},{"name":"media","type":"flags.9?MessageMedia"},{"name":"reply_markup","type":"flags.6?ReplyMarkup"},{"name":"entities","type":"flags.7?Vector<MessageEntity>"},{"name":"views","type":"flags.10?int"},{"name":"edit_date","type":"flags.15?int"}],"type":"Message"},{"id":"-1642487306","predicate":"messageService","params":[{"name":"flags","type":"#"},{"name":"out","type":"flags.1?true"},{"name":"mentioned","type":"flags.4?true"},{"name":"media_unread","type":"flags.5?true"},{"name":"silent","type":"flags.13?true"},{"name":"post","type":"flags.14?true"},{"name":"id","type":"int"},{"name":"from_id","type":"flags.8?int"},{"name":"to_id","type":"Peer"},{"name":"reply_to_msg_id","type":"flags.3?int"},{"name":"date","type":"int"},{"name":"action","type":"MessageAction"}],"type":"Message"},{"id":"1038967584","predicate":"messageMediaEmpty","params":[],"type":"MessageMedia"},{"id":"1032643901","predicate":"messageMediaPhoto","params":[{"name":"photo","type":"Photo"},{"name":"caption","type":"string"}],"type":"MessageMedia"},{"id":"1457575028","predicate":"messageMediaGeo","params":[{"name":"geo","type":"GeoPoint"}],"type":"MessageMedia"},{"id":"1585262393","predicate":"messageMediaContact","params":[{"name":"phone_number","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"},{"name":"user_id","type":"int"}],"type":"MessageMedia"},{"id":"-1618676578","predicate":"messageMediaUnsupported","params":[],"type":"MessageMedia"},{"id":"-1230047312","predicate":"messageActionEmpty","params":[],"type":"MessageAction"},{"id":"-1503425638","predicate":"messageActionChatCreate","params":[{"name":"title","type":"string"},{"name":"users","type":"Vector<int>"}],"type":"MessageAction"},{"id":"-1247687078","predicate":"messageActionChatEditTitle","params":[{"name":"title","type":"string"}],"type":"MessageAction"},{"id":"2144015272","predicate":"messageActionChatEditPhoto","params":[{"name":"photo","type":"Photo"}],"type":"MessageAction"},{"id":"-1780220945","predicate":"messageActionChatDeletePhoto","params":[],"type":"MessageAction"},{"id":"1217033015","predicate":"messageActionChatAddUser","params":[{"name":"users","type":"Vector<int>"}],"type":"MessageAction"},{"id":"-1297179892","predicate":"messageActionChatDeleteUser","params":[{"name":"user_id","type":"int"}],"type":"MessageAction"},{"id":"1728035348","predicate":"dialog","params":[{"name":"flags","type":"#"},{"name":"peer","type":"Peer"},{"name":"top_message","type":"int"},{"name":"read_inbox_max_id","type":"int"},{"name":"read_outbox_max_id","type":"int"},{"name":"unread_count","type":"int"},{"name":"notify_settings","type":"PeerNotifySettings"},{"name":"pts","type":"flags.0?int"},{"name":"draft","type":"flags.1?DraftMessage"}],"type":"Dialog"},{"id":"590459437","predicate":"photoEmpty","params":[{"name":"id","type":"long"}],"type":"Photo"},{"id":"-1836524247","predicate":"photo","params":[{"name":"flags","type":"#"},{"name":"has_stickers","type":"flags.0?true"},{"name":"id","type":"long"},{"name":"access_hash","type":"long"},{"name":"date","type":"int"},{"name":"sizes","type":"Vector<PhotoSize>"}],"type":"Photo"},{"id":"236446268","predicate":"photoSizeEmpty","params":[{"name":"type","type":"string"}],"type":"PhotoSize"},{"id":"2009052699","predicate":"photoSize","params":[{"name":"type","type":"string"},{"name":"location","type":"FileLocation"},{"name":"w","type":"int"},{"name":"h","type":"int"},{"name":"size","type":"int"}],"type":"PhotoSize"},{"id":"-374917894","predicate":"photoCachedSize","params":[{"name":"type","type":"string"},{"name":"location","type":"FileLocation"},{"name":"w","type":"int"},{"name":"h","type":"int"},{"name":"bytes","type":"bytes"}],"type":"PhotoSize"},{"id":"286776671","predicate":"geoPointEmpty","params":[],"type":"GeoPoint"},{"id":"541710092","predicate":"geoPoint","params":[{"name":"long","type":"double"},{"name":"lat","type":"double"}],"type":"GeoPoint"},{"id":"-2128698738","predicate":"auth.checkedPhone","params":[{"name":"phone_registered","type":"Bool"}],"type":"auth.CheckedPhone"},{"id":"1577067778","predicate":"auth.sentCode","params":[{"name":"flags","type":"#"},{"name":"phone_registered","type":"flags.0?true"},{"name":"type","type":"auth.SentCodeType"},{"name":"phone_code_hash","type":"string"},{"name":"next_type","type":"flags.1?auth.CodeType"},{"name":"timeout","type":"flags.2?int"}],"type":"auth.SentCode"},{"id":"-855308010","predicate":"auth.authorization","params":[{"name":"flags","type":"#"},{"name":"tmp_sessions","type":"flags.0?int"},{"name":"user","type":"User"}],"type":"auth.Authorization"},{"id":"-543777747","predicate":"auth.exportedAuthorization","params":[{"name":"id","type":"int"},{"name":"bytes","type":"bytes"}],"type":"auth.ExportedAuthorization"},{"id":"-1195615476","predicate":"inputNotifyPeer","params":[{"name":"peer","type":"InputPeer"}],"type":"InputNotifyPeer"},{"id":"423314455","predicate":"inputNotifyUsers","params":[],"type":"InputNotifyPeer"},{"id":"1251338318","predicate":"inputNotifyChats","params":[],"type":"InputNotifyPeer"},{"id":"-1540769658","predicate":"inputNotifyAll","params":[],"type":"InputNotifyPeer"},{"id":"-265263912","predicate":"inputPeerNotifyEventsEmpty","params":[],"type":"InputPeerNotifyEvents"},{"id":"-395694988","predicate":"inputPeerNotifyEventsAll","params":[],"type":"InputPeerNotifyEvents"},{"id":"949182130","predicate":"inputPeerNotifySettings","params":[{"name":"flags","type":"#"},{"name":"show_previews","type":"flags.0?true"},{"name":"silent","type":"flags.1?true"},{"name":"mute_until","type":"int"},{"name":"sound","type":"string"}],"type":"InputPeerNotifySettings"},{"id":"-1378534221","predicate":"peerNotifyEventsEmpty","params":[],"type":"PeerNotifyEvents"},{"id":"1830677896","predicate":"peerNotifyEventsAll","params":[],"type":"PeerNotifyEvents"},{"id":"1889961234","predicate":"peerNotifySettingsEmpty","params":[],"type":"PeerNotifySettings"},{"id":"-1697798976","predicate":"peerNotifySettings","params":[{"name":"flags","type":"#"},{"name":"show_previews","type":"flags.0?true"},{"name":"silent","type":"flags.1?true"},{"name":"mute_until","type":"int"},{"name":"sound","type":"string"}],"type":"PeerNotifySettings"},{"id":"-2122045747","predicate":"peerSettings","params":[{"name":"flags","type":"#"},{"name":"report_spam","type":"flags.0?true"}],"type":"PeerSettings"},{"id":"-860866985","predicate":"wallPaper","params":[{"name":"id","type":"int"},{"name":"title","type":"string"},{"name":"sizes","type":"Vector<PhotoSize>"},{"name":"color","type":"int"}],"type":"WallPaper"},{"id":"1490799288","predicate":"inputReportReasonSpam","params":[],"type":"ReportReason"},{"id":"505595789","predicate":"inputReportReasonViolence","params":[],"type":"ReportReason"},{"id":"777640226","predicate":"inputReportReasonPornography","params":[],"type":"ReportReason"},{"id":"-512463606","predicate":"inputReportReasonOther","params":[{"name":"text","type":"string"}],"type":"ReportReason"},{"id":"1496513539","predicate":"userFull","params":[{"name":"flags","type":"#"},{"name":"blocked","type":"flags.0?true"},{"name":"user","type":"User"},{"name":"about","type":"flags.1?string"},{"name":"link","type":"contacts.Link"},{"name":"profile_photo","type":"flags.2?Photo"},{"name":"notify_settings","type":"PeerNotifySettings"},{"name":"bot_info","type":"flags.3?BotInfo"}],"type":"UserFull"},{"id":"-116274796","predicate":"contact","params":[{"name":"user_id","type":"int"},{"name":"mutual","type":"Bool"}],"type":"Contact"},{"id":"-805141448","predicate":"importedContact","params":[{"name":"user_id","type":"int"},{"name":"client_id","type":"long"}],"type":"ImportedContact"},{"id":"1444661369","predicate":"contactBlocked","params":[{"name":"user_id","type":"int"},{"name":"date","type":"int"}],"type":"ContactBlocked"},{"id":"-748155807","predicate":"contactStatus","params":[{"name":"user_id","type":"int"},{"name":"status","type":"UserStatus"}],"type":"ContactStatus"},{"id":"986597452","predicate":"contacts.link","params":[{"name":"my_link","type":"ContactLink"},{"name":"foreign_link","type":"ContactLink"},{"name":"user","type":"User"}],"type":"contacts.Link"},{"id":"-1219778094","predicate":"contacts.contactsNotModified","params":[],"type":"contacts.Contacts"},{"id":"1871416498","predicate":"contacts.contacts","params":[{"name":"contacts","type":"Vector<Contact>"},{"name":"users","type":"Vector<User>"}],"type":"contacts.Contacts"},{"id":"-1387117803","predicate":"contacts.importedContacts","params":[{"name":"imported","type":"Vector<ImportedContact>"},{"name":"retry_contacts","type":"Vector<long>"},{"name":"users","type":"Vector<User>"}],"type":"contacts.ImportedContacts"},{"id":"471043349","predicate":"contacts.blocked","params":[{"name":"blocked","type":"Vector<ContactBlocked>"},{"name":"users","type":"Vector<User>"}],"type":"contacts.Blocked"},{"id":"-1878523231","predicate":"contacts.blockedSlice","params":[{"name":"count","type":"int"},{"name":"blocked","type":"Vector<ContactBlocked>"},{"name":"users","type":"Vector<User>"}],"type":"contacts.Blocked"},{"id":"364538944","predicate":"messages.dialogs","params":[{"name":"dialogs","type":"Vector<Dialog>"},{"name":"messages","type":"Vector<Message>"},{"name":"chats","type":"Vector<Chat>"},{"name":"users","type":"Vector<User>"}],"type":"messages.Dialogs"},{"id":"1910543603","predicate":"messages.dialogsSlice","params":[{"name":"count","type":"int"},{"name":"dialogs","type":"Vector<Dialog>"},{"name":"messages","type":"Vector<Message>"},{"name":"chats","type":"Vector<Chat>"},{"name":"users","type":"Vector<User>"}],"type":"messages.Dialogs"},{"id":"-1938715001","predicate":"messages.messages","params":[{"name":"messages","type":"Vector<Message>"},{"name":"chats","type":"Vector<Chat>"},{"name":"users","type":"Vector<User>"}],"type":"messages.Messages"},{"id":"189033187","predicate":"messages.messagesSlice","params":[{"name":"count","type":"int"},{"name":"messages","type":"Vector<Message>"},{"name":"chats","type":"Vector<Chat>"},{"name":"users","type":"Vector<User>"}],"type":"messages.Messages"},{"id":"1694474197","predicate":"messages.chats","params":[{"name":"chats","type":"Vector<Chat>"}],"type":"messages.Chats"},{"id":"-438840932","predicate":"messages.chatFull","params":[{"name":"full_chat","type":"ChatFull"},{"name":"chats","type":"Vector<Chat>"},{"name":"users","type":"Vector<User>"}],"type":"messages.ChatFull"},{"id":"-1269012015","predicate":"messages.affectedHistory","params":[{"name":"pts","type":"int"},{"name":"pts_count","type":"int"},{"name":"offset","type":"int"}],"type":"messages.AffectedHistory"},{"id":"1474492012","predicate":"inputMessagesFilterEmpty","params":[],"type":"MessagesFilter"},{"id":"-1777752804","predicate":"inputMessagesFilterPhotos","params":[],"type":"MessagesFilter"},{"id":"-1614803355","predicate":"inputMessagesFilterVideo","params":[],"type":"MessagesFilter"},{"id":"1458172132","predicate":"inputMessagesFilterPhotoVideo","params":[],"type":"MessagesFilter"},{"id":"-648121413","predicate":"inputMessagesFilterPhotoVideoDocuments","params":[],"type":"MessagesFilter"},{"id":"-1629621880","predicate":"inputMessagesFilterDocument","params":[],"type":"MessagesFilter"},{"id":"2129714567","predicate":"inputMessagesFilterUrl","params":[],"type":"MessagesFilter"},{"id":"-3644025","predicate":"inputMessagesFilterGif","params":[],"type":"MessagesFilter"},{"id":"522914557","predicate":"updateNewMessage","params":[{"name":"message","type":"Message"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"1318109142","predicate":"updateMessageID","params":[{"name":"id","type":"int"},{"name":"random_id","type":"long"}],"type":"Update"},{"id":"-1576161051","predicate":"updateDeleteMessages","params":[{"name":"messages","type":"Vector<int>"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"1548249383","predicate":"updateUserTyping","params":[{"name":"user_id","type":"int"},{"name":"action","type":"SendMessageAction"}],"type":"Update"},{"id":"-1704596961","predicate":"updateChatUserTyping","params":[{"name":"chat_id","type":"int"},{"name":"user_id","type":"int"},{"name":"action","type":"SendMessageAction"}],"type":"Update"},{"id":"125178264","predicate":"updateChatParticipants","params":[{"name":"participants","type":"ChatParticipants"}],"type":"Update"},{"id":"469489699","predicate":"updateUserStatus","params":[{"name":"user_id","type":"int"},{"name":"status","type":"UserStatus"}],"type":"Update"},{"id":"-1489818765","predicate":"updateUserName","params":[{"name":"user_id","type":"int"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"},{"name":"username","type":"string"}],"type":"Update"},{"id":"-1791935732","predicate":"updateUserPhoto","params":[{"name":"user_id","type":"int"},{"name":"date","type":"int"},{"name":"photo","type":"UserProfilePhoto"},{"name":"previous","type":"Bool"}],"type":"Update"},{"id":"628472761","predicate":"updateContactRegistered","params":[{"name":"user_id","type":"int"},{"name":"date","type":"int"}],"type":"Update"},{"id":"-1657903163","predicate":"updateContactLink","params":[{"name":"user_id","type":"int"},{"name":"my_link","type":"ContactLink"},{"name":"foreign_link","type":"ContactLink"}],"type":"Update"},{"id":"-1895411046","predicate":"updateNewAuthorization","params":[{"name":"auth_key_id","type":"long"},{"name":"date","type":"int"},{"name":"device","type":"string"},{"name":"location","type":"string"}],"type":"Update"},{"id":"-1519637954","predicate":"updates.state","params":[{"name":"pts","type":"int"},{"name":"qts","type":"int"},{"name":"date","type":"int"},{"name":"seq","type":"int"},{"name":"unread_count","type":"int"}],"type":"updates.State"},{"id":"1567990072","predicate":"updates.differenceEmpty","params":[{"name":"date","type":"int"},{"name":"seq","type":"int"}],"type":"updates.Difference"},{"id":"16030880","predicate":"updates.difference","params":[{"name":"new_messages","type":"Vector<Message>"},{"name":"new_encrypted_messages","type":"Vector<EncryptedMessage>"},{"name":"other_updates","type":"Vector<Update>"},{"name":"chats","type":"Vector<Chat>"},{"name":"users","type":"Vector<User>"},{"name":"state","type":"updates.State"}],"type":"updates.Difference"},{"id":"-1459938943","predicate":"updates.differenceSlice","params":[{"name":"new_messages","type":"Vector<Message>"},{"name":"new_encrypted_messages","type":"Vector<EncryptedMessage>"},{"name":"other_updates","type":"Vector<Update>"},{"name":"chats","type":"Vector<Chat>"},{"name":"users","type":"Vector<User>"},{"name":"intermediate_state","type":"updates.State"}],"type":"updates.Difference"},{"id":"-484987010","predicate":"updatesTooLong","params":[],"type":"Updates"},{"id":"-1857044719","predicate":"updateShortMessage","params":[{"name":"flags","type":"#"},{"name":"out","type":"flags.1?true"},{"name":"mentioned","type":"flags.4?true"},{"name":"media_unread","type":"flags.5?true"},{"name":"silent","type":"flags.13?true"},{"name":"id","type":"int"},{"name":"user_id","type":"int"},{"name":"message","type":"string"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"},{"name":"date","type":"int"},{"name":"fwd_from","type":"flags.2?MessageFwdHeader"},{"name":"via_bot_id","type":"flags.11?int"},{"name":"reply_to_msg_id","type":"flags.3?int"},{"name":"entities","type":"flags.7?Vector<MessageEntity>"}],"type":"Updates"},{"id":"377562760","predicate":"updateShortChatMessage","params":[{"name":"flags","type":"#"},{"name":"out","type":"flags.1?true"},{"name":"mentioned","type":"flags.4?true"},{"name":"media_unread","type":"flags.5?true"},{"name":"silent","type":"flags.13?true"},{"name":"id","type":"int"},{"name":"from_id","type":"int"},{"name":"chat_id","type":"int"},{"name":"message","type":"string"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"},{"name":"date","type":"int"},{"name":"fwd_from","type":"flags.2?MessageFwdHeader"},{"name":"via_bot_id","type":"flags.11?int"},{"name":"reply_to_msg_id","type":"flags.3?int"},{"name":"entities","type":"flags.7?Vector<MessageEntity>"}],"type":"Updates"},{"id":"2027216577","predicate":"updateShort","params":[{"name":"update","type":"Update"},{"name":"date","type":"int"}],"type":"Updates"},{"id":"1918567619","predicate":"updatesCombined","params":[{"name":"updates","type":"Vector<Update>"},{"name":"users","type":"Vector<User>"},{"name":"chats","type":"Vector<Chat>"},{"name":"date","type":"int"},{"name":"seq_start","type":"int"},{"name":"seq","type":"int"}],"type":"Updates"},{"id":"1957577280","predicate":"updates","params":[{"name":"updates","type":"Vector<Update>"},{"name":"users","type":"Vector<User>"},{"name":"chats","type":"Vector<Chat>"},{"name":"date","type":"int"},{"name":"seq","type":"int"}],"type":"Updates"},{"id":"-1916114267","predicate":"photos.photos","params":[{"name":"photos","type":"Vector<Photo>"},{"name":"users","type":"Vector<User>"}],"type":"photos.Photos"},{"id":"352657236","predicate":"photos.photosSlice","params":[{"name":"count","type":"int"},{"name":"photos","type":"Vector<Photo>"},{"name":"users","type":"Vector<User>"}],"type":"photos.Photos"},{"id":"539045032","predicate":"photos.photo","params":[{"name":"photo","type":"Photo"},{"name":"users","type":"Vector<User>"}],"type":"photos.Photo"},{"id":"157948117","predicate":"upload.file","params":[{"name":"type","type":"storage.FileType"},{"name":"mtime","type":"int"},{"name":"bytes","type":"bytes"}],"type":"upload.File"},{"id":"98092748","predicate":"dcOption","params":[{"name":"flags","type":"#"},{"name":"ipv6","type":"flags.0?true"},{"name":"media_only","type":"flags.1?true"},{"name":"tcpo_only","type":"flags.2?true"},{"name":"id","type":"int"},{"name":"ip_address","type":"string"},{"name":"port","type":"int"}],"type":"DcOption"},{"id":"-1704251862","predicate":"config","params":[{"name":"flags","type":"#"},{"name":"date","type":"int"},{"name":"expires","type":"int"},{"name":"test_mode","type":"Bool"},{"name":"this_dc","type":"int"},{"name":"dc_options","type":"Vector<DcOption>"},{"name":"chat_size_max","type":"int"},{"name":"megagroup_size_max","type":"int"},{"name":"forwarded_count_max","type":"int"},{"name":"online_update_period_ms","type":"int"},{"name":"offline_blur_timeout_ms","type":"int"},{"name":"offline_idle_timeout_ms","type":"int"},{"name":"online_cloud_timeout_ms","type":"int"},{"name":"notify_cloud_delay_ms","type":"int"},{"name":"notify_default_delay_ms","type":"int"},{"name":"chat_big_size","type":"int"},{"name":"push_chat_period_ms","type":"int"},{"name":"push_chat_limit","type":"int"},{"name":"saved_gifs_limit","type":"int"},{"name":"edit_time_limit","type":"int"},{"name":"rating_e_decay","type":"int"},{"name":"stickers_recent_limit","type":"int"},{"name":"tmp_sessions","type":"flags.0?int"},{"name":"disabled_features","type":"Vector<DisabledFeature>"}],"type":"Config"},{"id":"-1910892683","predicate":"nearestDc","params":[{"name":"country","type":"string"},{"name":"this_dc","type":"int"},{"name":"nearest_dc","type":"int"}],"type":"NearestDc"},{"id":"-1987579119","predicate":"help.appUpdate","params":[{"name":"id","type":"int"},{"name":"critical","type":"Bool"},{"name":"url","type":"string"},{"name":"text","type":"string"}],"type":"help.AppUpdate"},{"id":"-1000708810","predicate":"help.noAppUpdate","params":[],"type":"help.AppUpdate"},{"id":"415997816","predicate":"help.inviteText","params":[{"name":"message","type":"string"}],"type":"help.InviteText"},{"id":"1662091044","predicate":"wallPaperSolid","params":[{"name":"id","type":"int"},{"name":"title","type":"string"},{"name":"bg_color","type":"int"},{"name":"color","type":"int"}],"type":"WallPaper"},{"id":"314359194","predicate":"updateNewEncryptedMessage","params":[{"name":"message","type":"EncryptedMessage"},{"name":"qts","type":"int"}],"type":"Update"},{"id":"386986326","predicate":"updateEncryptedChatTyping","params":[{"name":"chat_id","type":"int"}],"type":"Update"},{"id":"-1264392051","predicate":"updateEncryption","params":[{"name":"chat","type":"EncryptedChat"},{"name":"date","type":"int"}],"type":"Update"},{"id":"956179895","predicate":"updateEncryptedMessagesRead","params":[{"name":"chat_id","type":"int"},{"name":"max_date","type":"int"},{"name":"date","type":"int"}],"type":"Update"},{"id":"-1417756512","predicate":"encryptedChatEmpty","params":[{"name":"id","type":"int"}],"type":"EncryptedChat"},{"id":"1006044124","predicate":"encryptedChatWaiting","params":[{"name":"id","type":"int"},{"name":"access_hash","type":"long"},{"name":"date","type":"int"},{"name":"admin_id","type":"int"},{"name":"participant_id","type":"int"}],"type":"EncryptedChat"},{"id":"-931638658","predicate":"encryptedChatRequested","params":[{"name":"id","type":"int"},{"name":"access_hash","type":"long"},{"name":"date","type":"int"},{"name":"admin_id","type":"int"},{"name":"participant_id","type":"int"},{"name":"g_a","type":"bytes"}],"type":"EncryptedChat"},{"id":"-94974410","predicate":"encryptedChat","params":[{"name":"id","type":"int"},{"name":"access_hash","type":"long"},{"name":"date","type":"int"},{"name":"admin_id","type":"int"},{"name":"participant_id","type":"int"},{"name":"g_a_or_b","type":"bytes"},{"name":"key_fingerprint","type":"long"}],"type":"EncryptedChat"},{"id":"332848423","predicate":"encryptedChatDiscarded","params":[{"name":"id","type":"int"}],"type":"EncryptedChat"},{"id":"-247351839","predicate":"inputEncryptedChat","params":[{"name":"chat_id","type":"int"},{"name":"access_hash","type":"long"}],"type":"InputEncryptedChat"},{"id":"-1038136962","predicate":"encryptedFileEmpty","params":[],"type":"EncryptedFile"},{"id":"1248893260","predicate":"encryptedFile","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"},{"name":"size","type":"int"},{"name":"dc_id","type":"int"},{"name":"key_fingerprint","type":"int"}],"type":"EncryptedFile"},{"id":"406307684","predicate":"inputEncryptedFileEmpty","params":[],"type":"InputEncryptedFile"},{"id":"1690108678","predicate":"inputEncryptedFileUploaded","params":[{"name":"id","type":"long"},{"name":"parts","type":"int"},{"name":"md5_checksum","type":"string"},{"name":"key_fingerprint","type":"int"}],"type":"InputEncryptedFile"},{"id":"1511503333","predicate":"inputEncryptedFile","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputEncryptedFile"},{"id":"-182231723","predicate":"inputEncryptedFileLocation","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputFileLocation"},{"id":"-317144808","predicate":"encryptedMessage","params":[{"name":"random_id","type":"long"},{"name":"chat_id","type":"int"},{"name":"date","type":"int"},{"name":"bytes","type":"bytes"},{"name":"file","type":"EncryptedFile"}],"type":"EncryptedMessage"},{"id":"594758406","predicate":"encryptedMessageService","params":[{"name":"random_id","type":"long"},{"name":"chat_id","type":"int"},{"name":"date","type":"int"},{"name":"bytes","type":"bytes"}],"type":"EncryptedMessage"},{"id":"-1058912715","predicate":"messages.dhConfigNotModified","params":[{"name":"random","type":"bytes"}],"type":"messages.DhConfig"},{"id":"740433629","predicate":"messages.dhConfig","params":[{"name":"g","type":"int"},{"name":"p","type":"bytes"},{"name":"version","type":"int"},{"name":"random","type":"bytes"}],"type":"messages.DhConfig"},{"id":"1443858741","predicate":"messages.sentEncryptedMessage","params":[{"name":"date","type":"int"}],"type":"messages.SentEncryptedMessage"},{"id":"-1802240206","predicate":"messages.sentEncryptedFile","params":[{"name":"date","type":"int"},{"name":"file","type":"EncryptedFile"}],"type":"messages.SentEncryptedMessage"},{"id":"-95482955","predicate":"inputFileBig","params":[{"name":"id","type":"long"},{"name":"parts","type":"int"},{"name":"name","type":"string"}],"type":"InputFile"},{"id":"767652808","predicate":"inputEncryptedFileBigUploaded","params":[{"name":"id","type":"long"},{"name":"parts","type":"int"},{"name":"key_fingerprint","type":"int"}],"type":"InputEncryptedFile"},{"id":"-364179876","predicate":"updateChatParticipantAdd","params":[{"name":"chat_id","type":"int"},{"name":"user_id","type":"int"},{"name":"inviter_id","type":"int"},{"name":"date","type":"int"},{"name":"version","type":"int"}],"type":"Update"},{"id":"1851755554","predicate":"updateChatParticipantDelete","params":[{"name":"chat_id","type":"int"},{"name":"user_id","type":"int"},{"name":"version","type":"int"}],"type":"Update"},{"id":"-1906403213","predicate":"updateDcOptions","params":[{"name":"dc_options","type":"Vector<DcOption>"}],"type":"Update"},{"id":"-797904407","predicate":"inputMediaUploadedDocument","params":[{"name":"flags","type":"#"},{"name":"file","type":"InputFile"},{"name":"mime_type","type":"string"},{"name":"attributes","type":"Vector<DocumentAttribute>"},{"name":"caption","type":"string"},{"name":"stickers","type":"flags.0?Vector<InputDocument>"}],"type":"InputMedia"},{"id":"1356369070","predicate":"inputMediaUploadedThumbDocument","params":[{"name":"flags","type":"#"},{"name":"file","type":"InputFile"},{"name":"thumb","type":"InputFile"},{"name":"mime_type","type":"string"},{"name":"attributes","type":"Vector<DocumentAttribute>"},{"name":"caption","type":"string"},{"name":"stickers","type":"flags.0?Vector<InputDocument>"}],"type":"InputMedia"},{"id":"444068508","predicate":"inputMediaDocument","params":[{"name":"id","type":"InputDocument"},{"name":"caption","type":"string"}],"type":"InputMedia"},{"id":"-203411800","predicate":"messageMediaDocument","params":[{"name":"document","type":"Document"},{"name":"caption","type":"string"}],"type":"MessageMedia"},{"id":"1928391342","predicate":"inputDocumentEmpty","params":[],"type":"InputDocument"},{"id":"410618194","predicate":"inputDocument","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputDocument"},{"id":"1125058340","predicate":"inputDocumentFileLocation","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"},{"name":"version","type":"int"}],"type":"InputFileLocation"},{"id":"922273905","predicate":"documentEmpty","params":[{"name":"id","type":"long"}],"type":"Document"},{"id":"-2027738169","predicate":"document","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"},{"name":"date","type":"int"},{"name":"mime_type","type":"string"},{"name":"size","type":"int"},{"name":"thumb","type":"PhotoSize"},{"name":"dc_id","type":"int"},{"name":"version","type":"int"},{"name":"attributes","type":"Vector<DocumentAttribute>"}],"type":"Document"},{"id":"398898678","predicate":"help.support","params":[{"name":"phone_number","type":"string"},{"name":"user","type":"User"}],"type":"help.Support"},{"id":"-1613493288","predicate":"notifyPeer","params":[{"name":"peer","type":"Peer"}],"type":"NotifyPeer"},{"id":"-1261946036","predicate":"notifyUsers","params":[],"type":"NotifyPeer"},{"id":"-1073230141","predicate":"notifyChats","params":[],"type":"NotifyPeer"},{"id":"1959820384","predicate":"notifyAll","params":[],"type":"NotifyPeer"},{"id":"-2131957734","predicate":"updateUserBlocked","params":[{"name":"user_id","type":"int"},{"name":"blocked","type":"Bool"}],"type":"Update"},{"id":"-1094555409","predicate":"updateNotifySettings","params":[{"name":"peer","type":"NotifyPeer"},{"name":"notify_settings","type":"PeerNotifySettings"}],"type":"Update"},{"id":"381645902","predicate":"sendMessageTypingAction","params":[],"type":"SendMessageAction"},{"id":"-44119819","predicate":"sendMessageCancelAction","params":[],"type":"SendMessageAction"},{"id":"-1584933265","predicate":"sendMessageRecordVideoAction","params":[],"type":"SendMessageAction"},{"id":"-378127636","predicate":"sendMessageUploadVideoAction","params":[{"name":"progress","type":"int"}],"type":"SendMessageAction"},{"id":"-718310409","predicate":"sendMessageRecordAudioAction","params":[],"type":"SendMessageAction"},{"id":"-212740181","predicate":"sendMessageUploadAudioAction","params":[{"name":"progress","type":"int"}],"type":"SendMessageAction"},{"id":"-774682074","predicate":"sendMessageUploadPhotoAction","params":[{"name":"progress","type":"int"}],"type":"SendMessageAction"},{"id":"-1441998364","predicate":"sendMessageUploadDocumentAction","params":[{"name":"progress","type":"int"}],"type":"SendMessageAction"},{"id":"393186209","predicate":"sendMessageGeoLocationAction","params":[],"type":"SendMessageAction"},{"id":"1653390447","predicate":"sendMessageChooseContactAction","params":[],"type":"SendMessageAction"},{"id":"446822276","predicate":"contacts.found","params":[{"name":"results","type":"Vector<Peer>"},{"name":"chats","type":"Vector<Chat>"},{"name":"users","type":"Vector<User>"}],"type":"contacts.Found"},{"id":"942527460","predicate":"updateServiceNotification","params":[{"name":"type","type":"string"},{"name":"message","type":"string"},{"name":"media","type":"MessageMedia"},{"name":"popup","type":"Bool"}],"type":"Update"},{"id":"-496024847","predicate":"userStatusRecently","params":[],"type":"UserStatus"},{"id":"129960444","predicate":"userStatusLastWeek","params":[],"type":"UserStatus"},{"id":"2011940674","predicate":"userStatusLastMonth","params":[],"type":"UserStatus"},{"id":"-298113238","predicate":"updatePrivacy","params":[{"name":"key","type":"PrivacyKey"},{"name":"rules","type":"Vector<PrivacyRule>"}],"type":"Update"},{"id":"1335282456","predicate":"inputPrivacyKeyStatusTimestamp","params":[],"type":"InputPrivacyKey"},{"id":"-1137792208","predicate":"privacyKeyStatusTimestamp","params":[],"type":"PrivacyKey"},{"id":"218751099","predicate":"inputPrivacyValueAllowContacts","params":[],"type":"InputPrivacyRule"},{"id":"407582158","predicate":"inputPrivacyValueAllowAll","params":[],"type":"InputPrivacyRule"},{"id":"320652927","predicate":"inputPrivacyValueAllowUsers","params":[{"name":"users","type":"Vector<InputUser>"}],"type":"InputPrivacyRule"},{"id":"195371015","predicate":"inputPrivacyValueDisallowContacts","params":[],"type":"InputPrivacyRule"},{"id":"-697604407","predicate":"inputPrivacyValueDisallowAll","params":[],"type":"InputPrivacyRule"},{"id":"-1877932953","predicate":"inputPrivacyValueDisallowUsers","params":[{"name":"users","type":"Vector<InputUser>"}],"type":"InputPrivacyRule"},{"id":"-123988","predicate":"privacyValueAllowContacts","params":[],"type":"PrivacyRule"},{"id":"1698855810","predicate":"privacyValueAllowAll","params":[],"type":"PrivacyRule"},{"id":"1297858060","predicate":"privacyValueAllowUsers","params":[{"name":"users","type":"Vector<int>"}],"type":"PrivacyRule"},{"id":"-125240806","predicate":"privacyValueDisallowContacts","params":[],"type":"PrivacyRule"},{"id":"-1955338397","predicate":"privacyValueDisallowAll","params":[],"type":"PrivacyRule"},{"id":"209668535","predicate":"privacyValueDisallowUsers","params":[{"name":"users","type":"Vector<int>"}],"type":"PrivacyRule"},{"id":"1430961007","predicate":"account.privacyRules","params":[{"name":"rules","type":"Vector<PrivacyRule>"},{"name":"users","type":"Vector<User>"}],"type":"account.PrivacyRules"},{"id":"-1194283041","predicate":"accountDaysTTL","params":[{"name":"days","type":"int"}],"type":"AccountDaysTTL"},{"id":"314130811","predicate":"updateUserPhone","params":[{"name":"user_id","type":"int"},{"name":"phone","type":"string"}],"type":"Update"},{"id":"1815593308","predicate":"documentAttributeImageSize","params":[{"name":"w","type":"int"},{"name":"h","type":"int"}],"type":"DocumentAttribute"},{"id":"297109817","predicate":"documentAttributeAnimated","params":[],"type":"DocumentAttribute"},{"id":"1662637586","predicate":"documentAttributeSticker","params":[{"name":"flags","type":"#"},{"name":"mask","type":"flags.1?true"},{"name":"alt","type":"string"},{"name":"stickerset","type":"InputStickerSet"},{"name":"mask_coords","type":"flags.0?MaskCoords"}],"type":"DocumentAttribute"},{"id":"1494273227","predicate":"documentAttributeVideo","params":[{"name":"duration","type":"int"},{"name":"w","type":"int"},{"name":"h","type":"int"}],"type":"DocumentAttribute"},{"id":"-1739392570","predicate":"documentAttributeAudio","params":[{"name":"flags","type":"#"},{"name":"voice","type":"flags.10?true"},{"name":"duration","type":"int"},{"name":"title","type":"flags.0?string"},{"name":"performer","type":"flags.1?string"},{"name":"waveform","type":"flags.2?bytes"}],"type":"DocumentAttribute"},{"id":"358154344","predicate":"documentAttributeFilename","params":[{"name":"file_name","type":"string"}],"type":"DocumentAttribute"},{"id":"-244016606","predicate":"messages.stickersNotModified","params":[],"type":"messages.Stickers"},{"id":"-1970352846","predicate":"messages.stickers","params":[{"name":"hash","type":"string"},{"name":"stickers","type":"Vector<Document>"}],"type":"messages.Stickers"},{"id":"313694676","predicate":"stickerPack","params":[{"name":"emoticon","type":"string"},{"name":"documents","type":"Vector<long>"}],"type":"StickerPack"},{"id":"-395967805","predicate":"messages.allStickersNotModified","params":[],"type":"messages.AllStickers"},{"id":"-302170017","predicate":"messages.allStickers","params":[{"name":"hash","type":"int"},{"name":"sets","type":"Vector<StickerSet>"}],"type":"messages.AllStickers"},{"id":"-1369215196","predicate":"disabledFeature","params":[{"name":"feature","type":"string"},{"name":"description","type":"string"}],"type":"DisabledFeature"},{"id":"-1721631396","predicate":"updateReadHistoryInbox","params":[{"name":"peer","type":"Peer"},{"name":"max_id","type":"int"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"791617983","predicate":"updateReadHistoryOutbox","params":[{"name":"peer","type":"Peer"},{"name":"max_id","type":"int"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"-2066640507","predicate":"messages.affectedMessages","params":[{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"messages.AffectedMessages"},{"id":"1599050311","predicate":"contactLinkUnknown","params":[],"type":"ContactLink"},{"id":"-17968211","predicate":"contactLinkNone","params":[],"type":"ContactLink"},{"id":"646922073","predicate":"contactLinkHasPhone","params":[],"type":"ContactLink"},{"id":"-721239344","predicate":"contactLinkContact","params":[],"type":"ContactLink"},{"id":"2139689491","predicate":"updateWebPage","params":[{"name":"webpage","type":"WebPage"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"-350980120","predicate":"webPageEmpty","params":[{"name":"id","type":"long"}],"type":"WebPage"},{"id":"-981018084","predicate":"webPagePending","params":[{"name":"id","type":"long"},{"name":"date","type":"int"}],"type":"WebPage"},{"id":"-897446185","predicate":"webPage","params":[{"name":"flags","type":"#"},{"name":"id","type":"long"},{"name":"url","type":"string"},{"name":"display_url","type":"string"},{"name":"type","type":"flags.0?string"},{"name":"site_name","type":"flags.1?string"},{"name":"title","type":"flags.2?string"},{"name":"description","type":"flags.3?string"},{"name":"photo","type":"flags.4?Photo"},{"name":"embed_url","type":"flags.5?string"},{"name":"embed_type","type":"flags.5?string"},{"name":"embed_width","type":"flags.6?int"},{"name":"embed_height","type":"flags.6?int"},{"name":"duration","type":"flags.7?int"},{"name":"author","type":"flags.8?string"},{"name":"document","type":"flags.9?Document"}],"type":"WebPage"},{"id":"-1557277184","predicate":"messageMediaWebPage","params":[{"name":"webpage","type":"WebPage"}],"type":"MessageMedia"},{"id":"2079516406","predicate":"authorization","params":[{"name":"hash","type":"long"},{"name":"flags","type":"int"},{"name":"device_model","type":"string"},{"name":"platform","type":"string"},{"name":"system_version","type":"string"},{"name":"api_id","type":"int"},{"name":"app_name","type":"string"},{"name":"app_version","type":"string"},{"name":"date_created","type":"int"},{"name":"date_active","type":"int"},{"name":"ip","type":"string"},{"name":"country","type":"string"},{"name":"region","type":"string"}],"type":"Authorization"},{"id":"307276766","predicate":"account.authorizations","params":[{"name":"authorizations","type":"Vector<Authorization>"}],"type":"account.Authorizations"},{"id":"-1764049896","predicate":"account.noPassword","params":[{"name":"new_salt","type":"bytes"},{"name":"email_unconfirmed_pattern","type":"string"}],"type":"account.Password"},{"id":"2081952796","predicate":"account.password","params":[{"name":"current_salt","type":"bytes"},{"name":"new_salt","type":"bytes"},{"name":"hint","type":"string"},{"name":"has_recovery","type":"Bool"},{"name":"email_unconfirmed_pattern","type":"string"}],"type":"account.Password"},{"id":"-1212732749","predicate":"account.passwordSettings","params":[{"name":"email","type":"string"}],"type":"account.PasswordSettings"},{"id":"-2037289493","predicate":"account.passwordInputSettings","params":[{"name":"flags","type":"#"},{"name":"new_salt","type":"flags.0?bytes"},{"name":"new_password_hash","type":"flags.0?bytes"},{"name":"hint","type":"flags.0?string"},{"name":"email","type":"flags.1?string"}],"type":"account.PasswordInputSettings"},{"id":"326715557","predicate":"auth.passwordRecovery","params":[{"name":"email_pattern","type":"string"}],"type":"auth.PasswordRecovery"},{"id":"673687578","predicate":"inputMediaVenue","params":[{"name":"geo_point","type":"InputGeoPoint"},{"name":"title","type":"string"},{"name":"address","type":"string"},{"name":"provider","type":"string"},{"name":"venue_id","type":"string"}],"type":"InputMedia"},{"id":"2031269663","predicate":"messageMediaVenue","params":[{"name":"geo","type":"GeoPoint"},{"name":"title","type":"string"},{"name":"address","type":"string"},{"name":"provider","type":"string"},{"name":"venue_id","type":"string"}],"type":"MessageMedia"},{"id":"-1551583367","predicate":"receivedNotifyMessage","params":[{"name":"id","type":"int"},{"name":"flags","type":"int"}],"type":"ReceivedNotifyMessage"},{"id":"1776236393","predicate":"chatInviteEmpty","params":[],"type":"ExportedChatInvite"},{"id":"-64092740","predicate":"chatInviteExported","params":[{"name":"link","type":"string"}],"type":"ExportedChatInvite"},{"id":"1516793212","predicate":"chatInviteAlready","params":[{"name":"chat","type":"Chat"}],"type":"ChatInvite"},{"id":"-613092008","predicate":"chatInvite","params":[{"name":"flags","type":"#"},{"name":"channel","type":"flags.0?true"},{"name":"broadcast","type":"flags.1?true"},{"name":"public","type":"flags.2?true"},{"name":"megagroup","type":"flags.3?true"},{"name":"title","type":"string"},{"name":"photo","type":"ChatPhoto"},{"name":"participants_count","type":"int"},{"name":"participants","type":"flags.4?Vector<User>"}],"type":"ChatInvite"},{"id":"-123931160","predicate":"messageActionChatJoinedByLink","params":[{"name":"inviter_id","type":"int"}],"type":"MessageAction"},{"id":"1757493555","predicate":"updateReadMessagesContents","params":[{"name":"messages","type":"Vector<int>"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"-4838507","predicate":"inputStickerSetEmpty","params":[],"type":"InputStickerSet"},{"id":"-1645763991","predicate":"inputStickerSetID","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputStickerSet"},{"id":"-2044933984","predicate":"inputStickerSetShortName","params":[{"name":"short_name","type":"string"}],"type":"InputStickerSet"},{"id":"-852477119","predicate":"stickerSet","params":[{"name":"flags","type":"#"},{"name":"installed","type":"flags.0?true"},{"name":"archived","type":"flags.1?true"},{"name":"official","type":"flags.2?true"},{"name":"masks","type":"flags.3?true"},{"name":"id","type":"long"},{"name":"access_hash","type":"long"},{"name":"title","type":"string"},{"name":"short_name","type":"string"},{"name":"count","type":"int"},{"name":"hash","type":"int"}],"type":"StickerSet"},{"id":"-1240849242","predicate":"messages.stickerSet","params":[{"name":"set","type":"StickerSet"},{"name":"packs","type":"Vector<StickerPack>"},{"name":"documents","type":"Vector<Document>"}],"type":"messages.StickerSet"},{"id":"-787638374","predicate":"user","params":[{"name":"flags","type":"#"},{"name":"self","type":"flags.10?true"},{"name":"contact","type":"flags.11?true"},{"name":"mutual_contact","type":"flags.12?true"},{"name":"deleted","type":"flags.13?true"},{"name":"bot","type":"flags.14?true"},{"name":"bot_chat_history","type":"flags.15?true"},{"name":"bot_nochats","type":"flags.16?true"},{"name":"verified","type":"flags.17?true"},{"name":"restricted","type":"flags.18?true"},{"name":"min","type":"flags.20?true"},{"name":"bot_inline_geo","type":"flags.21?true"},{"name":"id","type":"int"},{"name":"access_hash","type":"flags.0?long"},{"name":"first_name","type":"flags.1?string"},{"name":"last_name","type":"flags.2?string"},{"name":"username","type":"flags.3?string"},{"name":"phone","type":"flags.4?string"},{"name":"photo","type":"flags.5?UserProfilePhoto"},{"name":"status","type":"flags.6?UserStatus"},{"name":"bot_info_version","type":"flags.14?int"},{"name":"restriction_reason","type":"flags.18?string"},{"name":"bot_inline_placeholder","type":"flags.19?string"}],"type":"User"},{"id":"-1032140601","predicate":"botCommand","params":[{"name":"command","type":"string"},{"name":"description","type":"string"}],"type":"BotCommand"},{"id":"-1729618630","predicate":"botInfo","params":[{"name":"user_id","type":"int"},{"name":"description","type":"string"},{"name":"commands","type":"Vector<BotCommand>"}],"type":"BotInfo"},{"id":"-1560655744","predicate":"keyboardButton","params":[{"name":"text","type":"string"}],"type":"KeyboardButton"},{"id":"2002815875","predicate":"keyboardButtonRow","params":[{"name":"buttons","type":"Vector<KeyboardButton>"}],"type":"KeyboardButtonRow"},{"id":"-1606526075","predicate":"replyKeyboardHide","params":[{"name":"flags","type":"#"},{"name":"selective","type":"flags.2?true"}],"type":"ReplyMarkup"},{"id":"-200242528","predicate":"replyKeyboardForceReply","params":[{"name":"flags","type":"#"},{"name":"single_use","type":"flags.1?true"},{"name":"selective","type":"flags.2?true"}],"type":"ReplyMarkup"},{"id":"889353612","predicate":"replyKeyboardMarkup","params":[{"name":"flags","type":"#"},{"name":"resize","type":"flags.0?true"},{"name":"single_use","type":"flags.1?true"},{"name":"selective","type":"flags.2?true"},{"name":"rows","type":"Vector<KeyboardButtonRow>"}],"type":"ReplyMarkup"},{"id":"2072935910","predicate":"inputPeerUser","params":[{"name":"user_id","type":"int"},{"name":"access_hash","type":"long"}],"type":"InputPeer"},{"id":"-668391402","predicate":"inputUser","params":[{"name":"user_id","type":"int"},{"name":"access_hash","type":"long"}],"type":"InputUser"},{"id":"-1350696044","predicate":"help.appChangelogEmpty","params":[],"type":"help.AppChangelog"},{"id":"1181279933","predicate":"help.appChangelog","params":[{"name":"text","type":"string"}],"type":"help.AppChangelog"},{"id":"-1148011883","predicate":"messageEntityUnknown","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"-100378723","predicate":"messageEntityMention","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"1868782349","predicate":"messageEntityHashtag","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"1827637959","predicate":"messageEntityBotCommand","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"1859134776","predicate":"messageEntityUrl","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"1692693954","predicate":"messageEntityEmail","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"-1117713463","predicate":"messageEntityBold","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"-2106619040","predicate":"messageEntityItalic","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"681706865","predicate":"messageEntityCode","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"}],"type":"MessageEntity"},{"id":"1938967520","predicate":"messageEntityPre","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"},{"name":"language","type":"string"}],"type":"MessageEntity"},{"id":"1990644519","predicate":"messageEntityTextUrl","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"},{"name":"url","type":"string"}],"type":"MessageEntity"},{"id":"301019932","predicate":"updateShortSentMessage","params":[{"name":"flags","type":"#"},{"name":"out","type":"flags.1?true"},{"name":"id","type":"int"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"},{"name":"date","type":"int"},{"name":"media","type":"flags.9?MessageMedia"},{"name":"entities","type":"flags.7?Vector<MessageEntity>"}],"type":"Updates"},{"id":"-292807034","predicate":"inputChannelEmpty","params":[],"type":"InputChannel"},{"id":"-1343524562","predicate":"inputChannel","params":[{"name":"channel_id","type":"int"},{"name":"access_hash","type":"long"}],"type":"InputChannel"},{"id":"-1109531342","predicate":"peerChannel","params":[{"name":"channel_id","type":"int"}],"type":"Peer"},{"id":"548253432","predicate":"inputPeerChannel","params":[{"name":"channel_id","type":"int"},{"name":"access_hash","type":"long"}],"type":"InputPeer"},{"id":"-1588737454","predicate":"channel","params":[{"name":"flags","type":"#"},{"name":"creator","type":"flags.0?true"},{"name":"kicked","type":"flags.1?true"},{"name":"left","type":"flags.2?true"},{"name":"editor","type":"flags.3?true"},{"name":"moderator","type":"flags.4?true"},{"name":"broadcast","type":"flags.5?true"},{"name":"verified","type":"flags.7?true"},{"name":"megagroup","type":"flags.8?true"},{"name":"restricted","type":"flags.9?true"},{"name":"democracy","type":"flags.10?true"},{"name":"signatures","type":"flags.11?true"},{"name":"min","type":"flags.12?true"},{"name":"id","type":"int"},{"name":"access_hash","type":"flags.13?long"},{"name":"title","type":"string"},{"name":"username","type":"flags.6?string"},{"name":"photo","type":"ChatPhoto"},{"name":"date","type":"int"},{"name":"version","type":"int"},{"name":"restriction_reason","type":"flags.9?string"}],"type":"Chat"},{"id":"-2059962289","predicate":"channelForbidden","params":[{"name":"flags","type":"#"},{"name":"broadcast","type":"flags.5?true"},{"name":"megagroup","type":"flags.8?true"},{"name":"id","type":"int"},{"name":"access_hash","type":"long"},{"name":"title","type":"string"}],"type":"Chat"},{"id":"2131196633","predicate":"contacts.resolvedPeer","params":[{"name":"peer","type":"Peer"},{"name":"chats","type":"Vector<Chat>"},{"name":"users","type":"Vector<User>"}],"type":"contacts.ResolvedPeer"},{"id":"-1009430225","predicate":"channelFull","params":[{"name":"flags","type":"#"},{"name":"can_view_participants","type":"flags.3?true"},{"name":"can_set_username","type":"flags.6?true"},{"name":"id","type":"int"},{"name":"about","type":"string"},{"name":"participants_count","type":"flags.0?int"},{"name":"admins_count","type":"flags.1?int"},{"name":"kicked_count","type":"flags.2?int"},{"name":"read_inbox_max_id","type":"int"},{"name":"read_outbox_max_id","type":"int"},{"name":"unread_count","type":"int"},{"name":"chat_photo","type":"Photo"},{"name":"notify_settings","type":"PeerNotifySettings"},{"name":"exported_invite","type":"ExportedChatInvite"},{"name":"bot_info","type":"Vector<BotInfo>"},{"name":"migrated_from_chat_id","type":"flags.4?int"},{"name":"migrated_from_max_id","type":"flags.4?int"},{"name":"pinned_msg_id","type":"flags.5?int"}],"type":"ChatFull"},{"id":"182649427","predicate":"messageRange","params":[{"name":"min_id","type":"int"},{"name":"max_id","type":"int"}],"type":"MessageRange"},{"id":"-1725551049","predicate":"messages.channelMessages","params":[{"name":"flags","type":"#"},{"name":"pts","type":"int"},{"name":"count","type":"int"},{"name":"messages","type":"Vector<Message>"},{"name":"chats","type":"Vector<Chat>"},{"name":"users","type":"Vector<User>"}],"type":"messages.Messages"},{"id":"-1781355374","predicate":"messageActionChannelCreate","params":[{"name":"title","type":"string"}],"type":"MessageAction"},{"id":"-352032773","predicate":"updateChannelTooLong","params":[{"name":"flags","type":"#"},{"name":"channel_id","type":"int"},{"name":"pts","type":"flags.0?int"}],"type":"Update"},{"id":"-1227598250","predicate":"updateChannel","params":[{"name":"channel_id","type":"int"}],"type":"Update"},{"id":"1656358105","predicate":"updateNewChannelMessage","params":[{"name":"message","type":"Message"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"1108669311","predicate":"updateReadChannelInbox","params":[{"name":"channel_id","type":"int"},{"name":"max_id","type":"int"}],"type":"Update"},{"id":"-1015733815","predicate":"updateDeleteChannelMessages","params":[{"name":"channel_id","type":"int"},{"name":"messages","type":"Vector<int>"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"-1734268085","predicate":"updateChannelMessageViews","params":[{"name":"channel_id","type":"int"},{"name":"id","type":"int"},{"name":"views","type":"int"}],"type":"Update"},{"id":"1041346555","predicate":"updates.channelDifferenceEmpty","params":[{"name":"flags","type":"#"},{"name":"final","type":"flags.0?true"},{"name":"pts","type":"int"},{"name":"timeout","type":"flags.1?int"}],"type":"updates.ChannelDifference"},{"id":"1091431943","predicate":"updates.channelDifferenceTooLong","params":[{"name":"flags","type":"#"},{"name":"final","type":"flags.0?true"},{"name":"pts","type":"int"},{"name":"timeout","type":"flags.1?int"},{"name":"top_message","type":"int"},{"name":"read_inbox_max_id","type":"int"},{"name":"read_outbox_max_id","type":"int"},{"name":"unread_count","type":"int"},{"name":"messages","type":"Vector<Message>"},{"name":"chats","type":"Vector<Chat>"},{"name":"users","type":"Vector<User>"}],"type":"updates.ChannelDifference"},{"id":"543450958","predicate":"updates.channelDifference","params":[{"name":"flags","type":"#"},{"name":"final","type":"flags.0?true"},{"name":"pts","type":"int"},{"name":"timeout","type":"flags.1?int"},{"name":"new_messages","type":"Vector<Message>"},{"name":"other_updates","type":"Vector<Update>"},{"name":"chats","type":"Vector<Chat>"},{"name":"users","type":"Vector<User>"}],"type":"updates.ChannelDifference"},{"id":"-1798033689","predicate":"channelMessagesFilterEmpty","params":[],"type":"ChannelMessagesFilter"},{"id":"-847783593","predicate":"channelMessagesFilter","params":[{"name":"flags","type":"#"},{"name":"exclude_new_messages","type":"flags.1?true"},{"name":"ranges","type":"Vector<MessageRange>"}],"type":"ChannelMessagesFilter"},{"id":"367766557","predicate":"channelParticipant","params":[{"name":"user_id","type":"int"},{"name":"date","type":"int"}],"type":"ChannelParticipant"},{"id":"-1557620115","predicate":"channelParticipantSelf","params":[{"name":"user_id","type":"int"},{"name":"inviter_id","type":"int"},{"name":"date","type":"int"}],"type":"ChannelParticipant"},{"id":"-1861910545","predicate":"channelParticipantModerator","params":[{"name":"user_id","type":"int"},{"name":"inviter_id","type":"int"},{"name":"date","type":"int"}],"type":"ChannelParticipant"},{"id":"-1743180447","predicate":"channelParticipantEditor","params":[{"name":"user_id","type":"int"},{"name":"inviter_id","type":"int"},{"name":"date","type":"int"}],"type":"ChannelParticipant"},{"id":"-1933187430","predicate":"channelParticipantKicked","params":[{"name":"user_id","type":"int"},{"name":"kicked_by","type":"int"},{"name":"date","type":"int"}],"type":"ChannelParticipant"},{"id":"-471670279","predicate":"channelParticipantCreator","params":[{"name":"user_id","type":"int"}],"type":"ChannelParticipant"},{"id":"-566281095","predicate":"channelParticipantsRecent","params":[],"type":"ChannelParticipantsFilter"},{"id":"-1268741783","predicate":"channelParticipantsAdmins","params":[],"type":"ChannelParticipantsFilter"},{"id":"1010285434","predicate":"channelParticipantsKicked","params":[],"type":"ChannelParticipantsFilter"},{"id":"-1299865402","predicate":"channelRoleEmpty","params":[],"type":"ChannelParticipantRole"},{"id":"-1776756363","predicate":"channelRoleModerator","params":[],"type":"ChannelParticipantRole"},{"id":"-2113143156","predicate":"channelRoleEditor","params":[],"type":"ChannelParticipantRole"},{"id":"-177282392","predicate":"channels.channelParticipants","params":[{"name":"count","type":"int"},{"name":"participants","type":"Vector<ChannelParticipant>"},{"name":"users","type":"Vector<User>"}],"type":"channels.ChannelParticipants"},{"id":"-791039645","predicate":"channels.channelParticipant","params":[{"name":"participant","type":"ChannelParticipant"},{"name":"users","type":"Vector<User>"}],"type":"channels.ChannelParticipant"},{"id":"-636267638","predicate":"chatParticipantCreator","params":[{"name":"user_id","type":"int"}],"type":"ChatParticipant"},{"id":"-489233354","predicate":"chatParticipantAdmin","params":[{"name":"user_id","type":"int"},{"name":"inviter_id","type":"int"},{"name":"date","type":"int"}],"type":"ChatParticipant"},{"id":"1855224129","predicate":"updateChatAdmins","params":[{"name":"chat_id","type":"int"},{"name":"enabled","type":"Bool"},{"name":"version","type":"int"}],"type":"Update"},{"id":"-1232070311","predicate":"updateChatParticipantAdmin","params":[{"name":"chat_id","type":"int"},{"name":"user_id","type":"int"},{"name":"is_admin","type":"Bool"},{"name":"version","type":"int"}],"type":"Update"},{"id":"1371385889","predicate":"messageActionChatMigrateTo","params":[{"name":"channel_id","type":"int"}],"type":"MessageAction"},{"id":"-1336546578","predicate":"messageActionChannelMigrateFrom","params":[{"name":"title","type":"string"},{"name":"chat_id","type":"int"}],"type":"MessageAction"},{"id":"-1328445861","predicate":"channelParticipantsBots","params":[],"type":"ChannelParticipantsFilter"},{"id":"-236044656","predicate":"help.termsOfService","params":[{"name":"text","type":"string"}],"type":"help.TermsOfService"},{"id":"1753886890","predicate":"updateNewStickerSet","params":[{"name":"stickerset","type":"messages.StickerSet"}],"type":"Update"},{"id":"196268545","predicate":"updateStickerSetsOrder","params":[{"name":"flags","type":"#"},{"name":"masks","type":"flags.0?true"},{"name":"order","type":"Vector<long>"}],"type":"Update"},{"id":"1135492588","predicate":"updateStickerSets","params":[],"type":"Update"},{"id":"372165663","predicate":"foundGif","params":[{"name":"url","type":"string"},{"name":"thumb_url","type":"string"},{"name":"content_url","type":"string"},{"name":"content_type","type":"string"},{"name":"w","type":"int"},{"name":"h","type":"int"}],"type":"FoundGif"},{"id":"-1670052855","predicate":"foundGifCached","params":[{"name":"url","type":"string"},{"name":"photo","type":"Photo"},{"name":"document","type":"Document"}],"type":"FoundGif"},{"id":"1212395773","predicate":"inputMediaGifExternal","params":[{"name":"url","type":"string"},{"name":"q","type":"string"}],"type":"InputMedia"},{"id":"1158290442","predicate":"messages.foundGifs","params":[{"name":"next_offset","type":"int"},{"name":"results","type":"Vector<FoundGif>"}],"type":"messages.FoundGifs"},{"id":"-402498398","predicate":"messages.savedGifsNotModified","params":[],"type":"messages.SavedGifs"},{"id":"772213157","predicate":"messages.savedGifs","params":[{"name":"hash","type":"int"},{"name":"gifs","type":"Vector<Document>"}],"type":"messages.SavedGifs"},{"id":"-1821035490","predicate":"updateSavedGifs","params":[],"type":"Update"},{"id":"691006739","predicate":"inputBotInlineMessageMediaAuto","params":[{"name":"flags","type":"#"},{"name":"caption","type":"string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"InputBotInlineMessage"},{"id":"1036876423","predicate":"inputBotInlineMessageText","params":[{"name":"flags","type":"#"},{"name":"no_webpage","type":"flags.0?true"},{"name":"message","type":"string"},{"name":"entities","type":"flags.1?Vector<MessageEntity>"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"InputBotInlineMessage"},{"id":"750510426","predicate":"inputBotInlineResult","params":[{"name":"flags","type":"#"},{"name":"id","type":"string"},{"name":"type","type":"string"},{"name":"title","type":"flags.1?string"},{"name":"description","type":"flags.2?string"},{"name":"url","type":"flags.3?string"},{"name":"thumb_url","type":"flags.4?string"},{"name":"content_url","type":"flags.5?string"},{"name":"content_type","type":"flags.5?string"},{"name":"w","type":"flags.6?int"},{"name":"h","type":"flags.6?int"},{"name":"duration","type":"flags.7?int"},{"name":"send_message","type":"InputBotInlineMessage"}],"type":"InputBotInlineResult"},{"id":"175419739","predicate":"botInlineMessageMediaAuto","params":[{"name":"flags","type":"#"},{"name":"caption","type":"string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"BotInlineMessage"},{"id":"-1937807902","predicate":"botInlineMessageText","params":[{"name":"flags","type":"#"},{"name":"no_webpage","type":"flags.0?true"},{"name":"message","type":"string"},{"name":"entities","type":"flags.1?Vector<MessageEntity>"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"BotInlineMessage"},{"id":"-1679053127","predicate":"botInlineResult","params":[{"name":"flags","type":"#"},{"name":"id","type":"string"},{"name":"type","type":"string"},{"name":"title","type":"flags.1?string"},{"name":"description","type":"flags.2?string"},{"name":"url","type":"flags.3?string"},{"name":"thumb_url","type":"flags.4?string"},{"name":"content_url","type":"flags.5?string"},{"name":"content_type","type":"flags.5?string"},{"name":"w","type":"flags.6?int"},{"name":"h","type":"flags.6?int"},{"name":"duration","type":"flags.7?int"},{"name":"send_message","type":"BotInlineMessage"}],"type":"BotInlineResult"},{"id":"627509670","predicate":"messages.botResults","params":[{"name":"flags","type":"#"},{"name":"gallery","type":"flags.0?true"},{"name":"query_id","type":"long"},{"name":"next_offset","type":"flags.1?string"},{"name":"switch_pm","type":"flags.2?InlineBotSwitchPM"},{"name":"results","type":"Vector<BotInlineResult>"}],"type":"messages.BotResults"},{"id":"1417832080","predicate":"updateBotInlineQuery","params":[{"name":"flags","type":"#"},{"name":"query_id","type":"long"},{"name":"user_id","type":"int"},{"name":"query","type":"string"},{"name":"geo","type":"flags.0?GeoPoint"},{"name":"offset","type":"string"}],"type":"Update"},{"id":"239663460","predicate":"updateBotInlineSend","params":[{"name":"flags","type":"#"},{"name":"user_id","type":"int"},{"name":"query","type":"string"},{"name":"geo","type":"flags.0?GeoPoint"},{"name":"id","type":"string"},{"name":"msg_id","type":"flags.1?InputBotInlineMessageID"}],"type":"Update"},{"id":"1358283666","predicate":"inputMessagesFilterVoice","params":[],"type":"MessagesFilter"},{"id":"928101534","predicate":"inputMessagesFilterMusic","params":[],"type":"MessagesFilter"},{"id":"-1107622874","predicate":"inputPrivacyKeyChatInvite","params":[],"type":"InputPrivacyKey"},{"id":"1343122938","predicate":"privacyKeyChatInvite","params":[],"type":"PrivacyKey"},{"id":"524838915","predicate":"exportedMessageLink","params":[{"name":"link","type":"string"}],"type":"ExportedMessageLink"},{"id":"-947462709","predicate":"messageFwdHeader","params":[{"name":"flags","type":"#"},{"name":"from_id","type":"flags.0?int"},{"name":"date","type":"int"},{"name":"channel_id","type":"flags.1?int"},{"name":"channel_post","type":"flags.2?int"}],"type":"MessageFwdHeader"},{"id":"457133559","predicate":"updateEditChannelMessage","params":[{"name":"message","type":"Message"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"-1738988427","predicate":"updateChannelPinnedMessage","params":[{"name":"channel_id","type":"int"},{"name":"id","type":"int"}],"type":"Update"},{"id":"-1799538451","predicate":"messageActionPinMessage","params":[],"type":"MessageAction"},{"id":"1923290508","predicate":"auth.codeTypeSms","params":[],"type":"auth.CodeType"},{"id":"1948046307","predicate":"auth.codeTypeCall","params":[],"type":"auth.CodeType"},{"id":"577556219","predicate":"auth.codeTypeFlashCall","params":[],"type":"auth.CodeType"},{"id":"1035688326","predicate":"auth.sentCodeTypeApp","params":[{"name":"length","type":"int"}],"type":"auth.SentCodeType"},{"id":"-1073693790","predicate":"auth.sentCodeTypeSms","params":[{"name":"length","type":"int"}],"type":"auth.SentCodeType"},{"id":"1398007207","predicate":"auth.sentCodeTypeCall","params":[{"name":"length","type":"int"}],"type":"auth.SentCodeType"},{"id":"-1425815847","predicate":"auth.sentCodeTypeFlashCall","params":[{"name":"pattern","type":"string"}],"type":"auth.SentCodeType"},{"id":"629866245","predicate":"keyboardButtonUrl","params":[{"name":"text","type":"string"},{"name":"url","type":"string"}],"type":"KeyboardButton"},{"id":"1748655686","predicate":"keyboardButtonCallback","params":[{"name":"text","type":"string"},{"name":"data","type":"bytes"}],"type":"KeyboardButton"},{"id":"-1318425559","predicate":"keyboardButtonRequestPhone","params":[{"name":"text","type":"string"}],"type":"KeyboardButton"},{"id":"-59151553","predicate":"keyboardButtonRequestGeoLocation","params":[{"name":"text","type":"string"}],"type":"KeyboardButton"},{"id":"90744648","predicate":"keyboardButtonSwitchInline","params":[{"name":"flags","type":"#"},{"name":"same_peer","type":"flags.0?true"},{"name":"text","type":"string"},{"name":"query","type":"string"}],"type":"KeyboardButton"},{"id":"1218642516","predicate":"replyInlineMarkup","params":[{"name":"rows","type":"Vector<KeyboardButtonRow>"}],"type":"ReplyMarkup"},{"id":"-1324486149","predicate":"messages.botCallbackAnswer","params":[{"name":"flags","type":"#"},{"name":"alert","type":"flags.1?true"},{"name":"has_url","type":"flags.3?true"},{"name":"message","type":"flags.0?string"},{"name":"url","type":"flags.2?string"}],"type":"messages.BotCallbackAnswer"},{"id":"-415938591","predicate":"updateBotCallbackQuery","params":[{"name":"flags","type":"#"},{"name":"query_id","type":"long"},{"name":"user_id","type":"int"},{"name":"peer","type":"Peer"},{"name":"msg_id","type":"int"},{"name":"chat_instance","type":"long"},{"name":"data","type":"flags.0?bytes"},{"name":"game_short_name","type":"flags.1?string"}],"type":"Update"},{"id":"649453030","predicate":"messages.messageEditData","params":[{"name":"flags","type":"#"},{"name":"caption","type":"flags.0?true"}],"type":"messages.MessageEditData"},{"id":"-469536605","predicate":"updateEditMessage","params":[{"name":"message","type":"Message"},{"name":"pts","type":"int"},{"name":"pts_count","type":"int"}],"type":"Update"},{"id":"-190472735","predicate":"inputBotInlineMessageMediaGeo","params":[{"name":"flags","type":"#"},{"name":"geo_point","type":"InputGeoPoint"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"InputBotInlineMessage"},{"id":"-1431327288","predicate":"inputBotInlineMessageMediaVenue","params":[{"name":"flags","type":"#"},{"name":"geo_point","type":"InputGeoPoint"},{"name":"title","type":"string"},{"name":"address","type":"string"},{"name":"provider","type":"string"},{"name":"venue_id","type":"string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"InputBotInlineMessage"},{"id":"766443943","predicate":"inputBotInlineMessageMediaContact","params":[{"name":"flags","type":"#"},{"name":"phone_number","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"InputBotInlineMessage"},{"id":"982505656","predicate":"botInlineMessageMediaGeo","params":[{"name":"flags","type":"#"},{"name":"geo","type":"GeoPoint"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"BotInlineMessage"},{"id":"1130767150","predicate":"botInlineMessageMediaVenue","params":[{"name":"flags","type":"#"},{"name":"geo","type":"GeoPoint"},{"name":"title","type":"string"},{"name":"address","type":"string"},{"name":"provider","type":"string"},{"name":"venue_id","type":"string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"BotInlineMessage"},{"id":"904770772","predicate":"botInlineMessageMediaContact","params":[{"name":"flags","type":"#"},{"name":"phone_number","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"BotInlineMessage"},{"id":"-1462213465","predicate":"inputBotInlineResultPhoto","params":[{"name":"id","type":"string"},{"name":"type","type":"string"},{"name":"photo","type":"InputPhoto"},{"name":"send_message","type":"InputBotInlineMessage"}],"type":"InputBotInlineResult"},{"id":"-459324","predicate":"inputBotInlineResultDocument","params":[{"name":"flags","type":"#"},{"name":"id","type":"string"},{"name":"type","type":"string"},{"name":"title","type":"flags.1?string"},{"name":"description","type":"flags.2?string"},{"name":"document","type":"InputDocument"},{"name":"send_message","type":"InputBotInlineMessage"}],"type":"InputBotInlineResult"},{"id":"400266251","predicate":"botInlineMediaResult","params":[{"name":"flags","type":"#"},{"name":"id","type":"string"},{"name":"type","type":"string"},{"name":"photo","type":"flags.0?Photo"},{"name":"document","type":"flags.1?Document"},{"name":"title","type":"flags.2?string"},{"name":"description","type":"flags.3?string"},{"name":"send_message","type":"BotInlineMessage"}],"type":"BotInlineResult"},{"id":"-1995686519","predicate":"inputBotInlineMessageID","params":[{"name":"dc_id","type":"int"},{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputBotInlineMessageID"},{"id":"-103646630","predicate":"updateInlineBotCallbackQuery","params":[{"name":"flags","type":"#"},{"name":"query_id","type":"long"},{"name":"user_id","type":"int"},{"name":"msg_id","type":"InputBotInlineMessageID"},{"name":"chat_instance","type":"long"},{"name":"data","type":"flags.0?bytes"},{"name":"game_short_name","type":"flags.1?string"}],"type":"Update"},{"id":"1008755359","predicate":"inlineBotSwitchPM","params":[{"name":"text","type":"string"},{"name":"start_param","type":"string"}],"type":"InlineBotSwitchPM"},{"id":"863093588","predicate":"messages.peerDialogs","params":[{"name":"dialogs","type":"Vector<Dialog>"},{"name":"messages","type":"Vector<Message>"},{"name":"chats","type":"Vector<Chat>"},{"name":"users","type":"Vector<User>"},{"name":"state","type":"updates.State"}],"type":"messages.PeerDialogs"},{"id":"-305282981","predicate":"topPeer","params":[{"name":"peer","type":"Peer"},{"name":"rating","type":"double"}],"type":"TopPeer"},{"id":"-1419371685","predicate":"topPeerCategoryBotsPM","params":[],"type":"TopPeerCategory"},{"id":"344356834","predicate":"topPeerCategoryBotsInline","params":[],"type":"TopPeerCategory"},{"id":"104314861","predicate":"topPeerCategoryCorrespondents","params":[],"type":"TopPeerCategory"},{"id":"-1122524854","predicate":"topPeerCategoryGroups","params":[],"type":"TopPeerCategory"},{"id":"371037736","predicate":"topPeerCategoryChannels","params":[],"type":"TopPeerCategory"},{"id":"-75283823","predicate":"topPeerCategoryPeers","params":[{"name":"category","type":"TopPeerCategory"},{"name":"count","type":"int"},{"name":"peers","type":"Vector<TopPeer>"}],"type":"TopPeerCategoryPeers"},{"id":"-567906571","predicate":"contacts.topPeersNotModified","params":[],"type":"contacts.TopPeers"},{"id":"1891070632","predicate":"contacts.topPeers","params":[{"name":"categories","type":"Vector<TopPeerCategoryPeers>"},{"name":"chats","type":"Vector<Chat>"},{"name":"users","type":"Vector<User>"}],"type":"contacts.TopPeers"},{"id":"892193368","predicate":"messageEntityMentionName","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"},{"name":"user_id","type":"int"}],"type":"MessageEntity"},{"id":"546203849","predicate":"inputMessageEntityMentionName","params":[{"name":"offset","type":"int"},{"name":"length","type":"int"},{"name":"user_id","type":"InputUser"}],"type":"MessageEntity"},{"id":"975236280","predicate":"inputMessagesFilterChatPhotos","params":[],"type":"MessagesFilter"},{"id":"634833351","predicate":"updateReadChannelOutbox","params":[{"name":"channel_id","type":"int"},{"name":"max_id","type":"int"}],"type":"Update"},{"id":"-299124375","predicate":"updateDraftMessage","params":[{"name":"peer","type":"Peer"},{"name":"draft","type":"DraftMessage"}],"type":"Update"},{"id":"-1169445179","predicate":"draftMessageEmpty","params":[],"type":"DraftMessage"},{"id":"-40996577","predicate":"draftMessage","params":[{"name":"flags","type":"#"},{"name":"no_webpage","type":"flags.1?true"},{"name":"reply_to_msg_id","type":"flags.0?int"},{"name":"message","type":"string"},{"name":"entities","type":"flags.3?Vector<MessageEntity>"},{"name":"date","type":"int"}],"type":"DraftMessage"},{"id":"-1615153660","predicate":"messageActionHistoryClear","params":[],"type":"MessageAction"},{"id":"82699215","predicate":"messages.featuredStickersNotModified","params":[],"type":"messages.FeaturedStickers"},{"id":"-123893531","predicate":"messages.featuredStickers","params":[{"name":"hash","type":"int"},{"name":"sets","type":"Vector<StickerSetCovered>"},{"name":"unread","type":"Vector<long>"}],"type":"messages.FeaturedStickers"},{"id":"1461528386","predicate":"updateReadFeaturedStickers","params":[],"type":"Update"},{"id":"186120336","predicate":"messages.recentStickersNotModified","params":[],"type":"messages.RecentStickers"},{"id":"1558317424","predicate":"messages.recentStickers","params":[{"name":"hash","type":"int"},{"name":"stickers","type":"Vector<Document>"}],"type":"messages.RecentStickers"},{"id":"-1706939360","predicate":"updateRecentStickers","params":[],"type":"Update"},{"id":"1338747336","predicate":"messages.archivedStickers","params":[{"name":"count","type":"int"},{"name":"sets","type":"Vector<StickerSetCovered>"}],"type":"messages.ArchivedStickers"},{"id":"946083368","predicate":"messages.stickerSetInstallResultSuccess","params":[],"type":"messages.StickerSetInstallResult"},{"id":"904138920","predicate":"messages.stickerSetInstallResultArchive","params":[{"name":"sets","type":"Vector<StickerSetCovered>"}],"type":"messages.StickerSetInstallResult"},{"id":"1678812626","predicate":"stickerSetCovered","params":[{"name":"set","type":"StickerSet"},{"name":"cover","type":"Document"}],"type":"StickerSetCovered"},{"id":"-1574314746","predicate":"updateConfig","params":[],"type":"Update"},{"id":"861169551","predicate":"updatePtsChanged","params":[],"type":"Update"},{"id":"-1252045032","predicate":"inputMediaPhotoExternal","params":[{"name":"url","type":"string"},{"name":"caption","type":"string"}],"type":"InputMedia"},{"id":"-437690244","predicate":"inputMediaDocumentExternal","params":[{"name":"url","type":"string"},{"name":"caption","type":"string"}],"type":"InputMedia"},{"id":"872932635","predicate":"stickerSetMultiCovered","params":[{"name":"set","type":"StickerSet"},{"name":"covers","type":"Vector<Document>"}],"type":"StickerSetCovered"},{"id":"-1361650766","predicate":"maskCoords","params":[{"name":"n","type":"int"},{"name":"x","type":"double"},{"name":"y","type":"double"},{"name":"zoom","type":"double"}],"type":"MaskCoords"},{"id":"-1744710921","predicate":"documentAttributeHasStickers","params":[],"type":"DocumentAttribute"},{"id":"1251549527","predicate":"inputStickeredMediaPhoto","params":[{"name":"id","type":"InputPhoto"}],"type":"InputStickeredMedia"},{"id":"70813275","predicate":"inputStickeredMediaDocument","params":[{"name":"id","type":"InputDocument"}],"type":"InputStickeredMedia"},{"id":"-1107729093","predicate":"game","params":[{"name":"flags","type":"#"},{"name":"id","type":"long"},{"name":"access_hash","type":"long"},{"name":"short_name","type":"string"},{"name":"title","type":"string"},{"name":"description","type":"string"},{"name":"photo","type":"Photo"},{"name":"document","type":"flags.0?Document"}],"type":"Game"},{"id":"1336154098","predicate":"inputBotInlineResultGame","params":[{"name":"id","type":"string"},{"name":"short_name","type":"string"},{"name":"send_message","type":"InputBotInlineMessage"}],"type":"InputBotInlineResult"},{"id":"1262639204","predicate":"inputBotInlineMessageGame","params":[{"name":"flags","type":"#"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"InputBotInlineMessage"},{"id":"-580219064","predicate":"sendMessageGamePlayAction","params":[],"type":"SendMessageAction"},{"id":"-38694904","predicate":"messageMediaGame","params":[{"name":"game","type":"Game"}],"type":"MessageMedia"},{"id":"-750828557","predicate":"inputMediaGame","params":[{"name":"id","type":"InputGame"}],"type":"InputMedia"},{"id":"53231223","predicate":"inputGameID","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputGame"},{"id":"-1020139510","predicate":"inputGameShortName","params":[{"name":"bot_id","type":"InputUser"},{"name":"short_name","type":"string"}],"type":"InputGame"},{"id":"1358175439","predicate":"keyboardButtonGame","params":[{"name":"text","type":"string"}],"type":"KeyboardButton"},{"id":"-1834538890","predicate":"messageActionGameScore","params":[{"name":"game_id","type":"long"},{"name":"score","type":"int"}],"type":"MessageAction"},{"id":"1493171408","predicate":"highScore","params":[{"name":"pos","type":"int"},{"name":"user_id","type":"int"},{"name":"score","type":"int"}],"type":"HighScore"},{"id":"-1707344487","predicate":"messages.highScores","params":[{"name":"scores","type":"Vector<HighScore>"},{"name":"users","type":"Vector<User>"}],"type":"messages.HighScores"}],"methods":[{"id":"-878758099","method":"invokeAfterMsg","params":[{"name":"msg_id","type":"long"},{"name":"query","type":"!X"}],"type":"X"},{"id":"1036301552","method":"invokeAfterMsgs","params":[{"name":"msg_ids","type":"Vector<long>"},{"name":"query","type":"!X"}],"type":"X"},{"id":"1877286395","method":"auth.checkPhone","params":[{"name":"phone_number","type":"string"}],"type":"auth.CheckedPhone"},{"id":"-2035355412","method":"auth.sendCode","params":[{"name":"flags","type":"#"},{"name":"allow_flashcall","type":"flags.0?true"},{"name":"phone_number","type":"string"},{"name":"current_number","type":"flags.0?Bool"},{"name":"api_id","type":"int"},{"name":"api_hash","type":"string"}],"type":"auth.SentCode"},{"id":"453408308","method":"auth.signUp","params":[{"name":"phone_number","type":"string"},{"name":"phone_code_hash","type":"string"},{"name":"phone_code","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"}],"type":"auth.Authorization"},{"id":"-1126886015","method":"auth.signIn","params":[{"name":"phone_number","type":"string"},{"name":"phone_code_hash","type":"string"},{"name":"phone_code","type":"string"}],"type":"auth.Authorization"},{"id":"1461180992","method":"auth.logOut","params":[],"type":"Bool"},{"id":"-1616179942","method":"auth.resetAuthorizations","params":[],"type":"Bool"},{"id":"1998331287","method":"auth.sendInvites","params":[{"name":"phone_numbers","type":"Vector<string>"},{"name":"message","type":"string"}],"type":"Bool"},{"id":"-440401971","method":"auth.exportAuthorization","params":[{"name":"dc_id","type":"int"}],"type":"auth.ExportedAuthorization"},{"id":"-470837741","method":"auth.importAuthorization","params":[{"name":"id","type":"int"},{"name":"bytes","type":"bytes"}],"type":"auth.Authorization"},{"id":"-841733627","method":"auth.bindTempAuthKey","params":[{"name":"perm_auth_key_id","type":"long"},{"name":"nonce","type":"long"},{"name":"expires_at","type":"int"},{"name":"encrypted_message","type":"bytes"}],"type":"Bool"},{"id":"1669245048","method":"account.registerDevice","params":[{"name":"token_type","type":"int"},{"name":"token","type":"string"}],"type":"Bool"},{"id":"1707432768","method":"account.unregisterDevice","params":[{"name":"token_type","type":"int"},{"name":"token","type":"string"}],"type":"Bool"},{"id":"-2067899501","method":"account.updateNotifySettings","params":[{"name":"peer","type":"InputNotifyPeer"},{"name":"settings","type":"InputPeerNotifySettings"}],"type":"Bool"},{"id":"313765169","method":"account.getNotifySettings","params":[{"name":"peer","type":"InputNotifyPeer"}],"type":"PeerNotifySettings"},{"id":"-612493497","method":"account.resetNotifySettings","params":[],"type":"Bool"},{"id":"2018596725","method":"account.updateProfile","params":[{"name":"flags","type":"#"},{"name":"first_name","type":"flags.0?string"},{"name":"last_name","type":"flags.1?string"},{"name":"about","type":"flags.2?string"}],"type":"User"},{"id":"1713919532","method":"account.updateStatus","params":[{"name":"offline","type":"Bool"}],"type":"Bool"},{"id":"-1068696894","method":"account.getWallPapers","params":[],"type":"Vector<WallPaper>"},{"id":"-1374118561","method":"account.reportPeer","params":[{"name":"peer","type":"InputPeer"},{"name":"reason","type":"ReportReason"}],"type":"Bool"},{"id":"227648840","method":"users.getUsers","params":[{"name":"id","type":"Vector<InputUser>"}],"type":"Vector<User>"},{"id":"-902781519","method":"users.getFullUser","params":[{"name":"id","type":"InputUser"}],"type":"UserFull"},{"id":"-995929106","method":"contacts.getStatuses","params":[],"type":"Vector<ContactStatus>"},{"id":"583445000","method":"contacts.getContacts","params":[{"name":"hash","type":"string"}],"type":"contacts.Contacts"},{"id":"-634342611","method":"contacts.importContacts","params":[{"name":"contacts","type":"Vector<InputContact>"},{"name":"replace","type":"Bool"}],"type":"contacts.ImportedContacts"},{"id":"-1902823612","method":"contacts.deleteContact","params":[{"name":"id","type":"InputUser"}],"type":"contacts.Link"},{"id":"1504393374","method":"contacts.deleteContacts","params":[{"name":"id","type":"Vector<InputUser>"}],"type":"Bool"},{"id":"858475004","method":"contacts.block","params":[{"name":"id","type":"InputUser"}],"type":"Bool"},{"id":"-448724803","method":"contacts.unblock","params":[{"name":"id","type":"InputUser"}],"type":"Bool"},{"id":"-176409329","method":"contacts.getBlocked","params":[{"name":"offset","type":"int"},{"name":"limit","type":"int"}],"type":"contacts.Blocked"},{"id":"-2065352905","method":"contacts.exportCard","params":[],"type":"Vector<int>"},{"id":"1340184318","method":"contacts.importCard","params":[{"name":"export_card","type":"Vector<int>"}],"type":"User"},{"id":"1109588596","method":"messages.getMessages","params":[{"name":"id","type":"Vector<int>"}],"type":"messages.Messages"},{"id":"1799878989","method":"messages.getDialogs","params":[{"name":"offset_date","type":"int"},{"name":"offset_id","type":"int"},{"name":"offset_peer","type":"InputPeer"},{"name":"limit","type":"int"}],"type":"messages.Dialogs"},{"id":"-1347868602","method":"messages.getHistory","params":[{"name":"peer","type":"InputPeer"},{"name":"offset_id","type":"int"},{"name":"offset_date","type":"int"},{"name":"add_offset","type":"int"},{"name":"limit","type":"int"},{"name":"max_id","type":"int"},{"name":"min_id","type":"int"}],"type":"messages.Messages"},{"id":"-732523960","method":"messages.search","params":[{"name":"flags","type":"#"},{"name":"peer","type":"InputPeer"},{"name":"q","type":"string"},{"name":"filter","type":"MessagesFilter"},{"name":"min_date","type":"int"},{"name":"max_date","type":"int"},{"name":"offset","type":"int"},{"name":"max_id","type":"int"},{"name":"limit","type":"int"}],"type":"messages.Messages"},{"id":"238054714","method":"messages.readHistory","params":[{"name":"peer","type":"InputPeer"},{"name":"max_id","type":"int"}],"type":"messages.AffectedMessages"},{"id":"469850889","method":"messages.deleteHistory","params":[{"name":"flags","type":"#"},{"name":"just_clear","type":"flags.0?true"},{"name":"peer","type":"InputPeer"},{"name":"max_id","type":"int"}],"type":"messages.AffectedHistory"},{"id":"-1510897371","method":"messages.deleteMessages","params":[{"name":"id","type":"Vector<int>"}],"type":"messages.AffectedMessages"},{"id":"94983360","method":"messages.receivedMessages","params":[{"name":"max_id","type":"int"}],"type":"Vector<ReceivedNotifyMessage>"},{"id":"-1551737264","method":"messages.setTyping","params":[{"name":"peer","type":"InputPeer"},{"name":"action","type":"SendMessageAction"}],"type":"Bool"},{"id":"-91733382","method":"messages.sendMessage","params":[{"name":"flags","type":"#"},{"name":"no_webpage","type":"flags.1?true"},{"name":"silent","type":"flags.5?true"},{"name":"background","type":"flags.6?true"},{"name":"clear_draft","type":"flags.7?true"},{"name":"peer","type":"InputPeer"},{"name":"reply_to_msg_id","type":"flags.0?int"},{"name":"message","type":"string"},{"name":"random_id","type":"long"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"},{"name":"entities","type":"flags.3?Vector<MessageEntity>"}],"type":"Updates"},{"id":"-923703407","method":"messages.sendMedia","params":[{"name":"flags","type":"#"},{"name":"silent","type":"flags.5?true"},{"name":"background","type":"flags.6?true"},{"name":"clear_draft","type":"flags.7?true"},{"name":"peer","type":"InputPeer"},{"name":"reply_to_msg_id","type":"flags.0?int"},{"name":"media","type":"InputMedia"},{"name":"random_id","type":"long"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"}],"type":"Updates"},{"id":"1888354709","method":"messages.forwardMessages","params":[{"name":"flags","type":"#"},{"name":"silent","type":"flags.5?true"},{"name":"background","type":"flags.6?true"},{"name":"with_my_score","type":"flags.8?true"},{"name":"from_peer","type":"InputPeer"},{"name":"id","type":"Vector<int>"},{"name":"random_id","type":"Vector<long>"},{"name":"to_peer","type":"InputPeer"}],"type":"Updates"},{"id":"-820669733","method":"messages.reportSpam","params":[{"name":"peer","type":"InputPeer"}],"type":"Bool"},{"id":"-1460572005","method":"messages.hideReportSpam","params":[{"name":"peer","type":"InputPeer"}],"type":"Bool"},{"id":"913498268","method":"messages.getPeerSettings","params":[{"name":"peer","type":"InputPeer"}],"type":"PeerSettings"},{"id":"1013621127","method":"messages.getChats","params":[{"name":"id","type":"Vector<int>"}],"type":"messages.Chats"},{"id":"998448230","method":"messages.getFullChat","params":[{"name":"chat_id","type":"int"}],"type":"messages.ChatFull"},{"id":"-599447467","method":"messages.editChatTitle","params":[{"name":"chat_id","type":"int"},{"name":"title","type":"string"}],"type":"Updates"},{"id":"-900957736","method":"messages.editChatPhoto","params":[{"name":"chat_id","type":"int"},{"name":"photo","type":"InputChatPhoto"}],"type":"Updates"},{"id":"-106911223","method":"messages.addChatUser","params":[{"name":"chat_id","type":"int"},{"name":"user_id","type":"InputUser"},{"name":"fwd_limit","type":"int"}],"type":"Updates"},{"id":"-530505962","method":"messages.deleteChatUser","params":[{"name":"chat_id","type":"int"},{"name":"user_id","type":"InputUser"}],"type":"Updates"},{"id":"164303470","method":"messages.createChat","params":[{"name":"users","type":"Vector<InputUser>"},{"name":"title","type":"string"}],"type":"Updates"},{"id":"-304838614","method":"updates.getState","params":[],"type":"updates.State"},{"id":"168039573","method":"updates.getDifference","params":[{"name":"pts","type":"int"},{"name":"date","type":"int"},{"name":"qts","type":"int"}],"type":"updates.Difference"},{"id":"-256159406","method":"photos.updateProfilePhoto","params":[{"name":"id","type":"InputPhoto"}],"type":"UserProfilePhoto"},{"id":"1328726168","method":"photos.uploadProfilePhoto","params":[{"name":"file","type":"InputFile"}],"type":"photos.Photo"},{"id":"-2016444625","method":"photos.deletePhotos","params":[{"name":"id","type":"Vector<InputPhoto>"}],"type":"Vector<long>"},{"id":"-1291540959","method":"upload.saveFilePart","params":[{"name":"file_id","type":"long"},{"name":"file_part","type":"int"},{"name":"bytes","type":"bytes"}],"type":"Bool"},{"id":"-475607115","method":"upload.getFile","params":[{"name":"location","type":"InputFileLocation"},{"name":"offset","type":"int"},{"name":"limit","type":"int"}],"type":"upload.File"},{"id":"-990308245","method":"help.getConfig","params":[],"type":"Config"},{"id":"531836966","method":"help.getNearestDc","params":[],"type":"NearestDc"},{"id":"-1372724842","method":"help.getAppUpdate","params":[],"type":"help.AppUpdate"},{"id":"1862465352","method":"help.saveAppLog","params":[{"name":"events","type":"Vector<InputAppEvent>"}],"type":"Bool"},{"id":"1295590211","method":"help.getInviteText","params":[],"type":"help.InviteText"},{"id":"-1848823128","method":"photos.getUserPhotos","params":[{"name":"user_id","type":"InputUser"},{"name":"offset","type":"int"},{"name":"max_id","type":"long"},{"name":"limit","type":"int"}],"type":"photos.Photos"},{"id":"865483769","method":"messages.forwardMessage","params":[{"name":"peer","type":"InputPeer"},{"name":"id","type":"int"},{"name":"random_id","type":"long"}],"type":"Updates"},{"id":"651135312","method":"messages.getDhConfig","params":[{"name":"version","type":"int"},{"name":"random_length","type":"int"}],"type":"messages.DhConfig"},{"id":"-162681021","method":"messages.requestEncryption","params":[{"name":"user_id","type":"InputUser"},{"name":"random_id","type":"int"},{"name":"g_a","type":"bytes"}],"type":"EncryptedChat"},{"id":"1035731989","method":"messages.acceptEncryption","params":[{"name":"peer","type":"InputEncryptedChat"},{"name":"g_b","type":"bytes"},{"name":"key_fingerprint","type":"long"}],"type":"EncryptedChat"},{"id":"-304536635","method":"messages.discardEncryption","params":[{"name":"chat_id","type":"int"}],"type":"Bool"},{"id":"2031374829","method":"messages.setEncryptedTyping","params":[{"name":"peer","type":"InputEncryptedChat"},{"name":"typing","type":"Bool"}],"type":"Bool"},{"id":"2135648522","method":"messages.readEncryptedHistory","params":[{"name":"peer","type":"InputEncryptedChat"},{"name":"max_date","type":"int"}],"type":"Bool"},{"id":"-1451792525","method":"messages.sendEncrypted","params":[{"name":"peer","type":"InputEncryptedChat"},{"name":"random_id","type":"long"},{"name":"data","type":"bytes"}],"type":"messages.SentEncryptedMessage"},{"id":"-1701831834","method":"messages.sendEncryptedFile","params":[{"name":"peer","type":"InputEncryptedChat"},{"name":"random_id","type":"long"},{"name":"data","type":"bytes"},{"name":"file","type":"InputEncryptedFile"}],"type":"messages.SentEncryptedMessage"},{"id":"852769188","method":"messages.sendEncryptedService","params":[{"name":"peer","type":"InputEncryptedChat"},{"name":"random_id","type":"long"},{"name":"data","type":"bytes"}],"type":"messages.SentEncryptedMessage"},{"id":"1436924774","method":"messages.receivedQueue","params":[{"name":"max_qts","type":"int"}],"type":"Vector<long>"},{"id":"-562337987","method":"upload.saveBigFilePart","params":[{"name":"file_id","type":"long"},{"name":"file_part","type":"int"},{"name":"file_total_parts","type":"int"},{"name":"bytes","type":"bytes"}],"type":"Bool"},{"id":"1769565673","method":"initConnection","params":[{"name":"api_id","type":"int"},{"name":"device_model","type":"string"},{"name":"system_version","type":"string"},{"name":"app_version","type":"string"},{"name":"lang_code","type":"string"},{"name":"query","type":"!X"}],"type":"X"},{"id":"-1663104819","method":"help.getSupport","params":[],"type":"help.Support"},{"id":"916930423","method":"messages.readMessageContents","params":[{"name":"id","type":"Vector<int>"}],"type":"messages.AffectedMessages"},{"id":"655677548","method":"account.checkUsername","params":[{"name":"username","type":"string"}],"type":"Bool"},{"id":"1040964988","method":"account.updateUsername","params":[{"name":"username","type":"string"}],"type":"User"},{"id":"301470424","method":"contacts.search","params":[{"name":"q","type":"string"},{"name":"limit","type":"int"}],"type":"contacts.Found"},{"id":"-623130288","method":"account.getPrivacy","params":[{"name":"key","type":"InputPrivacyKey"}],"type":"account.PrivacyRules"},{"id":"-906486552","method":"account.setPrivacy","params":[{"name":"key","type":"InputPrivacyKey"},{"name":"rules","type":"Vector<InputPrivacyRule>"}],"type":"account.PrivacyRules"},{"id":"1099779595","method":"account.deleteAccount","params":[{"name":"reason","type":"string"}],"type":"Bool"},{"id":"150761757","method":"account.getAccountTTL","params":[],"type":"AccountDaysTTL"},{"id":"608323678","method":"account.setAccountTTL","params":[{"name":"ttl","type":"AccountDaysTTL"}],"type":"Bool"},{"id":"-627372787","method":"invokeWithLayer","params":[{"name":"layer","type":"int"},{"name":"query","type":"!X"}],"type":"X"},{"id":"-113456221","method":"contacts.resolveUsername","params":[{"name":"username","type":"string"}],"type":"contacts.ResolvedPeer"},{"id":"149257707","method":"account.sendChangePhoneCode","params":[{"name":"flags","type":"#"},{"name":"allow_flashcall","type":"flags.0?true"},{"name":"phone_number","type":"string"},{"name":"current_number","type":"flags.0?Bool"}],"type":"auth.SentCode"},{"id":"1891839707","method":"account.changePhone","params":[{"name":"phone_number","type":"string"},{"name":"phone_code_hash","type":"string"},{"name":"phone_code","type":"string"}],"type":"User"},{"id":"479598769","method":"messages.getAllStickers","params":[{"name":"hash","type":"int"}],"type":"messages.AllStickers"},{"id":"954152242","method":"account.updateDeviceLocked","params":[{"name":"period","type":"int"}],"type":"Bool"},{"id":"1738800940","method":"auth.importBotAuthorization","params":[{"name":"flags","type":"int"},{"name":"api_id","type":"int"},{"name":"api_hash","type":"string"},{"name":"bot_auth_token","type":"string"}],"type":"auth.Authorization"},{"id":"623001124","method":"messages.getWebPagePreview","params":[{"name":"message","type":"string"}],"type":"MessageMedia"},{"id":"-484392616","method":"account.getAuthorizations","params":[],"type":"account.Authorizations"},{"id":"-545786948","method":"account.resetAuthorization","params":[{"name":"hash","type":"long"}],"type":"Bool"},{"id":"1418342645","method":"account.getPassword","params":[],"type":"account.Password"},{"id":"-1131605573","method":"account.getPasswordSettings","params":[{"name":"current_password_hash","type":"bytes"}],"type":"account.PasswordSettings"},{"id":"-92517498","method":"account.updatePasswordSettings","params":[{"name":"current_password_hash","type":"bytes"},{"name":"new_settings","type":"account.PasswordInputSettings"}],"type":"Bool"},{"id":"174260510","method":"auth.checkPassword","params":[{"name":"password_hash","type":"bytes"}],"type":"auth.Authorization"},{"id":"-661144474","method":"auth.requestPasswordRecovery","params":[],"type":"auth.PasswordRecovery"},{"id":"1319464594","method":"auth.recoverPassword","params":[{"name":"code","type":"string"}],"type":"auth.Authorization"},{"id":"-1080796745","method":"invokeWithoutUpdates","params":[{"name":"query","type":"!X"}],"type":"X"},{"id":"2106086025","method":"messages.exportChatInvite","params":[{"name":"chat_id","type":"int"}],"type":"ExportedChatInvite"},{"id":"1051570619","method":"messages.checkChatInvite","params":[{"name":"hash","type":"string"}],"type":"ChatInvite"},{"id":"1817183516","method":"messages.importChatInvite","params":[{"name":"hash","type":"string"}],"type":"Updates"},{"id":"639215886","method":"messages.getStickerSet","params":[{"name":"stickerset","type":"InputStickerSet"}],"type":"messages.StickerSet"},{"id":"-946871200","method":"messages.installStickerSet","params":[{"name":"stickerset","type":"InputStickerSet"},{"name":"archived","type":"Bool"}],"type":"messages.StickerSetInstallResult"},{"id":"-110209570","method":"messages.uninstallStickerSet","params":[{"name":"stickerset","type":"InputStickerSet"}],"type":"Bool"},{"id":"-421563528","method":"messages.startBot","params":[{"name":"bot","type":"InputUser"},{"name":"peer","type":"InputPeer"},{"name":"random_id","type":"long"},{"name":"start_param","type":"string"}],"type":"Updates"},{"id":"-1189013126","method":"help.getAppChangelog","params":[],"type":"help.AppChangelog"},{"id":"-993483427","method":"messages.getMessagesViews","params":[{"name":"peer","type":"InputPeer"},{"name":"id","type":"Vector<int>"},{"name":"increment","type":"Bool"}],"type":"Vector<int>"},{"id":"-871347913","method":"channels.readHistory","params":[{"name":"channel","type":"InputChannel"},{"name":"max_id","type":"int"}],"type":"Bool"},{"id":"-2067661490","method":"channels.deleteMessages","params":[{"name":"channel","type":"InputChannel"},{"name":"id","type":"Vector<int>"}],"type":"messages.AffectedMessages"},{"id":"-787622117","method":"channels.deleteUserHistory","params":[{"name":"channel","type":"InputChannel"},{"name":"user_id","type":"InputUser"}],"type":"messages.AffectedHistory"},{"id":"-32999408","method":"channels.reportSpam","params":[{"name":"channel","type":"InputChannel"},{"name":"user_id","type":"InputUser"},{"name":"id","type":"Vector<int>"}],"type":"Bool"},{"id":"-1814580409","method":"channels.getMessages","params":[{"name":"channel","type":"InputChannel"},{"name":"id","type":"Vector<int>"}],"type":"messages.Messages"},{"id":"618237842","method":"channels.getParticipants","params":[{"name":"channel","type":"InputChannel"},{"name":"filter","type":"ChannelParticipantsFilter"},{"name":"offset","type":"int"},{"name":"limit","type":"int"}],"type":"channels.ChannelParticipants"},{"id":"1416484774","method":"channels.getParticipant","params":[{"name":"channel","type":"InputChannel"},{"name":"user_id","type":"InputUser"}],"type":"channels.ChannelParticipant"},{"id":"176122811","method":"channels.getChannels","params":[{"name":"id","type":"Vector<InputChannel>"}],"type":"messages.Chats"},{"id":"141781513","method":"channels.getFullChannel","params":[{"name":"channel","type":"InputChannel"}],"type":"messages.ChatFull"},{"id":"-192332417","method":"channels.createChannel","params":[{"name":"flags","type":"#"},{"name":"broadcast","type":"flags.0?true"},{"name":"megagroup","type":"flags.1?true"},{"name":"title","type":"string"},{"name":"about","type":"string"}],"type":"Updates"},{"id":"333610782","method":"channels.editAbout","params":[{"name":"channel","type":"InputChannel"},{"name":"about","type":"string"}],"type":"Bool"},{"id":"-344583728","method":"channels.editAdmin","params":[{"name":"channel","type":"InputChannel"},{"name":"user_id","type":"InputUser"},{"name":"role","type":"ChannelParticipantRole"}],"type":"Updates"},{"id":"1450044624","method":"channels.editTitle","params":[{"name":"channel","type":"InputChannel"},{"name":"title","type":"string"}],"type":"Updates"},{"id":"-248621111","method":"channels.editPhoto","params":[{"name":"channel","type":"InputChannel"},{"name":"photo","type":"InputChatPhoto"}],"type":"Updates"},{"id":"283557164","method":"channels.checkUsername","params":[{"name":"channel","type":"InputChannel"},{"name":"username","type":"string"}],"type":"Bool"},{"id":"890549214","method":"channels.updateUsername","params":[{"name":"channel","type":"InputChannel"},{"name":"username","type":"string"}],"type":"Bool"},{"id":"615851205","method":"channels.joinChannel","params":[{"name":"channel","type":"InputChannel"}],"type":"Updates"},{"id":"-130635115","method":"channels.leaveChannel","params":[{"name":"channel","type":"InputChannel"}],"type":"Updates"},{"id":"429865580","method":"channels.inviteToChannel","params":[{"name":"channel","type":"InputChannel"},{"name":"users","type":"Vector<InputUser>"}],"type":"Updates"},{"id":"-1502421484","method":"channels.kickFromChannel","params":[{"name":"channel","type":"InputChannel"},{"name":"user_id","type":"InputUser"},{"name":"kicked","type":"Bool"}],"type":"Updates"},{"id":"-950663035","method":"channels.exportInvite","params":[{"name":"channel","type":"InputChannel"}],"type":"ExportedChatInvite"},{"id":"-1072619549","method":"channels.deleteChannel","params":[{"name":"channel","type":"InputChannel"}],"type":"Updates"},{"id":"-1154295872","method":"updates.getChannelDifference","params":[{"name":"channel","type":"InputChannel"},{"name":"filter","type":"ChannelMessagesFilter"},{"name":"pts","type":"int"},{"name":"limit","type":"int"}],"type":"updates.ChannelDifference"},{"id":"-326379039","method":"messages.toggleChatAdmins","params":[{"name":"chat_id","type":"int"},{"name":"enabled","type":"Bool"}],"type":"Updates"},{"id":"-1444503762","method":"messages.editChatAdmin","params":[{"name":"chat_id","type":"int"},{"name":"user_id","type":"InputUser"},{"name":"is_admin","type":"Bool"}],"type":"Bool"},{"id":"363051235","method":"messages.migrateChat","params":[{"name":"chat_id","type":"int"}],"type":"Updates"},{"id":"-1640190800","method":"messages.searchGlobal","params":[{"name":"q","type":"string"},{"name":"offset_date","type":"int"},{"name":"offset_peer","type":"InputPeer"},{"name":"offset_id","type":"int"},{"name":"limit","type":"int"}],"type":"messages.Messages"},{"id":"889286899","method":"help.getTermsOfService","params":[],"type":"help.TermsOfService"},{"id":"2016638777","method":"messages.reorderStickerSets","params":[{"name":"flags","type":"#"},{"name":"masks","type":"flags.0?true"},{"name":"order","type":"Vector<long>"}],"type":"Bool"},{"id":"864953444","method":"messages.getDocumentByHash","params":[{"name":"sha256","type":"bytes"},{"name":"size","type":"int"},{"name":"mime_type","type":"string"}],"type":"Document"},{"id":"-1080395925","method":"messages.searchGifs","params":[{"name":"q","type":"string"},{"name":"offset","type":"int"}],"type":"messages.FoundGifs"},{"id":"-2084618926","method":"messages.getSavedGifs","params":[{"name":"hash","type":"int"}],"type":"messages.SavedGifs"},{"id":"846868683","method":"messages.saveGif","params":[{"name":"id","type":"InputDocument"},{"name":"unsave","type":"Bool"}],"type":"Bool"},{"id":"1364105629","method":"messages.getInlineBotResults","params":[{"name":"flags","type":"#"},{"name":"bot","type":"InputUser"},{"name":"peer","type":"InputPeer"},{"name":"geo_point","type":"flags.0?InputGeoPoint"},{"name":"query","type":"string"},{"name":"offset","type":"string"}],"type":"messages.BotResults"},{"id":"-346119674","method":"messages.setInlineBotResults","params":[{"name":"flags","type":"#"},{"name":"gallery","type":"flags.0?true"},{"name":"private","type":"flags.1?true"},{"name":"query_id","type":"long"},{"name":"results","type":"Vector<InputBotInlineResult>"},{"name":"cache_time","type":"int"},{"name":"next_offset","type":"flags.2?string"},{"name":"switch_pm","type":"flags.3?InlineBotSwitchPM"}],"type":"Bool"},{"id":"-1318189314","method":"messages.sendInlineBotResult","params":[{"name":"flags","type":"#"},{"name":"silent","type":"flags.5?true"},{"name":"background","type":"flags.6?true"},{"name":"clear_draft","type":"flags.7?true"},{"name":"peer","type":"InputPeer"},{"name":"reply_to_msg_id","type":"flags.0?int"},{"name":"random_id","type":"long"},{"name":"query_id","type":"long"},{"name":"id","type":"string"}],"type":"Updates"},{"id":"1231065863","method":"channels.toggleInvites","params":[{"name":"channel","type":"InputChannel"},{"name":"enabled","type":"Bool"}],"type":"Updates"},{"id":"-934882771","method":"channels.exportMessageLink","params":[{"name":"channel","type":"InputChannel"},{"name":"id","type":"int"}],"type":"ExportedMessageLink"},{"id":"527021574","method":"channels.toggleSignatures","params":[{"name":"channel","type":"InputChannel"},{"name":"enabled","type":"Bool"}],"type":"Updates"},{"id":"-1490162350","method":"channels.updatePinnedMessage","params":[{"name":"flags","type":"#"},{"name":"silent","type":"flags.0?true"},{"name":"channel","type":"InputChannel"},{"name":"id","type":"int"}],"type":"Updates"},{"id":"1056025023","method":"auth.resendCode","params":[{"name":"phone_number","type":"string"},{"name":"phone_code_hash","type":"string"}],"type":"auth.SentCode"},{"id":"520357240","method":"auth.cancelCode","params":[{"name":"phone_number","type":"string"},{"name":"phone_code_hash","type":"string"}],"type":"Bool"},{"id":"-39416522","method":"messages.getMessageEditData","params":[{"name":"peer","type":"InputPeer"},{"name":"id","type":"int"}],"type":"messages.MessageEditData"},{"id":"-829299510","method":"messages.editMessage","params":[{"name":"flags","type":"#"},{"name":"no_webpage","type":"flags.1?true"},{"name":"peer","type":"InputPeer"},{"name":"id","type":"int"},{"name":"message","type":"flags.11?string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"},{"name":"entities","type":"flags.3?Vector<MessageEntity>"}],"type":"Updates"},{"id":"319564933","method":"messages.editInlineBotMessage","params":[{"name":"flags","type":"#"},{"name":"no_webpage","type":"flags.1?true"},{"name":"id","type":"InputBotInlineMessageID"},{"name":"message","type":"flags.11?string"},{"name":"reply_markup","type":"flags.2?ReplyMarkup"},{"name":"entities","type":"flags.3?Vector<MessageEntity>"}],"type":"Bool"},{"id":"-2130010132","method":"messages.getBotCallbackAnswer","params":[{"name":"flags","type":"#"},{"name":"game","type":"flags.1?true"},{"name":"peer","type":"InputPeer"},{"name":"msg_id","type":"int"},{"name":"data","type":"flags.0?bytes"}],"type":"messages.BotCallbackAnswer"},{"id":"-920136629","method":"messages.setBotCallbackAnswer","params":[{"name":"flags","type":"#"},{"name":"alert","type":"flags.1?true"},{"name":"query_id","type":"long"},{"name":"message","type":"flags.0?string"},{"name":"url","type":"flags.2?string"}],"type":"Bool"},{"id":"-728224331","method":"contacts.getTopPeers","params":[{"name":"flags","type":"#"},{"name":"correspondents","type":"flags.0?true"},{"name":"bots_pm","type":"flags.1?true"},{"name":"bots_inline","type":"flags.2?true"},{"name":"groups","type":"flags.10?true"},{"name":"channels","type":"flags.15?true"},{"name":"offset","type":"int"},{"name":"limit","type":"int"},{"name":"hash","type":"int"}],"type":"contacts.TopPeers"},{"id":"451113900","method":"contacts.resetTopPeerRating","params":[{"name":"category","type":"TopPeerCategory"},{"name":"peer","type":"InputPeer"}],"type":"Bool"},{"id":"764901049","method":"messages.getPeerDialogs","params":[{"name":"peers","type":"Vector<InputPeer>"}],"type":"messages.PeerDialogs"},{"id":"-1137057461","method":"messages.saveDraft","params":[{"name":"flags","type":"#"},{"name":"no_webpage","type":"flags.1?true"},{"name":"reply_to_msg_id","type":"flags.0?int"},{"name":"peer","type":"InputPeer"},{"name":"message","type":"string"},{"name":"entities","type":"flags.3?Vector<MessageEntity>"}],"type":"Bool"},{"id":"1782549861","method":"messages.getAllDrafts","params":[],"type":"Updates"},{"id":"766298703","method":"messages.getFeaturedStickers","params":[{"name":"hash","type":"int"}],"type":"messages.FeaturedStickers"},{"id":"1527873830","method":"messages.readFeaturedStickers","params":[{"name":"id","type":"Vector<long>"}],"type":"Bool"},{"id":"1587647177","method":"messages.getRecentStickers","params":[{"name":"flags","type":"#"},{"name":"attached","type":"flags.0?true"},{"name":"hash","type":"int"}],"type":"messages.RecentStickers"},{"id":"958863608","method":"messages.saveRecentSticker","params":[{"name":"flags","type":"#"},{"name":"attached","type":"flags.0?true"},{"name":"id","type":"InputDocument"},{"name":"unsave","type":"Bool"}],"type":"Bool"},{"id":"-1986437075","method":"messages.clearRecentStickers","params":[{"name":"flags","type":"#"},{"name":"attached","type":"flags.0?true"}],"type":"Bool"},{"id":"1475442322","method":"messages.getArchivedStickers","params":[{"name":"flags","type":"#"},{"name":"masks","type":"flags.0?true"},{"name":"offset_id","type":"long"},{"name":"limit","type":"int"}],"type":"messages.ArchivedStickers"},{"id":"353818557","method":"account.sendConfirmPhoneCode","params":[{"name":"flags","type":"#"},{"name":"allow_flashcall","type":"flags.0?true"},{"name":"hash","type":"string"},{"name":"current_number","type":"flags.0?Bool"}],"type":"auth.SentCode"},{"id":"1596029123","method":"account.confirmPhone","params":[{"name":"phone_code_hash","type":"string"},{"name":"phone_code","type":"string"}],"type":"Bool"},{"id":"-1920105769","method":"channels.getAdminedPublicChannels","params":[],"type":"messages.Chats"},{"id":"1706608543","method":"messages.getMaskStickers","params":[{"name":"hash","type":"int"}],"type":"messages.AllStickers"},{"id":"-866424884","method":"messages.getAttachedStickers","params":[{"name":"media","type":"InputStickeredMedia"}],"type":"Vector<StickerSetCovered>"},{"id":"-1907842680","method":"auth.dropTempAuthKeys","params":[{"name":"except_auth_keys","type":"Vector<long>"}],"type":"Bool"},{"id":"-1896289088","method":"messages.setGameScore","params":[{"name":"flags","type":"#"},{"name":"edit_message","type":"flags.0?true"},{"name":"peer","type":"InputPeer"},{"name":"id","type":"int"},{"name":"user_id","type":"InputUser"},{"name":"score","type":"int"}],"type":"Updates"},{"id":"363700068","method":"messages.setInlineGameScore","params":[{"name":"flags","type":"#"},{"name":"edit_message","type":"flags.0?true"},{"name":"id","type":"InputBotInlineMessageID"},{"name":"user_id","type":"InputUser"},{"name":"score","type":"int"}],"type":"Bool"},{"id":"-400399203","method":"messages.getGameHighScores","params":[{"name":"peer","type":"InputPeer"},{"name":"id","type":"int"},{"name":"user_id","type":"InputUser"}],"type":"messages.HighScores"},{"id":"258170395","method":"messages.getInlineGameHighScores","params":[{"name":"id","type":"InputBotInlineMessageID"},{"name":"user_id","type":"InputUser"}],"type":"messages.HighScores"}]}<?php /** * Lang module * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class Lang { public static $lang = array ( 'it' => array ( 'phpseclib_fork' => 'Per favore installa questo fork di phpseclib: https://github.com/danog/phpseclib', 'inst_dc' => 'Istanziamento dei DataCenter...', 'load_rsa' => 'Caricamento delle chiavi RSA...', 'TL_translation' => 'Translazione degli schemi TL...', 'dh_prime_check_0' => 'Esecuzione dei check dh_prime (0/3)...', 'nearest_dc' => 'Siamo in %s, il DC più vicino è %d.', 'serialization_ofd' => 'La serializzazione non è aggiornata, reistanziamento dell\'oggetto in corso!', 'getupdates_deserialization' => 'Ottenimento aggiornamenti dopo deserializzazione...', 'shutdown_reader_pool' => 'Chiusura pool di lettura, %d thread rimasti', 'threading_on' => 'IL THREADING È ABILITATO', 'socket_reader' => 'Lettore socket su DC %s: ', 'socket_status_1' => 'CREAZIONE', 'socket_status_2' => 'INVIO', 'socket_status_3' => 'ATTESA', 'socket_status_4' => 'PRONTO', 'socket_status_5' => 'AVVIATO', 'api_not_set' => 'Devi specificare una chiave ed un ID API, ottienili su https://my.telegram.org', 'session_corrupted' => 'La sessione si è corrotta!', 'reset_session_seqno' => 'Resettando ID sessione e numero di sequenza sul DC %s...', 'gen_perm_auth_key' => 'Generando chiave di autorizzazione permanente per il DC %s...', 'gen_temp_auth_key' => 'Generando chiave di autorizzazione temporanea per il DC %s...', 'copy_auth_dcs' => 'Copiando autorizzazione dal DC %s al DC %s...', 'write_client_info' => 'Scrittura info sul client (eseguendo nel contempo il metodo %s)...', 'config_updated' => 'La configurazione è stata aggiornata!', 'length_not_4' => 'La lunghezza non è uguale a 4', 'length_not_8' => 'La lunghezza non è uguale a 8', 'value_bigger_than_2147483647' => 'Il valore fornito (%s) è maggiore di 2147483647', 'value_smaller_than_2147483648' => 'Il valore fornito (%s) è minore di -2147483648', 'value_bigger_than_9223372036854775807' => 'Il valore fornito (%s) è maggiore di 9223372036854775807', 'value_smaller_than_9223372036854775808' => 'Il valore fornito (%s) è minore di -9223372036854775808', 'value_bigger_than_4294967296' => 'Il valore fornito (%s) è maggiore di 4294967296', 'value_smaller_than_0' => 'Il valore fornito (%s) è minore di 0', 'encode_double_error' => 'Non sono riuscito a codificare il numero a virgola mobile fornito', 'file_not_exist' => 'Il file specificato non esiste', 'deserialization_error' => 'C\'è stato un errore durante la deserializzazione', 'rsa_init' => 'Istanziamento di \\phpseclib\\Crypt\\RSA in corso...', 'loading_key' => 'Caricamento della chiave in corso...', 'computing_fingerprint' => 'Calcolo del fingerprint in corso...', 'rsa_encrypting' => 'Criptando con chiave RSA...', 'rpc_tg_error' => 'Telegram ha ritornato un errore RPC: %s (%s), causato da %s:%sTL trace:', 'v_error' => '506572206661766f726520616767696f726e612071756573746120696e7374616c6c617a696f6e65206469204d6164656c696e6550726f746f20636f6e206769742070756c6c206520636f6d706f73657220757064617465', 'v_tgerror' => '506572206661766f726520616767696f726e61207068702d6c69627467766f6970', 'no_mode_specified' => 'Nessuna modalità di logging è stata specificata!', 'constructor_function_uncalled' => 'Il metodo costruttore non è stato ancora chiamato! Per favore chiama il metodo costruttore prima di usare questo metodo.', 'proxy_class_invalid' => 'È stata specificata una classe proxy errata!', 'socket_con_error' => 'Connessione fallita.', 'protocol_not_implemented' => 'Questo protocollo non è stato ancora implementato.', 'protocol_invalid' => 'È stato fornito un protocollo non valido', 'nothing_in_socket' => 'Non c\'è niente nel socket!', 'wrong_length_read' => 'ATTENZIONE: Non sono stati letti abbastanza byte (dovevo leggere %s, ho letto %s)!', 'no_data_in_socket' => 'Non ci sono dati nel socket!', 'dc_con_start' => 'Connessione al DC %s in corso...', 'dc_con_stop' => 'Disconnessione dal DC %s in corso...', 'dc_con_test_start' => 'Connessione al DC %s (server %s, %s, %s)...', 'script_not_exist' => 'Lo script fornito non esiste', 'apifactory_start' => 'Sto avviando la fabbrica di API...', 'madelineproto_ready' => 'MadelineProto è pronto!', 'logout_error' => 'C\'è stato un errore durante il logout!', 'logout_ok' => 'Il logout è stato eseguito correttamente!', 'already_logged_in' => 'Questa istanza di MadelineProto è già loggata, prima faccio il logout...', 'login_ok' => 'Il login è stato eseguito correttamente!', 'login_user' => 'Sto eseguendo il login come utente normale...', 'login_bot' => 'Sto eseguendo il login come bot...', 'login_code_sending' => 'Sto inviando il codice...', 'login_code_sent' => 'Il codice è stato inviato correttamente! Una volta ricevuto il codice dovrai usare la funzione complete_phone_login.', 'login_code_uncalled' => 'Non sto aspettando il codice! Usa la funzione phone_login.', 'login_2fa_enabled' => 'L\'autenticazione a due fattori è abilitata, dovrai chiamare il metodo complete_2fa_login...', 'login_need_signup' => 'Questo numero non è registrato su telegram, dovrai chiamare la funzione complete_signup...', 'login_auth_key' => 'Sto facendo il login con la chiave di autorizzazione...', 'not_logged_in' => 'Non ho ancora fatto il login!', 'signup_uncalled' => 'Chiama prima le funzioni phone_login e complete_phone_login.', 'signing_up' => 'Mi sto registrando su telegram come utente normale...', 'signup_ok' => 'Mi sono registrato su Telegram!', '2fa_uncalled' => 'Non sto aspettando la password, chiama prima le funzioni phone_login e complete_phone_login!', 'getting_dialogs' => 'Sto ottenendo la lista delle chat...', 'libtgvoip_required' => 'È necessario installare l\'estensione php-libtgvoip per accettare e gestire chiamate vocali, vistate https://docs.madelineproto.xyz per più info.', 'peer_not_in_db' => 'Questo utente/gruppo/canale non è presente nel database interno MadelineProto', 'calling_user' => 'Sto chiamando %s...', 'generating_a' => 'Sto generando a...', 'generating_g_a' => 'Sto generando g_a...', 'call_error_1' => 'Impossibile trovare ed accettare la chiamata %s', 'accepting_call' => 'Sto accettando una chiamata da %s...', 'generating_b' => 'Sto generando b...', 'call_already_accepted' => 'La chiamata %s è già stata accettata.', 'call_already_declined' => 'La chiamata %s è già stata annullata.', 'call_error_2' => 'Impossibile trovare e confermare la chiamata %s', 'call_confirming' => 'Sto confermando una chiamata da %s', 'call_error_3' => 'Impossibile trovare e completare la chiamata %s', 'call_completing' => 'Sto completando una chiamata da %s...', 'invalid_g_a' => 'g_a non valido!', 'fingerprint_invalid' => 'fingerprint della chiave non valido!', 'call_discarding' => 'Sto rifiutando la chiamata %s...', 'call_set_rating' => 'Sto inviando la recensione della chiamata %s...', 'call_debug_saving' => 'Sto inviando i dati di debug della chiamata %s...', 'TL_loading' => 'Sto caricando gli schemi TL...', 'file_parsing' => 'Leggendo %s...', 'crc32_mismatch' => 'CRC32 non valido (%s diverso da %s) per %s', 'src_file_invalid' => 'È stato fornito un file sorgente non valido: ', 'translating_obj' => 'Traducendo gli oggetti...', 'translating_methods' => 'Traducendo i metodi...', 'bool_error' => 'Non sono riuscito ad estrarre un booleano', 'not_numeric' => 'Il valore fornito non è numerico', 'long_not_16' => 'Il valore fornito non è lungo 16 byte', 'long_not_32' => 'Il valore fornito non è lungo 32 byte', 'long_not_64' => 'Il valore fornito non è lungo 64 byte', 'array_invalid' => 'Il valore fornito non è un array', 'predicate_not_set' => 'Il predicato (valore sotto chiave _, esempio [\'_\' => \'inputPeer\']) non è impostato!', 'type_extract_error' => 'Impossibile estrarre il tipo "%s"', 'method_not_found' => 'Impossibile trovare il seguente metodo: ', 'params_missing' => 'Non hai fornito un parametro obbligatorio, rileggi la documentazione API', 'sec_peer_not_in_db' => 'La chat segreta non è presente nel database interno MadelineProto', 'stream_handle_invalid' => 'Il valore fornito non è uno stream', 'length_too_big' => 'Il valore fornito è troppo lungo', 'deserialize_not_str' => 'Il valore generato non è una stringa', 'type_extract_error_id' => 'Non sono riuscito ad estrarre il tipo %s con ID %s', 'vector_invalid' => 'ID vettore non valido: ', 'constructor_not_found' => 'Costruttore non trovato per tipo: ', 'rand_bytes_too_small' => 'random_bytes è troppo corto!', 'botapi_conversion_error' => 'NOn sono risucito a convertire %s in un oggetto bot API', 'non_text_conversion' => 'Non posso ancora convertire messaggi media', 'last_byte_invalid' => 'L\'ultimo byte non è valido', 'file_type_invalid' => 'È stato fornito un tipo file errato', 'recreate_temp_auth_key' => 'Sono stato costretto a rigenerare la chiave di autorizzazione temporanea', 'resetting_auth_key' => 'ATTENZIONE: Sto resettando la chiave temporanea...', 'shutting_down_reader_pool' => 'Chisura pool di lettura', 'shutting_down_handler_pool' => 'Chiusura pool di gestione per DC %s, %d thread rimasti', 'secret_chat_skipping' => 'Non ho la chat segreta %s nel database, ignorando messaggio', 'fingerprint_mismatch' => 'Fingerprint della chiave non valido', 'msg_data_length_too_big' => 'message_data_length è troppo grande', 'length_not_divisible_16' => 'La lunghezza dei dati decifrati non è divisibile per 16', 'msg_key_mismatch' => 'msg_key non valido', 'rand_bytes_too_short' => 'random_bytes è troppo corto!', 'resending_unsupported' => 'IL riinvio di messaggi non è ancora supportato', 'unrecognized_dec_msg' => 'È stato ricevuto un messaggio decifrato sconosciuto: ', 'serializing_madelineproto' => 'Sto serializzando MadelineProto...', 'req_pq' => 'Sto richiedendo pq...', 'done' => 'Fatto!', 'cdn_reupload' => 'Il file non è disponibile sul nostro CDN, richiedo la copia!', 'stored_on_cdn' => 'Il file è scaricabile tramite CDN!', ), 'en' => array ( 'req_pq' => 'Requesting pq...', 'done' => 'Done!', 'cdn_reupload' => 'File is not stored on CDN, requesting reupload!', 'stored_on_cdn' => 'File is stored on CDN!', 'serializing_madelineproto' => 'Serializing MadelineProto...', 'phpseclib_fork' => 'Please install this fork of phpseclib: https://github.com/danog/phpseclib', 'inst_dc' => 'Istantiating DataCenter...', 'load_rsa' => 'Loading RSA keys...', 'TL_translation' => 'Translating TL schemas...', 'dh_prime_check_0' => 'Executing dh_prime checks (0/3)...', 'nearest_dc' => 'We\'re in %s, nearest DC is %d.', 'serialization_ofd' => 'Serialization is out of date, reconstructing object!', 'getupdates_deserialization' => 'Getting updates after deserialization...', 'shutdown_reader_pool' => 'Shutting down reader pool, %d jobs left', 'threading_on' => 'THREADING IS ENABLED', 'socket_reader' => 'Socket reader on DC %s: ', 'socket_status_1' => 'CREATING', 'socket_status_2' => 'SUBMITTING', 'socket_status_3' => 'WAITING', 'socket_status_4' => 'READY', 'socket_status_5' => 'WORKING', 'api_not_set' => 'You must provide an api key and an api id, get your own @ my.telegram.org', 'session_corrupted' => 'The session is corrupted!', 'reset_session_seqno' => 'Resetting session id and seq_no in DC %s...', 'gen_perm_auth_key' => 'Generating permanent authorization key for DC %s...', 'gen_temp_auth_key' => 'Generating temporary authorization key for DC %s...', 'copy_auth_dcs' => 'Copying authorization from DC %s to DC %s...', 'write_client_info' => 'Writing client info (also executing %s)...', 'config_updated' => 'Updated config!', 'length_not_4' => 'Length is not equal to 4', 'length_not_8' => 'Length is not equal to 8', 'value_bigger_than_2147483647' => 'Provided value %s is bigger than 2147483647', 'value_smaller_than_2147483648' => 'Provided value %s is smaller than -2147483648', 'value_bigger_than_9223372036854775807' => 'Provided value %s is bigger than 9223372036854775807', 'value_smaller_than_9223372036854775808' => 'Provided value %s is smaller than -9223372036854775808', 'value_bigger_than_4294967296' => 'Provided value %s is bigger than 4294967296', 'value_smaller_than_0' => 'Provided value %s is smaller than 0', 'encode_double_error' => 'Could not properly encode double', 'file_not_exist' => 'File does not exist', 'deserialization_error' => 'An error occurred on deserialization', 'rsa_init' => 'Istantiating \\phpseclib\\Crypt\\RSA...', 'loading_key' => 'Loading key...', 'computing_fingerprint' => 'Computing fingerprint...', 'rsa_encrypting' => 'Encrypting with rsa key...', 'rpc_tg_error' => 'Telegram returned an RPC error: %s (%s), caused by %s:%sTL trace:', 'v_error' => '506c656173652075706461746520746f20746865206c61746573742076657273696f6e206f66204d6164656c696e6550726f746f2e', 'v_tgerror' => '506c6561736520757064617465207068702d6c69627467766f6970', 'no_mode_specified' => 'No mode was specified!', 'constructor_function_uncalled' => 'The constructor function wasn\'t called! Please call the constructor function before using this method.', 'proxy_class_invalid' => 'Invalid proxy class provided!', 'socket_con_error' => 'Connection: couldn\'t connect to socket.', 'protocol_not_implemented' => 'Connection: This protocol isn\'t implemented yet.', 'protocol_invalid' => 'Connection: invalid protocol specified.', 'nothing_in_socket' => 'Nothing in the socket!', 'wrong_length_read' => 'WARNING: Wrong length was read (should\'ve read %s, read %s)!', 'no_data_in_socket' => 'No data in the socket!', 'dc_con_start' => 'Connecting to DC %s...', 'dc_con_stop' => 'Disconnecting from DC %s...', 'dc_con_test_start' => 'Connecting to DC %s (%s server, %s, %s)...', 'script_not_exist' => 'Provided script does not exist', 'apifactory_start' => 'Running APIFactory...', 'madelineproto_ready' => 'MadelineProto is ready!', 'logout_error' => 'An error occurred while logging out!', 'logout_ok' => 'Logged out successfully!', 'already_logged_in' => 'This instance of MadelineProto is already logged in. Logging out first...', 'login_ok' => 'Logged in successfully!', 'login_user' => 'Logging in as a normal user...', 'login_bot' => 'Logging in as a bot...', 'login_code_sending' => 'Sending code...', 'login_code_sent' => 'Code sent successfully! Once you receive the code you should use the complete_phone_login function.', 'login_code_uncalled' => 'I\'m not waiting for the code! Please call the phone_login method first', 'login_2fa_enabled' => '2FA enabled, you will have to call the complete_2fa_login function...', 'login_need_signup' => 'An account has not been created for this number, you will have to call the complete_signup function...', 'login_auth_key' => 'Logging in using auth key...', 'not_logged_in' => 'I\'m not logged in!', 'signup_uncalled' => 'I\'m not waiting to signup! Please call the phone_login and the complete_phone_login methods first!', 'signing_up' => 'Signing up as a normal user...', 'signup_ok' => 'Signed up in successfully!', '2fa_uncalled' => 'I\'m not waiting for the password! Please call the phone_login and the complete_phone_login methods first!', 'getting_dialogs' => 'Getting dialogs...', 'libtgvoip_required' => 'The php-libtgvoip extension is required to accept and manage calls. See daniil.it/MadelineProto for more info.', 'peer_not_in_db' => 'This peer is not present in the internal peer database', 'calling_user' => 'Calling %s...', 'generating_a' => 'Generating a...', 'generating_g_a' => 'Generating g_a...', 'call_error_1' => 'Could not find and accept call %s', 'accepting_call' => 'Accepting call from %s...', 'generating_b' => 'Generating b...', 'call_already_accepted' => 'Call %s already accepted', 'call_already_declined' => 'Call %s already declined', 'call_error_2' => 'Could not find and confirm call %s', 'call_confirming' => 'Confirming call from %s...', 'call_error_3' => 'Could not find and complete call %s', 'call_completing' => 'Completing call from %s...', 'invalid_g_a' => 'Invalid g_a!', 'fingerprint_invalid' => 'Invalid key fingerprint!', 'call_discarding' => 'Discarding call %s...', 'call_set_rating' => 'Setting rating for call %s...', 'call_debug_saving' => 'Saving debug data for call %s...', 'TL_loading' => 'Loading TL schemes...', 'file_parsing' => 'Parsing %s...', 'crc32_mismatch' => 'CRC32 mismatch (%s, %s) for %s', 'src_file_invalid' => 'Invalid source file was provided: ', 'translating_obj' => 'Translating objects...', 'translating_methods' => 'Translating methods...', 'bool_error' => 'Could not extract boolean', 'not_numeric' => 'Given value isn\'t numeric', 'long_not_16' => 'Given value is not 16 bytes long', 'long_not_32' => 'Given value is not 32 bytes long', 'long_not_64' => 'Given value is not 64 bytes long', 'array_invalid' => 'You didn\'t provide a valid array', 'predicate_not_set' => 'Predicate (value under _) was not set!', 'type_extract_error' => 'Could not extract type "%s"', 'method_not_found' => 'Could not find method: ', 'params_missing' => 'Missing required parameter', 'sec_peer_not_in_db' => 'This secret peer is not present in the internal peer database', 'stream_handle_invalid' => 'An invalid stream handle was provided.', 'length_too_big' => 'Length is too big', 'deserialize_not_str' => 'Deserialize: Generated value isn\'t a string', 'type_extract_error_id' => 'Could not extract type: %s with id %s', 'vector_invalid' => 'Invalid vector constructor: ', 'constructor_not_found' => 'Constructor not found for type: ', 'rand_bytes_too_small' => 'Random_bytes is too small!', 'botapi_conversion_error' => 'Can\'t convert %s to a bot API object', 'non_text_conversion' => 'Can\'t convert non text messages yet!', 'last_byte_invalid' => 'Invalid last byte', 'file_type_invalid' => 'Invalid file type detected (%s)', 'recreate_temp_auth_key' => 'I had to recreate the temporary authorization key', 'resetting_auth_key' => 'WARNING: Resetting auth key...', 'shutting_down_reader_pool' => 'Shutting down reader pool ', 'shutting_down_handler_pool' => 'Shutting down handler pool for dc %s, %d jobs left', 'secret_chat_skipping' => 'I do not have the secret chat %s in the database, skipping message...', 'fingerprint_mismatch' => 'Key fingerprint mismatch', 'msg_data_length_too_big' => 'Message_data_length is too big', 'length_not_divisible_16' => 'Length of decrypted data is not divisible by 16', 'msg_key_mismatch' => 'Msg_key mismatch', 'rand_bytes_too_short' => 'Random_bytes is too short!', 'resending_unsupported' => 'Resending of messages is not yet supported', 'unrecognized_dec_msg' => 'Unrecognized decrypted message received: ', 'method_req_pq' => 'Requests PQ for factorization', 'method_req_pq_param_nonce_type_int128' => 'Random number for cryptographic security', 'method_req_pq_multi' => 'Requests PQ for factorization (new version)', 'method_req_pq_multi_param_nonce_type_int128' => 'Random number for cryptographic security', 'method_req_DH_params' => 'Requests Diffie-hellman parameters for key exchange', 'method_req_DH_params_param_nonce_type_int128' => 'Random number for cryptographic security', 'method_req_DH_params_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'method_req_DH_params_param_p_type_bytes' => 'Factorized p from pq', 'method_req_DH_params_param_q_type_bytes' => 'Factorized q from pq', 'method_req_DH_params_param_public_key_fingerprint_type_long' => 'Server RSA fingerprint', 'method_req_DH_params_param_encrypted_data_type_bytes' => 'Encrypted key exchange message', 'method_set_client_DH_params' => 'Sets client diffie-hellman parameters', 'method_set_client_DH_params_param_nonce_type_int128' => 'Random number for cryptographic security', 'method_set_client_DH_params_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'method_set_client_DH_params_param_encrypted_data_type_bytes' => 'Encrypted key exchange message', 'method_rpc_drop_answer' => 'Do not send answer to provided request', 'method_rpc_drop_answer_param_req_msg_id_type_long' => 'The message ID of the request', 'method_get_future_salts' => 'Get future salts', 'method_get_future_salts_param_num_type_int' => 'How many salts should be fetched', 'method_ping' => 'Pings the server', 'method_ping_param_ping_id_type_long' => 'Ping ID', 'method_ping_delay_disconnect' => 'Pings the server and causes disconection if the same method is not called within ping_disconnect_delay', 'method_ping_delay_disconnect_param_ping_id_type_long' => 'Ping ID', 'method_ping_delay_disconnect_param_disconnect_delay_type_int' => 'Disconection delay', 'method_destroy_session' => 'Destroy the current MTProto session', 'method_destroy_session_param_session_id_type_long' => 'The session to destroy', 'method_http_wait' => 'Makes the server send messages waiting in the buffer', 'method_http_wait_param_max_delay_type_int' => 'Denotes the maximum number of milliseconds that has elapsed between the first message for this session and the transmission of an HTTP response', 'method_http_wait_param_wait_after_type_int' => 'After the receipt of the latest message for a particular session, the server waits another wait_after milliseconds in case there are more messages. If there are no additional messages, the result is transmitted (a container with all the messages).', 'method_http_wait_param_max_wait_type_int' => 'If more messages appear, the wait_after timer is reset.', 'method_invokeAfterMsg' => 'Invokes a query after successfull completion of one of the previous queries.', 'method_invokeAfterMsg_param_msg_id_type_long' => 'Message identifier on which a current query depends', 'method_invokeAfterMsg_param_query_type_!X' => 'The query itself', 'method_invokeAfterMsgs' => 'Result type returned by a current query.', 'method_invokeAfterMsgs_param_msg_ids_type_Vector t' => 'List of messages on which a current query depends', 'method_invokeAfterMsgs_param_query_type_!X' => 'The query itself', 'method_initConnection' => 'Initializes connection and save information on the user\'s device and application.', 'method_initConnection_param_api_id_type_int' => 'Application identifier', 'method_initConnection_param_device_model_type_string' => 'Device model', 'method_initConnection_param_system_version_type_string' => 'System version', 'method_initConnection_param_app_version_type_string' => 'App version', 'method_initConnection_param_system_lang_code_type_string' => 'Language code', 'method_initConnection_param_lang_pack_type_string' => 'Language pack to use', 'method_initConnection_param_lang_code_type_string' => 'Language code to set', 'method_initConnection_param_query_type_!X' => 'Nested query', 'method_invokeWithLayer' => 'Invoke this method with layer X', 'method_invokeWithLayer_param_layer_type_int' => 'The layer version', 'method_invokeWithLayer_param_query_type_!X' => 'The query', 'method_invokeWithoutUpdates' => 'Invoke with method without returning updates in the socket', 'method_invokeWithoutUpdates_param_query_type_!X' => 'The query', 'method_auth.checkPhone' => 'Check if this phone number is registered on telegram', 'method_auth.checkPhone_param_phone_number_type_string' => 'The phone number to check', 'method_auth.sendCode' => 'Use phone_login instead', 'method_auth.sendCode_param_allow_flashcall_type_true' => 'Use phone_login instead', 'method_auth.sendCode_param_phone_number_type_string' => 'Use phone_login instead', 'method_auth.sendCode_param_current_number_type_Bool' => 'Use phone_login instead', 'method_auth.sendCode_param_api_id_type_int' => 'Use phone_login instead', 'method_auth.sendCode_param_api_hash_type_string' => 'Use phone_login instead', 'method_auth.signUp' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signUp_param_phone_number_type_string' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signUp_param_phone_code_hash_type_string' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signUp_param_phone_code_type_string' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signUp_param_first_name_type_string' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signUp_param_last_name_type_string' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signIn' => 'You cannot use this method directly, use the complete_phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signIn_param_phone_number_type_string' => 'You cannot use this method directly, use the complete_phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signIn_param_phone_code_hash_type_string' => 'You cannot use this method directly, use the complete_phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signIn_param_phone_code_type_string' => 'You cannot use this method directly, use the complete_phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.logOut' => 'You cannot use this method directly, use the logout method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.resetAuthorizations' => 'Delete all logged-in sessions.', 'method_auth.sendInvites' => 'Invite friends to telegram!', 'method_auth.sendInvites_param_phone_numbers_type_Vector t' => 'Phone numbers to invite', 'method_auth.sendInvites_param_message_type_string' => 'The message to send', 'method_auth.exportAuthorization' => 'You cannot use this method directly, use $MadelineProto->export_authorization() instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'method_auth.exportAuthorization_param_dc_id_type_int' => 'You cannot use this method directly, use $MadelineProto->export_authorization() instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'method_auth.importAuthorization' => 'You cannot use this method directly, use $MadelineProto->import_authorization($authorization) instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'method_auth.importAuthorization_param_id_type_int' => 'You cannot use this method directly, use $MadelineProto->import_authorization($authorization) instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'method_auth.importAuthorization_param_bytes_type_bytes' => 'You cannot use this method directly, use $MadelineProto->import_authorization($authorization) instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'method_auth.bindTempAuthKey' => 'You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info', 'method_auth.bindTempAuthKey_param_perm_auth_key_id_type_long' => 'You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info', 'method_auth.bindTempAuthKey_param_nonce_type_long' => 'You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info', 'method_auth.bindTempAuthKey_param_expires_at_type_int' => 'You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info', 'method_auth.bindTempAuthKey_param_encrypted_message_type_bytes' => 'You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info', 'method_auth.importBotAuthorization' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.importBotAuthorization_param_api_id_type_int' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.importBotAuthorization_param_api_hash_type_string' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.importBotAuthorization_param_bot_auth_token_type_string' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.checkPassword' => 'You cannot use this method directly, use the complete_2fa_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.checkPassword_param_password_hash_type_bytes' => 'You cannot use this method directly, use the complete_2fa_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.requestPasswordRecovery' => 'Send an email to recover the 2FA password', 'method_auth.recoverPassword' => 'Use the code that was emailed to you after running $MadelineProto->auth->requestPasswordRecovery to login to your account', 'method_auth.recoverPassword_param_code_type_string' => 'The code that was emailed to you', 'method_auth.resendCode' => 'Resend the SMS verification code', 'method_auth.resendCode_param_phone_number_type_string' => 'The phone number', 'method_auth.resendCode_param_phone_code_hash_type_string' => 'The phone code hash', 'method_auth.cancelCode' => 'Invalidate sent phone code', 'method_auth.cancelCode_param_phone_number_type_string' => 'Phone number', 'method_auth.cancelCode_param_phone_code_hash_type_string' => 'Phone code hash', 'method_auth.dropTempAuthKeys' => 'Delete all temporary authorization keys except the ones provided', 'method_auth.dropTempAuthKeys_param_except_auth_keys_type_Vector t' => 'The temporary authorization keys to keep', 'method_account.registerDevice' => 'Register device for push notifications', 'method_account.registerDevice_param_token_type_type_int' => 'Device token type. Possible values: 1 - APNS, 2 - GCM, 3 - MPNS, 4 - Simple Push, 5 - Ubuntu Phone, 6 - Blackberry, and other, see source code of official apps for more info', 'method_account.registerDevice_param_token_type_string' => 'Device token type. Possible values: 1 - APNS, 2 - GCM, 3 - MPNS, 4 - Simple Push, 5 - Ubuntu Phone,6 - Blackberry, and other, see source code of official apps for more info', 'method_account.registerDevice_param_app_sandbox_type_Bool' => 'Should the app run in a sandbox?', 'method_account.registerDevice_param_other_uids_type_Vector t' => 'Other UIDs', 'method_account.unregisterDevice' => 'Stop sending PUSH notifications to app', 'method_account.unregisterDevice_param_token_type_type_int' => 'Device token type. Possible values: 1 - APNS, 2 - GCM, 3 - MPNS, 4 - Simple Push, 5 - Ubuntu Phone,6 - Blackberry, and other, see source code of official apps for more info', 'method_account.unregisterDevice_param_token_type_string' => 'Device token type. Possible values: 1 - APNS, 2 - GCM, 3 - MPNS, 4 - Simple Push, 5 - Ubuntu Phone,6 - Blackberry, and other, see source code of official apps for more info', 'method_account.unregisterDevice_param_other_uids_type_Vector t' => 'Other UIDs', 'method_account.updateNotifySettings' => 'Change notification settings', 'method_account.updateNotifySettings_param_peer_type_InputNotifyPeer' => 'The peers to which the notification settings should be applied', 'method_account.updateNotifySettings_param_settings_type_InputPeerNotifySettings' => 'Notification settings', 'method_account.getNotifySettings' => 'Get notification settings', 'method_account.getNotifySettings_param_peer_type_InputNotifyPeer' => 'Notification source ', 'method_account.resetNotifySettings' => 'Reset all notification settings', 'method_account.updateProfile' => 'Update profile info', 'method_account.updateProfile_param_first_name_type_string' => 'The first name', 'method_account.updateProfile_param_last_name_type_string' => 'The last name', 'method_account.updateProfile_param_about_type_string' => 'The bio/about field', 'method_account.updateStatus' => 'Update online status', 'method_account.updateStatus_param_offline_type_Bool' => 'True to set the status to offline', 'method_account.getWallPapers' => 'Returns a list of available wallpapers.', 'method_account.reportPeer' => 'Report for spam', 'method_account.reportPeer_param_peer_type_InputPeer' => 'The peer to report', 'method_account.reportPeer_param_reason_type_ReportReason' => 'Why are you reporting this peer', 'method_account.checkUsername' => 'Check if this username is available', 'method_account.checkUsername_param_username_type_string' => 'The username to check', 'method_account.updateUsername' => 'Update this user\'s username', 'method_account.updateUsername_param_username_type_string' => 'The new username', 'method_account.getPrivacy' => 'Get privacy settings', 'method_account.getPrivacy_param_key_type_InputPrivacyKey' => 'Privacy setting key', 'method_account.setPrivacy' => 'Set privacy settings', 'method_account.setPrivacy_param_key_type_InputPrivacyKey' => 'Privacy setting', 'method_account.setPrivacy_param_rules_type_Vector t' => 'Privacy settings', 'method_account.deleteAccount' => 'Delete this account', 'method_account.deleteAccount_param_reason_type_string' => 'Why are you going away? :(', 'method_account.getAccountTTL' => 'Get account TTL', 'method_account.setAccountTTL' => 'Set account TTL', 'method_account.setAccountTTL_param_ttl_type_AccountDaysTTL' => 'Time To Live of account', 'method_account.sendChangePhoneCode' => 'Change the phone number', 'method_account.sendChangePhoneCode_param_allow_flashcall_type_true' => 'Can the code be sent using a flash call instead of an SMS?', 'method_account.sendChangePhoneCode_param_phone_number_type_string' => 'New phone number', 'method_account.sendChangePhoneCode_param_current_number_type_Bool' => 'Current phone number', 'method_account.changePhone' => 'Change the phone number associated to this account', 'method_account.changePhone_param_phone_number_type_string' => 'Phone number', 'method_account.changePhone_param_phone_code_hash_type_string' => 'Phone code hash returned by account.sendChangePhoneCode', 'method_account.changePhone_param_phone_code_type_string' => 'The phone code sent by account.sendChangePhoneCode', 'method_account.updateDeviceLocked' => 'Disable all notifications for a certain period', 'method_account.updateDeviceLocked_param_period_type_int' => 'For how long should notifications be disabled', 'method_account.getAuthorizations' => 'Get all logged-in authorizations', 'method_account.resetAuthorization' => 'Delete a certain session', 'method_account.resetAuthorization_param_hash_type_long' => 'The session hash, obtained from $MadelineProto->account->getAuthorizations', 'method_account.getPassword' => 'Get the current password', 'method_account.getPasswordSettings' => 'Get the current 2FA settings', 'method_account.getPasswordSettings_param_current_password_hash_type_bytes' => 'Use only if you have set a 2FA password: `$current_salt = $MadelineProto->account->getPassword()[\'current_salt\']; $current_password_hash = hash(\'sha256\', $current_salt.$password.$current_salt, true);`', 'method_account.updatePasswordSettings' => 'You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info)', 'method_account.updatePasswordSettings_param_current_password_hash_type_bytes' => 'Use only if you have set a 2FA password: `$current_salt = $MadelineProto->account->getPassword()[\'current_salt\']; $current_password_hash = hash(\'sha256\', $current_salt.$password.$current_salt, true);`', 'method_account.updatePasswordSettings_param_new_settings_type_account.PasswordInputSettings' => 'New 2FA settings', 'method_account.sendConfirmPhoneCode' => 'Send confirmation phone code', 'method_account.sendConfirmPhoneCode_param_allow_flashcall_type_true' => 'Can telegram call you instead of sending an SMS?', 'method_account.sendConfirmPhoneCode_param_hash_type_string' => 'The hash', 'method_account.sendConfirmPhoneCode_param_current_number_type_Bool' => 'The current phone number', 'method_account.confirmPhone' => 'Confirm this phone number is associated to this account, obtain phone_code_hash from sendConfirmPhoneCode', 'method_account.confirmPhone_param_phone_code_hash_type_string' => 'Obtain phone_code_hash from sendConfirmPhoneCode', 'method_account.confirmPhone_param_phone_code_type_string' => 'The code sent by sendConfirmPhoneCode', 'method_account.getTmpPassword' => 'Get temporary password for buying products through bots', 'method_account.getTmpPassword_param_password_hash_type_bytes' => 'The password hash', 'method_account.getTmpPassword_param_period_type_int' => 'The validity period', 'method_account.getWebAuthorizations' => 'Get telegram web login authorizations', 'method_account.resetWebAuthorization' => 'Delete a certain telegram web login authorization', 'method_account.resetWebAuthorization_param_hash_type_long' => 'The authorization\'s hash', 'method_account.resetWebAuthorizations' => 'Reset all telegram web login authorizations', 'method_users.getUsers' => 'Get info about users', 'method_users.getUsers_param_id_type_Vector t' => 'The ids of the users', 'method_users.getFullUser' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_users.getFullUser_param_id_type_InputUser' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_contacts.getStatuses' => 'Get online status of all users', 'method_contacts.getContacts' => 'Get all contacts', 'method_contacts.getContacts_param_hash_type_int' => 'User ids of contacts previously fetched with this method', 'method_contacts.importContacts' => 'Add phone number as contact', 'method_contacts.importContacts_param_contacts_type_Vector t' => 'The numbers to import', 'method_contacts.deleteContact' => 'Delete a contact', 'method_contacts.deleteContact_param_id_type_InputUser' => 'The contact to delete', 'method_contacts.deleteContacts' => 'Delete multiple contacts', 'method_contacts.deleteContacts_param_id_type_Vector t' => 'The contacts to delete', 'method_contacts.block' => 'Block a user', 'method_contacts.block_param_id_type_InputUser' => 'The user to block', 'method_contacts.unblock' => 'Unblock a user', 'method_contacts.unblock_param_id_type_InputUser' => 'The user to unblock', 'method_contacts.getBlocked' => 'Get blocked users', 'method_contacts.getBlocked_param_offset_type_int' => 'Initially 0, then set to the number of blocked contacts previously fetched', 'method_contacts.getBlocked_param_limit_type_int' => 'How many blocked contacts to fetch', 'method_contacts.exportCard' => 'Export contact as card', 'method_contacts.importCard' => 'Import card as contact', 'method_contacts.importCard_param_export_card_type_Vector t' => 'The card', 'method_contacts.search' => 'Search contacts', 'method_contacts.search_param_q_type_string' => 'The search query', 'method_contacts.search_param_limit_type_int' => 'How many results should be returned', 'method_contacts.resolveUsername' => 'You cannot use this method directly, use the resolve_username, get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_contacts.resolveUsername_param_username_type_string' => 'You cannot use this method directly, use the resolve_username, get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_contacts.getTopPeers' => 'Get most used chats', 'method_contacts.getTopPeers_param_correspondents_type_true' => 'Fetch users?', 'method_contacts.getTopPeers_param_bots_pm_type_true' => 'Fetch bots?', 'method_contacts.getTopPeers_param_bots_inline_type_true' => 'Fetch inline bots?', 'method_contacts.getTopPeers_param_phone_calls_type_true' => 'Fetch phone calls?', 'method_contacts.getTopPeers_param_groups_type_true' => 'Fetch groups?', 'method_contacts.getTopPeers_param_channels_type_true' => 'Fetch channels and supergroups?', 'method_contacts.getTopPeers_param_offset_type_int' => 'Initially 0, then `$offset += $contacts_TopPeers[\'categories\'][\'count\'];`', 'method_contacts.getTopPeers_param_limit_type_int' => 'How many results to fetch', 'method_contacts.getTopPeers_param_hash_type_int' => 'Peer ids previously fetched with this method', 'method_contacts.resetTopPeerRating' => 'Reset top peer rating for a certain category/peer', 'method_contacts.resetTopPeerRating_param_category_type_TopPeerCategory' => 'The category ', 'method_contacts.resetTopPeerRating_param_peer_type_InputPeer' => 'The peer', 'method_contacts.resetSaved' => 'Reset saved contacts', 'method_messages.getMessages' => 'Get messages', 'method_messages.getMessages_param_id_type_Vector t' => 'The IDs of messages to fetch (only for users and normal groups)', 'method_messages.getDialogs' => 'Gets list of chats: you should use $MadelineProto->get_dialogs() instead: https://docs.madelineproto.xyz/docs/DIALOGS.html', 'method_messages.getDialogs_param_exclude_pinned_type_true' => 'Do not fetch pinned chats', 'method_messages.getDialogs_param_offset_date_type_int' => 'End($res[\'messages\'])[\'date\'];', 'method_messages.getDialogs_param_offset_id_type_int' => 'End($res[\'messages\'])[\'id\'];', 'method_messages.getDialogs_param_offset_peer_type_InputPeer' => 'End($res[\'dialogs\'])[\'peer\'];', 'method_messages.getDialogs_param_limit_type_int' => 'Number of dialogs to fetch', 'method_messages.getHistory' => 'Get previous messages of a group', 'method_messages.getHistory_param_peer_type_InputPeer' => 'The chat', 'method_messages.getHistory_param_offset_id_type_int' => 'The last fetched message ID, initially 0', 'method_messages.getHistory_param_offset_date_type_int' => 'The date of the last previously fetched message, initially 0', 'method_messages.getHistory_param_add_offset_type_int' => 'Additional offset, can be 0', 'method_messages.getHistory_param_limit_type_int' => 'Number of messages to fetch', 'method_messages.getHistory_param_max_id_type_int' => 'Maximum message ID to fetch', 'method_messages.getHistory_param_min_id_type_int' => 'Minumum message ID to fetch', 'method_messages.getHistory_param_hash_type_int' => 'List of IDs of already parsed messages', 'method_messages.search' => 'Search peers or messages', 'method_messages.search_param_peer_type_InputPeer' => 'Where to search', 'method_messages.search_param_q_type_string' => 'What to search', 'method_messages.search_param_from_id_type_InputUser' => 'Show only messages from a certain user?', 'method_messages.search_param_filter_type_MessagesFilter' => 'Message filter', 'method_messages.search_param_min_date_type_int' => 'Minumum date of results to fetch', 'method_messages.search_param_max_date_type_int' => 'Maximum date of results to fetch', 'method_messages.search_param_offset_id_type_int' => 'Message ID offset', 'method_messages.search_param_add_offset_type_int' => 'Additional offset, can be 0', 'method_messages.search_param_limit_type_int' => 'Number of results to return', 'method_messages.search_param_max_id_type_int' => 'Maximum message id to return', 'method_messages.search_param_min_id_type_int' => 'Minumum message id to return', 'method_messages.readHistory' => 'Mark messages as read', 'method_messages.readHistory_param_peer_type_InputPeer' => 'Where to mark messages as read', 'method_messages.readHistory_param_max_id_type_int' => 'Maximum message ID to mark as read', 'method_messages.deleteHistory' => 'Delete chat history', 'method_messages.deleteHistory_param_just_clear_type_true' => 'Only clear it from your side', 'method_messages.deleteHistory_param_peer_type_InputPeer' => 'Where to clear it', 'method_messages.deleteHistory_param_max_id_type_int' => 'Maximum message id of messages to delete', 'method_messages.deleteMessages' => 'Delete messages', 'method_messages.deleteMessages_param_revoke_type_true' => 'Delete the messages for everyone?', 'method_messages.deleteMessages_param_id_type_Vector t' => 'IDs of messages to delete, use channels->deleteMessages for supergroups', 'method_messages.receivedMessages' => 'Mark messages as read', 'method_messages.receivedMessages_param_max_id_type_int' => 'Maximum message id of messages to mark as read', 'method_messages.setTyping' => 'Change typing status', 'method_messages.setTyping_param_peer_type_InputPeer' => 'Where to change typing status', 'method_messages.setTyping_param_action_type_SendMessageAction' => 'Typing status', 'method_messages.sendMessage' => 'Send a message', 'method_messages.sendMessage_param_no_webpage_type_true' => 'Disable webpage preview?', 'method_messages.sendMessage_param_silent_type_true' => 'Disable notifications?', 'method_messages.sendMessage_param_background_type_true' => 'Disable background notifications?', 'method_messages.sendMessage_param_clear_draft_type_true' => 'Clear the message draft of this chat?', 'method_messages.sendMessage_param_peer_type_InputPeer' => 'The chat where to send this message', 'method_messages.sendMessage_param_reply_to_msg_id_type_int' => 'Reply to message by ID', 'method_messages.sendMessage_param_message_type_string' => 'The message to send', 'method_messages.sendMessage_param_reply_markup_type_ReplyMarkup' => 'Keyboards to send', 'method_messages.sendMessage_param_entities_type_Vector t' => 'Entities to send (for styled text)', 'method_messages.sendMedia' => 'Send a media', 'method_messages.sendMedia_param_silent_type_true' => 'Disable notifications?', 'method_messages.sendMedia_param_background_type_true' => 'Disable background notifications?', 'method_messages.sendMedia_param_clear_draft_type_true' => 'Clear the message draft of this chat?', 'method_messages.sendMedia_param_peer_type_InputPeer' => 'Where to send the media', 'method_messages.sendMedia_param_reply_to_msg_id_type_int' => 'Reply to message by ID', 'method_messages.sendMedia_param_media_type_InputMedia' => 'The media to send', 'method_messages.sendMedia_param_message_type_string' => 'The caption', 'method_messages.sendMedia_param_reply_markup_type_ReplyMarkup' => 'Keyboards to send', 'method_messages.sendMedia_param_entities_type_Vector t' => 'Entities for styled text', 'method_messages.forwardMessages' => 'Forward messages', 'method_messages.forwardMessages_param_silent_type_true' => 'Disable notifications', 'method_messages.forwardMessages_param_background_type_true' => 'Disable background notifications', 'method_messages.forwardMessages_param_with_my_score_type_true' => 'If forwarding a game, forward your score, too', 'method_messages.forwardMessages_param_grouped_type_true' => 'Set to true if forwarding albums', 'method_messages.forwardMessages_param_from_peer_type_InputPeer' => 'From where to forward the messages', 'method_messages.forwardMessages_param_id_type_Vector t' => 'The message IDs', 'method_messages.forwardMessages_param_to_peer_type_InputPeer' => 'Where to forward the messages', 'method_messages.reportSpam' => 'Report a peer for spam', 'method_messages.reportSpam_param_peer_type_InputPeer' => 'The peer to report', 'method_messages.hideReportSpam' => 'Hide report spam popup', 'method_messages.hideReportSpam_param_peer_type_InputPeer' => 'Where to hide the popup', 'method_messages.getPeerSettings' => 'Get the settings of apeer', 'method_messages.getPeerSettings_param_peer_type_InputPeer' => 'The peer', 'method_messages.getChats' => 'Get info about chats', 'method_messages.getChats_param_id_type_Vector t' => 'The MTProto IDs of chats to fetch info about', 'method_messages.getFullChat' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_messages.getFullChat_param_chat_id_type_InputPeer' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_messages.editChatTitle' => 'Edit the title of a normal chat (not supergroup)', 'method_messages.editChatTitle_param_chat_id_type_InputPeer' => 'The ID of the chat', 'method_messages.editChatTitle_param_title_type_string' => 'The new title', 'method_messages.editChatPhoto' => 'Edit the photo of a normal chat (not supergroup)', 'method_messages.editChatPhoto_param_chat_id_type_InputPeer' => 'The ID of the chat', 'method_messages.editChatPhoto_param_photo_type_InputChatPhoto' => 'The new phto', 'method_messages.addChatUser' => 'Add a user to a normal chat (use channels->inviteToChannel for supergroups)', 'method_messages.addChatUser_param_chat_id_type_InputPeer' => 'The chat where to invite users', 'method_messages.addChatUser_param_user_id_type_InputUser' => 'The user to invite', 'method_messages.addChatUser_param_fwd_limit_type_int' => 'Number of old messages the user will see', 'method_messages.deleteChatUser' => 'Delete a user from a chat (not supergroup)', 'method_messages.deleteChatUser_param_chat_id_type_InputPeer' => 'The ID of the chat', 'method_messages.deleteChatUser_param_user_id_type_InputUser' => 'The user to delete (pass @me to leave the chat)', 'method_messages.createChat' => 'Create a chat (not supergroup)', 'method_messages.createChat_param_users_type_Vector t' => 'The users to add to the chat', 'method_messages.createChat_param_title_type_string' => 'The new chat\'s title', 'method_messages.getDhConfig' => 'You cannot use this method directly, instead use $MadelineProto->get_dh_config();', 'method_messages.getDhConfig_param_version_type_int' => 'You cannot use this method directly, instead use $MadelineProto->get_dh_config();', 'method_messages.getDhConfig_param_random_length_type_int' => 'You cannot use this method directly, instead use $MadelineProto->get_dh_config();', 'method_messages.requestEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.requestEncryption_param_user_id_type_InputUser' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.requestEncryption_param_g_a_type_bytes' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.acceptEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.acceptEncryption_param_peer_type_InputEncryptedChat' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.acceptEncryption_param_g_b_type_bytes' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.acceptEncryption_param_key_fingerprint_type_long' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.discardEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.discardEncryption_param_chat_id_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.setEncryptedTyping' => 'Send typing notification to secret chat', 'method_messages.setEncryptedTyping_param_peer_type_InputEncryptedChat' => 'The secret chat where to send the notification', 'method_messages.setEncryptedTyping_param_typing_type_Bool' => 'Set to true to enable the notification, false to disable it', 'method_messages.readEncryptedHistory' => 'Mark messages as read in secret chats', 'method_messages.readEncryptedHistory_param_peer_type_InputEncryptedChat' => 'The secret chat where to mark messages as read', 'method_messages.readEncryptedHistory_param_max_date_type_int' => 'Maximum date of messages to mark', 'method_messages.sendEncrypted' => 'Send message to secret chat', 'method_messages.sendEncrypted_param_peer_type_InputEncryptedChat' => 'The chat where to send the message', 'method_messages.sendEncrypted_param_message_type_DecryptedMessage' => 'The message to send', 'method_messages.sendEncryptedFile' => 'Send a file to a secret chat', 'method_messages.sendEncryptedFile_param_peer_type_InputEncryptedChat' => 'The chat where to send the file', 'method_messages.sendEncryptedFile_param_message_type_DecryptedMessage' => 'The message with the file', 'method_messages.sendEncryptedFile_param_file_type_InputEncryptedFile' => 'The file (optional)', 'method_messages.sendEncryptedService' => 'Send a service message to a secret chat', 'method_messages.sendEncryptedService_param_peer_type_InputEncryptedChat' => 'The chat where to send the service message', 'method_messages.sendEncryptedService_param_message_type_DecryptedMessage' => 'The service message', 'method_messages.receivedQueue' => 'You cannot use this method directly', 'method_messages.receivedQueue_param_max_qts_type_int' => 'You cannot use this method directly', 'method_messages.reportEncryptedSpam' => 'Report for spam a secret chat', 'method_messages.reportEncryptedSpam_param_peer_type_InputEncryptedChat' => 'The chat to report', 'method_messages.readMessageContents' => 'Mark message as read', 'method_messages.readMessageContents_param_id_type_Vector t' => 'The messages to mark as read (only users and normal chats, not supergroups)', 'method_messages.getStickers' => 'Get stickers', 'method_messages.getStickers_param_emoticon_type_string' => 'Search by emoji', 'method_messages.getStickers_param_hash_type_string' => 'Previously fetched sticker IDs', 'method_messages.getAllStickers' => 'Get all stickerpacks', 'method_messages.getAllStickers_param_hash_type_int' => '0 or $result[\'hash\']', 'method_messages.getWebPagePreview' => 'Get webpage preview', 'method_messages.getWebPagePreview_param_message_type_string' => 'Extract preview from this message', 'method_messages.getWebPagePreview_param_entities_type_Vector t' => 'Entities for styled text', 'method_messages.exportChatInvite' => 'Export chat invite ', 'method_messages.exportChatInvite_param_chat_id_type_InputPeer' => 'The chat id ', 'method_messages.checkChatInvite' => 'Check if an invitation link is valid', 'method_messages.checkChatInvite_param_hash_type_string' => 'The invite link in t.me/joinchat/aflakf format', 'method_messages.importChatInvite' => 'Import chat invite', 'method_messages.importChatInvite_param_hash_type_string' => 'The invite link in t.me/joinchat/aflakf format', 'method_messages.getStickerSet' => 'Get a stickerset', 'method_messages.getStickerSet_param_stickerset_type_InputStickerSet' => 'The stickerset to get', 'method_messages.installStickerSet' => 'Add a sticker set', 'method_messages.installStickerSet_param_stickerset_type_InputStickerSet' => 'The sticker set to add', 'method_messages.installStickerSet_param_archived_type_Bool' => 'Archive this set?', 'method_messages.uninstallStickerSet' => 'Remove a sticker set', 'method_messages.uninstallStickerSet_param_stickerset_type_InputStickerSet' => 'The sticker set to remove', 'method_messages.startBot' => 'Start a bot', 'method_messages.startBot_param_bot_type_InputUser' => 'The bot\'s ID or username', 'method_messages.startBot_param_peer_type_InputPeer' => 'Where to start the bot (@me or group ID/username)', 'method_messages.startBot_param_start_param_type_string' => 'The bot\'s start parameter', 'method_messages.getMessagesViews' => 'Get and increase message views', 'method_messages.getMessagesViews_param_peer_type_InputPeer' => 'The chat where the message is located', 'method_messages.getMessagesViews_param_id_type_Vector t' => 'The IDs messages to get', 'method_messages.getMessagesViews_param_increment_type_Bool' => 'Increase message views?', 'method_messages.toggleChatAdmins' => 'Enable all users are admins in normal groups (not supergroups)', 'method_messages.toggleChatAdmins_param_chat_id_type_InputPeer' => 'Group ID', 'method_messages.toggleChatAdmins_param_enabled_type_Bool' => 'Enable all users are admins', 'method_messages.editChatAdmin' => 'Edit admin permissions', 'method_messages.editChatAdmin_param_chat_id_type_InputPeer' => 'The chat ID (no supergroups)', 'method_messages.editChatAdmin_param_user_id_type_InputUser' => 'The user ID', 'method_messages.editChatAdmin_param_is_admin_type_Bool' => 'Should the user be admin?', 'method_messages.migrateChat' => 'Convert chat to supergroup', 'method_messages.migrateChat_param_chat_id_type_InputPeer' => 'The chat to convert', 'method_messages.searchGlobal' => 'Global message search', 'method_messages.searchGlobal_param_q_type_string' => 'The query', 'method_messages.searchGlobal_param_offset_date_type_int' => '0 or the date offset', 'method_messages.searchGlobal_param_offset_peer_type_InputPeer' => '0 or the peer offset', 'method_messages.searchGlobal_param_offset_id_type_int' => '0 or the message ID offset', 'method_messages.searchGlobal_param_limit_type_int' => 'The number of results to return', 'method_messages.reorderStickerSets' => 'Reorder sticker sets', 'method_messages.reorderStickerSets_param_masks_type_true' => 'Reorder masks?', 'method_messages.reorderStickerSets_param_order_type_Vector t' => 'The order', 'method_messages.getDocumentByHash' => 'Get document by SHA256 hash', 'method_messages.getDocumentByHash_param_sha256_type_bytes' => '`hash(\'sha256\', $filename, true);`', 'method_messages.getDocumentByHash_param_size_type_int' => 'The file size', 'method_messages.getDocumentByHash_param_mime_type_type_string' => 'The mime type of the file', 'method_messages.searchGifs' => 'Search gifs', 'method_messages.searchGifs_param_q_type_string' => 'The search query', 'method_messages.searchGifs_param_offset_type_int' => 'The offset ', 'method_messages.getSavedGifs' => 'Get saved gifs', 'method_messages.getSavedGifs_param_hash_type_int' => '0 or $result[\'hash\']', 'method_messages.saveGif' => 'Save a GIF', 'method_messages.saveGif_param_id_type_InputDocument' => 'The GIF to save', 'method_messages.saveGif_param_unsave_type_Bool' => 'Remove the gif?', 'method_messages.getInlineBotResults' => 'Call inline bot', 'method_messages.getInlineBotResults_param_bot_type_InputUser' => 'The bot to call', 'method_messages.getInlineBotResults_param_peer_type_InputPeer' => 'The chat where to call the bot', 'method_messages.getInlineBotResults_param_geo_point_type_InputGeoPoint' => 'The current location', 'method_messages.getInlineBotResults_param_query_type_string' => 'The query to send to the bot', 'method_messages.getInlineBotResults_param_offset_type_string' => 'The offset to send to the bot', 'method_messages.setInlineBotResults' => 'Bots only: set the results of an inline query', 'method_messages.setInlineBotResults_param_gallery_type_true' => 'Is this a gallery?', 'method_messages.setInlineBotResults_param_private_type_true' => 'Is this result private (not cached)?', 'method_messages.setInlineBotResults_param_query_id_type_long' => 'Query ID', 'method_messages.setInlineBotResults_param_results_type_Vector t' => 'Results', 'method_messages.setInlineBotResults_param_cache_time_type_int' => 'Cache time', 'method_messages.setInlineBotResults_param_next_offset_type_string' => 'The next offset', 'method_messages.setInlineBotResults_param_switch_pm_type_InlineBotSwitchPM' => 'Switch to PM?', 'method_messages.sendInlineBotResult' => 'Send inline bot result obtained with messages.getInlineBotResults to the chat', 'method_messages.sendInlineBotResult_param_silent_type_true' => 'Disable notifications?', 'method_messages.sendInlineBotResult_param_background_type_true' => 'Disable background notifications?', 'method_messages.sendInlineBotResult_param_clear_draft_type_true' => 'Clear the message draft?', 'method_messages.sendInlineBotResult_param_peer_type_InputPeer' => 'Where to send the message', 'method_messages.sendInlineBotResult_param_reply_to_msg_id_type_int' => 'Reply to message by ID', 'method_messages.sendInlineBotResult_param_query_id_type_long' => 'The inline query ID', 'method_messages.sendInlineBotResult_param_id_type_string' => 'The ID of one of the inline results', 'method_messages.getMessageEditData' => 'Check if about to edit a message or a media caption', 'method_messages.getMessageEditData_param_peer_type_InputPeer' => 'The chat', 'method_messages.getMessageEditData_param_id_type_int' => 'The message ID', 'method_messages.editMessage' => 'Edit a message', 'method_messages.editMessage_param_no_webpage_type_true' => 'Disable webpage preview', 'method_messages.editMessage_param_stop_geo_live_type_true' => 'Stop live location', 'method_messages.editMessage_param_peer_type_InputPeer' => 'The chat', 'method_messages.editMessage_param_id_type_int' => 'The message ID', 'method_messages.editMessage_param_message_type_string' => 'The new message', 'method_messages.editMessage_param_reply_markup_type_ReplyMarkup' => 'The new keyboard', 'method_messages.editMessage_param_entities_type_Vector t' => 'The new entities (for styled text)', 'method_messages.editMessage_param_geo_point_type_InputGeoPoint' => 'The new location', 'method_messages.editInlineBotMessage' => 'Edit a sent inline message', 'method_messages.editInlineBotMessage_param_no_webpage_type_true' => 'Disable webpage preview', 'method_messages.editInlineBotMessage_param_stop_geo_live_type_true' => 'Stop live location', 'method_messages.editInlineBotMessage_param_id_type_InputBotInlineMessageID' => 'The message ID', 'method_messages.editInlineBotMessage_param_message_type_string' => 'The new message', 'method_messages.editInlineBotMessage_param_reply_markup_type_ReplyMarkup' => 'The new keyboard', 'method_messages.editInlineBotMessage_param_entities_type_Vector t' => 'The new entities (for styled text)', 'method_messages.editInlineBotMessage_param_geo_point_type_InputGeoPoint' => 'The new location', 'method_messages.getBotCallbackAnswer' => 'Get the callback answer of a bot (after clicking a button)', 'method_messages.getBotCallbackAnswer_param_game_type_true' => 'Is this a game?', 'method_messages.getBotCallbackAnswer_param_peer_type_InputPeer' => 'The chat', 'method_messages.getBotCallbackAnswer_param_msg_id_type_int' => 'The message ID', 'method_messages.getBotCallbackAnswer_param_data_type_bytes' => 'The data to send to the bot', 'method_messages.setBotCallbackAnswer' => 'Bots only: set the callback answer (after a button was clicked)', 'method_messages.setBotCallbackAnswer_param_alert_type_true' => 'Is this an alert?', 'method_messages.setBotCallbackAnswer_param_query_id_type_long' => 'The query ID', 'method_messages.setBotCallbackAnswer_param_message_type_string' => 'The message', 'method_messages.setBotCallbackAnswer_param_url_type_string' => 'The URL', 'method_messages.setBotCallbackAnswer_param_cache_time_type_int' => 'Cache time', 'method_messages.getPeerDialogs' => 'Get dialog info of peers', 'method_messages.getPeerDialogs_param_peers_type_Vector t' => 'The peers', 'method_messages.saveDraft' => 'Save a message draft', 'method_messages.saveDraft_param_no_webpage_type_true' => 'Disable webpage preview', 'method_messages.saveDraft_param_reply_to_msg_id_type_int' => 'Reply to message by ID', 'method_messages.saveDraft_param_peer_type_InputPeer' => 'The chat', 'method_messages.saveDraft_param_message_type_string' => 'The message', 'method_messages.saveDraft_param_entities_type_Vector t' => 'The entities (for styled text)', 'method_messages.getAllDrafts' => 'Get all message drafts', 'method_messages.getFeaturedStickers' => 'Get featured stickers', 'method_messages.getFeaturedStickers_param_hash_type_int' => '0 or $result[\'hash\']', 'method_messages.readFeaturedStickers' => 'Mark new featured stickers as read', 'method_messages.readFeaturedStickers_param_id_type_Vector t' => 'The stickers to mark as read', 'method_messages.getRecentStickers' => 'Get recent stickers', 'method_messages.getRecentStickers_param_attached_type_true' => 'Get stickers attached to image?', 'method_messages.getRecentStickers_param_hash_type_int' => '0 or $result[\'hash\']', 'method_messages.saveRecentSticker' => 'Add a sticker to recent stickers', 'method_messages.saveRecentSticker_param_attached_type_true' => 'Get stickers attached to image?', 'method_messages.saveRecentSticker_param_id_type_InputDocument' => 'The sticker', 'method_messages.saveRecentSticker_param_unsave_type_Bool' => 'Remove the sticker from recent stickers?', 'method_messages.clearRecentStickers' => 'Clear all recent stickers', 'method_messages.clearRecentStickers_param_attached_type_true' => 'Clear recent stickers attached to images?', 'method_messages.getArchivedStickers' => 'Get all archived stickers', 'method_messages.getArchivedStickers_param_masks_type_true' => 'Get masks?', 'method_messages.getArchivedStickers_param_offset_id_type_long' => 'Sticker ID offset', 'method_messages.getArchivedStickers_param_limit_type_int' => 'Number of stickers to fetch', 'method_messages.getMaskStickers' => 'Get masks', 'method_messages.getMaskStickers_param_hash_type_int' => '0 or $result[\'hash\']', 'method_messages.getAttachedStickers' => 'Get stickers attachable to images', 'method_messages.getAttachedStickers_param_media_type_InputStickeredMedia' => 'The stickered media', 'method_messages.setGameScore' => 'Set the game score', 'method_messages.setGameScore_param_edit_message_type_true' => 'Should the message with the game be edited?', 'method_messages.setGameScore_param_force_type_true' => 'Force setting the game score', 'method_messages.setGameScore_param_peer_type_InputPeer' => 'The chat where the game was sent', 'method_messages.setGameScore_param_id_type_int' => 'The message ID', 'method_messages.setGameScore_param_user_id_type_InputUser' => 'The user that set the score', 'method_messages.setGameScore_param_score_type_int' => 'The score', 'method_messages.setInlineGameScore' => 'Set the game score of an inline message', 'method_messages.setInlineGameScore_param_edit_message_type_true' => 'Should the message with the game be edited?', 'method_messages.setInlineGameScore_param_force_type_true' => 'Force setting the game score', 'method_messages.setInlineGameScore_param_id_type_InputBotInlineMessageID' => 'The ID of the inline message', 'method_messages.setInlineGameScore_param_user_id_type_InputUser' => 'The user that set the score', 'method_messages.setInlineGameScore_param_score_type_int' => 'The score', 'method_messages.getGameHighScores' => 'Get high scores of a game', 'method_messages.getGameHighScores_param_peer_type_InputPeer' => 'The chat', 'method_messages.getGameHighScores_param_id_type_int' => 'The message ID', 'method_messages.getGameHighScores_param_user_id_type_InputUser' => 'The user that set the high scores', 'method_messages.getInlineGameHighScores' => 'Get high scores of a game sent in an inline message', 'method_messages.getInlineGameHighScores_param_id_type_InputBotInlineMessageID' => 'The inline message', 'method_messages.getInlineGameHighScores_param_user_id_type_InputUser' => 'The user that set the high scores', 'method_messages.getCommonChats' => 'Get chats in common with a user', 'method_messages.getCommonChats_param_user_id_type_InputUser' => 'The user', 'method_messages.getCommonChats_param_max_id_type_int' => 'The maximum chat ID to fetch', 'method_messages.getCommonChats_param_limit_type_int' => 'Number of results to fetch', 'method_messages.getAllChats' => 'Get all chats (not supergroups or channels)', 'method_messages.getAllChats_param_except_ids_type_Vector t' => 'Do not fetch these chats (MTProto id)', 'method_messages.getWebPage' => 'Get webpage preview', 'method_messages.getWebPage_param_url_type_string' => 'URL', 'method_messages.getWebPage_param_hash_type_int' => '0 or $result[\'hash\']', 'method_messages.toggleDialogPin' => 'Pin or unpin dialog', 'method_messages.toggleDialogPin_param_pinned_type_true' => 'Pin or unpin the dialog?', 'method_messages.toggleDialogPin_param_peer_type_InputPeer' => 'The peer to pin', 'method_messages.reorderPinnedDialogs' => 'Reorder pinned dialogs', 'method_messages.reorderPinnedDialogs_param_force_type_true' => 'Force reordering', 'method_messages.reorderPinnedDialogs_param_order_type_Vector t' => 'New order', 'method_messages.getPinnedDialogs' => 'Get pinned dialogs', 'method_messages.setBotShippingResults' => 'Bots only: set shipping results', 'method_messages.setBotShippingResults_param_query_id_type_long' => 'Query ID', 'method_messages.setBotShippingResults_param_error_type_string' => 'Error', 'method_messages.setBotShippingResults_param_shipping_options_type_Vector t' => 'Shipping options', 'method_messages.setBotPrecheckoutResults' => 'Bots only: set precheckout results', 'method_messages.setBotPrecheckoutResults_param_success_type_true' => 'Success?', 'method_messages.setBotPrecheckoutResults_param_query_id_type_long' => 'Query ID', 'method_messages.setBotPrecheckoutResults_param_error_type_string' => 'Error', 'method_messages.uploadMedia' => 'Upload a file without sending it to anyone', 'method_messages.uploadMedia_param_peer_type_InputPeer' => 'Nothing', 'method_messages.uploadMedia_param_media_type_InputMedia' => 'The media to upload', 'method_messages.sendScreenshotNotification' => 'Send screenshot notification', 'method_messages.sendScreenshotNotification_param_peer_type_InputPeer' => 'Where to send the notification', 'method_messages.sendScreenshotNotification_param_reply_to_msg_id_type_int' => 'Reply to message by ID', 'method_messages.getFavedStickers' => 'Get favorite stickers', 'method_messages.getFavedStickers_param_hash_type_int' => '0 or $result[\'hash\']', 'method_messages.faveSticker' => 'Add a sticker to favorites', 'method_messages.faveSticker_param_id_type_InputDocument' => 'The sticker to add to favorites', 'method_messages.faveSticker_param_unfave_type_Bool' => 'Remove it from favorites?', 'method_messages.getUnreadMentions' => 'Get unread mentions', 'method_messages.getUnreadMentions_param_peer_type_InputPeer' => 'The chat where to get unread mentions', 'method_messages.getUnreadMentions_param_offset_id_type_int' => 'The offset', 'method_messages.getUnreadMentions_param_add_offset_type_int' => 'The additional offset', 'method_messages.getUnreadMentions_param_limit_type_int' => 'The number of results to fetch', 'method_messages.getUnreadMentions_param_max_id_type_int' => 'The maximum message ID to fetch', 'method_messages.getUnreadMentions_param_min_id_type_int' => 'The minumum message ID to fetch', 'method_messages.readMentions' => 'Mark mentions as read', 'method_messages.readMentions_param_peer_type_InputPeer' => 'The chat', 'method_messages.getRecentLocations' => 'Get recent locations', 'method_messages.getRecentLocations_param_peer_type_InputPeer' => 'The chat where to search locations', 'method_messages.getRecentLocations_param_limit_type_int' => 'Number of results to return', 'method_messages.sendMultiMedia' => 'Send an album', 'method_messages.sendMultiMedia_param_silent_type_true' => 'Disable notifications?', 'method_messages.sendMultiMedia_param_background_type_true' => 'Disable background notification?', 'method_messages.sendMultiMedia_param_clear_draft_type_true' => 'Clear draft?', 'method_messages.sendMultiMedia_param_peer_type_InputPeer' => 'Where to send the album', 'method_messages.sendMultiMedia_param_reply_to_msg_id_type_int' => 'Reply to message by ID', 'method_messages.sendMultiMedia_param_multi_media_type_Vector t' => 'The album', 'method_messages.uploadEncryptedFile' => 'Upload a secret chat file without sending it to anyone', 'method_messages.uploadEncryptedFile_param_peer_type_InputEncryptedChat' => 'The chat where to upload the media', 'method_messages.uploadEncryptedFile_param_file_type_InputEncryptedFile' => 'The file', 'method_updates.getState' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getDifference' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getDifference_param_pts_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getDifference_param_pts_total_limit_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getDifference_param_date_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getDifference_param_qts_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getChannelDifference' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getChannelDifference_param_force_type_true' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getChannelDifference_param_channel_type_InputChannel' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getChannelDifference_param_filter_type_ChannelMessagesFilter' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getChannelDifference_param_pts_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getChannelDifference_param_limit_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_photos.updateProfilePhoto' => 'Change the profile photo', 'method_photos.updateProfilePhoto_param_id_type_InputPhoto' => 'The photo to use', 'method_photos.uploadProfilePhoto' => 'Upload profile photo', 'method_photos.uploadProfilePhoto_param_file_type_InputFile' => 'The photo', 'method_photos.deletePhotos' => 'Delete profile photos', 'method_photos.deletePhotos_param_id_type_Vector t' => 'The profile photos to delete', 'method_photos.getUserPhotos' => 'Get the profile photos of a user', 'method_photos.getUserPhotos_param_user_id_type_InputUser' => 'The user', 'method_photos.getUserPhotos_param_offset_type_int' => 'Offset', 'method_photos.getUserPhotos_param_max_id_type_long' => 'Maximum ID of photo to return', 'method_photos.getUserPhotos_param_limit_type_int' => 'Number of photos to return', 'method_upload.saveFilePart' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveFilePart_param_file_id_type_long' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveFilePart_param_file_part_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveFilePart_param_bytes_type_bytes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getFile_param_location_type_InputFileLocation' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getFile_param_offset_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getFile_param_limit_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveBigFilePart' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveBigFilePart_param_file_id_type_long' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveBigFilePart_param_file_part_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveBigFilePart_param_file_total_parts_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveBigFilePart_param_bytes_type_bytes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getWebFile' => 'Download a file through telegram', 'method_upload.getWebFile_param_location_type_InputWebFileLocation' => 'The file', 'method_upload.getWebFile_param_offset_type_int' => 'The offset in bytes', 'method_upload.getWebFile_param_limit_type_int' => 'The number of bytes to fetch', 'method_upload.getCdnFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getCdnFile_param_file_token_type_bytes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getCdnFile_param_offset_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getCdnFile_param_limit_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.reuploadCdnFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.reuploadCdnFile_param_file_token_type_bytes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.reuploadCdnFile_param_request_token_type_bytes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getCdnFileHashes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getCdnFileHashes_param_file_token_type_bytes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getCdnFileHashes_param_offset_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_help.getConfig' => 'Get server configuration', 'method_help.getNearestDc' => 'Get nearest datacenter', 'method_help.getAppUpdate' => 'Get info about app updates', 'method_help.saveAppLog' => 'Log data for developer of this app', 'method_help.saveAppLog_param_events_type_Vector t' => 'Event list', 'method_help.getInviteText' => 'Get invitation text', 'method_help.getSupport' => 'Get info of support user', 'method_help.getAppChangelog' => 'Get the changelog of this app', 'method_help.getAppChangelog_param_prev_app_version_type_string' => 'Previous app version', 'method_help.getTermsOfService' => 'Get terms of service', 'method_help.setBotUpdatesStatus' => 'Set the update status of webhook', 'method_help.setBotUpdatesStatus_param_pending_updates_count_type_int' => 'Pending update count', 'method_help.setBotUpdatesStatus_param_message_type_string' => 'Message', 'method_help.getCdnConfig' => 'Get CDN configuration', 'method_help.getRecentMeUrls' => 'Get recent t.me URLs', 'method_help.getRecentMeUrls_param_referer_type_string' => 'Referrer', 'method_channels.readHistory' => 'Mark channel/supergroup history as read', 'method_channels.readHistory_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.readHistory_param_max_id_type_int' => 'Maximum message ID to mark as read', 'method_channels.deleteMessages' => 'Delete channel/supergroup messages', 'method_channels.deleteMessages_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.deleteMessages_param_id_type_Vector t' => 'The IDs of messages to delete', 'method_channels.deleteUserHistory' => 'Delete all messages of a user in a channel/supergroup', 'method_channels.deleteUserHistory_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.deleteUserHistory_param_user_id_type_InputUser' => 'The user', 'method_channels.reportSpam' => 'Report a message in a supergroup/channel for spam', 'method_channels.reportSpam_param_channel_type_InputChannel' => 'The channel', 'method_channels.reportSpam_param_user_id_type_InputUser' => 'The user that sent the messages', 'method_channels.reportSpam_param_id_type_Vector t' => 'The IDs of messages to report', 'method_channels.getMessages' => 'Get channel/supergroup messages', 'method_channels.getMessages_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.getMessages_param_id_type_Vector t' => 'The message IDs', 'method_channels.getParticipants' => 'Get channel/supergroup participants (you should use `$MadelineProto->get_pwr_chat($id)` instead)', 'method_channels.getParticipants_param_channel_type_InputChannel' => 'The channel', 'method_channels.getParticipants_param_filter_type_ChannelParticipantsFilter' => 'Member filter', 'method_channels.getParticipants_param_offset_type_int' => 'Offset', 'method_channels.getParticipants_param_limit_type_int' => 'Limit', 'method_channels.getParticipants_param_hash_type_int' => 'Sorted list of IDs of participants you already fetched', 'method_channels.getParticipant' => 'Get info about a certain channel/supergroup participant', 'method_channels.getParticipant_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.getParticipant_param_user_id_type_InputUser' => 'The user to fetch info about', 'method_channels.getChannels' => 'Get info about multiple channels/supergroups', 'method_channels.getChannels_param_id_type_Vector t' => 'The channel/supergroup MTProto IDs', 'method_channels.getFullChannel' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_channels.getFullChannel_param_channel_type_InputChannel' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_channels.createChannel' => 'Create channel/supergroup', 'method_channels.createChannel_param_broadcast_type_true' => 'Set this to true to create a channel', 'method_channels.createChannel_param_megagroup_type_true' => 'Set this to true to create a supergroup', 'method_channels.createChannel_param_title_type_string' => 'Supergroup/channel title', 'method_channels.createChannel_param_about_type_string' => 'About text', 'method_channels.editAbout' => 'Edit the about text of a channel/supergroup', 'method_channels.editAbout_param_channel_type_InputChannel' => 'The channel', 'method_channels.editAbout_param_about_type_string' => 'The new about text', 'method_channels.editAdmin' => 'Edit admin permissions of a user in a channel/supergroup', 'method_channels.editAdmin_param_channel_type_InputChannel' => 'The channel', 'method_channels.editAdmin_param_user_id_type_InputUser' => 'The user', 'method_channels.editAdmin_param_admin_rights_type_ChannelAdminRights' => 'The new admin rights', 'method_channels.editTitle' => 'Edit the title of a supergroup/channel', 'method_channels.editTitle_param_channel_type_InputChannel' => 'The channel', 'method_channels.editTitle_param_title_type_string' => 'The new channel/supergroup title', 'method_channels.editPhoto' => 'Edit the photo of a supergroup/channel', 'method_channels.editPhoto_param_channel_type_InputChannel' => 'The channel', 'method_channels.editPhoto_param_photo_type_InputChatPhoto' => 'The new photo', 'method_channels.checkUsername' => 'Check if this username is free and can be assigned to a channel/supergroup', 'method_channels.checkUsername_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.checkUsername_param_username_type_string' => 'The new username for this channel/supergroup', 'method_channels.updateUsername' => 'Update the username of a supergroup/channel', 'method_channels.updateUsername_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.updateUsername_param_username_type_string' => 'The new username', 'method_channels.joinChannel' => 'Join a channel/supergroup', 'method_channels.joinChannel_param_channel_type_InputChannel' => 'The channel/supergroup to join', 'method_channels.leaveChannel' => 'Leave a channel/supergroup', 'method_channels.leaveChannel_param_channel_type_InputChannel' => 'The channel/supergroup to leave', 'method_channels.inviteToChannel' => 'Add users to channel/supergroup', 'method_channels.inviteToChannel_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.inviteToChannel_param_users_type_Vector t' => 'The users to add', 'method_channels.exportInvite' => 'Export the invite link of a channel', 'method_channels.exportInvite_param_channel_type_InputChannel' => 'The channel', 'method_channels.deleteChannel' => 'Delete a channel/supergroup', 'method_channels.deleteChannel_param_channel_type_InputChannel' => 'The channel/supergroup to delete', 'method_channels.toggleInvites' => 'Allow or disallow any user to invite users to this channel/supergroup', 'method_channels.toggleInvites_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.toggleInvites_param_enabled_type_Bool' => 'Allow or disallow', 'method_channels.exportMessageLink' => 'Get the link of a message in a channel', 'method_channels.exportMessageLink_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.exportMessageLink_param_id_type_int' => 'The ID of the message', 'method_channels.exportMessageLink_param_grouped_type_Bool' => 'Is this an album?', 'method_channels.toggleSignatures' => 'Toggle channel signatures', 'method_channels.toggleSignatures_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.toggleSignatures_param_enabled_type_Bool' => 'Enable or disable channel signatures?', 'method_channels.updatePinnedMessage' => 'Set the pinned message of a channel/supergroup', 'method_channels.updatePinnedMessage_param_silent_type_true' => 'Pin silently', 'method_channels.updatePinnedMessage_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.updatePinnedMessage_param_id_type_int' => 'The ID of the message to pin', 'method_channels.getAdminedPublicChannels' => 'Get all supergroups/channels where you\'re admin', 'method_channels.editBanned' => 'Kick or ban a user from a channel/supergroup', 'method_channels.editBanned_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.editBanned_param_user_id_type_InputUser' => 'The user to kick/ban', 'method_channels.editBanned_param_banned_rights_type_ChannelBannedRights' => 'Banned/kicked permissions', 'method_channels.getAdminLog' => 'Get admin log of a channel/supergroup', 'method_channels.getAdminLog_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.getAdminLog_param_q_type_string' => 'Search query', 'method_channels.getAdminLog_param_events_filter_type_ChannelAdminLogEventsFilter' => 'Event filter', 'method_channels.getAdminLog_param_admins_type_Vector t' => 'Fetch only actions from these admins', 'method_channels.getAdminLog_param_max_id_type_long' => 'Maximum message ID to fetch', 'method_channels.getAdminLog_param_min_id_type_long' => 'Minimum message ID to fetch', 'method_channels.getAdminLog_param_limit_type_int' => 'Number of results to fetch', 'method_channels.setStickers' => 'Set the supergroup/channel stickerpack', 'method_channels.setStickers_param_channel_type_InputChannel' => 'The channel/supergoup', 'method_channels.setStickers_param_stickerset_type_InputStickerSet' => 'The stickerset', 'method_channels.readMessageContents' => 'Mark channel/supergroup messages as read', 'method_channels.readMessageContents_param_channel_type_InputChannel' => 'The channel', 'method_channels.readMessageContents_param_id_type_Vector t' => 'List of message IDs', 'method_channels.deleteHistory' => 'Delete the history of a supergroup/channel', 'method_channels.deleteHistory_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.deleteHistory_param_max_id_type_int' => 'Maximum message ID to delete', 'method_channels.togglePreHistoryHidden' => 'Enable or disable hidden history for new channel/supergroup users', 'method_channels.togglePreHistoryHidden_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.togglePreHistoryHidden_param_enabled_type_Bool' => 'Enable or disable hidden history for new channel/supergroup users', 'method_bots.sendCustomRequest' => 'Send a custom request to the bot API', 'method_bots.sendCustomRequest_param_custom_method_type_string' => 'The method to call', 'method_bots.sendCustomRequest_param_params_type_DataJSON' => 'Method parameters', 'method_bots.answerWebhookJSONQuery' => 'Send webhook request via bot API', 'method_bots.answerWebhookJSONQuery_param_query_id_type_long' => 'The query ID', 'method_bots.answerWebhookJSONQuery_param_data_type_DataJSON' => 'The parameters', 'method_payments.getPaymentForm' => 'Get payment form', 'method_payments.getPaymentForm_param_msg_id_type_int' => 'Message ID', 'method_payments.getPaymentReceipt' => 'Get payment receipt', 'method_payments.getPaymentReceipt_param_msg_id_type_int' => 'The message ID', 'method_payments.validateRequestedInfo' => 'Validate requested payment info', 'method_payments.validateRequestedInfo_param_save_type_true' => 'Save payment info?', 'method_payments.validateRequestedInfo_param_msg_id_type_int' => 'The message ID', 'method_payments.validateRequestedInfo_param_info_type_PaymentRequestedInfo' => 'The requested payment info', 'method_payments.sendPaymentForm' => 'Bots only: send payment form', 'method_payments.sendPaymentForm_param_msg_id_type_int' => 'Message ID', 'method_payments.sendPaymentForm_param_requested_info_id_type_string' => 'ID of requested info', 'method_payments.sendPaymentForm_param_shipping_option_id_type_string' => 'Shipping option ID', 'method_payments.sendPaymentForm_param_credentials_type_InputPaymentCredentials' => 'Payment credentials', 'method_payments.getSavedInfo' => 'Get saved payments info', 'method_payments.clearSavedInfo' => 'Clear saved payments info', 'method_payments.clearSavedInfo_param_credentials_type_true' => 'Clear credentials?', 'method_payments.clearSavedInfo_param_info_type_true' => 'Clear payment info?', 'method_stickers.createStickerSet' => 'Create stickerset', 'method_stickers.createStickerSet_param_masks_type_true' => 'Masks?', 'method_stickers.createStickerSet_param_user_id_type_InputUser' => 'The user ID associated to this stickerset', 'method_stickers.createStickerSet_param_title_type_string' => 'The stickerset title', 'method_stickers.createStickerSet_param_short_name_type_string' => 'The stickerset short name', 'method_stickers.createStickerSet_param_stickers_type_Vector t' => 'The stickers to add', 'method_stickers.removeStickerFromSet' => 'Remove sticker from stickerset', 'method_stickers.removeStickerFromSet_param_sticker_type_InputDocument' => 'The sticker to remove', 'method_stickers.changeStickerPosition' => 'Change sticker position in photo', 'method_stickers.changeStickerPosition_param_sticker_type_InputDocument' => 'The sticker', 'method_stickers.changeStickerPosition_param_position_type_int' => 'New position', 'method_stickers.addStickerToSet' => 'Add sticker to stickerset', 'method_stickers.addStickerToSet_param_stickerset_type_InputStickerSet' => 'The stickerset', 'method_stickers.addStickerToSet_param_sticker_type_InputStickerSetItem' => 'The sticker', 'method_phone.getCallConfig' => 'Get call configuration', 'method_phone.requestCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.requestCall_param_user_id_type_InputUser' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.requestCall_param_g_a_hash_type_bytes' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.requestCall_param_protocol_type_PhoneCallProtocol' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.acceptCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.acceptCall_param_peer_type_InputPhoneCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.acceptCall_param_g_b_type_bytes' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.acceptCall_param_protocol_type_PhoneCallProtocol' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.confirmCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.confirmCall_param_peer_type_InputPhoneCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.confirmCall_param_g_a_type_bytes' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.confirmCall_param_key_fingerprint_type_long' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.confirmCall_param_protocol_type_PhoneCallProtocol' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.receivedCall' => 'Notify server that you received a call (server will refuse all incoming calls until the current call is over)', 'method_phone.receivedCall_param_peer_type_InputPhoneCall' => 'The phone call you received', 'method_phone.discardCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.discardCall_param_peer_type_InputPhoneCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.discardCall_param_duration_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.discardCall_param_reason_type_PhoneCallDiscardReason' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.discardCall_param_connection_id_type_long' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.setCallRating' => 'Set phone call rating', 'method_phone.setCallRating_param_peer_type_InputPhoneCall' => 'The phone call', 'method_phone.setCallRating_param_rating_type_int' => 'Rating (1-5 stars)', 'method_phone.setCallRating_param_comment_type_string' => 'An optional comment', 'method_phone.saveCallDebug' => 'Save call debugging info', 'method_phone.saveCallDebug_param_peer_type_InputPhoneCall' => 'The call', 'method_phone.saveCallDebug_param_debug_type_DataJSON' => 'Debugging info', 'method_langpack.getLangPack' => 'Get language pack', 'method_langpack.getLangPack_param_lang_code_type_string' => 'Language code', 'method_langpack.getStrings' => 'Get language pack strings', 'method_langpack.getStrings_param_lang_code_type_string' => 'Language code', 'method_langpack.getStrings_param_keys_type_Vector t' => 'Keys', 'method_langpack.getDifference' => 'Get language pack updates', 'method_langpack.getDifference_param_from_version_type_int' => 'Previous version', 'method_langpack.getLanguages' => 'Get available languages', 'method_auth.sendCode_param_sms_type_type_int' => 'You cannot use this method directly, use the phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.sendCode_param_lang_code_type_string' => 'You cannot use this method directly, use the phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.sendCall' => 'Send verification phone call', 'method_auth.sendCall_param_phone_number_type_string' => 'The phone number', 'method_auth.sendCall_param_phone_code_hash_type_string' => 'The phone code hash', 'method_account.registerDevice_param_device_model_type_string' => 'Device model', 'method_account.registerDevice_param_system_version_type_string' => 'System version', 'method_account.registerDevice_param_app_version_type_string' => 'App version', 'method_account.registerDevice_param_lang_code_type_string' => 'Language code', 'method_contacts.getContacts_param_hash_type_string' => 'List of contact user IDs you already cached', 'method_contacts.importContacts_param_replace_type_Bool' => 'Replace contacts?', 'method_contacts.getSuggested' => 'Get suggested contacts', 'method_contacts.getSuggested_param_limit_type_int' => 'Number of results to return', 'method_messages.getDialogs_param_offset_type_int' => 'Offset', 'method_messages.getDialogs_param_max_id_type_int' => 'Maximum ID of result to return', 'method_messages.getHistory_param_offset_type_int' => 'Message ID offset', 'method_messages.search_param_offset_type_int' => 'Offset ', 'method_messages.readHistory_param_offset_type_int' => 'Offset', 'method_messages.readHistory_param_read_contents_type_Bool' => 'Mark messages as read?', 'method_messages.deleteHistory_param_offset_type_int' => 'Offset', 'method_messages.forwardMessages_param_peer_type_InputPeer' => 'Peer', 'method_photos.updateProfilePhoto_param_crop_type_InputPhotoCrop' => 'Cropping info', 'method_photos.uploadProfilePhoto_param_caption_type_string' => 'Caption type', 'method_photos.uploadProfilePhoto_param_geo_point_type_InputGeoPoint' => 'Location', 'method_photos.uploadProfilePhoto_param_crop_type_InputPhotoCrop' => 'Cropping info', 'method_help.getAppUpdate_param_device_model_type_string' => 'Device model', 'method_help.getAppUpdate_param_system_version_type_string' => 'System version', 'method_help.getAppUpdate_param_app_version_type_string' => 'App version', 'method_help.getAppUpdate_param_lang_code_type_string' => 'Langauge code', 'method_help.getInviteText_param_lang_code_type_string' => 'Language', 'method_photos.getUserPhotos_param_max_id_type_int' => 'Maximum ID of photo to return', 'method_messages.forwardMessage' => 'Forward message', 'method_messages.forwardMessage_param_peer_type_InputPeer' => 'From where to forward the message', 'method_messages.forwardMessage_param_id_type_int' => 'The message ID', 'method_messages.sendBroadcast' => 'Send a message to all users in the chat list', 'method_messages.sendBroadcast_param_contacts_type_Vector t' => 'The users to which send the message', 'method_messages.sendBroadcast_param_message_type_string' => 'The message', 'method_messages.sendBroadcast_param_media_type_InputMedia' => 'The media', 'method_auth.sendSms' => 'Send SMS verification code', 'method_auth.sendSms_param_phone_number_type_string' => 'Phone number', 'method_auth.sendSms_param_phone_code_hash_type_string' => 'Phone code ash', 'method_invokeWithLayer18' => 'Invoke this method with layer 18', 'method_invokeWithLayer18_param_query_type_!X' => 'The method call', 'method_messages.getAllStickers_param_hash_type_string' => 'Previously fetched stickers', 'method_geochats.getLocated' => 'Get nearby geochats', 'method_geochats.getLocated_param_geo_point_type_InputGeoPoint' => 'Current location', 'method_geochats.getLocated_param_radius_type_int' => 'Radius', 'method_geochats.getLocated_param_limit_type_int' => 'Number of results to return', 'method_geochats.getRecents' => 'Get recent geochats', 'method_geochats.getRecents_param_offset_type_int' => 'Offset', 'method_geochats.getRecents_param_limit_type_int' => 'Number of results to return', 'method_geochats.checkin' => 'Join a geochat', 'method_geochats.checkin_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.getFullChat' => 'Get full info about a geochat', 'method_geochats.getFullChat_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.editChatTitle' => 'Edit geochat title', 'method_geochats.editChatTitle_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.editChatTitle_param_title_type_string' => 'The new title', 'method_geochats.editChatTitle_param_address_type_string' => 'The new address', 'method_geochats.editChatPhoto' => 'Edit geochat photo', 'method_geochats.editChatPhoto_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.editChatPhoto_param_photo_type_InputChatPhoto' => 'The new photo', 'method_geochats.search' => 'Search messages in geocha', 'method_geochats.search_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.search_param_q_type_string' => 'The search query', 'method_geochats.search_param_filter_type_MessagesFilter' => 'Search filter', 'method_geochats.search_param_min_date_type_int' => 'Minumum date', 'method_geochats.search_param_max_date_type_int' => 'Maximum date', 'method_geochats.search_param_offset_type_int' => 'Offset', 'method_geochats.search_param_max_id_type_int' => 'Maximum message ID', 'method_geochats.search_param_limit_type_int' => 'Number of results to return', 'method_geochats.getHistory' => 'Get geochat history', 'method_geochats.getHistory_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.getHistory_param_offset_type_int' => 'Offset', 'method_geochats.getHistory_param_max_id_type_int' => 'Maximum message ID', 'method_geochats.getHistory_param_limit_type_int' => 'Number of results to return', 'method_geochats.setTyping' => 'Send typing notification to geochat', 'method_geochats.setTyping_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.setTyping_param_typing_type_Bool' => 'Typing or not typing', 'method_geochats.sendMessage' => 'Send message to geochat', 'method_geochats.sendMessage_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.sendMessage_param_message_type_string' => 'The message', 'method_geochats.sendMedia' => 'Send media to geochat', 'method_geochats.sendMedia_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.sendMedia_param_media_type_InputMedia' => 'The media', 'method_geochats.createGeoChat' => 'Create geochat', 'method_geochats.createGeoChat_param_title_type_string' => 'Geochat title', 'method_geochats.createGeoChat_param_geo_point_type_InputGeoPoint' => 'Geochat location', 'method_geochats.createGeoChat_param_address_type_string' => 'Geochat address', 'method_geochats.createGeoChat_param_venue_type_string' => 'Geochat venue ', 'method_account.setPassword' => 'Set 2FA password', 'method_account.setPassword_param_current_password_hash_type_bytes' => 'Use only if you have set a 2FA password: `$current_salt = $MadelineProto->account->getPassword()[\'current_salt\']; $current_password_hash = hash(\'sha256\', $current_salt.$password.$current_salt, true);`', 'method_account.setPassword_param_new_salt_type_bytes' => 'New salt', 'method_account.setPassword_param_new_password_hash_type_bytes' => '`hash(\'sha256\', $new_salt.$new_password.$new_salt, true)`', 'method_account.setPassword_param_hint_type_string' => 'Hint', 'method_messages.installStickerSet_param_disabled_type_Bool' => 'Disable stickerset?', 'method_messages.startBot_param_chat_id_type_InputPeer' => 'Chat ID', 'method_help.getAppChangelog_param_device_model_type_string' => 'Device model', 'method_help.getAppChangelog_param_system_version_type_string' => 'System version', 'method_help.getAppChangelog_param_app_version_type_string' => 'App version', 'method_help.getAppChangelog_param_lang_code_type_string' => 'Language code', 'method_channels.getDialogs' => 'Get channel dialogs', 'method_channels.getDialogs_param_offset_type_int' => 'Offset', 'method_channels.getDialogs_param_limit_type_int' => 'Number of results to return', 'method_channels.getImportantHistory' => 'Get important channel/supergroup history', 'method_channels.getImportantHistory_param_channel_type_InputChannel' => 'The supergroup/channel', 'method_channels.getImportantHistory_param_offset_id_type_int' => 'Message ID offset', 'method_channels.getImportantHistory_param_add_offset_type_int' => 'Additional offset', 'method_channels.getImportantHistory_param_limit_type_int' => 'Number of results to return', 'method_channels.getImportantHistory_param_max_id_type_int' => 'Maximum message ID', 'method_channels.getImportantHistory_param_min_id_type_int' => 'Minumum message ID', 'method_channels.createChannel_param_users_type_Vector t' => 'Users to add to channel', 'method_channels.editAdmin_param_role_type_ChannelParticipantRole' => 'User role', 'method_channels.toggleComments' => 'Enable channel comments', 'method_channels.toggleComments_param_channel_type_InputChannel' => 'The channel ', 'method_channels.toggleComments_param_enabled_type_Bool' => 'Enable or disable comments', 'method_channels.kickFromChannel' => 'Kick user from channel', 'method_channels.kickFromChannel_param_channel_type_InputChannel' => 'The channel', 'method_channels.kickFromChannel_param_user_id_type_InputUser' => 'The user to kick', 'method_channels.kickFromChannel_param_kicked_type_Bool' => 'Kick or unkick?', 'method_messages.getChannelDialogs' => 'Get channel/supergruop dialogs', 'method_messages.getChannelDialogs_param_offset_type_int' => 'Offset', 'method_messages.getChannelDialogs_param_limit_type_int' => 'Number of results to return', 'method_messages.getImportantHistory' => 'Get important message history', 'method_messages.getImportantHistory_param_peer_type_InputPeer' => 'Peer', 'method_messages.getImportantHistory_param_max_id_type_int' => 'Maximum message ID to fetch', 'method_messages.getImportantHistory_param_min_id_type_int' => 'Minumum message ID to fetch', 'method_messages.getImportantHistory_param_limit_type_int' => 'Number of results to fetch', 'method_messages.readChannelHistory' => 'Mark channel/supergroup history as read', 'method_messages.readChannelHistory_param_peer_type_InputPeer' => 'The channel/supergruop', 'method_messages.readChannelHistory_param_max_id_type_int' => 'Maximum message ID to mark as read', 'method_messages.createChannel' => 'Create channel', 'method_messages.createChannel_param_title_type_string' => 'Channel/supergroup title', 'method_messages.deleteChannelMessages' => 'Delete channel messages', 'method_messages.deleteChannelMessages_param_peer_type_InputPeer' => 'The channel/supergroup', 'method_messages.deleteChannelMessages_param_id_type_Vector t' => 'The IDs of messages to delete', 'method_updates.getChannelDifference_param_peer_type_InputPeer' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_messages.search_param_important_only_type_true' => 'Show only important messages', 'method_messages.sendMessage_param_broadcast_type_true' => 'Broadcast this message', 'method_messages.sendMedia_param_broadcast_type_true' => 'Broadcast this message', 'method_messages.forwardMessages_param_broadcast_type_true' => 'Broadcast this message', 'method_messages.deactivateChat' => 'Deactivate chat', 'method_messages.deactivateChat_param_chat_id_type_InputPeer' => 'The chat to deactivate', 'method_messages.deactivateChat_param_enabled_type_Bool' => 'Activate or deactivate?', 'method_help.getTermsOfService_param_lang_code_type_string' => 'Language code', 'method_messages.sendInlineBotResult_param_broadcast_type_true' => 'Broadcast this message?', 'method_channels.getImportantHistory_param_offset_date_type_int' => 'Date offset', 'method_messages.getUnusedStickers' => 'Get unused stickers', 'method_messages.getUnusedStickers_param_limit_type_int' => 'Number of results to return', 'method_destroy_auth_key' => 'Destroy current authorization key', 'method_phone.requestCall_param_g_a_type_bytes' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.acceptCall_param_key_fingerprint_type_long' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_req_DH_params_param_p_type_string' => 'Factorized p from pq', 'method_req_DH_params_param_q_type_string' => 'Factorized q from pq', 'method_req_DH_params_param_encrypted_data_type_string' => 'Encrypted message', 'method_set_client_DH_params_param_encrypted_data_type_string' => 'Encrypted message', 'method_contest.saveDeveloperInfo' => 'Save developer info for telegram contest', 'method_contest.saveDeveloperInfo_param_vk_id_type_int' => 'VK user ID', 'method_contest.saveDeveloperInfo_param_name_type_string' => 'Name', 'method_contest.saveDeveloperInfo_param_phone_number_type_string' => 'Phone number', 'method_contest.saveDeveloperInfo_param_age_type_int' => 'Age', 'method_contest.saveDeveloperInfo_param_city_type_string' => 'City', 'method_auth.importBotAuthorization_param_a_type_true' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.importBotAuthorization_param_b_type_true' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.importBotAuthorization_param_c_type_true' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.importBotAuthorization_param_d_type_true' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'object_vector' => 'Array', 'object_resPQ' => 'Contains pq to factorize', 'object_resPQ_param_nonce_type_int128' => 'Nonce', 'object_resPQ_param_server_nonce_type_int128' => 'Server nonce', 'object_resPQ_param_pq_type_bytes' => 'PQ ', 'object_resPQ_param_server_public_key_fingerprints_type_Vector t' => 'RSA key fingerprints', 'object_p_q_inner_data' => 'PQ inner data', 'object_p_q_inner_data_param_pq_type_bytes' => 'PQ', 'object_p_q_inner_data_param_p_type_bytes' => 'P', 'object_p_q_inner_data_param_q_type_bytes' => 'Q', 'object_p_q_inner_data_param_nonce_type_int128' => 'Nonce', 'object_p_q_inner_data_param_server_nonce_type_int128' => 'Nonce', 'object_p_q_inner_data_param_new_nonce_type_int256' => 'Nonce', 'object_p_q_inner_data_temp' => 'Inner data temp', 'object_p_q_inner_data_temp_param_pq_type_bytes' => 'Pq', 'object_p_q_inner_data_temp_param_p_type_bytes' => 'P', 'object_p_q_inner_data_temp_param_q_type_bytes' => 'Q', 'object_p_q_inner_data_temp_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_p_q_inner_data_temp_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_p_q_inner_data_temp_param_new_nonce_type_int256' => 'New nonce', 'object_p_q_inner_data_temp_param_expires_in_type_int' => 'Expires in', 'object_server_DH_params_fail' => 'Server params fail', 'object_server_DH_params_fail_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_server_DH_params_fail_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_server_DH_params_fail_param_new_nonce_hash_type_int128' => 'New nonce hash', 'object_server_DH_params_ok' => 'Server params ok', 'object_server_DH_params_ok_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_server_DH_params_ok_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_server_DH_params_ok_param_encrypted_answer_type_bytes' => 'Encrypted answer', 'object_server_DH_inner_data' => 'Server inner data', 'object_server_DH_inner_data_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_server_DH_inner_data_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_server_DH_inner_data_param_g_type_int' => 'G', 'object_server_DH_inner_data_param_dh_prime_type_bytes' => 'Dh prime', 'object_server_DH_inner_data_param_g_a_type_bytes' => 'G a', 'object_server_DH_inner_data_param_server_time_type_int' => 'Server time', 'object_client_DH_inner_data' => 'Client inner data', 'object_client_DH_inner_data_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_client_DH_inner_data_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_client_DH_inner_data_param_retry_id_type_long' => 'Retry ID', 'object_client_DH_inner_data_param_g_b_type_bytes' => 'G b', 'object_dh_gen_ok' => 'Dh gen ok', 'object_dh_gen_ok_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_dh_gen_ok_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_dh_gen_ok_param_new_nonce_hash1_type_int128' => 'New nonce hash1', 'object_dh_gen_retry' => 'Dh gen retry', 'object_dh_gen_retry_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_dh_gen_retry_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_dh_gen_retry_param_new_nonce_hash2_type_int128' => 'New nonce hash2', 'object_dh_gen_fail' => 'Dh gen fail', 'object_dh_gen_fail_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_dh_gen_fail_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_dh_gen_fail_param_new_nonce_hash3_type_int128' => 'New nonce hash3', 'object_rpc_result' => 'Rpc result', 'object_rpc_result_param_req_msg_id_type_long' => 'Req msg ID', 'object_rpc_result_param_result_type_Object' => 'Result', 'object_rpc_error' => 'Rpc error', 'object_rpc_error_param_error_code_type_int' => 'Error code', 'object_rpc_error_param_error_message_type_string' => 'Error message', 'object_rpc_answer_unknown' => 'Rpc answer unknown', 'object_rpc_answer_dropped_running' => 'Rpc answer dropped running', 'object_rpc_answer_dropped' => 'Rpc answer dropped', 'object_rpc_answer_dropped_param_msg_id_type_long' => 'Msg ID', 'object_rpc_answer_dropped_param_seq_no_type_int' => 'Seq no', 'object_rpc_answer_dropped_param_bytes_type_int' => 'Bytes', 'object_future_salt' => 'Future salt', 'object_future_salt_param_valid_since_type_int' => 'Valid since', 'object_future_salt_param_valid_until_type_int' => 'Valid until', 'object_future_salt_param_salt_type_long' => 'Salt', 'object_future_salts' => 'Future salts', 'object_future_salts_param_req_msg_id_type_long' => 'Req msg ID', 'object_future_salts_param_now_type_int' => 'Now', 'object_future_salts_param_salts_type_vector' => 'Salts', 'object_pong' => 'Pong', 'object_pong_param_msg_id_type_long' => 'Msg ID', 'object_pong_param_ping_id_type_long' => 'Ping ID', 'object_destroy_session_ok' => 'Destroy session ok', 'object_destroy_session_ok_param_session_id_type_long' => 'Session ID', 'object_destroy_session_none' => 'Destroy session none', 'object_destroy_session_none_param_session_id_type_long' => 'Session ID', 'object_new_session_created' => 'New session created', 'object_new_session_created_param_first_msg_id_type_long' => 'First msg ID', 'object_new_session_created_param_unique_id_type_long' => 'Unique ID', 'object_new_session_created_param_server_salt_type_long' => 'Server salt', 'object_msg_container' => 'Msg container', 'object_msg_container_param_messages_type_vector' => 'Messages', 'object_MTmessage' => 'MTProto message', 'object_MTmessage_param_msg_id_type_long' => 'Message ID', 'object_MTmessage_param_seqno_type_int' => 'Seqno', 'object_MTmessage_param_bytes_type_int' => 'Message body', 'object_MTmessage_param_body_type_Object' => 'Message body', 'object_msg_copy' => 'Msg copy', 'object_msg_copy_param_orig_message_type_MTMessage' => 'Orig message', 'object_gzip_packed' => 'Gzip packed', 'object_gzip_packed_param_packed_data_type_bytes' => 'Packed data', 'object_msgs_ack' => 'Msgs ack', 'object_msgs_ack_param_msg_ids_type_Vector t' => 'Msg IDs', 'object_bad_msg_notification' => 'Bad msg notification', 'object_bad_msg_notification_param_bad_msg_id_type_long' => 'Bad msg ID', 'object_bad_msg_notification_param_bad_msg_seqno_type_int' => 'Bad msg seqno', 'object_bad_msg_notification_param_error_code_type_int' => 'Error code', 'object_bad_server_salt' => 'Bad server salt', 'object_bad_server_salt_param_bad_msg_id_type_long' => 'Bad msg ID', 'object_bad_server_salt_param_bad_msg_seqno_type_int' => 'Bad msg seqno', 'object_bad_server_salt_param_error_code_type_int' => 'Error code', 'object_bad_server_salt_param_new_server_salt_type_long' => 'New server salt', 'object_msg_resend_req' => 'Msg resend req', 'object_msg_resend_req_param_msg_ids_type_Vector t' => 'Msg IDs', 'object_msgs_state_req' => 'Msgs state req', 'object_msgs_state_req_param_msg_ids_type_Vector t' => 'Msg IDs', 'object_msgs_state_info' => 'Msgs state info', 'object_msgs_state_info_param_req_msg_id_type_long' => 'Req msg ID', 'object_msgs_state_info_param_info_type_bytes' => 'Info', 'object_msgs_all_info' => 'Msgs all info', 'object_msgs_all_info_param_msg_ids_type_Vector t' => 'Msg IDs', 'object_msgs_all_info_param_info_type_bytes' => 'Info', 'object_msg_detailed_info' => 'Msg detailed info', 'object_msg_detailed_info_param_msg_id_type_long' => 'Msg ID', 'object_msg_detailed_info_param_answer_msg_id_type_long' => 'Answer msg ID', 'object_msg_detailed_info_param_bytes_type_int' => 'Bytes', 'object_msg_detailed_info_param_status_type_int' => 'Status', 'object_msg_new_detailed_info' => 'Msg new detailed info', 'object_msg_new_detailed_info_param_answer_msg_id_type_long' => 'Answer msg ID', 'object_msg_new_detailed_info_param_bytes_type_int' => 'Bytes', 'object_msg_new_detailed_info_param_status_type_int' => 'Status', 'object_bind_auth_key_inner' => 'Bind auth key inner', 'object_bind_auth_key_inner_param_nonce_type_long' => 'Nonce', 'object_bind_auth_key_inner_param_temp_auth_key_id_type_long' => 'Temp auth key ID', 'object_bind_auth_key_inner_param_perm_auth_key_id_type_long' => 'Perm auth key ID', 'object_bind_auth_key_inner_param_temp_session_id_type_long' => 'Temp session ID', 'object_bind_auth_key_inner_param_expires_at_type_int' => 'Expires at', 'object_boolFalse' => 'Bool false', 'object_boolTrue' => 'Bool true', 'object_true' => 'True', 'object_error' => 'Error', 'object_error_param_code_type_int' => 'Code', 'object_error_param_text_type_string' => 'Text', 'object_null' => 'Null', 'object_inputPeerEmpty' => 'Empty input peer', 'object_inputPeerSelf' => 'Peer self', 'object_inputPeerChat' => 'Peer chat', 'object_inputPeerChat_param_chat_id_type_int' => 'Chat ID', 'object_inputPeerUser' => 'Peer user', 'object_inputPeerUser_param_user_id_type_int' => 'User ID', 'object_inputPeerUser_param_access_hash_type_long' => 'Access hash', 'object_inputPeerChannel' => 'Peer channel', 'object_inputPeerChannel_param_channel_id_type_int' => 'Channel ID', 'object_inputPeerChannel_param_access_hash_type_long' => 'Access hash', 'object_inputUserEmpty' => 'Empty input user', 'object_inputUserSelf' => 'User self', 'object_inputUser' => 'User', 'object_inputUser_param_user_id_type_int' => 'User ID', 'object_inputUser_param_access_hash_type_long' => 'Access hash', 'object_inputPhoneContact' => 'Phone contact', 'object_inputPhoneContact_param_client_id_type_long' => 'Client ID', 'object_inputPhoneContact_param_phone_type_string' => 'Phone', 'object_inputPhoneContact_param_first_name_type_string' => 'First name', 'object_inputPhoneContact_param_last_name_type_string' => 'Last name', 'object_inputFile' => 'File', 'object_inputFile_param_id_type_long' => 'ID', 'object_inputFile_param_parts_type_int' => 'Parts', 'object_inputFile_param_name_type_string' => 'Name', 'object_inputFile_param_md5_checksum_type_string' => 'Md5 checksum', 'object_inputFileBig' => 'File big', 'object_inputFileBig_param_id_type_long' => 'ID', 'object_inputFileBig_param_parts_type_int' => 'Parts', 'object_inputFileBig_param_name_type_string' => 'Name', 'object_inputMediaEmpty' => 'Empty input media', 'object_inputMediaUploadedPhoto' => 'Media uploaded photo', 'object_inputMediaUploadedPhoto_param_file_type_InputFile' => 'File', 'object_inputMediaUploadedPhoto_param_stickers_type_Vector t' => 'Stickers', 'object_inputMediaUploadedPhoto_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_inputMediaPhoto' => 'Media photo', 'object_inputMediaPhoto_param_id_type_InputPhoto' => 'ID', 'object_inputMediaPhoto_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_inputMediaGeoPoint' => 'Media geo point', 'object_inputMediaGeoPoint_param_geo_point_type_InputGeoPoint' => 'Geo point', 'object_inputMediaContact' => 'Media contact', 'object_inputMediaContact_param_phone_number_type_string' => 'Phone number', 'object_inputMediaContact_param_first_name_type_string' => 'First name', 'object_inputMediaContact_param_last_name_type_string' => 'Last name', 'object_inputMediaUploadedDocument' => 'Media uploaded document', 'object_inputMediaUploadedDocument_param_nosound_video_type_true' => 'Nosound video?', 'object_inputMediaUploadedDocument_param_file_type_InputFile' => 'File', 'object_inputMediaUploadedDocument_param_thumb_type_InputFile' => 'Thumbnail', 'object_inputMediaUploadedDocument_param_mime_type_type_string' => 'Mime type', 'object_inputMediaUploadedDocument_param_attributes_type_Vector t' => 'Attributes', 'object_inputMediaUploadedDocument_param_stickers_type_Vector t' => 'Stickers', 'object_inputMediaUploadedDocument_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_inputMediaDocument' => 'Media document', 'object_inputMediaDocument_param_id_type_InputDocument' => 'ID', 'object_inputMediaDocument_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_inputMediaVenue' => 'Media venue', 'object_inputMediaVenue_param_geo_point_type_InputGeoPoint' => 'Geo point', 'object_inputMediaVenue_param_title_type_string' => 'Title', 'object_inputMediaVenue_param_address_type_string' => 'Address', 'object_inputMediaVenue_param_provider_type_string' => 'Provider', 'object_inputMediaVenue_param_venue_id_type_string' => 'Venue ID', 'object_inputMediaVenue_param_venue_type_type_string' => 'Venue type', 'object_inputMediaGifExternal' => 'Media gif external', 'object_inputMediaGifExternal_param_url_type_string' => 'URL', 'object_inputMediaGifExternal_param_q_type_string' => 'Q', 'object_inputMediaPhotoExternal' => 'Media photo external', 'object_inputMediaPhotoExternal_param_url_type_string' => 'URL', 'object_inputMediaPhotoExternal_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_inputMediaDocumentExternal' => 'Media document external', 'object_inputMediaDocumentExternal_param_url_type_string' => 'URL', 'object_inputMediaDocumentExternal_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_inputMediaGame' => 'Media game', 'object_inputMediaGame_param_id_type_InputGame' => 'ID', 'object_inputMediaInvoice' => 'Media invoice', 'object_inputMediaInvoice_param_title_type_string' => 'Title', 'object_inputMediaInvoice_param_description_type_string' => 'Description', 'object_inputMediaInvoice_param_photo_type_InputWebDocument' => 'Photo', 'object_inputMediaInvoice_param_invoice_type_Invoice' => 'Invoice', 'object_inputMediaInvoice_param_payload_type_bytes' => 'Payload', 'object_inputMediaInvoice_param_provider_type_string' => 'Provider', 'object_inputMediaInvoice_param_provider_data_type_DataJSON' => 'Provider data', 'object_inputMediaInvoice_param_start_param_type_string' => 'Start param', 'object_inputMediaGeoLive' => 'Media geo live', 'object_inputMediaGeoLive_param_geo_point_type_InputGeoPoint' => 'Geo point', 'object_inputMediaGeoLive_param_period_type_int' => 'Period', 'object_inputChatPhotoEmpty' => 'Empty input chat photo', 'object_inputChatUploadedPhoto' => 'Chat uploaded photo', 'object_inputChatUploadedPhoto_param_file_type_InputFile' => 'File', 'object_inputChatPhoto' => 'Chat photo', 'object_inputChatPhoto_param_id_type_InputPhoto' => 'ID', 'object_inputGeoPointEmpty' => 'Empty input geo point', 'object_inputGeoPoint' => 'Geo point', 'object_inputGeoPoint_param_lat_type_double' => 'Lat', 'object_inputGeoPoint_param_long_type_double' => 'Long', 'object_inputPhotoEmpty' => 'Empty input photo', 'object_inputPhoto' => 'Photo', 'object_inputPhoto_param_id_type_long' => 'ID', 'object_inputPhoto_param_access_hash_type_long' => 'Access hash', 'object_inputFileLocation' => 'File location', 'object_inputFileLocation_param_volume_id_type_long' => 'Volume ID', 'object_inputFileLocation_param_local_id_type_int' => 'Local ID', 'object_inputFileLocation_param_secret_type_long' => 'Secret', 'object_inputEncryptedFileLocation' => 'Encrypted file location', 'object_inputEncryptedFileLocation_param_id_type_long' => 'ID', 'object_inputEncryptedFileLocation_param_access_hash_type_long' => 'Access hash', 'object_inputDocumentFileLocation' => 'Document file location', 'object_inputDocumentFileLocation_param_id_type_long' => 'ID', 'object_inputDocumentFileLocation_param_access_hash_type_long' => 'Access hash', 'object_inputDocumentFileLocation_param_version_type_int' => 'Version', 'object_inputAppEvent' => 'App event', 'object_inputAppEvent_param_time_type_double' => 'Time', 'object_inputAppEvent_param_type_type_string' => 'Type', 'object_inputAppEvent_param_peer_type_long' => 'Peer', 'object_inputAppEvent_param_data_type_string' => 'Data', 'object_peerUser' => 'Peer user', 'object_peerUser_param_user_id_type_int' => 'User ID', 'object_peerChat' => 'Peer chat', 'object_peerChat_param_chat_id_type_int' => 'Chat ID', 'object_peerChannel' => 'Peer channel', 'object_peerChannel_param_channel_id_type_int' => 'Channel ID', 'object_storage.fileUnknown' => 'File unknown', 'object_storage.filePartial' => 'File partial', 'object_storage.fileJpeg' => 'File jpeg', 'object_storage.fileGif' => 'File gif', 'object_storage.filePng' => 'File png', 'object_storage.filePdf' => 'File pdf', 'object_storage.fileMp3' => 'File mp3', 'object_storage.fileMov' => 'File mov', 'object_storage.fileMp4' => 'File mp4', 'object_storage.fileWebp' => 'File webp', 'object_fileLocationUnavailable' => 'File location unavailable', 'object_fileLocationUnavailable_param_volume_id_type_long' => 'Volume ID', 'object_fileLocationUnavailable_param_local_id_type_int' => 'Local ID', 'object_fileLocationUnavailable_param_secret_type_long' => 'Secret', 'object_fileLocation' => 'File location', 'object_fileLocation_param_dc_id_type_int' => 'DC ID', 'object_fileLocation_param_volume_id_type_long' => 'Volume ID', 'object_fileLocation_param_local_id_type_int' => 'Local ID', 'object_fileLocation_param_secret_type_long' => 'Secret', 'object_userEmpty' => 'Empty user', 'object_userEmpty_param_id_type_int' => 'ID', 'object_user' => 'User', 'object_user_param_self_type_true' => 'Self?', 'object_user_param_contact_type_true' => 'Contact?', 'object_user_param_mutual_contact_type_true' => 'Mutual contact?', 'object_user_param_deleted_type_true' => 'Deleted?', 'object_user_param_bot_type_true' => 'Bot?', 'object_user_param_bot_chat_history_type_true' => 'Bot chat history?', 'object_user_param_bot_nochats_type_true' => 'Bot nochats?', 'object_user_param_verified_type_true' => 'Verified?', 'object_user_param_restricted_type_true' => 'Restricted?', 'object_user_param_min_type_true' => 'Min?', 'object_user_param_bot_inline_geo_type_true' => 'Bot inline geo?', 'object_user_param_id_type_int' => 'ID', 'object_user_param_access_hash_type_long' => 'Access hash', 'object_user_param_first_name_type_string' => 'First name', 'object_user_param_last_name_type_string' => 'Last name', 'object_user_param_username_type_string' => 'Username', 'object_user_param_phone_type_string' => 'Phone', 'object_user_param_photo_type_UserProfilePhoto' => 'Photo', 'object_user_param_status_type_UserStatus' => 'Status', 'object_user_param_bot_info_version_type_int' => 'Bot info version', 'object_user_param_restriction_reason_type_string' => 'Restriction reason', 'object_user_param_bot_inline_placeholder_type_string' => 'Bot inline placeholder', 'object_user_param_lang_code_type_string' => 'Lang code', 'object_userProfilePhotoEmpty' => 'Empty user profile photo', 'object_userProfilePhoto' => 'User profile photo', 'object_userProfilePhoto_param_photo_id_type_long' => 'Photo ID', 'object_userProfilePhoto_param_photo_small_type_FileLocation' => 'Photo small', 'object_userProfilePhoto_param_photo_big_type_FileLocation' => 'Photo big', 'object_chatEmpty' => 'Empty chat', 'object_chatEmpty_param_id_type_int' => 'ID', 'object_chat' => 'Chat', 'object_chat_param_creator_type_true' => 'Creator?', 'object_chat_param_kicked_type_true' => 'Kicked?', 'object_chat_param_left_type_true' => 'Left?', 'object_chat_param_admins_enabled_type_true' => 'Admins enabled?', 'object_chat_param_admin_type_true' => 'Admin?', 'object_chat_param_deactivated_type_true' => 'Deactivated?', 'object_chat_param_id_type_int' => 'ID', 'object_chat_param_title_type_string' => 'Title', 'object_chat_param_photo_type_ChatPhoto' => 'Photo', 'object_chat_param_participants_count_type_int' => 'Participants count', 'object_chat_param_date_type_int' => 'Date', 'object_chat_param_version_type_int' => 'Version', 'object_chat_param_migrated_to_type_InputChannel' => 'Migrated to', 'object_chatForbidden' => 'Chat forbidden', 'object_chatForbidden_param_id_type_int' => 'ID', 'object_chatForbidden_param_title_type_string' => 'Title', 'object_channel' => 'Channel', 'object_channel_param_creator_type_true' => 'Creator?', 'object_channel_param_left_type_true' => 'Left?', 'object_channel_param_editor_type_true' => 'Editor?', 'object_channel_param_broadcast_type_true' => 'Broadcast?', 'object_channel_param_verified_type_true' => 'Verified?', 'object_channel_param_megagroup_type_true' => 'Megagroup?', 'object_channel_param_restricted_type_true' => 'Restricted?', 'object_channel_param_democracy_type_true' => 'Democracy?', 'object_channel_param_signatures_type_true' => 'Signatures?', 'object_channel_param_min_type_true' => 'Min?', 'object_channel_param_id_type_int' => 'ID', 'object_channel_param_access_hash_type_long' => 'Access hash', 'object_channel_param_title_type_string' => 'Title', 'object_channel_param_username_type_string' => 'Username', 'object_channel_param_photo_type_ChatPhoto' => 'Photo', 'object_channel_param_date_type_int' => 'Date', 'object_channel_param_version_type_int' => 'Version', 'object_channel_param_restriction_reason_type_string' => 'Restriction reason', 'object_channel_param_admin_rights_type_ChannelAdminRights' => 'Admin rights', 'object_channel_param_banned_rights_type_ChannelBannedRights' => 'Banned rights', 'object_channel_param_participants_count_type_int' => 'Participants count', 'object_channelForbidden' => 'Forbidden channel', 'object_channelForbidden_param_broadcast_type_true' => 'Broadcast?', 'object_channelForbidden_param_megagroup_type_true' => 'Megagroup?', 'object_channelForbidden_param_id_type_int' => 'ID', 'object_channelForbidden_param_access_hash_type_long' => 'Access hash', 'object_channelForbidden_param_title_type_string' => 'Title', 'object_channelForbidden_param_until_date_type_int' => 'Until date', 'object_chatFull' => 'Chat full', 'object_chatFull_param_id_type_int' => 'ID', 'object_chatFull_param_participants_type_ChatParticipants' => 'Participants', 'object_chatFull_param_chat_photo_type_Photo' => 'Chat photo', 'object_chatFull_param_notify_settings_type_PeerNotifySettings' => 'Notify settings', 'object_chatFull_param_exported_invite_type_ExportedChatInvite' => 'Exported invite', 'object_chatFull_param_bot_info_type_Vector t' => 'Bot info', 'object_channelFull' => 'Full channel', 'object_channelFull_param_can_view_participants_type_true' => 'Can view participants?', 'object_channelFull_param_can_set_username_type_true' => 'Can set username?', 'object_channelFull_param_can_set_stickers_type_true' => 'Can set group stickerset?', 'object_channelFull_param_hidden_prehistory_type_true' => 'Hidden prehistory?', 'object_channelFull_param_id_type_int' => 'ID', 'object_channelFull_param_about_type_string' => 'About', 'object_channelFull_param_participants_count_type_int' => 'Participants count', 'object_channelFull_param_admins_count_type_int' => 'Admins count', 'object_channelFull_param_kicked_count_type_int' => 'Kicked count', 'object_channelFull_param_banned_count_type_int' => 'Banned count', 'object_channelFull_param_read_inbox_max_id_type_int' => 'Read inbox max ID', 'object_channelFull_param_read_outbox_max_id_type_int' => 'Read outbox max ID', 'object_channelFull_param_unread_count_type_int' => 'Unread count', 'object_channelFull_param_chat_photo_type_Photo' => 'Chat photo', 'object_channelFull_param_notify_settings_type_PeerNotifySettings' => 'Notify settings', 'object_channelFull_param_exported_invite_type_ExportedChatInvite' => 'Exported invite', 'object_channelFull_param_bot_info_type_Vector t' => 'Bot info', 'object_channelFull_param_migrated_from_chat_id_type_int' => 'Migrated from chat ID', 'object_channelFull_param_migrated_from_max_id_type_int' => 'Migrated from max ID', 'object_channelFull_param_pinned_msg_id_type_int' => 'Pinned msg ID', 'object_channelFull_param_stickerset_type_StickerSet' => 'Stickerset', 'object_channelFull_param_available_min_id_type_int' => 'Available min ID', 'object_chatParticipant' => 'Chat participant', 'object_chatParticipant_param_user_id_type_int' => 'User ID', 'object_chatParticipant_param_inviter_id_type_int' => 'Inviter ID', 'object_chatParticipant_param_date_type_int' => 'Date', 'object_chatParticipantCreator' => 'Chat participant creator', 'object_chatParticipantCreator_param_user_id_type_int' => 'User ID', 'object_chatParticipantAdmin' => 'Chat participant admin', 'object_chatParticipantAdmin_param_user_id_type_int' => 'User ID', 'object_chatParticipantAdmin_param_inviter_id_type_int' => 'Inviter ID', 'object_chatParticipantAdmin_param_date_type_int' => 'Date', 'object_chatParticipantsForbidden' => 'Chat participants forbidden', 'object_chatParticipantsForbidden_param_chat_id_type_int' => 'Chat ID', 'object_chatParticipantsForbidden_param_self_participant_type_ChatParticipant' => 'Self participant', 'object_chatParticipants' => 'Chat participants', 'object_chatParticipants_param_chat_id_type_int' => 'Chat ID', 'object_chatParticipants_param_participants_type_Vector t' => 'Participants', 'object_chatParticipants_param_version_type_int' => 'Version', 'object_chatPhotoEmpty' => 'Empty chat photo', 'object_chatPhoto' => 'Chat photo', 'object_chatPhoto_param_photo_small_type_FileLocation' => 'Photo small', 'object_chatPhoto_param_photo_big_type_FileLocation' => 'Photo big', 'object_messageEmpty' => 'Empty message', 'object_messageEmpty_param_id_type_int' => 'ID', 'object_message' => 'Message', 'object_message_param_out_type_true' => 'Out?', 'object_message_param_mentioned_type_true' => 'Mentioned?', 'object_message_param_media_unread_type_true' => 'Media unread?', 'object_message_param_silent_type_true' => 'Silent?', 'object_message_param_post_type_true' => 'Post?', 'object_message_param_id_type_int' => 'ID', 'object_message_param_from_id_type_int' => 'From ID', 'object_message_param_to_id_type_Peer' => 'To ID', 'object_message_param_fwd_from_type_MessageFwdHeader' => 'Forwarded from', 'object_message_param_via_bot_id_type_int' => 'Via bot ID', 'object_message_param_reply_to_msg_id_type_int' => 'Reply to msg ID', 'object_message_param_date_type_int' => 'Date', 'object_message_param_message_type_string' => 'Message', 'object_message_param_media_type_MessageMedia' => 'Media', 'object_message_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_message_param_entities_type_Vector t' => 'Entities', 'object_message_param_views_type_int' => 'Views', 'object_message_param_edit_date_type_int' => 'Edit date', 'object_message_param_post_author_type_string' => 'Post author', 'object_message_param_grouped_id_type_long' => 'Grouped ID', 'object_messageService' => 'Message service', 'object_messageService_param_out_type_true' => 'Out?', 'object_messageService_param_mentioned_type_true' => 'Mentioned?', 'object_messageService_param_media_unread_type_true' => 'Media unread?', 'object_messageService_param_silent_type_true' => 'Silent?', 'object_messageService_param_post_type_true' => 'Post?', 'object_messageService_param_id_type_int' => 'ID', 'object_messageService_param_from_id_type_int' => 'From ID', 'object_messageService_param_to_id_type_Peer' => 'To ID', 'object_messageService_param_reply_to_msg_id_type_int' => 'Reply to msg ID', 'object_messageService_param_date_type_int' => 'Date', 'object_messageService_param_action_type_MessageAction' => 'Action', 'object_messageMediaEmpty' => 'Empty message media', 'object_messageMediaPhoto' => 'Message media photo', 'object_messageMediaPhoto_param_photo_type_Photo' => 'Photo', 'object_messageMediaPhoto_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_messageMediaGeo' => 'Message media geo', 'object_messageMediaGeo_param_geo_type_GeoPoint' => 'Geo', 'object_messageMediaContact' => 'Message media contact', 'object_messageMediaContact_param_phone_number_type_string' => 'Phone number', 'object_messageMediaContact_param_first_name_type_string' => 'First name', 'object_messageMediaContact_param_last_name_type_string' => 'Last name', 'object_messageMediaContact_param_user_id_type_int' => 'User ID', 'object_messageMediaUnsupported' => 'Message media unsupported', 'object_messageMediaDocument' => 'Message media document', 'object_messageMediaDocument_param_document_type_Document' => 'Document', 'object_messageMediaDocument_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_messageMediaWebPage' => 'Message media web page', 'object_messageMediaWebPage_param_webpage_type_WebPage' => 'Webpage', 'object_messageMediaVenue' => 'Message media venue', 'object_messageMediaVenue_param_geo_type_GeoPoint' => 'Geo', 'object_messageMediaVenue_param_title_type_string' => 'Title', 'object_messageMediaVenue_param_address_type_string' => 'Address', 'object_messageMediaVenue_param_provider_type_string' => 'Provider', 'object_messageMediaVenue_param_venue_id_type_string' => 'Venue ID', 'object_messageMediaVenue_param_venue_type_type_string' => 'Venue type', 'object_messageMediaGame' => 'Message media game', 'object_messageMediaGame_param_game_type_Game' => 'Game', 'object_messageMediaInvoice' => 'Message media invoice', 'object_messageMediaInvoice_param_shipping_address_requested_type_true' => 'Shipping address requested?', 'object_messageMediaInvoice_param_test_type_true' => 'Test?', 'object_messageMediaInvoice_param_title_type_string' => 'Title', 'object_messageMediaInvoice_param_description_type_string' => 'Description', 'object_messageMediaInvoice_param_photo_type_WebDocument' => 'Photo', 'object_messageMediaInvoice_param_receipt_msg_id_type_int' => 'Receipt msg ID', 'object_messageMediaInvoice_param_currency_type_string' => 'Currency', 'object_messageMediaInvoice_param_total_amount_type_long' => 'Total amount', 'object_messageMediaInvoice_param_start_param_type_string' => 'Start param', 'object_messageMediaGeoLive' => 'Message media geo live', 'object_messageMediaGeoLive_param_geo_type_GeoPoint' => 'Geo', 'object_messageMediaGeoLive_param_period_type_int' => 'Period', 'object_messageActionEmpty' => 'Empty message action', 'object_messageActionChatCreate' => 'Message action chat create', 'object_messageActionChatCreate_param_title_type_string' => 'Title', 'object_messageActionChatCreate_param_users_type_Vector t' => 'Users', 'object_messageActionChatEditTitle' => 'Message action chat edit title', 'object_messageActionChatEditTitle_param_title_type_string' => 'Title', 'object_messageActionChatEditPhoto' => 'Message action chat edit photo', 'object_messageActionChatEditPhoto_param_photo_type_Photo' => 'Photo', 'object_messageActionChatDeletePhoto' => 'Message action chat delete photo', 'object_messageActionChatAddUser' => 'Message action chat add user', 'object_messageActionChatAddUser_param_users_type_Vector t' => 'Users', 'object_messageActionChatDeleteUser' => 'Message action chat delete user', 'object_messageActionChatDeleteUser_param_user_id_type_int' => 'User ID', 'object_messageActionChatJoinedByLink' => 'Message action chat joined by link', 'object_messageActionChatJoinedByLink_param_inviter_id_type_int' => 'Inviter ID', 'object_messageActionChannelCreate' => 'Message action channel create', 'object_messageActionChannelCreate_param_title_type_string' => 'Title', 'object_messageActionChatMigrateTo' => 'Message action chat migrate to', 'object_messageActionChatMigrateTo_param_channel_id_type_int' => 'Channel ID', 'object_messageActionChannelMigrateFrom' => 'Message action channel migrate from', 'object_messageActionChannelMigrateFrom_param_title_type_string' => 'Title', 'object_messageActionChannelMigrateFrom_param_chat_id_type_int' => 'Chat ID', 'object_messageActionPinMessage' => 'Message action pin message', 'object_messageActionHistoryClear' => 'Message action history clear', 'object_messageActionGameScore' => 'Message action game score', 'object_messageActionGameScore_param_game_id_type_long' => 'Game ID', 'object_messageActionGameScore_param_score_type_int' => 'Score', 'object_messageActionPaymentSentMe' => 'Message action payment sent me', 'object_messageActionPaymentSentMe_param_currency_type_string' => 'Currency', 'object_messageActionPaymentSentMe_param_total_amount_type_long' => 'Total amount', 'object_messageActionPaymentSentMe_param_payload_type_bytes' => 'Payload', 'object_messageActionPaymentSentMe_param_info_type_PaymentRequestedInfo' => 'Info', 'object_messageActionPaymentSentMe_param_shipping_option_id_type_string' => 'Shipping option ID', 'object_messageActionPaymentSentMe_param_charge_type_PaymentCharge' => 'Charge', 'object_messageActionPaymentSent' => 'Message action payment sent', 'object_messageActionPaymentSent_param_currency_type_string' => 'Currency', 'object_messageActionPaymentSent_param_total_amount_type_long' => 'Total amount', 'object_messageActionPhoneCall' => 'Message action phone call', 'object_messageActionPhoneCall_param_call_id_type_long' => 'Call ID', 'object_messageActionPhoneCall_param_reason_type_PhoneCallDiscardReason' => 'Reason', 'object_messageActionPhoneCall_param_duration_type_int' => 'Duration', 'object_messageActionScreenshotTaken' => 'Message action screenshot taken', 'object_messageActionCustomAction' => 'Message action custom action', 'object_messageActionCustomAction_param_message_type_string' => 'Message', 'object_dialog' => 'Dialog', 'object_dialog_param_pinned_type_true' => 'Pinned?', 'object_dialog_param_peer_type_Peer' => 'Peer', 'object_dialog_param_top_message_type_int' => 'Top message', 'object_dialog_param_read_inbox_max_id_type_int' => 'Read inbox max ID', 'object_dialog_param_read_outbox_max_id_type_int' => 'Read outbox max ID', 'object_dialog_param_unread_count_type_int' => 'Unread count', 'object_dialog_param_unread_mentions_count_type_int' => 'Unread mentions count', 'object_dialog_param_notify_settings_type_PeerNotifySettings' => 'Notify settings', 'object_dialog_param_pts_type_int' => 'Pts', 'object_dialog_param_draft_type_DraftMessage' => 'Draft', 'object_photoEmpty' => 'Empty photo', 'object_photoEmpty_param_id_type_long' => 'ID', 'object_photo' => 'Photo', 'object_photo_param_has_stickers_type_true' => 'Has stickers?', 'object_photo_param_id_type_long' => 'ID', 'object_photo_param_access_hash_type_long' => 'Access hash', 'object_photo_param_date_type_int' => 'Date', 'object_photo_param_sizes_type_Vector t' => 'Sizes', 'object_photoSizeEmpty' => 'Empty photo size', 'object_photoSizeEmpty_param_type_type_string' => 'Type', 'object_photoSize' => 'Photo size', 'object_photoSize_param_type_type_string' => 'Type', 'object_photoSize_param_location_type_FileLocation' => 'Location', 'object_photoSize_param_w_type_int' => 'Width', 'object_photoSize_param_h_type_int' => 'Height', 'object_photoSize_param_size_type_int' => 'Size', 'object_photoCachedSize' => 'Photo cached size', 'object_photoCachedSize_param_type_type_string' => 'Type', 'object_photoCachedSize_param_location_type_FileLocation' => 'Location', 'object_photoCachedSize_param_w_type_int' => 'Width', 'object_photoCachedSize_param_h_type_int' => 'Height', 'object_photoCachedSize_param_bytes_type_bytes' => 'Bytes', 'object_geoPointEmpty' => 'Empty geo point', 'object_geoPoint' => 'Geo point', 'object_geoPoint_param_long_type_double' => 'Long', 'object_geoPoint_param_lat_type_double' => 'Lat', 'object_auth.checkedPhone' => 'Checked phone', 'object_auth.checkedPhone_param_phone_registered_type_Bool' => 'Phone registered?', 'object_auth.sentCode' => 'Sent code', 'object_auth.sentCode_param_phone_registered_type_true' => 'Phone registered?', 'object_auth.sentCode_param_type_type_auth.SentCodeType' => 'Type', 'object_auth.sentCode_param_phone_code_hash_type_string' => 'Phone code hash', 'object_auth.sentCode_param_next_type_type_auth.CodeType' => 'Next type', 'object_auth.sentCode_param_timeout_type_int' => 'Timeout', 'object_auth.authorization' => 'Authorization', 'object_auth.authorization_param_tmp_sessions_type_int' => 'Temporary sessions', 'object_auth.authorization_param_user_type_User' => 'User', 'object_auth.exportedAuthorization' => 'Exported authorization', 'object_auth.exportedAuthorization_param_id_type_int' => 'ID', 'object_auth.exportedAuthorization_param_bytes_type_bytes' => 'Bytes', 'object_inputNotifyPeer' => 'Notify peer', 'object_inputNotifyPeer_param_peer_type_InputPeer' => 'Peer', 'object_inputNotifyUsers' => 'Notify users', 'object_inputNotifyChats' => 'Notify chats', 'object_inputNotifyAll' => 'Notify all', 'object_inputPeerNotifyEventsEmpty' => 'Empty input peer notify events', 'object_inputPeerNotifyEventsAll' => 'Peer notify events all', 'object_inputPeerNotifySettings' => 'Peer notify settings', 'object_inputPeerNotifySettings_param_show_previews_type_true' => 'Show previews?', 'object_inputPeerNotifySettings_param_silent_type_true' => 'Silent?', 'object_inputPeerNotifySettings_param_mute_until_type_int' => 'Mute until', 'object_inputPeerNotifySettings_param_sound_type_string' => 'Sound', 'object_peerNotifyEventsEmpty' => 'Empty peer notify events', 'object_peerNotifyEventsAll' => 'Peer notify events all', 'object_peerNotifySettingsEmpty' => 'Empty peer notify settings', 'object_peerNotifySettings' => 'Peer notify settings', 'object_peerNotifySettings_param_show_previews_type_true' => 'Show previews?', 'object_peerNotifySettings_param_silent_type_true' => 'Silent?', 'object_peerNotifySettings_param_mute_until_type_int' => 'Mute until', 'object_peerNotifySettings_param_sound_type_string' => 'Sound', 'object_peerSettings' => 'Peer settings', 'object_peerSettings_param_report_spam_type_true' => 'Report spam?', 'object_wallPaper' => 'Wall paper', 'object_wallPaper_param_id_type_int' => 'ID', 'object_wallPaper_param_title_type_string' => 'Title', 'object_wallPaper_param_sizes_type_Vector t' => 'Sizes', 'object_wallPaper_param_color_type_int' => 'Color', 'object_wallPaperSolid' => 'Wall paper solid', 'object_wallPaperSolid_param_id_type_int' => 'ID', 'object_wallPaperSolid_param_title_type_string' => 'Title', 'object_wallPaperSolid_param_bg_color_type_int' => 'Bg color', 'object_wallPaperSolid_param_color_type_int' => 'Color', 'object_inputReportReasonSpam' => 'Report reason spam', 'object_inputReportReasonViolence' => 'Report reason violence', 'object_inputReportReasonPornography' => 'Report reason pornography', 'object_inputReportReasonOther' => 'Report reason other', 'object_inputReportReasonOther_param_text_type_string' => 'Text', 'object_userFull' => 'User full', 'object_userFull_param_blocked_type_true' => 'Blocked?', 'object_userFull_param_phone_calls_available_type_true' => 'Phone calls available?', 'object_userFull_param_phone_calls_private_type_true' => 'Phone calls private?', 'object_userFull_param_user_type_User' => 'User', 'object_userFull_param_about_type_string' => 'About', 'object_userFull_param_link_type_contacts.Link' => 'Link', 'object_userFull_param_profile_photo_type_Photo' => 'Profile photo', 'object_userFull_param_notify_settings_type_PeerNotifySettings' => 'Notify settings', 'object_userFull_param_bot_info_type_BotInfo' => 'Bot info', 'object_userFull_param_common_chats_count_type_int' => 'Common chats count', 'object_contact' => 'Contact', 'object_contact_param_user_id_type_int' => 'User ID', 'object_contact_param_mutual_type_Bool' => 'Mutual?', 'object_importedContact' => 'Imported contact', 'object_importedContact_param_user_id_type_int' => 'User ID', 'object_importedContact_param_client_id_type_long' => 'Client ID', 'object_contactBlocked' => 'Contact blocked', 'object_contactBlocked_param_user_id_type_int' => 'User ID', 'object_contactBlocked_param_date_type_int' => 'Date', 'object_contactStatus' => 'Contact status', 'object_contactStatus_param_user_id_type_int' => 'User ID', 'object_contactStatus_param_status_type_UserStatus' => 'Status', 'object_contacts.link' => 'Link', 'object_contacts.link_param_my_link_type_ContactLink' => 'My link', 'object_contacts.link_param_foreign_link_type_ContactLink' => 'Foreign link', 'object_contacts.link_param_user_type_User' => 'User', 'object_contacts.contactsNotModified' => 'Contacts not modified', 'object_contacts.contacts' => 'Contacts', 'object_contacts.contacts_param_contacts_type_Vector t' => 'Contacts', 'object_contacts.contacts_param_saved_count_type_int' => 'Saved count', 'object_contacts.contacts_param_users_type_Vector t' => 'Users', 'object_contacts.importedContacts' => 'Imported contacts', 'object_contacts.importedContacts_param_imported_type_Vector t' => 'Imported', 'object_contacts.importedContacts_param_popular_invites_type_Vector t' => 'Popular invites', 'object_contacts.importedContacts_param_retry_contacts_type_Vector t' => 'Retry importing contacts whose client IDs appear here', 'object_contacts.importedContacts_param_users_type_Vector t' => 'Users', 'object_contacts.blocked' => 'Blocked', 'object_contacts.blocked_param_blocked_type_Vector t' => 'Blocked', 'object_contacts.blocked_param_users_type_Vector t' => 'Users', 'object_contacts.blockedSlice' => 'Blocked slice', 'object_contacts.blockedSlice_param_count_type_int' => 'Count', 'object_contacts.blockedSlice_param_blocked_type_Vector t' => 'Blocked', 'object_contacts.blockedSlice_param_users_type_Vector t' => 'Users', 'object_messages.dialogs' => 'Dialogs', 'object_messages.dialogs_param_dialogs_type_Vector t' => 'Dialogs', 'object_messages.dialogs_param_messages_type_Vector t' => 'Messages', 'object_messages.dialogs_param_chats_type_Vector t' => 'Chats', 'object_messages.dialogs_param_users_type_Vector t' => 'Users', 'object_messages.dialogsSlice' => 'Dialogs slice', 'object_messages.dialogsSlice_param_count_type_int' => 'Count', 'object_messages.dialogsSlice_param_dialogs_type_Vector t' => 'Dialogs', 'object_messages.dialogsSlice_param_messages_type_Vector t' => 'Messages', 'object_messages.dialogsSlice_param_chats_type_Vector t' => 'Chats', 'object_messages.dialogsSlice_param_users_type_Vector t' => 'Users', 'object_messages.messages' => 'Messages', 'object_messages.messages_param_messages_type_Vector t' => 'Messages', 'object_messages.messages_param_chats_type_Vector t' => 'Chats', 'object_messages.messages_param_users_type_Vector t' => 'Users', 'object_messages.messagesSlice' => 'Messages slice', 'object_messages.messagesSlice_param_count_type_int' => 'Count', 'object_messages.messagesSlice_param_messages_type_Vector t' => 'Messages', 'object_messages.messagesSlice_param_chats_type_Vector t' => 'Chats', 'object_messages.messagesSlice_param_users_type_Vector t' => 'Users', 'object_messages.channelMessages' => 'Channel messages', 'object_messages.channelMessages_param_pts_type_int' => 'Pts', 'object_messages.channelMessages_param_count_type_int' => 'Count', 'object_messages.channelMessages_param_messages_type_Vector t' => 'Messages', 'object_messages.channelMessages_param_chats_type_Vector t' => 'Chats', 'object_messages.channelMessages_param_users_type_Vector t' => 'Users', 'object_messages.messagesNotModified' => 'Messages not modified', 'object_messages.messagesNotModified_param_count_type_int' => 'Count', 'object_messages.chats' => 'Chats', 'object_messages.chats_param_chats_type_Vector t' => 'Chats', 'object_messages.chatsSlice' => 'Chats slice', 'object_messages.chatsSlice_param_count_type_int' => 'Count', 'object_messages.chatsSlice_param_chats_type_Vector t' => 'Chats', 'object_messages.chatFull' => 'Chat full', 'object_messages.chatFull_param_full_chat_type_ChatFull' => 'Full chat', 'object_messages.chatFull_param_chats_type_Vector t' => 'Chats', 'object_messages.chatFull_param_users_type_Vector t' => 'Users', 'object_messages.affectedHistory' => 'Affected history', 'object_messages.affectedHistory_param_pts_type_int' => 'Pts', 'object_messages.affectedHistory_param_pts_count_type_int' => 'Pts count', 'object_messages.affectedHistory_param_offset_type_int' => 'Offset', 'object_inputMessagesFilterEmpty' => 'Empty input messages filter', 'object_inputMessagesFilterPhotos' => 'Messages filter photos', 'object_inputMessagesFilterVideo' => 'Messages filter video', 'object_inputMessagesFilterPhotoVideo' => 'Messages filter photo video', 'object_inputMessagesFilterDocument' => 'Messages filter document', 'object_inputMessagesFilterUrl' => 'Messages filter URL', 'object_inputMessagesFilterGif' => 'Messages filter gif', 'object_inputMessagesFilterVoice' => 'Messages filter voice', 'object_inputMessagesFilterMusic' => 'Messages filter music', 'object_inputMessagesFilterChatPhotos' => 'Messages filter chat photos', 'object_inputMessagesFilterPhoneCalls' => 'Messages filter phone calls', 'object_inputMessagesFilterPhoneCalls_param_missed_type_true' => 'Missed?', 'object_inputMessagesFilterRoundVoice' => 'Messages filter round voice', 'object_inputMessagesFilterRoundVideo' => 'Messages filter round video', 'object_inputMessagesFilterMyMentions' => 'Messages filter my mentions', 'object_inputMessagesFilterGeo' => 'Messages filter geo', 'object_inputMessagesFilterContacts' => 'Messages filter contacts', 'object_updateNewMessage' => 'Update new message', 'object_updateNewMessage_param_message_type_Message' => 'Message', 'object_updateNewMessage_param_pts_type_int' => 'Pts', 'object_updateNewMessage_param_pts_count_type_int' => 'Pts count', 'object_updateMessageID' => 'Update message ID', 'object_updateMessageID_param_id_type_int' => 'ID', 'object_updateDeleteMessages' => 'Update delete messages', 'object_updateDeleteMessages_param_messages_type_Vector t' => 'Messages', 'object_updateDeleteMessages_param_pts_type_int' => 'Pts', 'object_updateDeleteMessages_param_pts_count_type_int' => 'Pts count', 'object_updateUserTyping' => 'Update user typing', 'object_updateUserTyping_param_user_id_type_int' => 'User ID', 'object_updateUserTyping_param_action_type_SendMessageAction' => 'Action', 'object_updateChatUserTyping' => 'Update chat user typing', 'object_updateChatUserTyping_param_chat_id_type_int' => 'Chat ID', 'object_updateChatUserTyping_param_user_id_type_int' => 'User ID', 'object_updateChatUserTyping_param_action_type_SendMessageAction' => 'Action', 'object_updateChatParticipants' => 'Update chat participants', 'object_updateChatParticipants_param_participants_type_ChatParticipants' => 'Participants', 'object_updateUserName' => 'Update user name', 'object_updateUserName_param_user_id_type_int' => 'User ID', 'object_updateUserName_param_first_name_type_string' => 'First name', 'object_updateUserName_param_last_name_type_string' => 'Last name', 'object_updateUserName_param_username_type_string' => 'Username', 'object_updateUserPhoto' => 'Update user photo', 'object_updateUserPhoto_param_user_id_type_int' => 'User ID', 'object_updateUserPhoto_param_date_type_int' => 'Date', 'object_updateUserPhoto_param_photo_type_UserProfilePhoto' => 'Photo', 'object_updateUserPhoto_param_previous_type_Bool' => 'Previous?', 'object_updateContactRegistered' => 'Update contact registered', 'object_updateContactRegistered_param_user_id_type_int' => 'User ID', 'object_updateContactRegistered_param_date_type_int' => 'Date', 'object_updateContactLink' => 'Update contact link', 'object_updateContactLink_param_user_id_type_int' => 'User ID', 'object_updateContactLink_param_my_link_type_ContactLink' => 'My link', 'object_updateContactLink_param_foreign_link_type_ContactLink' => 'Foreign link', 'object_updateNewEncryptedMessage' => 'Update new encrypted message', 'object_updateNewEncryptedMessage_param_message_type_EncryptedMessage' => 'Message', 'object_updateNewEncryptedMessage_param_qts_type_int' => 'Qts', 'object_updateEncryptedChatTyping' => 'Update encrypted chat typing', 'object_updateEncryptedChatTyping_param_chat_id_type_int' => 'Chat ID', 'object_updateEncryption' => 'Update encryption', 'object_updateEncryption_param_chat_type_EncryptedChat' => 'Chat', 'object_updateEncryption_param_date_type_int' => 'Date', 'object_updateEncryptedMessagesRead' => 'Update encrypted messages read', 'object_updateEncryptedMessagesRead_param_chat_id_type_int' => 'Chat ID', 'object_updateEncryptedMessagesRead_param_max_date_type_int' => 'Max date', 'object_updateEncryptedMessagesRead_param_date_type_int' => 'Date', 'object_updateChatParticipantAdd' => 'Update chat participant add', 'object_updateChatParticipantAdd_param_chat_id_type_int' => 'Chat ID', 'object_updateChatParticipantAdd_param_user_id_type_int' => 'User ID', 'object_updateChatParticipantAdd_param_inviter_id_type_int' => 'Inviter ID', 'object_updateChatParticipantAdd_param_date_type_int' => 'Date', 'object_updateChatParticipantAdd_param_version_type_int' => 'Version', 'object_updateChatParticipantDelete' => 'Update chat participant delete', 'object_updateChatParticipantDelete_param_chat_id_type_int' => 'Chat ID', 'object_updateChatParticipantDelete_param_user_id_type_int' => 'User ID', 'object_updateChatParticipantDelete_param_version_type_int' => 'Version', 'object_updateDcOptions' => 'Update DC options', 'object_updateDcOptions_param_dc_options_type_Vector t' => 'DC options', 'object_updateUserBlocked' => 'Update user blocked', 'object_updateUserBlocked_param_user_id_type_int' => 'User ID', 'object_updateUserBlocked_param_blocked_type_Bool' => 'Blocked?', 'object_updateNotifySettings' => 'Update notify settings', 'object_updateNotifySettings_param_peer_type_NotifyPeer' => 'Peer', 'object_updateNotifySettings_param_notify_settings_type_PeerNotifySettings' => 'Notify settings', 'object_updateServiceNotification' => 'Update service notification', 'object_updateServiceNotification_param_popup_type_true' => 'Popup?', 'object_updateServiceNotification_param_inbox_date_type_int' => 'Inbox date', 'object_updateServiceNotification_param_type_type_string' => 'Type', 'object_updateServiceNotification_param_message_type_string' => 'Message', 'object_updateServiceNotification_param_media_type_MessageMedia' => 'Media', 'object_updateServiceNotification_param_entities_type_Vector t' => 'Entities', 'object_updatePrivacy' => 'Update privacy', 'object_updatePrivacy_param_key_type_PrivacyKey' => 'Key', 'object_updatePrivacy_param_rules_type_Vector t' => 'Rules', 'object_updateUserPhone' => 'Update user phone', 'object_updateUserPhone_param_user_id_type_int' => 'User ID', 'object_updateUserPhone_param_phone_type_string' => 'Phone', 'object_updateReadHistoryInbox' => 'Update read history inbox', 'object_updateReadHistoryInbox_param_peer_type_Peer' => 'Peer', 'object_updateReadHistoryInbox_param_max_id_type_int' => 'Max ID', 'object_updateReadHistoryInbox_param_pts_type_int' => 'Pts', 'object_updateReadHistoryInbox_param_pts_count_type_int' => 'Pts count', 'object_updateReadHistoryOutbox' => 'Update read history outbox', 'object_updateReadHistoryOutbox_param_peer_type_Peer' => 'Peer', 'object_updateReadHistoryOutbox_param_max_id_type_int' => 'Max ID', 'object_updateReadHistoryOutbox_param_pts_type_int' => 'Pts', 'object_updateReadHistoryOutbox_param_pts_count_type_int' => 'Pts count', 'object_updateWebPage' => 'Update web page', 'object_updateWebPage_param_webpage_type_WebPage' => 'Webpage', 'object_updateWebPage_param_pts_type_int' => 'Pts', 'object_updateWebPage_param_pts_count_type_int' => 'Pts count', 'object_updateReadMessagesContents' => 'Update read messages contents', 'object_updateReadMessagesContents_param_messages_type_Vector t' => 'Messages', 'object_updateReadMessagesContents_param_pts_type_int' => 'Pts', 'object_updateReadMessagesContents_param_pts_count_type_int' => 'Pts count', 'object_updateChannelTooLong' => 'Update channel too long', 'object_updateChannelTooLong_param_channel_id_type_int' => 'Channel ID', 'object_updateChannelTooLong_param_pts_type_int' => 'Pts', 'object_updateChannel' => 'Update channel', 'object_updateChannel_param_channel_id_type_int' => 'Channel ID', 'object_updateNewChannelMessage' => 'Update new channel message', 'object_updateNewChannelMessage_param_message_type_Message' => 'Message', 'object_updateNewChannelMessage_param_pts_type_int' => 'Pts', 'object_updateNewChannelMessage_param_pts_count_type_int' => 'Pts count', 'object_updateReadChannelInbox' => 'Update read channel inbox', 'object_updateReadChannelInbox_param_channel_id_type_int' => 'Channel ID', 'object_updateReadChannelInbox_param_max_id_type_int' => 'Max ID', 'object_updateDeleteChannelMessages' => 'Update delete channel messages', 'object_updateDeleteChannelMessages_param_channel_id_type_int' => 'Channel ID', 'object_updateDeleteChannelMessages_param_messages_type_Vector t' => 'Messages', 'object_updateDeleteChannelMessages_param_pts_type_int' => 'Pts', 'object_updateDeleteChannelMessages_param_pts_count_type_int' => 'Pts count', 'object_updateChannelMessageViews' => 'Update channel message views', 'object_updateChannelMessageViews_param_channel_id_type_int' => 'Channel ID', 'object_updateChannelMessageViews_param_id_type_int' => 'ID', 'object_updateChannelMessageViews_param_views_type_int' => 'Views', 'object_updateChatAdmins' => 'Update chat admins', 'object_updateChatAdmins_param_chat_id_type_int' => 'Chat ID', 'object_updateChatAdmins_param_enabled_type_Bool' => 'Enabled?', 'object_updateChatAdmins_param_version_type_int' => 'Version', 'object_updateChatParticipantAdmin' => 'Update chat participant admin', 'object_updateChatParticipantAdmin_param_chat_id_type_int' => 'Chat ID', 'object_updateChatParticipantAdmin_param_user_id_type_int' => 'User ID', 'object_updateChatParticipantAdmin_param_is_admin_type_Bool' => 'Is admin?', 'object_updateChatParticipantAdmin_param_version_type_int' => 'Version', 'object_updateNewStickerSet' => 'Update new sticker set', 'object_updateNewStickerSet_param_stickerset_type_messages.StickerSet' => 'Stickerset', 'object_updateStickerSetsOrder' => 'Update sticker sets order', 'object_updateStickerSetsOrder_param_masks_type_true' => 'Masks?', 'object_updateStickerSetsOrder_param_order_type_Vector t' => 'Order', 'object_updateStickerSets' => 'Update sticker sets', 'object_updateSavedGifs' => 'Update saved gifs', 'object_updateBotInlineQuery' => 'Update bot inline query', 'object_updateBotInlineQuery_param_query_id_type_long' => 'Query ID', 'object_updateBotInlineQuery_param_user_id_type_int' => 'User ID', 'object_updateBotInlineQuery_param_query_type_string' => 'Query', 'object_updateBotInlineQuery_param_geo_type_GeoPoint' => 'Geo', 'object_updateBotInlineQuery_param_offset_type_string' => 'Offset', 'object_updateBotInlineSend' => 'Update bot inline send', 'object_updateBotInlineSend_param_user_id_type_int' => 'User ID', 'object_updateBotInlineSend_param_query_type_string' => 'Query', 'object_updateBotInlineSend_param_geo_type_GeoPoint' => 'Geo', 'object_updateBotInlineSend_param_id_type_string' => 'ID', 'object_updateBotInlineSend_param_msg_id_type_InputBotInlineMessageID' => 'Msg ID', 'object_updateEditChannelMessage' => 'Update edit channel message', 'object_updateEditChannelMessage_param_message_type_Message' => 'Message', 'object_updateEditChannelMessage_param_pts_type_int' => 'Pts', 'object_updateEditChannelMessage_param_pts_count_type_int' => 'Pts count', 'object_updateChannelPinnedMessage' => 'Update channel pinned message', 'object_updateChannelPinnedMessage_param_channel_id_type_int' => 'Channel ID', 'object_updateChannelPinnedMessage_param_id_type_int' => 'ID', 'object_updateBotCallbackQuery' => 'Update bot callback query', 'object_updateBotCallbackQuery_param_query_id_type_long' => 'Query ID', 'object_updateBotCallbackQuery_param_user_id_type_int' => 'User ID', 'object_updateBotCallbackQuery_param_peer_type_Peer' => 'Peer', 'object_updateBotCallbackQuery_param_msg_id_type_int' => 'Msg ID', 'object_updateBotCallbackQuery_param_chat_instance_type_long' => 'Chat instance', 'object_updateBotCallbackQuery_param_data_type_bytes' => 'Data', 'object_updateBotCallbackQuery_param_game_short_name_type_string' => 'Game short name', 'object_updateEditMessage' => 'Update edit message', 'object_updateEditMessage_param_message_type_Message' => 'Message', 'object_updateEditMessage_param_pts_type_int' => 'Pts', 'object_updateEditMessage_param_pts_count_type_int' => 'Pts count', 'object_updateInlineBotCallbackQuery' => 'Update inline bot callback query', 'object_updateInlineBotCallbackQuery_param_query_id_type_long' => 'Query ID', 'object_updateInlineBotCallbackQuery_param_user_id_type_int' => 'User ID', 'object_updateInlineBotCallbackQuery_param_msg_id_type_InputBotInlineMessageID' => 'Msg ID', 'object_updateInlineBotCallbackQuery_param_chat_instance_type_long' => 'Chat instance', 'object_updateInlineBotCallbackQuery_param_data_type_bytes' => 'Data', 'object_updateInlineBotCallbackQuery_param_game_short_name_type_string' => 'Game short name', 'object_updateReadChannelOutbox' => 'Update read channel outbox', 'object_updateReadChannelOutbox_param_channel_id_type_int' => 'Channel ID', 'object_updateReadChannelOutbox_param_max_id_type_int' => 'Max ID', 'object_updateDraftMessage' => 'Update draft message', 'object_updateDraftMessage_param_peer_type_Peer' => 'Peer', 'object_updateDraftMessage_param_draft_type_DraftMessage' => 'Draft', 'object_updateReadFeaturedStickers' => 'Update read featured stickers', 'object_updateRecentStickers' => 'Update recent stickers', 'object_updateConfig' => 'Update config', 'object_updatePtsChanged' => 'Update pts changed', 'object_updateChannelWebPage' => 'Update channel web page', 'object_updateChannelWebPage_param_channel_id_type_int' => 'Channel ID', 'object_updateChannelWebPage_param_webpage_type_WebPage' => 'Webpage', 'object_updateChannelWebPage_param_pts_type_int' => 'Pts', 'object_updateChannelWebPage_param_pts_count_type_int' => 'Pts count', 'object_updateDialogPinned' => 'Update dialog pinned', 'object_updateDialogPinned_param_pinned_type_true' => 'Pinned?', 'object_updateDialogPinned_param_peer_type_Peer' => 'Peer', 'object_updatePinnedDialogs' => 'Update pinned dialogs', 'object_updatePinnedDialogs_param_order_type_Vector t' => 'Order', 'object_updateBotWebhookJSON' => 'Update bot webhook json', 'object_updateBotWebhookJSON_param_data_type_DataJSON' => 'Data', 'object_updateBotWebhookJSONQuery' => 'Update bot webhook json query', 'object_updateBotWebhookJSONQuery_param_query_id_type_long' => 'Query ID', 'object_updateBotWebhookJSONQuery_param_data_type_DataJSON' => 'Data', 'object_updateBotWebhookJSONQuery_param_timeout_type_int' => 'Timeout', 'object_updateBotShippingQuery' => 'Update bot shipping query', 'object_updateBotShippingQuery_param_query_id_type_long' => 'Query ID', 'object_updateBotShippingQuery_param_user_id_type_int' => 'User ID', 'object_updateBotShippingQuery_param_payload_type_bytes' => 'Payload', 'object_updateBotShippingQuery_param_shipping_address_type_PostAddress' => 'Shipping address', 'object_updateBotPrecheckoutQuery' => 'Update bot precheckout query', 'object_updateBotPrecheckoutQuery_param_query_id_type_long' => 'Query ID', 'object_updateBotPrecheckoutQuery_param_user_id_type_int' => 'User ID', 'object_updateBotPrecheckoutQuery_param_payload_type_bytes' => 'Payload', 'object_updateBotPrecheckoutQuery_param_info_type_PaymentRequestedInfo' => 'Info', 'object_updateBotPrecheckoutQuery_param_shipping_option_id_type_string' => 'Shipping option ID', 'object_updateBotPrecheckoutQuery_param_currency_type_string' => 'Currency', 'object_updateBotPrecheckoutQuery_param_total_amount_type_long' => 'Total amount', 'object_updatePhoneCall' => 'Update phone call', 'object_updatePhoneCall_param_phone_call_type_PhoneCall' => 'Phone call', 'object_updateLangPackTooLong' => 'Update lang pack too long', 'object_updateLangPack' => 'Update lang pack', 'object_updateLangPack_param_difference_type_LangPackDifference' => 'Difference', 'object_updateFavedStickers' => 'Update faved stickers', 'object_updateChannelReadMessagesContents' => 'Update channel read messages contents', 'object_updateChannelReadMessagesContents_param_channel_id_type_int' => 'Channel ID', 'object_updateChannelReadMessagesContents_param_messages_type_Vector t' => 'Messages', 'object_updateContactsReset' => 'Update contacts reset', 'object_updateChannelAvailableMessages' => 'Update channel available messages', 'object_updateChannelAvailableMessages_param_channel_id_type_int' => 'Channel ID', 'object_updateChannelAvailableMessages_param_available_min_id_type_int' => 'Available min ID', 'object_updates.state' => 'State', 'object_updates.state_param_pts_type_int' => 'Pts', 'object_updates.state_param_qts_type_int' => 'Qts', 'object_updates.state_param_date_type_int' => 'Date', 'object_updates.state_param_seq_type_int' => 'Seq', 'object_updates.state_param_unread_count_type_int' => 'Unread count', 'object_updates.differenceEmpty' => 'Empty difference', 'object_updates.differenceEmpty_param_date_type_int' => 'Date', 'object_updates.differenceEmpty_param_seq_type_int' => 'Seq', 'object_updates.difference' => 'Difference', 'object_updates.difference_param_new_messages_type_Vector t' => 'New messages', 'object_updates.difference_param_new_encrypted_messages_type_Vector t' => 'New encrypted messages', 'object_updates.difference_param_other_updates_type_Vector t' => 'Other updates', 'object_updates.difference_param_chats_type_Vector t' => 'Chats', 'object_updates.difference_param_users_type_Vector t' => 'Users', 'object_updates.difference_param_state_type_updates.State' => 'State', 'object_updates.differenceSlice' => 'Difference slice', 'object_updates.differenceSlice_param_new_messages_type_Vector t' => 'New messages', 'object_updates.differenceSlice_param_new_encrypted_messages_type_Vector t' => 'New encrypted messages', 'object_updates.differenceSlice_param_other_updates_type_Vector t' => 'Other updates', 'object_updates.differenceSlice_param_chats_type_Vector t' => 'Chats', 'object_updates.differenceSlice_param_users_type_Vector t' => 'Users', 'object_updates.differenceSlice_param_intermediate_state_type_updates.State' => 'Intermediate state', 'object_updates.differenceTooLong' => 'Difference too long', 'object_updates.differenceTooLong_param_pts_type_int' => 'Pts', 'object_updatesTooLong' => 'Updates too long', 'object_updateShortMessage' => 'Update short message', 'object_updateShortMessage_param_out_type_true' => 'Out?', 'object_updateShortMessage_param_mentioned_type_true' => 'Mentioned?', 'object_updateShortMessage_param_media_unread_type_true' => 'Media unread?', 'object_updateShortMessage_param_silent_type_true' => 'Silent?', 'object_updateShortMessage_param_id_type_int' => 'ID', 'object_updateShortMessage_param_user_id_type_int' => 'User ID', 'object_updateShortMessage_param_message_type_string' => 'Message', 'object_updateShortMessage_param_pts_type_int' => 'Pts', 'object_updateShortMessage_param_pts_count_type_int' => 'Pts count', 'object_updateShortMessage_param_date_type_int' => 'Date', 'object_updateShortMessage_param_fwd_from_type_MessageFwdHeader' => 'Fwd from', 'object_updateShortMessage_param_via_bot_id_type_int' => 'Via bot ID', 'object_updateShortMessage_param_reply_to_msg_id_type_int' => 'Reply to msg ID', 'object_updateShortMessage_param_entities_type_Vector t' => 'Entities', 'object_updateShortChatMessage' => 'Update short chat message', 'object_updateShortChatMessage_param_out_type_true' => 'Out?', 'object_updateShortChatMessage_param_mentioned_type_true' => 'Mentioned?', 'object_updateShortChatMessage_param_media_unread_type_true' => 'Media unread?', 'object_updateShortChatMessage_param_silent_type_true' => 'Silent?', 'object_updateShortChatMessage_param_id_type_int' => 'ID', 'object_updateShortChatMessage_param_from_id_type_int' => 'From ID', 'object_updateShortChatMessage_param_chat_id_type_int' => 'Chat ID', 'object_updateShortChatMessage_param_message_type_string' => 'Message', 'object_updateShortChatMessage_param_pts_type_int' => 'Pts', 'object_updateShortChatMessage_param_pts_count_type_int' => 'Pts count', 'object_updateShortChatMessage_param_date_type_int' => 'Date', 'object_updateShortChatMessage_param_fwd_from_type_MessageFwdHeader' => 'Fwd from', 'object_updateShortChatMessage_param_via_bot_id_type_int' => 'Via bot ID', 'object_updateShortChatMessage_param_reply_to_msg_id_type_int' => 'Reply to msg ID', 'object_updateShortChatMessage_param_entities_type_Vector t' => 'Entities', 'object_updateShort' => 'Update short', 'object_updateShort_param_update_type_Update' => 'Update', 'object_updateShort_param_date_type_int' => 'Date', 'object_updatesCombined' => 'Updates combined', 'object_updatesCombined_param_updates_type_Vector t' => 'Updates', 'object_updatesCombined_param_users_type_Vector t' => 'Users', 'object_updatesCombined_param_chats_type_Vector t' => 'Chats', 'object_updatesCombined_param_date_type_int' => 'Date', 'object_updatesCombined_param_seq_start_type_int' => 'Seq start', 'object_updatesCombined_param_seq_type_int' => 'Seq', 'object_updates' => 'Updates', 'object_updates_param_updates_type_Vector t' => 'Updates', 'object_updates_param_users_type_Vector t' => 'Users', 'object_updates_param_chats_type_Vector t' => 'Chats', 'object_updates_param_date_type_int' => 'Date', 'object_updates_param_seq_type_int' => 'Seq', 'object_updateShortSentMessage' => 'Update short sent message', 'object_updateShortSentMessage_param_out_type_true' => 'Out?', 'object_updateShortSentMessage_param_id_type_int' => 'ID', 'object_updateShortSentMessage_param_pts_type_int' => 'Pts', 'object_updateShortSentMessage_param_pts_count_type_int' => 'Pts count', 'object_updateShortSentMessage_param_date_type_int' => 'Date', 'object_updateShortSentMessage_param_media_type_MessageMedia' => 'Media', 'object_updateShortSentMessage_param_entities_type_Vector t' => 'Entities', 'object_photos.photos' => 'Photos', 'object_photos.photos_param_photos_type_Vector t' => 'Photos', 'object_photos.photos_param_users_type_Vector t' => 'Users', 'object_photos.photosSlice' => 'Photos slice', 'object_photos.photosSlice_param_count_type_int' => 'Count', 'object_photos.photosSlice_param_photos_type_Vector t' => 'Photos', 'object_photos.photosSlice_param_users_type_Vector t' => 'Users', 'object_photos.photo' => 'Photo', 'object_photos.photo_param_photo_type_Photo' => 'Photo', 'object_photos.photo_param_users_type_Vector t' => 'Users', 'object_upload.file' => 'File', 'object_upload.file_param_type_type_storage.FileType' => 'Type', 'object_upload.file_param_mtime_type_int' => 'Mtime', 'object_upload.file_param_bytes_type_bytes' => 'Bytes', 'object_upload.fileCdnRedirect' => 'File cdn redirect', 'object_upload.fileCdnRedirect_param_dc_id_type_int' => 'DC ID', 'object_upload.fileCdnRedirect_param_file_token_type_bytes' => 'File token', 'object_upload.fileCdnRedirect_param_encryption_key_type_bytes' => 'Encryption key', 'object_upload.fileCdnRedirect_param_encryption_iv_type_bytes' => 'Encryption iv', 'object_upload.fileCdnRedirect_param_cdn_file_hashes_type_Vector t' => 'Cdn file hashes', 'object_dcOption' => 'DC option', 'object_dcOption_param_ipv6_type_true' => 'Ipv6?', 'object_dcOption_param_media_only_type_true' => 'Media only?', 'object_dcOption_param_tcpo_only_type_true' => 'Tcpo only?', 'object_dcOption_param_cdn_type_true' => 'Cdn?', 'object_dcOption_param_static_type_true' => 'Static?', 'object_dcOption_param_id_type_int' => 'ID', 'object_dcOption_param_ip_address_type_string' => 'Ip address', 'object_dcOption_param_port_type_int' => 'Port', 'object_config' => 'Config', 'object_config_param_phonecalls_enabled_type_true' => 'Phonecalls enabled?', 'object_config_param_default_p2p_contacts_type_true' => 'Default p2p contacts?', 'object_config_param_date_type_int' => 'Date', 'object_config_param_expires_type_int' => 'Expires', 'object_config_param_test_mode_type_Bool' => 'Test mode?', 'object_config_param_this_dc_type_int' => 'This DC', 'object_config_param_dc_options_type_Vector t' => 'DC options', 'object_config_param_chat_size_max_type_int' => 'Chat size max', 'object_config_param_megagroup_size_max_type_int' => 'Megagroup size max', 'object_config_param_forwarded_count_max_type_int' => 'Forwarded count max', 'object_config_param_online_update_period_ms_type_int' => 'Online update period ms', 'object_config_param_offline_blur_timeout_ms_type_int' => 'Offline blur timeout ms', 'object_config_param_offline_idle_timeout_ms_type_int' => 'Offline IDle timeout ms', 'object_config_param_online_cloud_timeout_ms_type_int' => 'Online cloud timeout ms', 'object_config_param_notify_cloud_delay_ms_type_int' => 'Notify cloud delay ms', 'object_config_param_notify_default_delay_ms_type_int' => 'Notify default delay ms', 'object_config_param_chat_big_size_type_int' => 'Chat big size', 'object_config_param_push_chat_period_ms_type_int' => 'Push chat period ms', 'object_config_param_push_chat_limit_type_int' => 'Push chat limit', 'object_config_param_saved_gifs_limit_type_int' => 'Saved gifs limit', 'object_config_param_edit_time_limit_type_int' => 'Edit time limit', 'object_config_param_rating_e_decay_type_int' => 'Rating e decay', 'object_config_param_stickers_recent_limit_type_int' => 'Stickers recent limit', 'object_config_param_stickers_faved_limit_type_int' => 'Stickers faved limit', 'object_config_param_channels_read_media_period_type_int' => 'Channels read media period', 'object_config_param_tmp_sessions_type_int' => 'Tmp sessions', 'object_config_param_pinned_dialogs_count_max_type_int' => 'Pinned dialogs count max', 'object_config_param_call_receive_timeout_ms_type_int' => 'Call receive timeout ms', 'object_config_param_call_ring_timeout_ms_type_int' => 'Call ring timeout ms', 'object_config_param_call_connect_timeout_ms_type_int' => 'Call connect timeout ms', 'object_config_param_call_packet_timeout_ms_type_int' => 'Call packet timeout ms', 'object_config_param_me_url_prefix_type_string' => 'Me URL prefix', 'object_config_param_suggested_lang_code_type_string' => 'Suggested lang code', 'object_config_param_lang_pack_version_type_int' => 'Lang pack version', 'object_config_param_disabled_features_type_Vector t' => 'Disabled features', 'object_nearestDc' => 'Nearest DC', 'object_nearestDc_param_country_type_string' => 'Country', 'object_nearestDc_param_this_dc_type_int' => 'This DC', 'object_nearestDc_param_nearest_dc_type_int' => 'Nearest DC', 'object_help.appUpdate' => 'App update', 'object_help.appUpdate_param_id_type_int' => 'ID', 'object_help.appUpdate_param_critical_type_Bool' => 'Critical?', 'object_help.appUpdate_param_url_type_string' => 'URL', 'object_help.appUpdate_param_text_type_string' => 'Text', 'object_help.noAppUpdate' => 'No app update', 'object_help.inviteText' => 'Invite text', 'object_help.inviteText_param_message_type_string' => 'Message', 'object_encryptedChatEmpty' => 'Empty encrypted chat', 'object_encryptedChatEmpty_param_id_type_int' => 'ID', 'object_encryptedChatWaiting' => 'Encrypted chat waiting', 'object_encryptedChatWaiting_param_id_type_int' => 'ID', 'object_encryptedChatWaiting_param_access_hash_type_long' => 'Access hash', 'object_encryptedChatWaiting_param_date_type_int' => 'Date', 'object_encryptedChatWaiting_param_admin_id_type_int' => 'Admin ID', 'object_encryptedChatWaiting_param_participant_id_type_int' => 'Participant ID', 'object_encryptedChatRequested' => 'Encrypted chat requested', 'object_encryptedChatRequested_param_id_type_int' => 'ID', 'object_encryptedChatRequested_param_access_hash_type_long' => 'Access hash', 'object_encryptedChatRequested_param_date_type_int' => 'Date', 'object_encryptedChatRequested_param_admin_id_type_int' => 'Admin ID', 'object_encryptedChatRequested_param_participant_id_type_int' => 'Participant ID', 'object_encryptedChatRequested_param_g_a_type_bytes' => 'G a', 'object_encryptedChat' => 'Encrypted chat', 'object_encryptedChat_param_id_type_int' => 'ID', 'object_encryptedChat_param_access_hash_type_long' => 'Access hash', 'object_encryptedChat_param_date_type_int' => 'Date', 'object_encryptedChat_param_admin_id_type_int' => 'Admin ID', 'object_encryptedChat_param_participant_id_type_int' => 'Participant ID', 'object_encryptedChat_param_g_a_or_b_type_bytes' => 'G a or b', 'object_encryptedChat_param_key_fingerprint_type_long' => 'Key fingerprint', 'object_encryptedChatDiscarded' => 'Encrypted chat discarded', 'object_encryptedChatDiscarded_param_id_type_int' => 'ID', 'object_inputEncryptedChat' => 'Encrypted chat', 'object_inputEncryptedChat_param_chat_id_type_int' => 'Chat ID', 'object_inputEncryptedChat_param_access_hash_type_long' => 'Access hash', 'object_encryptedFileEmpty' => 'Empty encrypted file', 'object_encryptedFile' => 'Encrypted file', 'object_encryptedFile_param_id_type_long' => 'ID', 'object_encryptedFile_param_access_hash_type_long' => 'Access hash', 'object_encryptedFile_param_size_type_int' => 'Size', 'object_encryptedFile_param_dc_id_type_int' => 'DC ID', 'object_encryptedFile_param_key_fingerprint_type_int' => 'Key fingerprint', 'object_inputEncryptedFileEmpty' => 'Empty input encrypted file', 'object_inputEncryptedFileUploaded' => 'Encrypted file uploaded', 'object_inputEncryptedFileUploaded_param_id_type_long' => 'ID', 'object_inputEncryptedFileUploaded_param_parts_type_int' => 'Parts', 'object_inputEncryptedFileUploaded_param_md5_checksum_type_string' => 'Md5 checksum', 'object_inputEncryptedFileUploaded_param_key_fingerprint_type_int' => 'Key fingerprint', 'object_inputEncryptedFile' => 'Encrypted file', 'object_inputEncryptedFile_param_id_type_long' => 'ID', 'object_inputEncryptedFile_param_access_hash_type_long' => 'Access hash', 'object_inputEncryptedFileBigUploaded' => 'Encrypted file big uploaded', 'object_inputEncryptedFileBigUploaded_param_id_type_long' => 'ID', 'object_inputEncryptedFileBigUploaded_param_parts_type_int' => 'Parts', 'object_inputEncryptedFileBigUploaded_param_key_fingerprint_type_int' => 'Key fingerprint', 'object_encryptedMessage' => 'Encrypted message', 'object_encryptedMessage_param_chat_id_type_int' => 'Chat ID', 'object_encryptedMessage_param_date_type_int' => 'Date', 'object_encryptedMessage_param_decrypted_message_type_DecryptedMessage' => 'Decrypted message', 'object_encryptedMessage_param_file_type_EncryptedFile' => 'File', 'object_encryptedMessageService' => 'Encrypted message service', 'object_encryptedMessageService_param_chat_id_type_int' => 'Chat ID', 'object_encryptedMessageService_param_date_type_int' => 'Date', 'object_encryptedMessageService_param_decrypted_message_type_DecryptedMessage' => 'Decrypted message', 'object_messages.dhConfigNotModified' => 'Dh config not modified', 'object_messages.dhConfigNotModified_param_random_type_bytes' => 'Random', 'object_messages.dhConfig' => 'Dh config', 'object_messages.dhConfig_param_g_type_int' => 'G', 'object_messages.dhConfig_param_p_type_bytes' => 'P', 'object_messages.dhConfig_param_version_type_int' => 'Version', 'object_messages.dhConfig_param_random_type_bytes' => 'Random', 'object_messages.sentEncryptedMessage' => 'Sent encrypted message', 'object_messages.sentEncryptedMessage_param_date_type_int' => 'Date', 'object_messages.sentEncryptedFile' => 'Sent encrypted file', 'object_messages.sentEncryptedFile_param_date_type_int' => 'Date', 'object_messages.sentEncryptedFile_param_file_type_EncryptedFile' => 'File', 'object_inputDocumentEmpty' => 'Empty input document', 'object_inputDocument' => 'Document', 'object_inputDocument_param_id_type_long' => 'ID', 'object_inputDocument_param_access_hash_type_long' => 'Access hash', 'object_documentEmpty' => 'Empty document', 'object_documentEmpty_param_id_type_long' => 'ID', 'object_document' => 'Document', 'object_document_param_id_type_long' => 'ID', 'object_document_param_access_hash_type_long' => 'Access hash', 'object_document_param_date_type_int' => 'Date', 'object_document_param_mime_type_type_string' => 'Mime type', 'object_document_param_size_type_int' => 'Size', 'object_document_param_thumb_type_PhotoSize' => 'Thumbnail', 'object_document_param_dc_id_type_int' => 'DC ID', 'object_document_param_version_type_int' => 'Version', 'object_document_param_attributes_type_Vector t' => 'Attributes', 'object_help.support' => 'Support', 'object_help.support_param_phone_number_type_string' => 'Phone number', 'object_help.support_param_user_type_User' => 'User', 'object_notifyPeer' => 'Notify peer', 'object_notifyPeer_param_peer_type_Peer' => 'Peer', 'object_notifyUsers' => 'Notify users', 'object_notifyChats' => 'Notify chats', 'object_notifyAll' => 'Notify all', 'object_sendMessageTypingAction' => 'Send message typing action', 'object_sendMessageCancelAction' => 'Send message cancel action', 'object_sendMessageRecordVideoAction' => 'Send message record video action', 'object_sendMessageUploadVideoAction' => 'Send message upload video action', 'object_sendMessageUploadVideoAction_param_progress_type_int' => 'Progress', 'object_sendMessageRecordAudioAction' => 'Send message record audio action', 'object_sendMessageUploadAudioAction' => 'Send message upload audio action', 'object_sendMessageUploadAudioAction_param_progress_type_int' => 'Progress', 'object_sendMessageUploadPhotoAction' => 'Send message upload photo action', 'object_sendMessageUploadPhotoAction_param_progress_type_int' => 'Progress', 'object_sendMessageUploadDocumentAction' => 'Send message upload document action', 'object_sendMessageUploadDocumentAction_param_progress_type_int' => 'Progress', 'object_sendMessageGeoLocationAction' => 'Send message geo location action', 'object_sendMessageChooseContactAction' => 'Send message choose contact action', 'object_sendMessageGamePlayAction' => 'Send message game play action', 'object_sendMessageRecordRoundAction' => 'Send message record round action', 'object_sendMessageUploadRoundAction' => 'Send message upload round action', 'object_sendMessageUploadRoundAction_param_progress_type_int' => 'Progress', 'object_contacts.found' => 'Found', 'object_contacts.found_param_my_results_type_Vector t' => 'My results', 'object_contacts.found_param_results_type_Vector t' => 'Results', 'object_contacts.found_param_chats_type_Vector t' => 'Chats', 'object_contacts.found_param_users_type_Vector t' => 'Users', 'object_inputPrivacyKeyStatusTimestamp' => 'Privacy key status timestamp', 'object_inputPrivacyKeyChatInvite' => 'Privacy key chat invite', 'object_inputPrivacyKeyPhoneCall' => 'Privacy key phone call', 'object_privacyKeyStatusTimestamp' => 'Privacy key status timestamp', 'object_privacyKeyPhoneCall' => 'Privacy key phone call', 'object_inputPrivacyValueAllowContacts' => 'Privacy value allow contacts', 'object_inputPrivacyValueAllowAll' => 'Privacy value allow all', 'object_inputPrivacyValueAllowUsers' => 'Privacy value allow users', 'object_inputPrivacyValueAllowUsers_param_users_type_Vector t' => 'Users', 'object_inputPrivacyValueDisallowContacts' => 'Privacy value disallow contacts', 'object_inputPrivacyValueDisallowAll' => 'Privacy value disallow all', 'object_inputPrivacyValueDisallowUsers' => 'Privacy value disallow users', 'object_inputPrivacyValueDisallowUsers_param_users_type_Vector t' => 'Users', 'object_privacyValueAllowContacts' => 'Privacy value allow contacts', 'object_privacyValueAllowAll' => 'Privacy value allow all', 'object_privacyValueAllowUsers' => 'Privacy value allow users', 'object_privacyValueAllowUsers_param_users_type_Vector t' => 'Users', 'object_privacyValueDisallowContacts' => 'Privacy value disallow contacts', 'object_privacyValueDisallowAll' => 'Privacy value disallow all', 'object_privacyValueDisallowUsers' => 'Privacy value disallow users', 'object_privacyValueDisallowUsers_param_users_type_Vector t' => 'Users', 'object_account.privacyRules' => 'Privacy rules', 'object_account.privacyRules_param_rules_type_Vector t' => 'Rules', 'object_account.privacyRules_param_users_type_Vector t' => 'Users', 'object_accountDaysTTL' => 'Account TTL in days', 'object_accountDaysTTL_param_days_type_int' => 'Days', 'object_documentAttributeImageSize' => 'Document attribute image size', 'object_documentAttributeImageSize_param_w_type_int' => 'Width', 'object_documentAttributeImageSize_param_h_type_int' => 'Height', 'object_documentAttributeAnimated' => 'Document attribute animated', 'object_documentAttributeSticker' => 'Document attribute sticker', 'object_documentAttributeSticker_param_mask_type_true' => 'Mask?', 'object_documentAttributeSticker_param_alt_type_string' => 'Alt', 'object_documentAttributeSticker_param_stickerset_type_InputStickerSet' => 'Stickerset', 'object_documentAttributeSticker_param_mask_coords_type_MaskCoords' => 'Mask coords', 'object_documentAttributeVideo' => 'Document attribute video', 'object_documentAttributeVideo_param_round_message_type_true' => 'Round message?', 'object_documentAttributeVideo_param_supports_streaming_type_true' => 'Supports streaming?', 'object_documentAttributeVideo_param_duration_type_int' => 'Duration', 'object_documentAttributeVideo_param_w_type_int' => 'Width', 'object_documentAttributeVideo_param_h_type_int' => 'Height', 'object_documentAttributeAudio' => 'Document attribute audio', 'object_documentAttributeAudio_param_voice_type_true' => 'Voice?', 'object_documentAttributeAudio_param_duration_type_int' => 'Duration', 'object_documentAttributeAudio_param_title_type_string' => 'Title', 'object_documentAttributeAudio_param_performer_type_string' => 'Performer', 'object_documentAttributeAudio_param_waveform_type_bytes' => 'Waveform', 'object_documentAttributeFilename' => 'Document attribute filename', 'object_documentAttributeFilename_param_file_name_type_string' => 'File name', 'object_documentAttributeHasStickers' => 'Document attribute has stickers', 'object_messages.stickersNotModified' => 'Stickers not modified', 'object_messages.stickers' => 'Stickers', 'object_messages.stickers_param_hash_type_string' => 'Hash', 'object_messages.stickers_param_stickers_type_Vector t' => 'Stickers', 'object_stickerPack' => 'Sticker pack', 'object_stickerPack_param_emoticon_type_string' => 'Emoticon', 'object_stickerPack_param_documents_type_Vector t' => 'Documents', 'object_messages.allStickersNotModified' => 'All stickers not modified', 'object_messages.allStickers' => 'All stickers', 'object_messages.allStickers_param_hash_type_int' => 'Hash', 'object_messages.allStickers_param_sets_type_Vector t' => 'Sets', 'object_disabledFeature' => 'Disabled feature', 'object_disabledFeature_param_feature_type_string' => 'Feature', 'object_disabledFeature_param_description_type_string' => 'Description', 'object_messages.affectedMessages' => 'Affected messages', 'object_messages.affectedMessages_param_pts_type_int' => 'Pts', 'object_messages.affectedMessages_param_pts_count_type_int' => 'Pts count', 'object_contactLinkUnknown' => 'Contact link unknown', 'object_contactLinkNone' => 'Contact link none', 'object_contactLinkHasPhone' => 'Contact link has phone', 'object_contactLinkContact' => 'Contact link contact', 'object_webPageEmpty' => 'Empty web page', 'object_webPageEmpty_param_id_type_long' => 'ID', 'object_webPagePending' => 'Web page pending', 'object_webPagePending_param_id_type_long' => 'ID', 'object_webPagePending_param_date_type_int' => 'Date', 'object_webPage' => 'Web page', 'object_webPage_param_id_type_long' => 'ID', 'object_webPage_param_url_type_string' => 'URL', 'object_webPage_param_display_url_type_string' => 'Display URL', 'object_webPage_param_hash_type_int' => 'Hash', 'object_webPage_param_type_type_string' => 'Type', 'object_webPage_param_site_name_type_string' => 'Site name', 'object_webPage_param_title_type_string' => 'Title', 'object_webPage_param_description_type_string' => 'Description', 'object_webPage_param_photo_type_Photo' => 'Photo', 'object_webPage_param_embed_url_type_string' => 'Embed URL', 'object_webPage_param_embed_type_type_string' => 'Embed type', 'object_webPage_param_embed_width_type_int' => 'Embed width', 'object_webPage_param_embed_height_type_int' => 'Embed height', 'object_webPage_param_duration_type_int' => 'Duration', 'object_webPage_param_author_type_string' => 'Author', 'object_webPage_param_document_type_Document' => 'Document', 'object_webPage_param_cached_page_type_Page' => 'Cached page', 'object_webPageNotModified' => 'Web page not modified', 'object_authorization' => 'Authorization', 'object_authorization_param_hash_type_long' => 'Hash', 'object_authorization_param_device_model_type_string' => 'Device model', 'object_authorization_param_platform_type_string' => 'Platform', 'object_authorization_param_system_version_type_string' => 'System version', 'object_authorization_param_api_id_type_int' => 'Api ID', 'object_authorization_param_app_name_type_string' => 'App name', 'object_authorization_param_app_version_type_string' => 'App version', 'object_authorization_param_date_created_type_int' => 'Date created', 'object_authorization_param_date_active_type_int' => 'Date active', 'object_authorization_param_ip_type_string' => 'Ip', 'object_authorization_param_country_type_string' => 'Country', 'object_authorization_param_region_type_string' => 'Region', 'object_account.authorizations' => 'Authorized clients for this account', 'object_account.authorizations_param_authorizations_type_Vector t' => 'Authorizations', 'object_account.noPassword' => 'No password', 'object_account.noPassword_param_new_salt_type_bytes' => 'New salt', 'object_account.noPassword_param_email_unconfirmed_pattern_type_string' => 'Email unconfirmed pattern', 'object_account.password' => 'Password', 'object_account.password_param_current_salt_type_bytes' => 'Current salt', 'object_account.password_param_new_salt_type_bytes' => 'New salt', 'object_account.password_param_hint_type_string' => 'Hint', 'object_account.password_param_has_recovery_type_Bool' => 'Has recovery?', 'object_account.password_param_email_unconfirmed_pattern_type_string' => 'Email unconfirmed pattern', 'object_account.passwordSettings' => 'Password settings', 'object_account.passwordSettings_param_email_type_string' => 'Email', 'object_account.passwordInputSettings' => '2FA password settings', 'object_account.passwordInputSettings_param_new_salt_type_bytes' => '`$new_salt = $MadelineProto->account->getPassword()[\'new_salt\'].$MadelineProto->random(8);`', 'object_account.passwordInputSettings_param_new_password_hash_type_bytes' => '`hash(\'sha256\', $new_salt.$new_password.$new_salt, true)`', 'object_account.passwordInputSettings_param_hint_type_string' => 'Hint', 'object_account.passwordInputSettings_param_email_type_string' => 'Email', 'object_auth.passwordRecovery' => 'Password recovery', 'object_auth.passwordRecovery_param_email_pattern_type_string' => 'Email pattern', 'object_receivedNotifyMessage' => 'Received notify message', 'object_receivedNotifyMessage_param_id_type_int' => 'ID', 'object_chatInviteEmpty' => 'Empty chat invite', 'object_chatInviteExported' => 'Exported chat invite', 'object_chatInviteExported_param_link_type_string' => 'Link', 'object_chatInviteAlready' => 'Invite of a chat of which I am already member ', 'object_chatInviteAlready_param_chat_type_Chat' => 'Chat', 'object_chatInvite' => 'Chat invite', 'object_chatInvite_param_channel_type_true' => 'Channel?', 'object_chatInvite_param_broadcast_type_true' => 'Broadcast?', 'object_chatInvite_param_public_type_true' => 'Public?', 'object_chatInvite_param_megagroup_type_true' => 'Megagroup?', 'object_chatInvite_param_title_type_string' => 'Title', 'object_chatInvite_param_photo_type_ChatPhoto' => 'Photo', 'object_chatInvite_param_participants_count_type_int' => 'Participants count', 'object_chatInvite_param_participants_type_Vector t' => 'Participants', 'object_inputStickerSetEmpty' => 'Empty input sticker set', 'object_inputStickerSetID' => 'Sticker set ID', 'object_inputStickerSetID_param_id_type_long' => 'ID', 'object_inputStickerSetID_param_access_hash_type_long' => 'Access hash', 'object_inputStickerSetShortName' => 'Sticker set short name', 'object_inputStickerSetShortName_param_short_name_type_string' => 'Short name', 'object_stickerSet' => 'Sticker set', 'object_stickerSet_param_installed_type_true' => 'Installed?', 'object_stickerSet_param_archived_type_true' => 'Archived?', 'object_stickerSet_param_official_type_true' => 'Official?', 'object_stickerSet_param_masks_type_true' => 'Masks?', 'object_stickerSet_param_id_type_long' => 'ID', 'object_stickerSet_param_access_hash_type_long' => 'Access hash', 'object_stickerSet_param_title_type_string' => 'Title', 'object_stickerSet_param_short_name_type_string' => 'Short name', 'object_stickerSet_param_count_type_int' => 'Count', 'object_stickerSet_param_hash_type_int' => 'Hash', 'object_messages.stickerSet' => 'Sticker set', 'object_messages.stickerSet_param_set_type_StickerSet' => 'Set', 'object_messages.stickerSet_param_packs_type_Vector t' => 'Packs', 'object_messages.stickerSet_param_documents_type_Vector t' => 'Documents', 'object_botInfo' => 'Bot info', 'object_botInfo_param_user_id_type_int' => 'User ID', 'object_botInfo_param_description_type_string' => 'Description', 'object_botInfo_param_commands_type_Vector t' => 'Commands', 'object_keyboardButton' => 'Keyboard button', 'object_keyboardButton_param_text_type_string' => 'Text', 'object_keyboardButtonUrl' => 'Keyboard button URL', 'object_keyboardButtonUrl_param_text_type_string' => 'Text', 'object_keyboardButtonUrl_param_url_type_string' => 'URL', 'object_keyboardButtonCallback' => 'Keyboard button callback', 'object_keyboardButtonCallback_param_text_type_string' => 'Text', 'object_keyboardButtonCallback_param_data_type_bytes' => 'Data', 'object_keyboardButtonRequestPhone' => 'Keyboard button request phone', 'object_keyboardButtonRequestPhone_param_text_type_string' => 'Text', 'object_keyboardButtonRequestGeoLocation' => 'Keyboard button request geo location', 'object_keyboardButtonRequestGeoLocation_param_text_type_string' => 'Text', 'object_keyboardButtonSwitchInline' => 'Keyboard button switch inline', 'object_keyboardButtonSwitchInline_param_same_peer_type_true' => 'Same peer?', 'object_keyboardButtonSwitchInline_param_text_type_string' => 'Text', 'object_keyboardButtonSwitchInline_param_query_type_string' => 'Query', 'object_keyboardButtonGame' => 'Keyboard button game', 'object_keyboardButtonGame_param_text_type_string' => 'Text', 'object_keyboardButtonBuy' => 'Keyboard button buy', 'object_keyboardButtonBuy_param_text_type_string' => 'Text', 'object_keyboardButtonRow' => 'Keyboard button row', 'object_keyboardButtonRow_param_buttons_type_Vector t' => 'Buttons', 'object_replyKeyboardHide' => 'Reply keyboard hide', 'object_replyKeyboardHide_param_selective_type_true' => 'Selective?', 'object_replyKeyboardForceReply' => 'Reply keyboard force reply', 'object_replyKeyboardForceReply_param_single_use_type_true' => 'Single use?', 'object_replyKeyboardForceReply_param_selective_type_true' => 'Selective?', 'object_replyKeyboardMarkup' => 'Reply keyboard markup', 'object_replyKeyboardMarkup_param_resize_type_true' => 'Resize?', 'object_replyKeyboardMarkup_param_single_use_type_true' => 'Single use?', 'object_replyKeyboardMarkup_param_selective_type_true' => 'Selective?', 'object_replyKeyboardMarkup_param_rows_type_Vector t' => 'Rows', 'object_replyInlineMarkup' => 'Reply inline markup', 'object_replyInlineMarkup_param_rows_type_Vector t' => 'Rows', 'object_messageEntityUnknown' => 'Message entity unknown', 'object_messageEntityUnknown_param_offset_type_int' => 'Offset', 'object_messageEntityUnknown_param_length_type_int' => 'Length', 'object_messageEntityMention' => 'Message entity mention', 'object_messageEntityMention_param_offset_type_int' => 'Offset', 'object_messageEntityMention_param_length_type_int' => 'Length', 'object_messageEntityHashtag' => 'Message entity hashtag', 'object_messageEntityHashtag_param_offset_type_int' => 'Offset', 'object_messageEntityHashtag_param_length_type_int' => 'Length', 'object_messageEntityBotCommand' => 'Message entity bot command', 'object_messageEntityBotCommand_param_offset_type_int' => 'Offset', 'object_messageEntityBotCommand_param_length_type_int' => 'Length', 'object_messageEntityUrl' => 'Message entity URL', 'object_messageEntityUrl_param_offset_type_int' => 'Offset', 'object_messageEntityUrl_param_length_type_int' => 'Length', 'object_messageEntityEmail' => 'Message entity email', 'object_messageEntityEmail_param_offset_type_int' => 'Offset', 'object_messageEntityEmail_param_length_type_int' => 'Length', 'object_messageEntityBold' => 'Message entity bold', 'object_messageEntityBold_param_offset_type_int' => 'Offset', 'object_messageEntityBold_param_length_type_int' => 'Length', 'object_messageEntityItalic' => 'Message entity italic', 'object_messageEntityItalic_param_offset_type_int' => 'Offset', 'object_messageEntityItalic_param_length_type_int' => 'Length', 'object_messageEntityCode' => 'Message entity code', 'object_messageEntityCode_param_offset_type_int' => 'Offset', 'object_messageEntityCode_param_length_type_int' => 'Length', 'object_messageEntityPre' => 'Message entity pre', 'object_messageEntityPre_param_offset_type_int' => 'Offset', 'object_messageEntityPre_param_length_type_int' => 'Length', 'object_messageEntityPre_param_language_type_string' => 'Language', 'object_messageEntityTextUrl' => 'Message entity text URL', 'object_messageEntityTextUrl_param_offset_type_int' => 'Offset', 'object_messageEntityTextUrl_param_length_type_int' => 'Length', 'object_messageEntityTextUrl_param_url_type_string' => 'URL', 'object_messageEntityMentionName' => 'Message entity mention name', 'object_messageEntityMentionName_param_offset_type_int' => 'Offset', 'object_messageEntityMentionName_param_length_type_int' => 'Length', 'object_messageEntityMentionName_param_user_id_type_int' => 'User ID', 'object_inputMessageEntityMentionName' => 'Message entity mention name', 'object_inputMessageEntityMentionName_param_offset_type_int' => 'Offset', 'object_inputMessageEntityMentionName_param_length_type_int' => 'Length', 'object_inputMessageEntityMentionName_param_user_id_type_InputUser' => 'User ID', 'object_inputChannelEmpty' => 'Empty input channel', 'object_inputChannel' => 'Channel', 'object_inputChannel_param_channel_id_type_int' => 'Channel ID', 'object_inputChannel_param_access_hash_type_long' => 'Access hash', 'object_contacts.resolvedPeer' => 'Resolved peer', 'object_contacts.resolvedPeer_param_peer_type_Peer' => 'Peer', 'object_contacts.resolvedPeer_param_chats_type_Vector t' => 'Chats', 'object_contacts.resolvedPeer_param_users_type_Vector t' => 'Users', 'object_messageRange' => 'Message range', 'object_messageRange_param_min_id_type_int' => 'Min ID', 'object_messageRange_param_max_id_type_int' => 'Max ID', 'object_updates.channelDifferenceEmpty' => 'Empty channel difference', 'object_updates.channelDifferenceEmpty_param_final_type_true' => 'Final?', 'object_updates.channelDifferenceEmpty_param_pts_type_int' => 'Pts', 'object_updates.channelDifferenceEmpty_param_timeout_type_int' => 'Timeout', 'object_updates.channelDifferenceTooLong' => 'Channel difference too long', 'object_updates.channelDifferenceTooLong_param_final_type_true' => 'Final?', 'object_updates.channelDifferenceTooLong_param_pts_type_int' => 'Pts', 'object_updates.channelDifferenceTooLong_param_timeout_type_int' => 'Timeout', 'object_updates.channelDifferenceTooLong_param_top_message_type_int' => 'Top message', 'object_updates.channelDifferenceTooLong_param_read_inbox_max_id_type_int' => 'Read inbox max ID', 'object_updates.channelDifferenceTooLong_param_read_outbox_max_id_type_int' => 'Read outbox max ID', 'object_updates.channelDifferenceTooLong_param_unread_count_type_int' => 'Unread count', 'object_updates.channelDifferenceTooLong_param_unread_mentions_count_type_int' => 'Unread mentions count', 'object_updates.channelDifferenceTooLong_param_messages_type_Vector t' => 'Messages', 'object_updates.channelDifferenceTooLong_param_chats_type_Vector t' => 'Chats', 'object_updates.channelDifferenceTooLong_param_users_type_Vector t' => 'Users', 'object_updates.channelDifference' => 'Channel difference', 'object_updates.channelDifference_param_final_type_true' => 'Final?', 'object_updates.channelDifference_param_pts_type_int' => 'Pts', 'object_updates.channelDifference_param_timeout_type_int' => 'Timeout', 'object_updates.channelDifference_param_new_messages_type_Vector t' => 'New messages', 'object_updates.channelDifference_param_other_updates_type_Vector t' => 'Other updates', 'object_updates.channelDifference_param_chats_type_Vector t' => 'Chats', 'object_updates.channelDifference_param_users_type_Vector t' => 'Users', 'object_channelMessagesFilterEmpty' => 'Empty channel messages filter', 'object_channelMessagesFilter' => 'Channel messages filter', 'object_channelMessagesFilter_param_exclude_new_messages_type_true' => 'Exclude new messages?', 'object_channelMessagesFilter_param_ranges_type_Vector t' => 'Ranges', 'object_channelParticipant' => 'Channel participant', 'object_channelParticipant_param_user_id_type_int' => 'User ID', 'object_channelParticipant_param_date_type_int' => 'Date', 'object_channelParticipantSelf' => 'Channel participant self', 'object_channelParticipantSelf_param_user_id_type_int' => 'User ID', 'object_channelParticipantSelf_param_inviter_id_type_int' => 'Inviter ID', 'object_channelParticipantSelf_param_date_type_int' => 'Date', 'object_channelParticipantCreator' => 'Channel participant creator', 'object_channelParticipantCreator_param_user_id_type_int' => 'User ID', 'object_channelParticipantAdmin' => 'Channel participant admin', 'object_channelParticipantAdmin_param_can_edit_type_true' => 'Can edit?', 'object_channelParticipantAdmin_param_user_id_type_int' => 'User ID', 'object_channelParticipantAdmin_param_inviter_id_type_int' => 'Inviter ID', 'object_channelParticipantAdmin_param_promoted_by_type_int' => 'Promoted by', 'object_channelParticipantAdmin_param_date_type_int' => 'Date', 'object_channelParticipantAdmin_param_admin_rights_type_ChannelAdminRights' => 'Admin rights', 'object_channelParticipantBanned' => 'Channel participant banned', 'object_channelParticipantBanned_param_left_type_true' => 'Left?', 'object_channelParticipantBanned_param_user_id_type_int' => 'User ID', 'object_channelParticipantBanned_param_kicked_by_type_int' => 'Kicked by', 'object_channelParticipantBanned_param_date_type_int' => 'Date', 'object_channelParticipantBanned_param_banned_rights_type_ChannelBannedRights' => 'Banned rights', 'object_channelParticipantsRecent' => 'Channel participants recent', 'object_channelParticipantsAdmins' => 'Channel participants admins', 'object_channelParticipantsKicked' => 'Channel participants kicked', 'object_channelParticipantsKicked_param_q_type_string' => 'Query', 'object_channelParticipantsBots' => 'Channel participants bots', 'object_channelParticipantsBanned' => 'Channel participants banned', 'object_channelParticipantsBanned_param_q_type_string' => 'Query', 'object_channelParticipantsSearch' => 'Channel participants search', 'object_channelParticipantsSearch_param_q_type_string' => 'Query', 'object_channels.channelParticipants' => 'Channel participants', 'object_channels.channelParticipants_param_count_type_int' => 'Count', 'object_channels.channelParticipants_param_participants_type_Vector t' => 'Participants', 'object_channels.channelParticipants_param_users_type_Vector t' => 'Users', 'object_channels.channelParticipantsNotModified' => 'Channel participants not modified', 'object_channels.channelParticipant' => 'Channel participant', 'object_channels.channelParticipant_param_participant_type_ChannelParticipant' => 'Participant', 'object_channels.channelParticipant_param_users_type_Vector t' => 'Users', 'object_help.termsOfService' => 'Terms of service', 'object_help.termsOfService_param_text_type_string' => 'Text', 'object_foundGif' => 'Found gif', 'object_foundGif_param_url_type_string' => 'URL', 'object_foundGif_param_thumb_url_type_string' => 'Thumbnail URL', 'object_foundGif_param_content_url_type_string' => 'Content URL', 'object_foundGif_param_content_type_type_string' => 'Content type', 'object_foundGif_param_w_type_int' => 'Width', 'object_foundGif_param_h_type_int' => 'Height', 'object_foundGifCached' => 'Found gif cached', 'object_foundGifCached_param_url_type_string' => 'URL', 'object_foundGifCached_param_photo_type_Photo' => 'Photo', 'object_foundGifCached_param_document_type_Document' => 'Document', 'object_messages.foundGifs' => 'Found gifs', 'object_messages.foundGifs_param_next_offset_type_int' => 'Next offset', 'object_messages.foundGifs_param_results_type_Vector t' => 'Results', 'object_messages.savedGifsNotModified' => 'Saved gifs not modified', 'object_messages.savedGifs' => 'Saved gifs', 'object_messages.savedGifs_param_hash_type_int' => 'Hash', 'object_messages.savedGifs_param_gifs_type_Vector t' => 'Gifs', 'object_inputBotInlineMessageMediaAuto' => 'Bot inline message media auto', 'object_inputBotInlineMessageMediaAuto_param_message_type_string' => 'Message', 'object_inputBotInlineMessageMediaAuto_param_entities_type_Vector t' => 'Entities', 'object_inputBotInlineMessageMediaAuto_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_inputBotInlineMessageText' => 'Bot inline message text', 'object_inputBotInlineMessageText_param_no_webpage_type_true' => 'No webpage?', 'object_inputBotInlineMessageText_param_message_type_string' => 'Message', 'object_inputBotInlineMessageText_param_entities_type_Vector t' => 'Entities', 'object_inputBotInlineMessageText_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_inputBotInlineMessageMediaGeo' => 'Bot inline message media geo', 'object_inputBotInlineMessageMediaGeo_param_geo_point_type_InputGeoPoint' => 'Geo point', 'object_inputBotInlineMessageMediaGeo_param_period_type_int' => 'Period', 'object_inputBotInlineMessageMediaGeo_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_inputBotInlineMessageMediaVenue' => 'Bot inline message media venue', 'object_inputBotInlineMessageMediaVenue_param_geo_point_type_InputGeoPoint' => 'Geo point', 'object_inputBotInlineMessageMediaVenue_param_title_type_string' => 'Title', 'object_inputBotInlineMessageMediaVenue_param_address_type_string' => 'Address', 'object_inputBotInlineMessageMediaVenue_param_provider_type_string' => 'Provider', 'object_inputBotInlineMessageMediaVenue_param_venue_id_type_string' => 'Venue ID', 'object_inputBotInlineMessageMediaVenue_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_inputBotInlineMessageMediaContact' => 'Bot inline message media contact', 'object_inputBotInlineMessageMediaContact_param_phone_number_type_string' => 'Phone number', 'object_inputBotInlineMessageMediaContact_param_first_name_type_string' => 'First name', 'object_inputBotInlineMessageMediaContact_param_last_name_type_string' => 'Last name', 'object_inputBotInlineMessageMediaContact_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_inputBotInlineMessageGame' => 'Bot inline message game', 'object_inputBotInlineMessageGame_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_inputBotInlineResult' => 'Bot inline result', 'object_inputBotInlineResult_param_id_type_string' => 'ID', 'object_inputBotInlineResult_param_type_type_string' => 'Type', 'object_inputBotInlineResult_param_title_type_string' => 'Title', 'object_inputBotInlineResult_param_description_type_string' => 'Description', 'object_inputBotInlineResult_param_url_type_string' => 'URL', 'object_inputBotInlineResult_param_thumb_url_type_string' => 'Thumbnail URL', 'object_inputBotInlineResult_param_content_url_type_string' => 'Content URL', 'object_inputBotInlineResult_param_content_type_type_string' => 'Content type', 'object_inputBotInlineResult_param_w_type_int' => 'Width', 'object_inputBotInlineResult_param_h_type_int' => 'Height', 'object_inputBotInlineResult_param_duration_type_int' => 'Duration', 'object_inputBotInlineResult_param_send_message_type_InputBotInlineMessage' => 'Message to send', 'object_inputBotInlineResultPhoto' => 'Bot inline result photo', 'object_inputBotInlineResultPhoto_param_id_type_string' => 'ID', 'object_inputBotInlineResultPhoto_param_type_type_string' => 'Type', 'object_inputBotInlineResultPhoto_param_photo_type_InputPhoto' => 'Photo', 'object_inputBotInlineResultPhoto_param_send_message_type_InputBotInlineMessage' => 'Message to send', 'object_inputBotInlineResultDocument' => 'Bot inline result document', 'object_inputBotInlineResultDocument_param_id_type_string' => 'ID', 'object_inputBotInlineResultDocument_param_type_type_string' => 'Type', 'object_inputBotInlineResultDocument_param_title_type_string' => 'Title', 'object_inputBotInlineResultDocument_param_description_type_string' => 'Description', 'object_inputBotInlineResultDocument_param_document_type_InputDocument' => 'Document', 'object_inputBotInlineResultDocument_param_send_message_type_InputBotInlineMessage' => 'Message to send', 'object_inputBotInlineResultGame' => 'Bot inline result game', 'object_inputBotInlineResultGame_param_id_type_string' => 'ID', 'object_inputBotInlineResultGame_param_short_name_type_string' => 'Short name', 'object_inputBotInlineResultGame_param_send_message_type_InputBotInlineMessage' => 'Message to send', 'object_botInlineMessageMediaAuto' => 'Bot inline message media auto', 'object_botInlineMessageMediaAuto_param_message_type_string' => 'Message', 'object_botInlineMessageMediaAuto_param_entities_type_Vector t' => 'Entities', 'object_botInlineMessageMediaAuto_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_botInlineMessageText' => 'Bot inline message text', 'object_botInlineMessageText_param_no_webpage_type_true' => 'No webpage?', 'object_botInlineMessageText_param_message_type_string' => 'Message', 'object_botInlineMessageText_param_entities_type_Vector t' => 'Entities', 'object_botInlineMessageText_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_botInlineMessageMediaGeo' => 'Bot inline message media geo', 'object_botInlineMessageMediaGeo_param_geo_type_GeoPoint' => 'Geo', 'object_botInlineMessageMediaGeo_param_period_type_int' => 'Period', 'object_botInlineMessageMediaGeo_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_botInlineMessageMediaVenue' => 'Bot inline message media venue', 'object_botInlineMessageMediaVenue_param_geo_type_GeoPoint' => 'Geo', 'object_botInlineMessageMediaVenue_param_title_type_string' => 'Title', 'object_botInlineMessageMediaVenue_param_address_type_string' => 'Address', 'object_botInlineMessageMediaVenue_param_provider_type_string' => 'Provider', 'object_botInlineMessageMediaVenue_param_venue_id_type_string' => 'Venue ID', 'object_botInlineMessageMediaVenue_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_botInlineMessageMediaContact' => 'Bot inline message media contact', 'object_botInlineMessageMediaContact_param_phone_number_type_string' => 'Phone number', 'object_botInlineMessageMediaContact_param_first_name_type_string' => 'First name', 'object_botInlineMessageMediaContact_param_last_name_type_string' => 'Last name', 'object_botInlineMessageMediaContact_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_botInlineResult' => 'Bot inline result', 'object_botInlineResult_param_id_type_string' => 'ID', 'object_botInlineResult_param_type_type_string' => 'Type', 'object_botInlineResult_param_title_type_string' => 'Title', 'object_botInlineResult_param_description_type_string' => 'Description', 'object_botInlineResult_param_url_type_string' => 'URL', 'object_botInlineResult_param_thumb_url_type_string' => 'Thumbnail URL', 'object_botInlineResult_param_content_url_type_string' => 'Content URL', 'object_botInlineResult_param_content_type_type_string' => 'Content type', 'object_botInlineResult_param_w_type_int' => 'Width', 'object_botInlineResult_param_h_type_int' => 'Height', 'object_botInlineResult_param_duration_type_int' => 'Duration', 'object_botInlineResult_param_send_message_type_BotInlineMessage' => 'Message to send', 'object_botInlineMediaResult' => 'Bot inline media result', 'object_botInlineMediaResult_param_id_type_string' => 'ID', 'object_botInlineMediaResult_param_type_type_string' => 'Type', 'object_botInlineMediaResult_param_photo_type_Photo' => 'Photo', 'object_botInlineMediaResult_param_document_type_Document' => 'Document', 'object_botInlineMediaResult_param_title_type_string' => 'Title', 'object_botInlineMediaResult_param_description_type_string' => 'Description', 'object_botInlineMediaResult_param_send_message_type_BotInlineMessage' => 'Send message', 'object_messages.botResults' => 'Bot results', 'object_messages.botResults_param_gallery_type_true' => 'Gallery?', 'object_messages.botResults_param_query_id_type_long' => 'Query ID', 'object_messages.botResults_param_next_offset_type_string' => 'Next offset', 'object_messages.botResults_param_switch_pm_type_InlineBotSwitchPM' => 'Switch pm', 'object_messages.botResults_param_results_type_Vector t' => 'Results', 'object_messages.botResults_param_cache_time_type_int' => 'Cache time', 'object_messages.botResults_param_users_type_Vector t' => 'Users', 'object_exportedMessageLink' => 'Exported message link', 'object_exportedMessageLink_param_link_type_string' => 'Link', 'object_exportedMessageLink_param_html_type_string' => 'Html', 'object_messageFwdHeader' => 'Forwarded message info', 'object_messageFwdHeader_param_from_id_type_int' => 'From ID', 'object_messageFwdHeader_param_date_type_int' => 'Date', 'object_messageFwdHeader_param_channel_id_type_int' => 'Channel ID', 'object_messageFwdHeader_param_channel_post_type_int' => 'Channel post', 'object_messageFwdHeader_param_post_author_type_string' => 'Post author', 'object_messageFwdHeader_param_saved_from_peer_type_Peer' => 'Saved from peer', 'object_messageFwdHeader_param_saved_from_msg_id_type_int' => 'Saved from msg ID', 'object_auth.codeTypeSms' => 'Auth code type: SMS', 'object_auth.codeTypeCall' => 'Auth code type: call', 'object_auth.codeTypeFlashCall' => 'Auth code type: flash call', 'object_auth.sentCodeTypeApp' => 'Sent code type app', 'object_auth.sentCodeTypeApp_param_length_type_int' => 'Length', 'object_auth.sentCodeTypeSms' => 'Sent code type sms', 'object_auth.sentCodeTypeSms_param_length_type_int' => 'Length', 'object_auth.sentCodeTypeCall' => 'Sent code type call', 'object_auth.sentCodeTypeCall_param_length_type_int' => 'Length', 'object_auth.sentCodeTypeFlashCall' => 'Sent code type flash call', 'object_auth.sentCodeTypeFlashCall_param_pattern_type_string' => 'Pattern', 'object_messages.botCallbackAnswer' => 'Bot callback answer', 'object_messages.botCallbackAnswer_param_alert_type_true' => 'Alert?', 'object_messages.botCallbackAnswer_param_has_url_type_true' => 'Has URL?', 'object_messages.botCallbackAnswer_param_native_ui_type_true' => 'Native ui?', 'object_messages.botCallbackAnswer_param_message_type_string' => 'Message', 'object_messages.botCallbackAnswer_param_url_type_string' => 'URL', 'object_messages.botCallbackAnswer_param_cache_time_type_int' => 'Cache time', 'object_messages.messageEditData' => 'Message edit data', 'object_messages.messageEditData_param_caption_type_true' => 'Caption?', 'object_inputBotInlineMessageID' => 'Bot inline message ID', 'object_inputBotInlineMessageID_param_dc_id_type_int' => 'DC ID', 'object_inputBotInlineMessageID_param_id_type_long' => 'ID', 'object_inputBotInlineMessageID_param_access_hash_type_long' => 'Access hash', 'object_inlineBotSwitchPM' => 'Inline bot switch pm', 'object_inlineBotSwitchPM_param_text_type_string' => 'Text', 'object_inlineBotSwitchPM_param_start_param_type_string' => 'Start param', 'object_messages.peerDialogs' => 'Peer dialogs', 'object_messages.peerDialogs_param_dialogs_type_Vector t' => 'Dialogs', 'object_messages.peerDialogs_param_messages_type_Vector t' => 'Messages', 'object_messages.peerDialogs_param_chats_type_Vector t' => 'Chats', 'object_messages.peerDialogs_param_users_type_Vector t' => 'Users', 'object_messages.peerDialogs_param_state_type_updates.State' => 'State', 'object_topPeer' => 'Top peer', 'object_topPeer_param_peer_type_Peer' => 'Peer', 'object_topPeer_param_rating_type_double' => 'Rating', 'object_topPeerCategoryBotsPM' => 'Top peer category bots pm', 'object_topPeerCategoryBotsInline' => 'Top peer category bots inline', 'object_topPeerCategoryCorrespondents' => 'Top peer category correspondents', 'object_topPeerCategoryGroups' => 'Top peer category groups', 'object_topPeerCategoryChannels' => 'Top peer category channels', 'object_topPeerCategoryPhoneCalls' => 'Top peer category phone calls', 'object_topPeerCategoryPeers' => 'Top peer category peers', 'object_topPeerCategoryPeers_param_category_type_TopPeerCategory' => 'Category', 'object_topPeerCategoryPeers_param_count_type_int' => 'Count', 'object_topPeerCategoryPeers_param_peers_type_Vector t' => 'Peers', 'object_contacts.topPeersNotModified' => 'Top peers not modified', 'object_contacts.topPeers' => 'Top peers', 'object_contacts.topPeers_param_categories_type_Vector t' => 'Categories', 'object_contacts.topPeers_param_chats_type_Vector t' => 'Chats', 'object_contacts.topPeers_param_users_type_Vector t' => 'Users', 'object_draftMessageEmpty' => 'Empty draft message', 'object_draftMessage' => 'Draft message', 'object_draftMessage_param_no_webpage_type_true' => 'No webpage?', 'object_draftMessage_param_reply_to_msg_id_type_int' => 'Reply to msg ID', 'object_draftMessage_param_message_type_string' => 'Message', 'object_draftMessage_param_entities_type_Vector t' => 'Entities', 'object_draftMessage_param_date_type_int' => 'Date', 'object_messages.featuredStickersNotModified' => 'Featured stickers not modified', 'object_messages.featuredStickers' => 'Featured stickers', 'object_messages.featuredStickers_param_hash_type_int' => 'Hash', 'object_messages.featuredStickers_param_sets_type_Vector t' => 'Sets', 'object_messages.featuredStickers_param_unread_type_Vector t' => 'Unread', 'object_messages.recentStickersNotModified' => 'Recent stickers not modified', 'object_messages.recentStickers' => 'Recent stickers', 'object_messages.recentStickers_param_hash_type_int' => 'Hash', 'object_messages.recentStickers_param_stickers_type_Vector t' => 'Stickers', 'object_messages.archivedStickers' => 'Archived stickers', 'object_messages.archivedStickers_param_count_type_int' => 'Count', 'object_messages.archivedStickers_param_sets_type_Vector t' => 'Sets', 'object_messages.stickerSetInstallResultSuccess' => 'Sticker set install result success', 'object_messages.stickerSetInstallResultArchive' => 'Sticker set install result archive', 'object_messages.stickerSetInstallResultArchive_param_sets_type_Vector t' => 'Sets', 'object_stickerSetCovered' => 'Sticker set covered', 'object_stickerSetCovered_param_set_type_StickerSet' => 'Set', 'object_stickerSetCovered_param_cover_type_Document' => 'Cover', 'object_stickerSetMultiCovered' => 'Sticker set multi covered', 'object_stickerSetMultiCovered_param_set_type_StickerSet' => 'Set', 'object_stickerSetMultiCovered_param_covers_type_Vector t' => 'Covers', 'object_maskCoords' => 'Mask coords', 'object_maskCoords_param_n_type_int' => 'N', 'object_maskCoords_param_x_type_double' => 'X', 'object_maskCoords_param_y_type_double' => 'Y', 'object_maskCoords_param_zoom_type_double' => 'Zoom', 'object_inputStickeredMediaPhoto' => 'Stickered media photo', 'object_inputStickeredMediaPhoto_param_id_type_InputPhoto' => 'ID', 'object_inputStickeredMediaDocument' => 'Stickered media document', 'object_inputStickeredMediaDocument_param_id_type_InputDocument' => 'ID', 'object_game' => 'Game', 'object_game_param_id_type_long' => 'ID', 'object_game_param_access_hash_type_long' => 'Access hash', 'object_game_param_short_name_type_string' => 'Short name', 'object_game_param_title_type_string' => 'Title', 'object_game_param_description_type_string' => 'Description', 'object_game_param_photo_type_Photo' => 'Photo', 'object_game_param_document_type_Document' => 'Document', 'object_inputGameID' => 'Game ID', 'object_inputGameID_param_id_type_long' => 'ID', 'object_inputGameID_param_access_hash_type_long' => 'Access hash', 'object_inputGameShortName' => 'Game short name', 'object_inputGameShortName_param_bot_id_type_InputUser' => 'Bot ID', 'object_inputGameShortName_param_short_name_type_string' => 'Short name', 'object_highScore' => 'High score', 'object_highScore_param_pos_type_int' => 'Pos', 'object_highScore_param_user_id_type_int' => 'User ID', 'object_highScore_param_score_type_int' => 'Score', 'object_messages.highScores' => 'High scores', 'object_messages.highScores_param_scores_type_Vector t' => 'Scores', 'object_messages.highScores_param_users_type_Vector t' => 'Users', 'object_textEmpty' => 'Empty text', 'object_textPlain' => 'Text plain', 'object_textPlain_param_text_type_string' => 'Text', 'object_textBold' => 'Text bold', 'object_textBold_param_text_type_RichText' => 'Text', 'object_textItalic' => 'Text italic', 'object_textItalic_param_text_type_RichText' => 'Text', 'object_textUnderline' => 'Text underline', 'object_textUnderline_param_text_type_RichText' => 'Text', 'object_textStrike' => 'Text strike', 'object_textStrike_param_text_type_RichText' => 'Text', 'object_textFixed' => 'Text fixed', 'object_textFixed_param_text_type_RichText' => 'Text', 'object_textUrl' => 'Text URL', 'object_textUrl_param_text_type_RichText' => 'Text', 'object_textUrl_param_url_type_string' => 'URL', 'object_textUrl_param_webpage_id_type_long' => 'Webpage ID', 'object_textEmail' => 'Text email', 'object_textEmail_param_text_type_RichText' => 'Text', 'object_textEmail_param_email_type_string' => 'Email', 'object_textConcat' => 'Text concat', 'object_textConcat_param_texts_type_Vector t' => 'Texts', 'object_pageBlockUnsupported' => 'Page block unsupported', 'object_pageBlockTitle' => 'Page block title', 'object_pageBlockTitle_param_text_type_RichText' => 'Text', 'object_pageBlockSubtitle' => 'Page block subtitle', 'object_pageBlockSubtitle_param_text_type_RichText' => 'Text', 'object_pageBlockAuthorDate' => 'Page block author date', 'object_pageBlockAuthorDate_param_author_type_RichText' => 'Author', 'object_pageBlockAuthorDate_param_published_date_type_int' => 'Published date', 'object_pageBlockHeader' => 'Page block header', 'object_pageBlockHeader_param_text_type_RichText' => 'Text', 'object_pageBlockSubheader' => 'Page block subheader', 'object_pageBlockSubheader_param_text_type_RichText' => 'Text', 'object_pageBlockFooter' => 'Page block footer', 'object_pageBlockFooter_param_text_type_RichText' => 'Text', 'object_pageBlockList' => 'Page block list', 'object_pageBlockList_param_ordered_type_Bool' => 'Ordered?', 'object_pageBlockList_param_items_type_Vector t' => 'Items', 'object_pageBlockBlockquote' => 'Page block blockquote', 'object_pageBlockBlockquote_param_text_type_RichText' => 'Text', 'object_pageBlockBlockquote_param_caption_type_RichText' => 'Caption', 'object_pageBlockPullquote' => 'Page block pullquote', 'object_pageBlockPullquote_param_text_type_RichText' => 'Text', 'object_pageBlockPullquote_param_caption_type_RichText' => 'Caption', 'object_pageBlockPhoto' => 'Page block photo', 'object_pageBlockPhoto_param_photo_id_type_long' => 'Photo ID', 'object_pageBlockPhoto_param_caption_type_RichText' => 'Caption', 'object_pageBlockVideo' => 'Page block video', 'object_pageBlockVideo_param_autoplay_type_true' => 'Autoplay?', 'object_pageBlockVideo_param_loop_type_true' => 'Loop?', 'object_pageBlockVideo_param_video_id_type_long' => 'Video ID', 'object_pageBlockVideo_param_caption_type_RichText' => 'Caption', 'object_pageBlockEmbed' => 'Page block embed', 'object_pageBlockEmbed_param_full_width_type_true' => 'Full width?', 'object_pageBlockEmbed_param_allow_scrolling_type_true' => 'Allow scrolling?', 'object_pageBlockEmbed_param_url_type_string' => 'URL', 'object_pageBlockEmbed_param_html_type_string' => 'Html', 'object_pageBlockEmbed_param_poster_photo_id_type_long' => 'Poster photo ID', 'object_pageBlockEmbed_param_w_type_int' => 'Width', 'object_pageBlockEmbed_param_h_type_int' => 'Height', 'object_pageBlockEmbed_param_caption_type_RichText' => 'Caption', 'object_pageBlockEmbedPost' => 'Page block embed post', 'object_pageBlockEmbedPost_param_url_type_string' => 'URL', 'object_pageBlockEmbedPost_param_webpage_id_type_long' => 'Webpage ID', 'object_pageBlockEmbedPost_param_author_photo_id_type_long' => 'Author photo ID', 'object_pageBlockEmbedPost_param_author_type_string' => 'Author', 'object_pageBlockEmbedPost_param_date_type_int' => 'Date', 'object_pageBlockEmbedPost_param_blocks_type_Vector t' => 'Blocks', 'object_pageBlockEmbedPost_param_caption_type_RichText' => 'Caption', 'object_pageBlockCollage' => 'Page block collage', 'object_pageBlockCollage_param_items_type_Vector t' => 'Items', 'object_pageBlockCollage_param_caption_type_RichText' => 'Caption', 'object_pageBlockSlideshow' => 'Page block slideshow', 'object_pageBlockSlideshow_param_items_type_Vector t' => 'Items', 'object_pageBlockSlideshow_param_caption_type_RichText' => 'Caption', 'object_pageBlockChannel' => 'Page block channel', 'object_pageBlockChannel_param_channel_type_Chat' => 'Channel', 'object_pageBlockAudio' => 'Page block audio', 'object_pageBlockAudio_param_audio_id_type_long' => 'Audio ID', 'object_pageBlockAudio_param_caption_type_RichText' => 'Caption', 'object_pagePart' => 'Page part', 'object_pagePart_param_blocks_type_Vector t' => 'Blocks', 'object_pagePart_param_photos_type_Vector t' => 'Photos', 'object_pagePart_param_documents_type_Vector t' => 'Documents', 'object_pageFull' => 'Page full', 'object_pageFull_param_blocks_type_Vector t' => 'Blocks', 'object_pageFull_param_photos_type_Vector t' => 'Photos', 'object_pageFull_param_documents_type_Vector t' => 'Documents', 'object_phoneCallDiscardReasonMissed' => 'Phone call discard reason missed', 'object_phoneCallDiscardReasonDisconnect' => 'Phone call discard reason disconnect', 'object_phoneCallDiscardReasonHangup' => 'Phone call discard reason hangup', 'object_phoneCallDiscardReasonBusy' => 'Phone call discard reason busy', 'object_dataJSON' => 'Data json', 'object_dataJSON_param_data_type_string' => 'Data', 'object_labeledPrice' => 'Labeled price', 'object_labeledPrice_param_label_type_string' => 'Label', 'object_labeledPrice_param_amount_type_long' => 'Amount', 'object_invoice' => 'Invoice', 'object_invoice_param_test_type_true' => 'Test?', 'object_invoice_param_name_requested_type_true' => 'Name requested?', 'object_invoice_param_phone_requested_type_true' => 'Phone requested?', 'object_invoice_param_email_requested_type_true' => 'Email requested?', 'object_invoice_param_shipping_address_requested_type_true' => 'Shipping address requested?', 'object_invoice_param_flexible_type_true' => 'Flexible?', 'object_invoice_param_phone_to_provider_type_true' => 'Phone to provider?', 'object_invoice_param_email_to_provider_type_true' => 'Email to provider?', 'object_invoice_param_currency_type_string' => 'Currency', 'object_invoice_param_prices_type_Vector t' => 'Prices', 'object_paymentCharge' => 'Payment charge', 'object_paymentCharge_param_id_type_string' => 'ID', 'object_paymentCharge_param_provider_charge_id_type_string' => 'Provider charge ID', 'object_postAddress' => 'Post address', 'object_postAddress_param_street_line1_type_string' => 'Street line1', 'object_postAddress_param_street_line2_type_string' => 'Street line2', 'object_postAddress_param_city_type_string' => 'City', 'object_postAddress_param_state_type_string' => 'State', 'object_postAddress_param_country_iso2_type_string' => 'Country iso2', 'object_postAddress_param_post_code_type_string' => 'Post code', 'object_paymentRequestedInfo' => 'Payment requested info', 'object_paymentRequestedInfo_param_name_type_string' => 'Name', 'object_paymentRequestedInfo_param_phone_type_string' => 'Phone', 'object_paymentRequestedInfo_param_email_type_string' => 'Email', 'object_paymentRequestedInfo_param_shipping_address_type_PostAddress' => 'Shipping address', 'object_paymentSavedCredentialsCard' => 'Payment saved credentials card', 'object_paymentSavedCredentialsCard_param_id_type_string' => 'ID', 'object_paymentSavedCredentialsCard_param_title_type_string' => 'Title', 'object_webDocument' => 'Web document', 'object_webDocument_param_url_type_string' => 'URL', 'object_webDocument_param_access_hash_type_long' => 'Access hash', 'object_webDocument_param_size_type_int' => 'Size', 'object_webDocument_param_mime_type_type_string' => 'Mime type', 'object_webDocument_param_attributes_type_Vector t' => 'Attributes', 'object_webDocument_param_dc_id_type_int' => 'DC ID', 'object_inputWebDocument' => 'Web document', 'object_inputWebDocument_param_url_type_string' => 'URL', 'object_inputWebDocument_param_size_type_int' => 'Size', 'object_inputWebDocument_param_mime_type_type_string' => 'Mime type', 'object_inputWebDocument_param_attributes_type_Vector t' => 'Attributes', 'object_inputWebFileLocation' => 'Web file location', 'object_inputWebFileLocation_param_url_type_string' => 'URL', 'object_inputWebFileLocation_param_access_hash_type_long' => 'Access hash', 'object_upload.webFile' => 'Web file', 'object_upload.webFile_param_size_type_int' => 'Size', 'object_upload.webFile_param_mime_type_type_string' => 'Mime type', 'object_upload.webFile_param_file_type_type_storage.FileType' => 'File type', 'object_upload.webFile_param_mtime_type_int' => 'Mtime', 'object_upload.webFile_param_bytes_type_bytes' => 'Bytes', 'object_payments.paymentForm' => 'Payment form', 'object_payments.paymentForm_param_can_save_credentials_type_true' => 'Can save credentials?', 'object_payments.paymentForm_param_password_missing_type_true' => 'Password missing?', 'object_payments.paymentForm_param_bot_id_type_int' => 'Bot ID', 'object_payments.paymentForm_param_invoice_type_Invoice' => 'Invoice', 'object_payments.paymentForm_param_provider_id_type_int' => 'Provider ID', 'object_payments.paymentForm_param_url_type_string' => 'URL', 'object_payments.paymentForm_param_native_provider_type_string' => 'Native provider', 'object_payments.paymentForm_param_native_params_type_DataJSON' => 'Native params', 'object_payments.paymentForm_param_saved_info_type_PaymentRequestedInfo' => 'Saved info', 'object_payments.paymentForm_param_saved_credentials_type_PaymentSavedCredentials' => 'Saved credentials', 'object_payments.paymentForm_param_users_type_Vector t' => 'Users', 'object_payments.validatedRequestedInfo' => 'Validated requested info', 'object_payments.validatedRequestedInfo_param_id_type_string' => 'ID', 'object_payments.validatedRequestedInfo_param_shipping_options_type_Vector t' => 'Shipping options', 'object_payments.paymentResult' => 'Payment result', 'object_payments.paymentResult_param_updates_type_Updates' => 'Updates', 'object_payments.paymentVerficationNeeded' => 'Payment verfication needed', 'object_payments.paymentVerficationNeeded_param_url_type_string' => 'URL', 'object_payments.paymentReceipt' => 'Payment receipt', 'object_payments.paymentReceipt_param_date_type_int' => 'Date', 'object_payments.paymentReceipt_param_bot_id_type_int' => 'Bot ID', 'object_payments.paymentReceipt_param_invoice_type_Invoice' => 'Invoice', 'object_payments.paymentReceipt_param_provider_id_type_int' => 'Provider ID', 'object_payments.paymentReceipt_param_info_type_PaymentRequestedInfo' => 'Info', 'object_payments.paymentReceipt_param_shipping_type_ShippingOption' => 'Shipping', 'object_payments.paymentReceipt_param_currency_type_string' => 'Currency', 'object_payments.paymentReceipt_param_total_amount_type_long' => 'Total amount', 'object_payments.paymentReceipt_param_credentials_title_type_string' => 'Credentials title', 'object_payments.paymentReceipt_param_users_type_Vector t' => 'Users', 'object_payments.savedInfo' => 'Saved info', 'object_payments.savedInfo_param_has_saved_credentials_type_true' => 'Has saved credentials?', 'object_payments.savedInfo_param_saved_info_type_PaymentRequestedInfo' => 'Saved info', 'object_inputPaymentCredentialsSaved' => 'Payment credentials saved', 'object_inputPaymentCredentialsSaved_param_id_type_string' => 'ID', 'object_inputPaymentCredentialsSaved_param_tmp_password_type_bytes' => 'Tmp password', 'object_inputPaymentCredentials' => 'Payment credentials', 'object_inputPaymentCredentials_param_save_type_true' => 'Save?', 'object_inputPaymentCredentials_param_data_type_DataJSON' => 'Data', 'object_inputPaymentCredentialsApplePay' => 'Payment credentials apple pay', 'object_inputPaymentCredentialsApplePay_param_payment_data_type_DataJSON' => 'Payment data', 'object_inputPaymentCredentialsAndroidPay' => 'Payment credentials android pay', 'object_inputPaymentCredentialsAndroidPay_param_payment_token_type_DataJSON' => 'Payment token', 'object_inputPaymentCredentialsAndroidPay_param_google_transaction_id_type_string' => 'Google transaction ID', 'object_account.tmpPassword' => 'Tmp password', 'object_account.tmpPassword_param_tmp_password_type_bytes' => 'Tmp password', 'object_account.tmpPassword_param_valid_until_type_int' => 'Valid until', 'object_shippingOption' => 'Shipping option', 'object_shippingOption_param_id_type_string' => 'ID', 'object_shippingOption_param_title_type_string' => 'Title', 'object_shippingOption_param_prices_type_Vector t' => 'Prices', 'object_inputStickerSetItem' => 'Sticker set item', 'object_inputStickerSetItem_param_document_type_InputDocument' => 'Document', 'object_inputStickerSetItem_param_emoji_type_string' => 'Emoji', 'object_inputStickerSetItem_param_mask_coords_type_MaskCoords' => 'Mask coords', 'object_inputPhoneCall' => 'Phone call', 'object_inputPhoneCall_param_id_type_long' => 'ID', 'object_inputPhoneCall_param_access_hash_type_long' => 'Access hash', 'object_phoneCallEmpty' => 'Empty phone call', 'object_phoneCallEmpty_param_id_type_long' => 'ID', 'object_phoneCallWaiting' => 'Phone call waiting', 'object_phoneCallWaiting_param_id_type_long' => 'ID', 'object_phoneCallWaiting_param_access_hash_type_long' => 'Access hash', 'object_phoneCallWaiting_param_date_type_int' => 'Date', 'object_phoneCallWaiting_param_admin_id_type_int' => 'Admin ID', 'object_phoneCallWaiting_param_participant_id_type_int' => 'Participant ID', 'object_phoneCallWaiting_param_protocol_type_PhoneCallProtocol' => 'Protocol', 'object_phoneCallWaiting_param_receive_date_type_int' => 'Receive date', 'object_phoneCallRequested' => 'Phone call requested', 'object_phoneCallRequested_param_id_type_long' => 'ID', 'object_phoneCallRequested_param_access_hash_type_long' => 'Access hash', 'object_phoneCallRequested_param_date_type_int' => 'Date', 'object_phoneCallRequested_param_admin_id_type_int' => 'Admin ID', 'object_phoneCallRequested_param_participant_id_type_int' => 'Participant ID', 'object_phoneCallRequested_param_g_a_hash_type_bytes' => 'G a hash', 'object_phoneCallRequested_param_protocol_type_PhoneCallProtocol' => 'Protocol', 'object_phoneCallAccepted' => 'Phone call accepted', 'object_phoneCallAccepted_param_id_type_long' => 'ID', 'object_phoneCallAccepted_param_access_hash_type_long' => 'Access hash', 'object_phoneCallAccepted_param_date_type_int' => 'Date', 'object_phoneCallAccepted_param_admin_id_type_int' => 'Admin ID', 'object_phoneCallAccepted_param_participant_id_type_int' => 'Participant ID', 'object_phoneCallAccepted_param_g_b_type_bytes' => 'G b', 'object_phoneCallAccepted_param_protocol_type_PhoneCallProtocol' => 'Protocol', 'object_phoneCall' => 'Phone call', 'object_phoneCall_param_id_type_long' => 'ID', 'object_phoneCall_param_access_hash_type_long' => 'Access hash', 'object_phoneCall_param_date_type_int' => 'Date', 'object_phoneCall_param_admin_id_type_int' => 'Admin ID', 'object_phoneCall_param_participant_id_type_int' => 'Participant ID', 'object_phoneCall_param_g_a_or_b_type_bytes' => 'G a or b', 'object_phoneCall_param_key_fingerprint_type_long' => 'Key fingerprint', 'object_phoneCall_param_protocol_type_PhoneCallProtocol' => 'Protocol', 'object_phoneCall_param_connection_type_PhoneConnection' => 'Connection', 'object_phoneCall_param_alternative_connections_type_Vector t' => 'Alternative connections', 'object_phoneCall_param_start_date_type_int' => 'Start date', 'object_phoneCallDiscarded' => 'Phone call discarded', 'object_phoneCallDiscarded_param_need_rating_type_true' => 'Need rating?', 'object_phoneCallDiscarded_param_need_debug_type_true' => 'Need debug?', 'object_phoneCallDiscarded_param_id_type_long' => 'ID', 'object_phoneCallDiscarded_param_reason_type_PhoneCallDiscardReason' => 'Reason', 'object_phoneCallDiscarded_param_duration_type_int' => 'Duration', 'object_phoneConnection' => 'Phone connection', 'object_phoneConnection_param_id_type_long' => 'ID', 'object_phoneConnection_param_ip_type_string' => 'Ip', 'object_phoneConnection_param_ipv6_type_string' => 'Ipv6', 'object_phoneConnection_param_port_type_int' => 'Port', 'object_phoneConnection_param_peer_tag_type_bytes' => 'Peer tag', 'object_phoneCallProtocol' => 'Phone call protocol', 'object_phoneCallProtocol_param_udp_p2p_type_true' => 'Udp p2p?', 'object_phoneCallProtocol_param_udp_reflector_type_true' => 'Udp reflector?', 'object_phoneCallProtocol_param_min_layer_type_int' => 'Min layer', 'object_phoneCallProtocol_param_max_layer_type_int' => 'Max layer', 'object_phone.phoneCall' => 'Phone call', 'object_phone.phoneCall_param_phone_call_type_PhoneCall' => 'Phone call', 'object_phone.phoneCall_param_users_type_Vector t' => 'Users', 'object_upload.cdnFileReuploadNeeded' => 'Cdn file reupload needed', 'object_upload.cdnFileReuploadNeeded_param_request_token_type_bytes' => 'Request token', 'object_upload.cdnFile' => 'Cdn file', 'object_upload.cdnFile_param_bytes_type_bytes' => 'Bytes', 'object_cdnPublicKey' => 'Cdn public key', 'object_cdnPublicKey_param_dc_id_type_int' => 'DC ID', 'object_cdnPublicKey_param_public_key_type_string' => 'Public key', 'object_cdnConfig' => 'CDN configuration', 'object_cdnConfig_param_public_keys_type_Vector t' => 'Public keys', 'object_langPackString' => 'Lang pack string', 'object_langPackString_param_key_type_string' => 'Key', 'object_langPackString_param_value_type_string' => 'Value', 'object_langPackStringPluralized' => 'Lang pack string pluralized', 'object_langPackStringPluralized_param_key_type_string' => 'Key', 'object_langPackStringPluralized_param_zero_value_type_string' => 'Zero value', 'object_langPackStringPluralized_param_one_value_type_string' => 'One value', 'object_langPackStringPluralized_param_two_value_type_string' => 'Two value', 'object_langPackStringPluralized_param_few_value_type_string' => 'Few value', 'object_langPackStringPluralized_param_many_value_type_string' => 'Many value', 'object_langPackStringPluralized_param_other_value_type_string' => 'Other value', 'object_langPackStringDeleted' => 'Lang pack string deleted', 'object_langPackStringDeleted_param_key_type_string' => 'Key', 'object_langPackDifference' => 'Lang pack difference', 'object_langPackDifference_param_lang_code_type_string' => 'Lang code', 'object_langPackDifference_param_from_version_type_int' => 'From version', 'object_langPackDifference_param_version_type_int' => 'Version', 'object_langPackDifference_param_strings_type_Vector t' => 'Strings', 'object_langPackLanguage' => 'Lang pack language', 'object_langPackLanguage_param_name_type_string' => 'Name', 'object_langPackLanguage_param_native_name_type_string' => 'Native name', 'object_langPackLanguage_param_lang_code_type_string' => 'Lang code', 'object_channelAdminRights' => 'Admin rights', 'object_channelAdminRights_param_change_info_type_true' => 'Change info', 'object_channelAdminRights_param_post_messages_type_true' => 'Post messages', 'object_channelAdminRights_param_edit_messages_type_true' => 'Edit messages', 'object_channelAdminRights_param_delete_messages_type_true' => 'Delete messages', 'object_channelAdminRights_param_ban_users_type_true' => 'Ban users', 'object_channelAdminRights_param_invite_users_type_true' => 'Invite users', 'object_channelAdminRights_param_invite_link_type_true' => 'Generate an invite link', 'object_channelAdminRights_param_pin_messages_type_true' => 'Pin messages', 'object_channelAdminRights_param_add_admins_type_true' => 'Add other admins', 'object_channelBannedRights' => 'Banned user rights (when true, the user will NOT be able to do that thing)', 'object_channelBannedRights_param_view_messages_type_true' => 'Disallow viewing messages', 'object_channelBannedRights_param_send_messages_type_true' => 'Disallow sending messages', 'object_channelBannedRights_param_send_media_type_true' => 'Disallow sending media', 'object_channelBannedRights_param_send_stickers_type_true' => 'Disallow sending stickers', 'object_channelBannedRights_param_send_gifs_type_true' => 'Disallow sending gifs', 'object_channelBannedRights_param_send_games_type_true' => 'Disallow sending games', 'object_channelBannedRights_param_send_inline_type_true' => 'Disallow sending inline keyboards', 'object_channelBannedRights_param_embed_links_type_true' => 'Disallow embedding links', 'object_channelBannedRights_param_until_date_type_int' => 'Until date', 'object_channelAdminLogEventActionChangeTitle' => 'Change title', 'object_channelAdminLogEventActionChangeTitle_param_prev_value_type_string' => 'Previous value', 'object_channelAdminLogEventActionChangeTitle_param_new_value_type_string' => 'New value', 'object_channelAdminLogEventActionChangeAbout' => 'Change about text', 'object_channelAdminLogEventActionChangeAbout_param_prev_value_type_string' => 'Previous value', 'object_channelAdminLogEventActionChangeAbout_param_new_value_type_string' => 'New value', 'object_channelAdminLogEventActionChangeUsername' => 'Change username', 'object_channelAdminLogEventActionChangeUsername_param_prev_value_type_string' => 'Prev value', 'object_channelAdminLogEventActionChangeUsername_param_new_value_type_string' => 'New value', 'object_channelAdminLogEventActionChangePhoto' => 'Change photo', 'object_channelAdminLogEventActionChangePhoto_param_prev_photo_type_ChatPhoto' => 'Previous photo', 'object_channelAdminLogEventActionChangePhoto_param_new_photo_type_ChatPhoto' => 'New photo', 'object_channelAdminLogEventActionToggleInvites' => 'Invite setting toggled', 'object_channelAdminLogEventActionToggleInvites_param_new_value_type_Bool' => 'New value', 'object_channelAdminLogEventActionToggleSignatures' => 'Toggle channel signatures', 'object_channelAdminLogEventActionToggleSignatures_param_new_value_type_Bool' => 'New value?', 'object_channelAdminLogEventActionUpdatePinned' => 'Message pinned', 'object_channelAdminLogEventActionUpdatePinned_param_message_type_Message' => 'Message', 'object_channelAdminLogEventActionEditMessage' => 'Edit message', 'object_channelAdminLogEventActionEditMessage_param_prev_message_type_Message' => 'Prev message', 'object_channelAdminLogEventActionEditMessage_param_new_message_type_Message' => 'New message', 'object_channelAdminLogEventActionDeleteMessage' => 'Delete message', 'object_channelAdminLogEventActionDeleteMessage_param_message_type_Message' => 'Message', 'object_channelAdminLogEventActionParticipantJoin' => 'Joined participant', 'object_channelAdminLogEventActionParticipantLeave' => 'Left participant', 'object_channelAdminLogEventActionParticipantInvite' => 'Invite participant', 'object_channelAdminLogEventActionParticipantInvite_param_participant_type_ChannelParticipant' => 'Participant', 'object_channelAdminLogEventActionParticipantToggleBan' => 'User banned', 'object_channelAdminLogEventActionParticipantToggleBan_param_prev_participant_type_ChannelParticipant' => 'Prev participant', 'object_channelAdminLogEventActionParticipantToggleBan_param_new_participant_type_ChannelParticipant' => 'New participant', 'object_channelAdminLogEventActionParticipantToggleAdmin' => 'Admin toggled', 'object_channelAdminLogEventActionParticipantToggleAdmin_param_prev_participant_type_ChannelParticipant' => 'Prev participant', 'object_channelAdminLogEventActionParticipantToggleAdmin_param_new_participant_type_ChannelParticipant' => 'New participant', 'object_channelAdminLogEventActionChangeStickerSet' => 'Change stickerset', 'object_channelAdminLogEventActionChangeStickerSet_param_prev_stickerset_type_InputStickerSet' => 'Previous stickerset', 'object_channelAdminLogEventActionChangeStickerSet_param_new_stickerset_type_InputStickerSet' => 'New stickerset', 'object_channelAdminLogEventActionTogglePreHistoryHidden' => 'Previous history hidden', 'object_channelAdminLogEventActionTogglePreHistoryHidden_param_new_value_type_Bool' => 'New value', 'object_channelAdminLogEvent' => 'Channel admin log event', 'object_channelAdminLogEvent_param_id_type_long' => 'ID', 'object_channelAdminLogEvent_param_date_type_int' => 'Date', 'object_channelAdminLogEvent_param_user_id_type_int' => 'User ID', 'object_channelAdminLogEvent_param_action_type_ChannelAdminLogEventAction' => 'Action', 'object_channels.adminLogResults' => 'Admin log results', 'object_channels.adminLogResults_param_events_type_Vector t' => 'Events', 'object_channels.adminLogResults_param_chats_type_Vector t' => 'Chats', 'object_channels.adminLogResults_param_users_type_Vector t' => 'Users', 'object_channelAdminLogEventsFilter' => 'Event filter', 'object_channelAdminLogEventsFilter_param_join_type_true' => 'Join users events', 'object_channelAdminLogEventsFilter_param_leave_type_true' => 'Left users events', 'object_channelAdminLogEventsFilter_param_invite_type_true' => 'Invite users events', 'object_channelAdminLogEventsFilter_param_ban_type_true' => 'Ban events', 'object_channelAdminLogEventsFilter_param_unban_type_true' => 'Unban events', 'object_channelAdminLogEventsFilter_param_kick_type_true' => 'Kicked users events', 'object_channelAdminLogEventsFilter_param_unkick_type_true' => 'Unkick events', 'object_channelAdminLogEventsFilter_param_promote_type_true' => 'Admin promotion events', 'object_channelAdminLogEventsFilter_param_demote_type_true' => 'Demote admin events', 'object_channelAdminLogEventsFilter_param_info_type_true' => 'Change info events', 'object_channelAdminLogEventsFilter_param_settings_type_true' => 'Setting changes', 'object_channelAdminLogEventsFilter_param_pinned_type_true' => 'Pinned message events', 'object_channelAdminLogEventsFilter_param_edit_type_true' => 'Edit message events', 'object_channelAdminLogEventsFilter_param_delete_type_true' => 'Delete message events', 'object_popularContact' => 'Popular contact', 'object_popularContact_param_client_id_type_long' => 'Client ID', 'object_popularContact_param_importers_type_int' => 'Importers', 'object_cdnFileHash' => 'CDN file hash', 'object_cdnFileHash_param_offset_type_int' => 'Offset', 'object_cdnFileHash_param_limit_type_int' => 'Limit', 'object_cdnFileHash_param_hash_type_bytes' => 'Hash', 'object_messages.favedStickersNotModified' => 'Faved stickers not modified', 'object_messages.favedStickers' => 'Faved stickers', 'object_messages.favedStickers_param_hash_type_int' => 'Hash', 'object_messages.favedStickers_param_packs_type_Vector t' => 'Packs', 'object_messages.favedStickers_param_stickers_type_Vector t' => 'Stickers', 'object_recentMeUrlUnknown' => 'Recent me URL unknown', 'object_recentMeUrlUnknown_param_url_type_string' => 'URL', 'object_recentMeUrlUser' => 'Recent me URL user', 'object_recentMeUrlUser_param_url_type_string' => 'URL', 'object_recentMeUrlUser_param_user_id_type_int' => 'User ID', 'object_recentMeUrlChat' => 'Recent me URL chat', 'object_recentMeUrlChat_param_url_type_string' => 'URL', 'object_recentMeUrlChat_param_chat_id_type_int' => 'Chat ID', 'object_recentMeUrlChatInvite' => 'Recent me URL chat invite', 'object_recentMeUrlChatInvite_param_url_type_string' => 'URL', 'object_recentMeUrlChatInvite_param_chat_invite_type_ChatInvite' => 'Chat invite', 'object_recentMeUrlStickerSet' => 'Recent me URL sticker set', 'object_recentMeUrlStickerSet_param_url_type_string' => 'URL', 'object_recentMeUrlStickerSet_param_set_type_StickerSetCovered' => 'Set', 'object_help.recentMeUrls' => 'Recent me URLs', 'object_help.recentMeUrls_param_urls_type_Vector t' => 'URLs', 'object_help.recentMeUrls_param_chats_type_Vector t' => 'Chats', 'object_help.recentMeUrls_param_users_type_Vector t' => 'Users', 'object_inputSingleMedia' => 'Single media', 'object_inputSingleMedia_param_media_type_InputMedia' => 'Media', 'object_inputSingleMedia_param_message_type_string' => 'Message', 'object_inputSingleMedia_param_entities_type_Vector t' => 'Entities', 'object_webAuthorization' => 'Web authorization', 'object_webAuthorization_param_hash_type_long' => 'Hash', 'object_webAuthorization_param_bot_id_type_int' => 'Bot ID', 'object_webAuthorization_param_domain_type_string' => 'Domain', 'object_webAuthorization_param_browser_type_string' => 'Browser', 'object_webAuthorization_param_platform_type_string' => 'Platform', 'object_webAuthorization_param_date_created_type_int' => 'Date created', 'object_webAuthorization_param_date_active_type_int' => 'Date active', 'object_webAuthorization_param_ip_type_string' => 'Ip', 'object_webAuthorization_param_region_type_string' => 'Region', 'object_account.webAuthorizations' => 'Telegram login authorizations', 'object_account.webAuthorizations_param_authorizations_type_Vector t' => 'Authorizations', 'object_account.webAuthorizations_param_users_type_Vector t' => 'Users', 'object_inputMessageID' => 'Message ID', 'object_inputMessageID_param_id_type_int' => 'ID', 'object_inputMessageReplyTo' => 'Message reply to', 'object_inputMessageReplyTo_param_id_type_int' => 'ID', 'object_inputMessagePinned' => 'Message pinned', 'object_decryptedDataBlock' => 'Decrypted data block', 'object_decryptedDataBlock_param_voice_call_id_type_int128' => 'Voice call ID', 'object_decryptedDataBlock_param_in_seq_no_type_int' => 'In seq no', 'object_decryptedDataBlock_param_out_seq_no_type_int' => 'Out seq no', 'object_decryptedDataBlock_param_recent_received_mask_type_int' => 'Recent received mask', 'object_decryptedDataBlock_param_proto_type_int' => 'Proto', 'object_decryptedDataBlock_param_extra_type_string' => 'Extra', 'object_decryptedDataBlock_param_raw_data_type_string' => 'Raw data', 'object_simpleDataBlock' => 'Simple data block', 'object_simpleDataBlock_param_raw_data_type_string' => 'Raw data', 'object_decryptedMessage' => 'Decrypted message', 'object_decryptedMessage_param_message_type_string' => 'Message', 'object_decryptedMessage_param_media_type_DecryptedMessageMedia' => 'Media', 'object_decryptedMessageService' => 'Decrypted message service', 'object_decryptedMessageService_param_action_type_DecryptedMessageAction' => 'Action', 'object_decryptedMessageMediaEmpty' => 'Empty decrypted message media', 'object_decryptedMessageMediaPhoto' => 'Decrypted message media photo', 'object_decryptedMessageMediaPhoto_param_thumb_type_bytes' => 'Thumbnail', 'object_decryptedMessageMediaPhoto_param_thumb_w_type_int' => 'Thumbnail width', 'object_decryptedMessageMediaPhoto_param_thumb_h_type_int' => 'Thumbnail height', 'object_decryptedMessageMediaPhoto_param_w_type_int' => 'Width', 'object_decryptedMessageMediaPhoto_param_h_type_int' => 'Height', 'object_decryptedMessageMediaPhoto_param_size_type_int' => 'Size', 'object_decryptedMessageMediaPhoto_param_key_type_bytes' => 'Key', 'object_decryptedMessageMediaPhoto_param_iv_type_bytes' => 'Iv', 'object_decryptedMessageMediaVideo' => 'Decrypted message media video', 'object_decryptedMessageMediaVideo_param_thumb_type_bytes' => 'Thumbnail', 'object_decryptedMessageMediaVideo_param_thumb_w_type_int' => 'Thumbnail width', 'object_decryptedMessageMediaVideo_param_thumb_h_type_int' => 'Thumbnail height', 'object_decryptedMessageMediaVideo_param_duration_type_int' => 'Duration', 'object_decryptedMessageMediaVideo_param_w_type_int' => 'Width', 'object_decryptedMessageMediaVideo_param_h_type_int' => 'Height', 'object_decryptedMessageMediaVideo_param_size_type_int' => 'Size', 'object_decryptedMessageMediaVideo_param_key_type_bytes' => 'Key', 'object_decryptedMessageMediaVideo_param_iv_type_bytes' => 'Iv', 'object_decryptedMessageMediaGeoPoint' => 'Decrypted message media geo point', 'object_decryptedMessageMediaGeoPoint_param_lat_type_double' => 'Lat', 'object_decryptedMessageMediaGeoPoint_param_long_type_double' => 'Long', 'object_decryptedMessageMediaContact' => 'Decrypted message media contact', 'object_decryptedMessageMediaContact_param_phone_number_type_string' => 'Phone number', 'object_decryptedMessageMediaContact_param_first_name_type_string' => 'First name', 'object_decryptedMessageMediaContact_param_last_name_type_string' => 'Last name', 'object_decryptedMessageMediaContact_param_user_id_type_int' => 'User ID', 'object_decryptedMessageActionSetMessageTTL' => 'Decrypted message action set message ttl', 'object_decryptedMessageActionSetMessageTTL_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_decryptedMessageMediaDocument' => 'Decrypted message media document', 'object_decryptedMessageMediaDocument_param_thumb_type_bytes' => 'Thumbnail', 'object_decryptedMessageMediaDocument_param_thumb_w_type_int' => 'Thumbnail w', 'object_decryptedMessageMediaDocument_param_thumb_h_type_int' => 'Thumbnail h', 'object_decryptedMessageMediaDocument_param_file_name_type_string' => 'File name', 'object_decryptedMessageMediaDocument_param_mime_type_type_string' => 'Mime type', 'object_decryptedMessageMediaDocument_param_size_type_int' => 'Size', 'object_decryptedMessageMediaDocument_param_key_type_bytes' => 'Key', 'object_decryptedMessageMediaDocument_param_iv_type_bytes' => 'Iv', 'object_decryptedMessageMediaAudio' => 'Decrypted message media audio', 'object_decryptedMessageMediaAudio_param_duration_type_int' => 'Duration', 'object_decryptedMessageMediaAudio_param_size_type_int' => 'Size', 'object_decryptedMessageMediaAudio_param_key_type_bytes' => 'Key', 'object_decryptedMessageMediaAudio_param_iv_type_bytes' => 'Iv', 'object_decryptedMessageActionReadMessages' => 'Decrypted message action read messages', 'object_decryptedMessageActionReadMessages_param_random_ids_type_Vector t' => 'Random IDs', 'object_decryptedMessageActionDeleteMessages' => 'Decrypted message action delete messages', 'object_decryptedMessageActionDeleteMessages_param_random_ids_type_Vector t' => 'Random IDs', 'object_decryptedMessageActionScreenshotMessages' => 'Decrypted message action screenshot messages', 'object_decryptedMessageActionScreenshotMessages_param_random_ids_type_Vector t' => 'Random IDs', 'object_decryptedMessageActionFlushHistory' => 'Decrypted message action flush history', 'object_decryptedMessage_param_ttl_type_int' => 'Ttl', 'object_decryptedMessageMediaVideo_param_mime_type_type_string' => 'Mime type', 'object_decryptedMessageMediaAudio_param_mime_type_type_string' => 'Mime type', 'object_decryptedMessageLayer' => 'Decrypted message layer', 'object_decryptedMessageLayer_param_layer_type_int' => 'Layer', 'object_decryptedMessageLayer_param_in_seq_no_type_int' => 'In seq no', 'object_decryptedMessageLayer_param_out_seq_no_type_int' => 'Out seq no', 'object_decryptedMessageLayer_param_message_type_DecryptedMessage' => 'Message', 'object_decryptedMessageActionResend' => 'Decrypted message action resend', 'object_decryptedMessageActionResend_param_start_seq_no_type_int' => 'Start seq no', 'object_decryptedMessageActionResend_param_end_seq_no_type_int' => 'End seq no', 'object_decryptedMessageActionNotifyLayer' => 'Decrypted message action notify layer', 'object_decryptedMessageActionNotifyLayer_param_layer_type_int' => 'Layer', 'object_decryptedMessageActionTyping' => 'Decrypted message action typing', 'object_decryptedMessageActionTyping_param_action_type_SendMessageAction' => 'Action', 'object_decryptedMessageActionRequestKey' => 'Decrypted message action request key', 'object_decryptedMessageActionRequestKey_param_exchange_id_type_long' => 'Exchange ID', 'object_decryptedMessageActionRequestKey_param_g_a_type_bytes' => 'G a', 'object_decryptedMessageActionAcceptKey' => 'Decrypted message action accept key', 'object_decryptedMessageActionAcceptKey_param_exchange_id_type_long' => 'Exchange ID', 'object_decryptedMessageActionAcceptKey_param_g_b_type_bytes' => 'G b', 'object_decryptedMessageActionAcceptKey_param_key_fingerprint_type_long' => 'Key fingerprint', 'object_decryptedMessageActionAbortKey' => 'Decrypted message action abort key', 'object_decryptedMessageActionAbortKey_param_exchange_id_type_long' => 'Exchange ID', 'object_decryptedMessageActionCommitKey' => 'Decrypted message action commit key', 'object_decryptedMessageActionCommitKey_param_exchange_id_type_long' => 'Exchange ID', 'object_decryptedMessageActionCommitKey_param_key_fingerprint_type_long' => 'Key fingerprint', 'object_decryptedMessageActionNoop' => 'Decrypted message action noop', 'object_decryptedMessageMediaExternalDocument' => 'Decrypted message media external document', 'object_decryptedMessageMediaExternalDocument_param_id_type_long' => 'ID', 'object_decryptedMessageMediaExternalDocument_param_access_hash_type_long' => 'Access hash', 'object_decryptedMessageMediaExternalDocument_param_date_type_int' => 'Date', 'object_decryptedMessageMediaExternalDocument_param_mime_type_type_string' => 'Mime type', 'object_decryptedMessageMediaExternalDocument_param_size_type_int' => 'Size', 'object_decryptedMessageMediaExternalDocument_param_thumb_type_PhotoSize' => 'Thumbnail', 'object_decryptedMessageMediaExternalDocument_param_dc_id_type_int' => 'DC ID', 'object_decryptedMessageMediaExternalDocument_param_attributes_type_Vector t' => 'Attributes', 'object_decryptedMessage_param_entities_type_Vector t' => 'Entities', 'object_decryptedMessage_param_via_bot_name_type_string' => 'Via bot name', 'object_decryptedMessage_param_reply_to_random_id_type_long' => 'Reply to random ID', 'object_decryptedMessageMediaPhoto_param_caption_type_string' => 'Caption', 'object_decryptedMessageMediaVideo_param_caption_type_string' => 'Caption', 'object_decryptedMessageMediaDocument_param_attributes_type_Vector t' => 'Attributes', 'object_decryptedMessageMediaDocument_param_caption_type_string' => 'Caption', 'object_decryptedMessageMediaVenue' => 'Decrypted message media venue', 'object_decryptedMessageMediaVenue_param_lat_type_double' => 'Lat', 'object_decryptedMessageMediaVenue_param_long_type_double' => 'Long', 'object_decryptedMessageMediaVenue_param_title_type_string' => 'Title', 'object_decryptedMessageMediaVenue_param_address_type_string' => 'Address', 'object_decryptedMessageMediaVenue_param_provider_type_string' => 'Provider', 'object_decryptedMessageMediaVenue_param_venue_id_type_string' => 'Venue ID', 'object_decryptedMessageMediaWebPage' => 'Decrypted message media web page', 'object_decryptedMessageMediaWebPage_param_url_type_string' => 'URL', 'object_decryptedMessage_param_grouped_id_type_long' => 'Grouped ID', 'object_inputPeerContact' => 'Peer contact', 'object_inputPeerContact_param_user_id_type_int' => 'User ID', 'object_inputPeerForeign' => 'Peer foreign', 'object_inputPeerForeign_param_user_id_type_int' => 'User ID', 'object_inputPeerForeign_param_access_hash_type_long' => 'Access hash', 'object_inputUserContact' => 'User contact', 'object_inputUserContact_param_user_id_type_int' => 'User ID', 'object_inputUserForeign' => 'User foreign', 'object_inputUserForeign_param_user_id_type_int' => 'User ID', 'object_inputUserForeign_param_access_hash_type_long' => 'Access hash', 'object_inputMediaUploadedVideo' => 'Media uploaded video', 'object_inputMediaUploadedVideo_param_file_type_InputFile' => 'File', 'object_inputMediaUploadedVideo_param_duration_type_int' => 'Duration', 'object_inputMediaUploadedVideo_param_w_type_int' => 'Width', 'object_inputMediaUploadedVideo_param_h_type_int' => 'Height', 'object_inputMediaUploadedVideo_param_mime_type_type_string' => 'Mime type', 'object_inputMediaUploadedThumbVideo' => 'Media uploaded thumb video', 'object_inputMediaUploadedThumbVideo_param_file_type_InputFile' => 'File', 'object_inputMediaUploadedThumbVideo_param_thumb_type_InputFile' => 'Thumbnail', 'object_inputMediaUploadedThumbVideo_param_duration_type_int' => 'Duration', 'object_inputMediaUploadedThumbVideo_param_w_type_int' => 'Width', 'object_inputMediaUploadedThumbVideo_param_h_type_int' => 'Height', 'object_inputMediaUploadedThumbVideo_param_mime_type_type_string' => 'Mime type', 'object_inputMediaVideo' => 'Media video', 'object_inputMediaVideo_param_id_type_InputVideo' => 'ID', 'object_inputChatUploadedPhoto_param_crop_type_InputPhotoCrop' => 'Crop', 'object_inputChatPhoto_param_crop_type_InputPhotoCrop' => 'Crop', 'object_inputVideoEmpty' => 'Empty input video', 'object_inputVideo' => 'Video', 'object_inputVideo_param_id_type_long' => 'ID', 'object_inputVideo_param_access_hash_type_long' => 'Access hash', 'object_inputVideoFileLocation' => 'Video file location', 'object_inputVideoFileLocation_param_id_type_long' => 'ID', 'object_inputVideoFileLocation_param_access_hash_type_long' => 'Access hash', 'object_inputPhotoCropAuto' => 'Photo crop auto', 'object_inputPhotoCrop' => 'Photo crop', 'object_inputPhotoCrop_param_crop_left_type_double' => 'Crop left', 'object_inputPhotoCrop_param_crop_top_type_double' => 'Crop top', 'object_inputPhotoCrop_param_crop_width_type_double' => 'Crop width', 'object_userSelf' => 'User self', 'object_userSelf_param_id_type_int' => 'ID', 'object_userSelf_param_first_name_type_string' => 'First name', 'object_userSelf_param_last_name_type_string' => 'Last name', 'object_userSelf_param_username_type_string' => 'Username', 'object_userSelf_param_phone_type_string' => 'Phone', 'object_userSelf_param_photo_type_UserProfilePhoto' => 'Photo', 'object_userSelf_param_status_type_UserStatus' => 'Status', 'object_userSelf_param_inactive_type_Bool' => 'Inactive?', 'object_userContact' => 'User contact', 'object_userContact_param_id_type_int' => 'ID', 'object_userContact_param_first_name_type_string' => 'First name', 'object_userContact_param_last_name_type_string' => 'Last name', 'object_userContact_param_username_type_string' => 'Username', 'object_userContact_param_access_hash_type_long' => 'Access hash', 'object_userContact_param_phone_type_string' => 'Phone', 'object_userContact_param_photo_type_UserProfilePhoto' => 'Photo', 'object_userContact_param_status_type_UserStatus' => 'Status', 'object_userRequest' => 'User request', 'object_userRequest_param_id_type_int' => 'ID', 'object_userRequest_param_first_name_type_string' => 'First name', 'object_userRequest_param_last_name_type_string' => 'Last name', 'object_userRequest_param_username_type_string' => 'Username', 'object_userRequest_param_access_hash_type_long' => 'Access hash', 'object_userRequest_param_phone_type_string' => 'Phone', 'object_userRequest_param_photo_type_UserProfilePhoto' => 'Photo', 'object_userRequest_param_status_type_UserStatus' => 'Status', 'object_userForeign' => 'User foreign', 'object_userForeign_param_id_type_int' => 'ID', 'object_userForeign_param_first_name_type_string' => 'First name', 'object_userForeign_param_last_name_type_string' => 'Last name', 'object_userForeign_param_username_type_string' => 'Username', 'object_userForeign_param_access_hash_type_long' => 'Access hash', 'object_userForeign_param_photo_type_UserProfilePhoto' => 'Photo', 'object_userForeign_param_status_type_UserStatus' => 'Status', 'object_userDeleted' => 'User deleted', 'object_userDeleted_param_id_type_int' => 'ID', 'object_userDeleted_param_first_name_type_string' => 'First name', 'object_userDeleted_param_last_name_type_string' => 'Last name', 'object_userDeleted_param_username_type_string' => 'Username', 'object_userStatusEmpty' => 'Empty user status', 'object_userStatusOnline' => 'User status online', 'object_userStatusOnline_param_expires_type_int' => 'Expires', 'object_userStatusOffline' => 'User status offline', 'object_userStatusOffline_param_was_online_type_int' => 'Was online', 'object_chat_param_left_type_Bool' => 'Left?', 'object_chatForbidden_param_date_type_int' => 'Date', 'object_chatParticipants_param_admin_id_type_int' => 'Admin ID', 'object_messageForwarded' => 'Message forwarded', 'object_messageForwarded_param_id_type_int' => 'ID', 'object_messageForwarded_param_fwd_from_id_type_int' => 'Forwarded from ID', 'object_messageForwarded_param_fwd_date_type_int' => 'Forwarded date', 'object_messageForwarded_param_from_id_type_int' => 'From ID', 'object_messageForwarded_param_to_id_type_Peer' => 'To ID', 'object_messageForwarded_param_date_type_int' => 'Date', 'object_messageForwarded_param_message_type_string' => 'Message', 'object_messageForwarded_param_media_type_MessageMedia' => 'Media', 'object_messageMediaVideo' => 'Message media video', 'object_messageMediaVideo_param_video_type_Video' => 'Video', 'object_messageMediaUnsupported_param_bytes_type_bytes' => 'Bytes', 'object_messageActionChatAddUser_param_user_id_type_int' => 'User ID', 'object_photo_param_user_id_type_int' => 'User ID', 'object_photo_param_caption_type_string' => 'Caption', 'object_photo_param_geo_type_GeoPoint' => 'Geo', 'object_videoEmpty' => 'Empty video', 'object_videoEmpty_param_id_type_long' => 'ID', 'object_video' => 'Video', 'object_video_param_id_type_long' => 'ID', 'object_video_param_access_hash_type_long' => 'Access hash', 'object_video_param_user_id_type_int' => 'User ID', 'object_video_param_date_type_int' => 'Date', 'object_video_param_caption_type_string' => 'Caption', 'object_video_param_duration_type_int' => 'Duration', 'object_video_param_mime_type_type_string' => 'Mime type', 'object_video_param_size_type_int' => 'Size', 'object_video_param_thumb_type_PhotoSize' => 'Thumbnail', 'object_video_param_dc_id_type_int' => 'DC ID', 'object_video_param_w_type_int' => 'Width', 'object_video_param_h_type_int' => 'Height', 'object_auth.checkedPhone_param_phone_invited_type_Bool' => 'Phone invited?', 'object_auth.sentCode_param_phone_registered_type_Bool' => 'Phone registered?', 'object_auth.sentCode_param_send_call_timeout_type_int' => 'Send call timeout', 'object_auth.sentCode_param_is_password_type_Bool' => 'Is password?', 'object_auth.authorization_param_expires_type_int' => 'Expiration date', 'object_inputPeerNotifySettings_param_show_previews_type_Bool' => 'Show previews?', 'object_inputPeerNotifySettings_param_events_mask_type_int' => 'Events mask', 'object_peerNotifySettings_param_show_previews_type_Bool' => 'Show previews?', 'object_peerNotifySettings_param_events_mask_type_int' => 'Events mask', 'object_userFull_param_blocked_type_Bool' => 'Blocked?', 'object_userFull_param_real_first_name_type_string' => 'Real first name', 'object_userFull_param_real_last_name_type_string' => 'Real last name', 'object_contactSuggested' => 'Contact suggested', 'object_contactSuggested_param_user_id_type_int' => 'User ID', 'object_contactSuggested_param_mutual_contacts_type_int' => 'Mutual contacts', 'object_contactStatus_param_expires_type_int' => 'Expires', 'object_contacts.foreignLinkUnknown' => 'Foreign link unknown', 'object_contacts.foreignLinkRequested' => 'Foreign link requested', 'object_contacts.foreignLinkRequested_param_has_phone_type_Bool' => 'Has phone?', 'object_contacts.foreignLinkMutual' => 'Foreign link mutual', 'object_contacts.myLinkEmpty' => 'Empty my link', 'object_contacts.myLinkRequested' => 'My link requested', 'object_contacts.myLinkRequested_param_contact_type_Bool' => 'Contact?', 'object_contacts.myLinkContact' => 'My link contact', 'object_contacts.link_param_my_link_type_contacts.MyLink' => 'My link', 'object_contacts.link_param_foreign_link_type_contacts.ForeignLink' => 'Foreign link', 'object_contacts.suggested' => 'Suggested', 'object_contacts.suggested_param_results_type_Vector t' => 'Results', 'object_contacts.suggested_param_users_type_Vector t' => 'Users', 'object_messages.statedMessages' => 'Stated messages', 'object_messages.statedMessages_param_messages_type_Vector t' => 'Messages', 'object_messages.statedMessages_param_chats_type_Vector t' => 'Chats', 'object_messages.statedMessages_param_users_type_Vector t' => 'Users', 'object_messages.statedMessages_param_pts_type_int' => 'Pts', 'object_messages.statedMessages_param_seq_type_int' => 'Seq', 'object_messages.statedMessage' => 'Stated message', 'object_messages.statedMessage_param_message_type_Message' => 'Message', 'object_messages.statedMessage_param_chats_type_Vector t' => 'Chats', 'object_messages.statedMessage_param_users_type_Vector t' => 'Users', 'object_messages.statedMessage_param_pts_type_int' => 'Pts', 'object_messages.statedMessage_param_seq_type_int' => 'Seq', 'object_messages.sentMessage' => 'Sent message', 'object_messages.sentMessage_param_id_type_int' => 'ID', 'object_messages.sentMessage_param_date_type_int' => 'Date', 'object_messages.sentMessage_param_pts_type_int' => 'Pts', 'object_messages.sentMessage_param_seq_type_int' => 'Seq', 'object_messages.chats_param_users_type_Vector t' => 'Users', 'object_messages.affectedHistory_param_seq_type_int' => 'Seq', 'object_inputMessagesFilterPhotoVideoDocuments' => 'Messages filter photo video documents', 'object_inputMessagesFilterAudio' => 'Messages filter audio', 'object_inputMessagesFilterAudioDocuments' => 'Messages filter audio documents', 'object_updateReadMessages' => 'Update read messages', 'object_updateReadMessages_param_messages_type_Vector t' => 'Messages', 'object_updateReadMessages_param_pts_type_int' => 'Pts', 'object_updateUserStatus' => 'Update user status', 'object_updateUserStatus_param_user_id_type_int' => 'User ID', 'object_updateUserStatus_param_status_type_UserStatus' => 'Status', 'object_updateContactLink_param_my_link_type_contacts.MyLink' => 'My link', 'object_updateContactLink_param_foreign_link_type_contacts.ForeignLink' => 'Foreign link', 'object_updateNewAuthorization' => 'Update new authorization', 'object_updateNewAuthorization_param_auth_key_id_type_long' => 'Auth key ID', 'object_updateNewAuthorization_param_date_type_int' => 'Date', 'object_updateNewAuthorization_param_device_type_string' => 'Device', 'object_updateNewAuthorization_param_location_type_string' => 'Location', 'object_updateShortMessage_param_from_id_type_int' => 'From ID', 'object_updateShortMessage_param_seq_type_int' => 'Seq', 'object_updateShortChatMessage_param_seq_type_int' => 'Seq', 'object_dcOption_param_hostname_type_string' => 'Hostname', 'object_config_param_broadcast_size_max_type_int' => 'Broadcast size max', 'object_messages.statedMessagesLinks' => 'Stated messages links', 'object_messages.statedMessagesLinks_param_messages_type_Vector t' => 'Messages', 'object_messages.statedMessagesLinks_param_chats_type_Vector t' => 'Chats', 'object_messages.statedMessagesLinks_param_users_type_Vector t' => 'Users', 'object_messages.statedMessagesLinks_param_links_type_Vector t' => 'Links', 'object_messages.statedMessagesLinks_param_pts_type_int' => 'Pts', 'object_messages.statedMessagesLinks_param_seq_type_int' => 'Seq', 'object_messages.statedMessageLink' => 'Stated message link', 'object_messages.statedMessageLink_param_message_type_Message' => 'Message', 'object_messages.statedMessageLink_param_chats_type_Vector t' => 'Chats', 'object_messages.statedMessageLink_param_users_type_Vector t' => 'Users', 'object_messages.statedMessageLink_param_links_type_Vector t' => 'Links', 'object_messages.statedMessageLink_param_pts_type_int' => 'Pts', 'object_messages.statedMessageLink_param_seq_type_int' => 'Seq', 'object_messages.sentMessageLink' => 'Sent message link', 'object_messages.sentMessageLink_param_id_type_int' => 'ID', 'object_messages.sentMessageLink_param_date_type_int' => 'Date', 'object_messages.sentMessageLink_param_pts_type_int' => 'Pts', 'object_messages.sentMessageLink_param_seq_type_int' => 'Seq', 'object_messages.sentMessageLink_param_links_type_Vector t' => 'Links', 'object_inputMediaUploadedAudio' => 'Media uploaded audio', 'object_inputMediaUploadedAudio_param_file_type_InputFile' => 'File', 'object_inputMediaUploadedAudio_param_duration_type_int' => 'Duration', 'object_inputMediaUploadedAudio_param_mime_type_type_string' => 'Mime type', 'object_inputMediaAudio' => 'Media audio', 'object_inputMediaAudio_param_id_type_InputAudio' => 'ID', 'object_inputMediaUploadedDocument_param_file_name_type_string' => 'File name', 'object_inputMediaUploadedThumbDocument' => 'Media uploaded thumb document', 'object_inputMediaUploadedThumbDocument_param_file_type_InputFile' => 'File', 'object_inputMediaUploadedThumbDocument_param_thumb_type_InputFile' => 'Thumbnail', 'object_inputMediaUploadedThumbDocument_param_file_name_type_string' => 'File name', 'object_inputMediaUploadedThumbDocument_param_mime_type_type_string' => 'Mime type', 'object_messageMediaAudio' => 'Message media audio', 'object_messageMediaAudio_param_audio_type_Audio' => 'Audio', 'object_inputAudioEmpty' => 'Empty input audio', 'object_inputAudio' => 'Audio', 'object_inputAudio_param_id_type_long' => 'ID', 'object_inputAudio_param_access_hash_type_long' => 'Access hash', 'object_inputAudioFileLocation' => 'Audio file location', 'object_inputAudioFileLocation_param_id_type_long' => 'ID', 'object_inputAudioFileLocation_param_access_hash_type_long' => 'Access hash', 'object_audioEmpty' => 'Empty audio', 'object_audioEmpty_param_id_type_long' => 'ID', 'object_audio' => 'Audio', 'object_audio_param_id_type_long' => 'ID', 'object_audio_param_access_hash_type_long' => 'Access hash', 'object_audio_param_user_id_type_int' => 'User ID', 'object_audio_param_date_type_int' => 'Date', 'object_audio_param_duration_type_int' => 'Duration', 'object_audio_param_mime_type_type_string' => 'Mime type', 'object_audio_param_size_type_int' => 'Size', 'object_audio_param_dc_id_type_int' => 'DC ID', 'object_document_param_user_id_type_int' => 'User ID', 'object_document_param_file_name_type_string' => 'File name', 'object_auth.sentAppCode' => 'Sent app code', 'object_auth.sentAppCode_param_phone_registered_type_Bool' => 'Phone registered?', 'object_auth.sentAppCode_param_phone_code_hash_type_string' => 'Phone code hash', 'object_auth.sentAppCode_param_send_call_timeout_type_int' => 'Send call timeout', 'object_auth.sentAppCode_param_is_password_type_Bool' => 'Is password?', 'object_contactFound' => 'Contact found', 'object_contactFound_param_user_id_type_int' => 'User ID', 'object_updateServiceNotification_param_popup_type_Bool' => 'Popup?', 'object_inputMediaUploadedThumbDocument_param_attributes_type_Vector t' => 'Attributes', 'object_userStatusRecently' => 'User status recently', 'object_userStatusLastWeek' => 'User status last week', 'object_userStatusLastMonth' => 'User status last month', 'object_account.sentChangePhoneCode' => 'Sent change phone code', 'object_account.sentChangePhoneCode_param_phone_code_hash_type_string' => 'Phone code hash', 'object_account.sentChangePhoneCode_param_send_call_timeout_type_int' => 'Send call timeout', 'object_messages.allStickers_param_hash_type_string' => 'Hash', 'object_messages.allStickers_param_packs_type_Vector t' => 'Packs', 'object_messages.allStickers_param_documents_type_Vector t' => 'Documents', 'object_message_param_fwd_from_id_type_int' => 'Forwarded from ID', 'object_message_param_fwd_date_type_int' => 'Forwarded date', 'object_chatLocated' => 'Chat located', 'object_chatLocated_param_chat_id_type_int' => 'Chat ID', 'object_chatLocated_param_distance_type_int' => 'Distance', 'object_messages.messageEmpty' => 'Empty message', 'object_messages.statedMessages_param_pts_count_type_int' => 'Pts count', 'object_messages.statedMessage_param_pts_count_type_int' => 'Pts count', 'object_messages.sentMessage_param_pts_count_type_int' => 'Pts count', 'object_updateReadMessages_param_pts_count_type_int' => 'Pts count', 'object_updateShortMessage_param_fwd_from_id_type_int' => 'Fwd from ID', 'object_updateShortMessage_param_fwd_date_type_int' => 'Fwd date', 'object_updateShortChatMessage_param_fwd_from_id_type_int' => 'Fwd from ID', 'object_updateShortChatMessage_param_fwd_date_type_int' => 'Fwd date', 'object_messages.statedMessagesLinks_param_pts_count_type_int' => 'Pts count', 'object_messages.statedMessageLink_param_pts_count_type_int' => 'Pts count', 'object_messages.sentMessageLink_param_pts_count_type_int' => 'Pts count', 'object_inputGeoChat' => 'Geo chat', 'object_inputGeoChat_param_chat_id_type_int' => 'Chat ID', 'object_inputGeoChat_param_access_hash_type_long' => 'Access hash', 'object_inputNotifyGeoChatPeer' => 'Notify geo chat peer', 'object_inputNotifyGeoChatPeer_param_peer_type_InputGeoChat' => 'Peer', 'object_geoChat' => 'Geo chat', 'object_geoChat_param_id_type_int' => 'ID', 'object_geoChat_param_access_hash_type_long' => 'Access hash', 'object_geoChat_param_title_type_string' => 'Title', 'object_geoChat_param_address_type_string' => 'Address', 'object_geoChat_param_venue_type_string' => 'Venue', 'object_geoChat_param_geo_type_GeoPoint' => 'Geo', 'object_geoChat_param_photo_type_ChatPhoto' => 'Photo', 'object_geoChat_param_participants_count_type_int' => 'Participants count', 'object_geoChat_param_date_type_int' => 'Date', 'object_geoChat_param_checked_in_type_Bool' => 'Checked in?', 'object_geoChat_param_version_type_int' => 'Version', 'object_geoChatMessageEmpty' => 'Empty geo chat message', 'object_geoChatMessageEmpty_param_chat_id_type_int' => 'Chat ID', 'object_geoChatMessageEmpty_param_id_type_int' => 'ID', 'object_geoChatMessage' => 'Geo chat message', 'object_geoChatMessage_param_chat_id_type_int' => 'Chat ID', 'object_geoChatMessage_param_id_type_int' => 'ID', 'object_geoChatMessage_param_from_id_type_int' => 'From ID', 'object_geoChatMessage_param_date_type_int' => 'Date', 'object_geoChatMessage_param_message_type_string' => 'Message', 'object_geoChatMessage_param_media_type_MessageMedia' => 'Media', 'object_geoChatMessageService' => 'Geo chat message service', 'object_geoChatMessageService_param_chat_id_type_int' => 'Chat ID', 'object_geoChatMessageService_param_id_type_int' => 'ID', 'object_geoChatMessageService_param_from_id_type_int' => 'From ID', 'object_geoChatMessageService_param_date_type_int' => 'Date', 'object_geoChatMessageService_param_action_type_MessageAction' => 'Action', 'object_geochats.statedMessage' => 'Stated message', 'object_geochats.statedMessage_param_message_type_GeoChatMessage' => 'Message', 'object_geochats.statedMessage_param_chats_type_Vector t' => 'Chats', 'object_geochats.statedMessage_param_users_type_Vector t' => 'Users', 'object_geochats.statedMessage_param_seq_type_int' => 'Seq', 'object_geochats.located' => 'Located', 'object_geochats.located_param_results_type_Vector t' => 'Results', 'object_geochats.located_param_messages_type_Vector t' => 'Messages', 'object_geochats.located_param_chats_type_Vector t' => 'Chats', 'object_geochats.located_param_users_type_Vector t' => 'Users', 'object_geochats.messages' => 'Messages', 'object_geochats.messages_param_messages_type_Vector t' => 'Messages', 'object_geochats.messages_param_chats_type_Vector t' => 'Chats', 'object_geochats.messages_param_users_type_Vector t' => 'Users', 'object_geochats.messagesSlice' => 'Messages slice', 'object_geochats.messagesSlice_param_count_type_int' => 'Count', 'object_geochats.messagesSlice_param_messages_type_Vector t' => 'Messages', 'object_geochats.messagesSlice_param_chats_type_Vector t' => 'Chats', 'object_geochats.messagesSlice_param_users_type_Vector t' => 'Users', 'object_messageActionGeoChatCreate' => 'Message action geo chat create', 'object_messageActionGeoChatCreate_param_title_type_string' => 'Title', 'object_messageActionGeoChatCreate_param_address_type_string' => 'Address', 'object_messageActionGeoChatCheckin' => 'Message action geo chat checkin', 'object_updateNewGeoChatMessage' => 'Update new geo chat message', 'object_updateNewGeoChatMessage_param_message_type_GeoChatMessage' => 'Message', 'object_messages.sentMessage_param_media_type_MessageMedia' => 'Media', 'object_messages.sentMessageLink_param_media_type_MessageMedia' => 'Media', 'object_inputMediaUploadedPhoto_param_caption_type_string' => 'Caption', 'object_inputMediaPhoto_param_caption_type_string' => 'Caption', 'object_inputMediaUploadedVideo_param_caption_type_string' => 'Caption', 'object_inputMediaUploadedThumbVideo_param_caption_type_string' => 'Caption', 'object_inputMediaVideo_param_caption_type_string' => 'Caption', 'object_messageMediaPhoto_param_caption_type_string' => 'Caption', 'object_messageMediaVideo_param_caption_type_string' => 'Caption', 'object_botCommand' => 'Bot command', 'object_botCommand_param_command_type_string' => 'Command', 'object_botCommand_param_description_type_string' => 'Description', 'object_botInfoEmpty' => 'Empty bot info', 'object_botInfo_param_version_type_int' => 'Version', 'object_botInfo_param_share_text_type_string' => 'Share text', 'object_help.appChangelogEmpty' => 'Empty app changelog', 'object_help.appChangelog' => 'App changelog', 'object_help.appChangelog_param_text_type_string' => 'Text', 'object_message_param_fwd_from_id_type_Peer' => 'Forwarded from ID', 'object_updateShortMessage_param_fwd_from_id_type_Peer' => 'Fwd from ID', 'object_updateShortChatMessage_param_fwd_from_id_type_Peer' => 'Fwd from ID', 'object_channelFull_param_unread_important_count_type_int' => 'Unread important count', 'object_dialogChannel' => 'Dialog channel', 'object_dialogChannel_param_peer_type_Peer' => 'Peer', 'object_dialogChannel_param_top_message_type_int' => 'Top message', 'object_dialogChannel_param_top_important_message_type_int' => 'Top important message', 'object_dialogChannel_param_read_inbox_max_id_type_int' => 'Read inbox max ID', 'object_dialogChannel_param_unread_count_type_int' => 'Unread count', 'object_dialogChannel_param_unread_important_count_type_int' => 'Unread important count', 'object_dialogChannel_param_notify_settings_type_PeerNotifySettings' => 'Notify settings', 'object_dialogChannel_param_pts_type_int' => 'Pts', 'object_messageGroup' => 'Message group', 'object_messageGroup_param_min_id_type_int' => 'Min ID', 'object_messageGroup_param_max_id_type_int' => 'Max ID', 'object_messageGroup_param_count_type_int' => 'Count', 'object_messageGroup_param_date_type_int' => 'Date', 'object_messages.channelMessages_param_collapsed_type_Vector t' => 'Collapsed', 'object_updateChannelGroup' => 'Update channel group', 'object_updateChannelGroup_param_channel_id_type_int' => 'Channel ID', 'object_updateChannelGroup_param_group_type_MessageGroup' => 'Group', 'object_updates.channelDifferenceTooLong_param_top_important_message_type_int' => 'Top important message', 'object_updates.channelDifferenceTooLong_param_unread_important_count_type_int' => 'Unread important count', 'object_channelMessagesFilterCollapsed' => 'Channel messages filter collapsed', 'object_channelParticipantModerator' => 'Channel participant moderator', 'object_channelParticipantModerator_param_user_id_type_int' => 'User ID', 'object_channelParticipantModerator_param_inviter_id_type_int' => 'Inviter ID', 'object_channelParticipantModerator_param_date_type_int' => 'Date', 'object_channelParticipantEditor' => 'Channel participant editor', 'object_channelParticipantEditor_param_user_id_type_int' => 'User ID', 'object_channelParticipantEditor_param_inviter_id_type_int' => 'Inviter ID', 'object_channelParticipantEditor_param_date_type_int' => 'Date', 'object_channelParticipantKicked' => 'Channel participant kicked', 'object_channelParticipantKicked_param_user_id_type_int' => 'User ID', 'object_channelParticipantKicked_param_kicked_by_type_int' => 'Kicked by', 'object_channelParticipantKicked_param_date_type_int' => 'Date', 'object_channelRoleEmpty' => 'Empty channel role', 'object_channelRoleModerator' => 'Channel role moderator', 'object_channelRoleEditor' => 'Channel role editor', 'object_inputChatEmpty' => 'Empty input chat', 'object_inputChat' => 'Chat', 'object_inputChat_param_chat_id_type_int' => 'Chat ID', 'object_updateReadChannelInbox_param_peer_type_Peer' => 'Peer', 'object_updateDeleteChannelMessages_param_peer_type_Peer' => 'Peer', 'object_message_param_unread_type_true' => 'Unread?', 'object_messageService_param_unread_type_true' => 'Unread?', 'object_updateShortMessage_param_unread_type_true' => 'Unread?', 'object_updateShortChatMessage_param_unread_type_true' => 'Unread?', 'object_stickerSet_param_disabled_type_true' => 'Disabled?', 'object_updateShortSentMessage_param_unread_type_true' => 'Unread?', 'object_channel_param_kicked_type_true' => 'Kicked?', 'object_channel_param_moderator_type_true' => 'Moderator?', 'object_channelMessagesFilter_param_important_only_type_true' => 'Important only?', 'object_messageActionChatDeactivate' => 'Message action chat deactivate', 'object_messageActionChatActivate' => 'Message action chat activate', 'object_user_param_restiction_reason_type_string' => 'Restiction reason', 'object_channel_param_restiction_reason_type_string' => 'Restiction reason', 'object_webPageExternal' => 'Web page external', 'object_webPageExternal_param_url_type_string' => 'URL', 'object_webPageExternal_param_display_url_type_string' => 'Display URL', 'object_webPageExternal_param_type_type_string' => 'Type', 'object_webPageExternal_param_title_type_string' => 'Title', 'object_webPageExternal_param_description_type_string' => 'Description', 'object_webPageExternal_param_thumb_url_type_string' => 'Thumbnail URL', 'object_webPageExternal_param_content_url_type_string' => 'Content URL', 'object_webPageExternal_param_w_type_int' => 'Width', 'object_webPageExternal_param_h_type_int' => 'Height', 'object_webPageExternal_param_duration_type_int' => 'Duration', 'object_foundGif_param_webpage_type_WebPage' => 'Webpage', 'object_inputMediaUploadedDocument_param_caption_type_string' => 'Caption', 'object_inputMediaUploadedThumbDocument_param_caption_type_string' => 'Caption', 'object_inputMediaDocument_param_caption_type_string' => 'Caption', 'object_messageMediaDocument_param_caption_type_string' => 'Caption', 'object_inputBotInlineMessageMediaAuto_param_caption_type_string' => 'Caption', 'object_botInlineMessageMediaAuto_param_caption_type_string' => 'Caption', 'object_botInlineMediaResultDocument' => 'Bot inline media result document', 'object_botInlineMediaResultDocument_param_id_type_string' => 'ID', 'object_botInlineMediaResultDocument_param_type_type_string' => 'Type', 'object_botInlineMediaResultDocument_param_document_type_Document' => 'Document', 'object_botInlineMediaResultDocument_param_send_message_type_BotInlineMessage' => 'Send message', 'object_botInlineMediaResultPhoto' => 'Bot inline media result photo', 'object_botInlineMediaResultPhoto_param_id_type_string' => 'ID', 'object_botInlineMediaResultPhoto_param_type_type_string' => 'Type', 'object_botInlineMediaResultPhoto_param_photo_type_Photo' => 'Photo', 'object_botInlineMediaResultPhoto_param_send_message_type_BotInlineMessage' => 'Send message', 'object_inputMediaVideo_param_video_type_InputVideo' => 'Video', 'object_inputMediaAudio_param_audio_type_InputAudio' => 'Audio', 'object_inputMediaDocument_param_document_id_type_InputDocument' => 'Document ID', 'object_inputGeoPoint_param_latitude_type_double' => 'Latitude', 'object_inputGeoPoint_param_longitude_type_double' => 'Longitude', 'object_geoPoint_param_longitude_type_double' => 'Longitude', 'object_geoPoint_param_latitude_type_double' => 'Latitude', 'object_updateNewEncryptedMessage_param_encr_message_type_EncryptedMessage' => 'Encr message', 'object_updateEncryption_param_encr_chat_type_EncryptedChat' => 'Encr chat', 'object_updateNotifySettings_param_notify_peer_type_NotifyPeer' => 'Notify peer', 'object_updateServiceNotification_param_message_text_type_string' => 'Message text', 'object_updateNewChannelMessage_param_channel_pts_type_int' => 'Channel pts', 'object_updateNewChannelMessage_param_channel_pts_count_type_int' => 'Channel pts count', 'object_updateDeleteChannelMessages_param_channel_pts_type_int' => 'Channel pts', 'object_updateDeleteChannelMessages_param_channel_pts_count_type_int' => 'Channel pts count', 'object_updates.channelDifferenceEmpty_param_channel_pts_type_int' => 'Channel pts', 'object_updates.channelDifferenceTooLong_param_channel_pts_type_int' => 'Channel pts', 'object_updates.channelDifference_param_channel_pts_type_int' => 'Channel pts', 'object_privacyKeyChatInvite' => 'Privacy key chat invite', 'object_inputMediaUploadedThumbDocument_param_stickers_type_Vector t' => 'Stickers', 'object_inputMediaPhotoExternal_param_caption_type_string' => 'Caption', 'object_inputMediaDocumentExternal_param_caption_type_string' => 'Caption', 'object_destroy_auth_key_ok' => 'Destroy auth key ok', 'object_destroy_auth_key_none' => 'Destroy auth key none', 'object_destroy_auth_key_fail' => 'Destroy auth key fail', 'object_help.appChangelog_param_message_type_string' => 'Message', 'object_help.appChangelog_param_media_type_MessageMedia' => 'Media', 'object_help.appChangelog_param_entities_type_Vector t' => 'Entities', 'object_pageBlockParagraph' => 'Page block paragraph', 'object_pageBlockParagraph_param_text_type_RichText' => 'Text', 'object_pageBlockPreformatted' => 'Page block preformatted', 'object_pageBlockPreformatted_param_text_type_RichText' => 'Text', 'object_pageBlockPreformatted_param_language_type_string' => 'Language', 'object_pageBlockDivider' => 'Page block divider', 'object_pageBlockAnchor' => 'Page block anchor', 'object_pageBlockAnchor_param_name_type_string' => 'Name', 'object_pageBlockCover' => 'Page block cover', 'object_pageBlockCover_param_cover_type_PageBlock' => 'Cover', 'object_pagePart_param_videos_type_Vector t' => 'Videos', 'object_pageFull_param_videos_type_Vector t' => 'Videos', 'object_phoneCallRequested_param_g_a_type_bytes' => 'G a', 'object_resPQ_param_pq_type_string' => 'Pq', 'object_p_q_inner_data_param_pq_type_string' => 'Pq', 'object_p_q_inner_data_param_p_type_string' => 'P', 'object_p_q_inner_data_param_q_type_string' => 'Q', 'object_server_DH_params_ok_param_encrypted_answer_type_string' => 'Encrypted answer', 'object_server_DH_inner_data_param_dh_prime_type_string' => 'Dh prime', 'object_server_DH_inner_data_param_g_a_type_string' => 'G a', 'object_client_DH_inner_data_param_g_b_type_string' => 'G b', 'object_msgs_state_info_param_info_type_string' => 'Info', 'object_msgs_all_info_param_info_type_string' => 'Info', 'object_http_wait' => 'Http wait', 'object_http_wait_param_max_delay_type_int' => 'Max delay', 'object_http_wait_param_wait_after_type_int' => 'Wait after', 'object_http_wait_param_max_wait_type_int' => 'Max wait', 'object_ipPort' => 'Ip port', 'object_ipPort_param_ipv4_type_int' => 'Ipv4', 'object_ipPort_param_port_type_int' => 'Port', 'object_help.configSimple' => 'Config simple', 'object_help.configSimple_param_date_type_int' => 'Date', 'object_help.configSimple_param_expires_type_int' => 'Expires', 'object_help.configSimple_param_dc_id_type_int' => 'DC ID', 'object_help.configSimple_param_ip_port_list_type_Vector t' => 'Ip port list', 'object_inputMessagesFilterMyMentionsUnread' => 'Messages filter my mentions unread', 'method_initConnection_param_proxy_type_InputClientProxy' => 'The current proxy', 'method_account.registerDevice_param_secret_type_bytes' => 'Secret', 'method_account.getAllSecureValues' => 'Get all secure telegram passport values', 'method_account.getSecureValue' => 'Get secure value for telegram passport', 'method_account.getSecureValue_param_types_type_Vector t' => 'Get telegram passport secure parameters', 'method_account.saveSecureValue' => 'Save telegram passport secure value', 'method_account.saveSecureValue_param_value_type_InputSecureValue' => 'Encrypted value', 'method_account.saveSecureValue_param_secure_secret_id_type_long' => 'Secret', 'method_account.deleteSecureValue' => 'Delete secure telegram passport value', 'method_account.deleteSecureValue_param_types_type_Vector t' => 'The values to delete', 'method_account.getAuthorizationForm' => 'Bots only: get telegram passport authorization form', 'method_account.getAuthorizationForm_param_bot_id_type_int' => 'Bot ID', 'method_account.getAuthorizationForm_param_scope_type_string' => 'Scope', 'method_account.getAuthorizationForm_param_public_key_type_string' => 'Bot\'s public key', 'method_account.acceptAuthorization' => 'Accept telegram passport authorization', 'method_account.acceptAuthorization_param_bot_id_type_int' => 'Bot ID', 'method_account.acceptAuthorization_param_scope_type_string' => 'Scope', 'method_account.acceptAuthorization_param_public_key_type_string' => 'The bot\'s RSA public key', 'method_account.acceptAuthorization_param_value_hashes_type_Vector t' => 'Hashes of the encrypted credentials', 'method_account.acceptAuthorization_param_credentials_type_SecureCredentialsEncrypted' => 'Encrypted secure credentials', 'method_account.sendVerifyPhoneCode' => 'Send phone verification code', 'method_account.sendVerifyPhoneCode_param_allow_flashcall_type_true' => 'Allow phone calls?', 'method_account.sendVerifyPhoneCode_param_phone_number_type_string' => 'The phone number', 'method_account.sendVerifyPhoneCode_param_current_number_type_Bool' => 'Is this the current number?', 'method_account.verifyPhone' => 'Verify phone number', 'method_account.verifyPhone_param_phone_number_type_string' => 'The phone number', 'method_account.verifyPhone_param_phone_code_hash_type_string' => 'The phone code hash returned by account.sendVerifyPhoneCode', 'method_account.verifyPhone_param_phone_code_type_string' => 'The phone code type returned by account.sendVerifyPhoneCode', 'method_account.sendVerifyEmailCode' => 'Send email verification code', 'method_account.sendVerifyEmailCode_param_email_type_string' => 'Email', 'method_account.verifyEmail' => 'Verify email address', 'method_account.verifyEmail_param_email_type_string' => 'The email address', 'method_account.verifyEmail_param_code_type_string' => 'The received code', 'method_users.setSecureValueErrors' => 'Set secure value error for telegram passport', 'method_users.setSecureValueErrors_param_id_type_InputUser' => 'The user ID', 'method_users.setSecureValueErrors_param_errors_type_Vector t' => 'The errors', 'method_messages.search_param_hash_type_int' => 'IDs of messages you already fetched', 'method_messages.report' => 'Report a message', 'method_messages.report_param_peer_type_InputPeer' => 'The user that sent the messages', 'method_messages.report_param_id_type_Vector t' => 'The messages to report', 'method_messages.report_param_reason_type_ReportReason' => 'The reason why you\'re sending this report', 'method_messages.getStickers_param_hash_type_int' => 'IDs of previously fetched stickers', 'method_messages.editMessage_param_media_type_InputMedia' => 'The media to substitute', 'method_messages.editInlineBotMessage_param_media_type_InputMedia' => 'The media to substitute', 'method_messages.toggleDialogPin_param_peer_type_InputDialogPeer' => 'The dialog to pin', 'method_messages.getRecentLocations_param_hash_type_int' => 'IDs of previously fetched locations', 'method_messages.searchStickerSets' => 'Find a sticker set', 'method_messages.searchStickerSets_param_exclude_featured_type_true' => 'Exclude featured sticker sets from the search?', 'method_messages.searchStickerSets_param_q_type_string' => 'The search query', 'method_messages.searchStickerSets_param_hash_type_int' => 'Ids of stickers you already cached', 'method_upload.getFileHashes' => 'Get file hashes', 'method_upload.getFileHashes_param_location_type_InputFileLocation' => 'The file', 'method_upload.getFileHashes_param_offset_type_int' => 'Offset', 'method_help.getProxyData' => 'Get information about the current proxy', 'method_help.getTermsOfServiceUpdate' => 'Get updated TOS', 'method_help.acceptTermsOfService' => 'Accept telegram\'s TOS', 'method_help.acceptTermsOfService_param_id_type_DataJSON' => 'TOS', 'method_help.getDeepLinkInfo' => 'Get deep link info', 'method_help.getDeepLinkInfo_param_path_type_string' => 'Deep link', 'object_inputSecureFileLocation' => 'Secure file location', 'object_inputSecureFileLocation_param_id_type_long' => 'ID', 'object_inputSecureFileLocation_param_access_hash_type_long' => 'Access hash', 'object_messageActionBotAllowed' => 'Message action bot allowed', 'object_messageActionBotAllowed_param_domain_type_string' => 'Domain', 'object_messageActionSecureValuesSentMe' => 'Message action secure values sent me', 'object_messageActionSecureValuesSentMe_param_values_type_Vector t' => 'Values', 'object_messageActionSecureValuesSentMe_param_credentials_type_SecureCredentialsEncrypted' => 'Credentials', 'object_messageActionSecureValuesSent' => 'Message action secure values sent', 'object_messageActionSecureValuesSent_param_types_type_Vector t' => 'Types', 'object_auth.sentCode_param_terms_of_service_type_help.TermsOfService' => 'Terms of service', 'object_inputPeerNotifySettings_param_silent_type_Bool' => 'Silent?', 'object_peerNotifySettings_param_silent_type_Bool' => 'Silent?', 'object_updateDialogPinned_param_peer_type_DialogPeer' => 'Peer', 'object_upload.fileCdnRedirect_param_file_hashes_type_Vector t' => 'File hashes', 'object_dcOption_param_secret_type_bytes' => 'Secret', 'object_config_param_preload_featured_stickers_type_true' => 'Preload featured stickers?', 'object_config_param_ignore_phone_entities_type_true' => 'Ignore phone entities?', 'object_config_param_revoke_pm_inbox_type_true' => 'Revoke pm inbox?', 'object_config_param_blocked_mode_type_true' => 'Blocked mode?', 'object_config_param_revoke_time_limit_type_int' => 'Revoke time limit', 'object_config_param_revoke_pm_time_limit_type_int' => 'Revoke pm time limit', 'object_config_param_autoupdate_url_prefix_type_string' => 'Autoupdate URL prefix', 'object_messages.stickers_param_hash_type_int' => 'Hash', 'object_account.noPassword_param_new_secure_salt_type_bytes' => 'New secure salt', 'object_account.noPassword_param_secure_random_type_bytes' => 'Secure random', 'object_account.password_param_has_recovery_type_true' => 'Has recovery?', 'object_account.password_param_has_secure_values_type_true' => 'Has secure values?', 'object_account.password_param_new_secure_salt_type_bytes' => 'New secure salt', 'object_account.password_param_secure_random_type_bytes' => 'Secure random', 'object_account.passwordSettings_param_secure_salt_type_bytes' => 'Secure salt', 'object_account.passwordSettings_param_secure_secret_type_bytes' => 'Secure secret', 'object_account.passwordSettings_param_secure_secret_id_type_long' => 'Secure secret ID', 'object_account.passwordInputSettings_param_new_secure_salt_type_bytes' => 'New secure salt', 'object_account.passwordInputSettings_param_new_secure_secret_type_bytes' => 'New secure secret', 'object_account.passwordInputSettings_param_new_secure_secret_id_type_long' => 'New secure secret ID', 'object_stickerSet_param_installed_date_type_int' => 'Installed date', 'object_messageEntityPhone' => 'Message entity phone', 'object_messageEntityPhone_param_offset_type_int' => 'Offset', 'object_messageEntityPhone_param_length_type_int' => 'Length', 'object_messageEntityCashtag' => 'Message entity cashtag', 'object_messageEntityCashtag_param_offset_type_int' => 'Offset', 'object_messageEntityCashtag_param_length_type_int' => 'Length', 'object_help.termsOfService_param_popup_type_true' => 'Popup?', 'object_help.termsOfService_param_id_type_DataJSON' => 'ID', 'object_help.termsOfService_param_entities_type_Vector t' => 'Entities', 'object_help.termsOfService_param_min_age_confirm_type_int' => 'Min age confirm', 'object_inputBotInlineMessageMediaVenue_param_venue_type_type_string' => 'Venue type', 'object_inputBotInlineResult_param_thumb_type_InputWebDocument' => 'Thumbnail', 'object_inputBotInlineResult_param_content_type_InputWebDocument' => 'Content', 'object_botInlineMessageMediaVenue_param_venue_type_type_string' => 'Venue type', 'object_botInlineResult_param_thumb_type_WebDocument' => 'Thumbnailnail', 'object_botInlineResult_param_content_type_WebDocument' => 'Content', 'object_messages.recentStickers_param_packs_type_Vector t' => 'Packs', 'object_messages.recentStickers_param_dates_type_Vector t' => 'Dates', 'object_webDocumentNoProxy' => 'Web document no proxy', 'object_webDocumentNoProxy_param_url_type_string' => 'URL', 'object_webDocumentNoProxy_param_size_type_int' => 'Size', 'object_webDocumentNoProxy_param_mime_type_type_string' => 'Mime type', 'object_webDocumentNoProxy_param_attributes_type_Vector t' => 'Attributes', 'object_inputWebFileGeoPointLocation' => 'Web file geo point location', 'object_inputWebFileGeoPointLocation_param_geo_point_type_InputGeoPoint' => 'Geo point', 'object_inputWebFileGeoPointLocation_param_w_type_int' => 'Width', 'object_inputWebFileGeoPointLocation_param_h_type_int' => 'Height', 'object_inputWebFileGeoPointLocation_param_zoom_type_int' => 'Zoom', 'object_inputWebFileGeoPointLocation_param_scale_type_int' => 'Scale', 'object_inputWebFileGeoMessageLocation' => 'Web file geo message location', 'object_inputWebFileGeoMessageLocation_param_peer_type_InputPeer' => 'Peer', 'object_inputWebFileGeoMessageLocation_param_msg_id_type_int' => 'Msg ID', 'object_inputWebFileGeoMessageLocation_param_w_type_int' => 'Width', 'object_inputWebFileGeoMessageLocation_param_h_type_int' => 'Height', 'object_inputWebFileGeoMessageLocation_param_zoom_type_int' => 'Zoom', 'object_inputWebFileGeoMessageLocation_param_scale_type_int' => 'Scale', 'object_channelAdminRights_param_manage_call_type_true' => 'Manage group calls', 'object_inputDialogPeer' => 'Dialog peer', 'object_inputDialogPeer_param_peer_type_InputPeer' => 'Peer', 'object_dialogPeer' => 'Dialog peer', 'object_dialogPeer_param_peer_type_Peer' => 'Peer', 'object_messages.foundStickerSetsNotModified' => 'Found sticker sets not modified', 'object_messages.foundStickerSets' => 'Found sticker sets', 'object_messages.foundStickerSets_param_hash_type_int' => 'Hash', 'object_messages.foundStickerSets_param_sets_type_Vector t' => 'Sets', 'object_fileHash' => 'File hash', 'object_fileHash_param_offset_type_int' => 'Offset', 'object_fileHash_param_limit_type_int' => 'Limit', 'object_fileHash_param_hash_type_bytes' => 'Hash', 'object_inputClientProxy' => 'Client proxy', 'object_inputClientProxy_param_address_type_string' => 'Address', 'object_inputClientProxy_param_port_type_int' => 'Port', 'object_help.proxyDataEmpty' => 'Empty proxy data', 'object_help.proxyDataEmpty_param_expires_type_int' => 'Expires', 'object_help.proxyDataPromo' => 'Proxy data promo', 'object_help.proxyDataPromo_param_expires_type_int' => 'Expires', 'object_help.proxyDataPromo_param_peer_type_Peer' => 'Peer', 'object_help.proxyDataPromo_param_chats_type_Vector t' => 'Chats', 'object_help.proxyDataPromo_param_users_type_Vector t' => 'Users', 'object_help.termsOfServiceUpdateEmpty' => 'Empty terms of service update', 'object_help.termsOfServiceUpdateEmpty_param_expires_type_int' => 'Expires', 'object_help.termsOfServiceUpdate' => 'Terms of service update', 'object_help.termsOfServiceUpdate_param_expires_type_int' => 'Expires', 'object_help.termsOfServiceUpdate_param_terms_of_service_type_help.TermsOfService' => 'Terms of service', 'object_inputSecureFileUploaded' => 'Secure file uploaded', 'object_inputSecureFileUploaded_param_id_type_long' => 'ID', 'object_inputSecureFileUploaded_param_parts_type_int' => 'Parts', 'object_inputSecureFileUploaded_param_md5_checksum_type_string' => 'Md5 checksum', 'object_inputSecureFileUploaded_param_file_hash_type_bytes' => 'File hash', 'object_inputSecureFileUploaded_param_secret_type_bytes' => 'Secret', 'object_inputSecureFile' => 'Secure file', 'object_inputSecureFile_param_id_type_long' => 'ID', 'object_inputSecureFile_param_access_hash_type_long' => 'Access hash', 'object_secureFileEmpty' => 'Empty secure file', 'object_secureFile' => 'Secure file', 'object_secureFile_param_id_type_long' => 'ID', 'object_secureFile_param_access_hash_type_long' => 'Access hash', 'object_secureFile_param_size_type_int' => 'Size', 'object_secureFile_param_dc_id_type_int' => 'DC ID', 'object_secureFile_param_date_type_int' => 'Date', 'object_secureFile_param_file_hash_type_bytes' => 'File hash', 'object_secureFile_param_secret_type_bytes' => 'Secret', 'object_secureData' => 'Secure data', 'object_secureData_param_data_type_bytes' => 'Data', 'object_secureData_param_data_hash_type_bytes' => 'Data hash', 'object_secureData_param_secret_type_bytes' => 'Secret', 'object_securePlainPhone' => 'Secure plain phone', 'object_securePlainPhone_param_phone_type_string' => 'Phone', 'object_securePlainEmail' => 'Secure plain email', 'object_securePlainEmail_param_email_type_string' => 'Email', 'object_secureValueTypePersonalDetails' => 'Secure value type personal details', 'object_secureValueTypePassport' => 'Secure value type passport', 'object_secureValueTypeDriverLicense' => 'Secure value type driver license', 'object_secureValueTypeIdentityCard' => 'Secure value type IDentity card', 'object_secureValueTypeInternalPassport' => 'Secure value type internal passport', 'object_secureValueTypeAddress' => 'Secure value type address', 'object_secureValueTypeUtilityBill' => 'Secure value type utility bill', 'object_secureValueTypeBankStatement' => 'Secure value type bank statement', 'object_secureValueTypeRentalAgreement' => 'Secure value type rental agreement', 'object_secureValueTypePassportRegistration' => 'Secure value type passport registration', 'object_secureValueTypeTemporaryRegistration' => 'Secure value type temporary registration', 'object_secureValueTypePhone' => 'Secure value type phone', 'object_secureValueTypeEmail' => 'Secure value type email', 'object_secureValue' => 'Secure value', 'object_secureValue_param_type_type_SecureValueType' => 'Type', 'object_secureValue_param_data_type_SecureData' => 'Data', 'object_secureValue_param_front_side_type_SecureFile' => 'Front side', 'object_secureValue_param_reverse_side_type_SecureFile' => 'Reverse side', 'object_secureValue_param_selfie_type_SecureFile' => 'Selfie', 'object_secureValue_param_files_type_Vector t' => 'Files', 'object_secureValue_param_plain_data_type_SecurePlainData' => 'Plain data', 'object_secureValue_param_hash_type_bytes' => 'Hash', 'object_inputSecureValue' => 'Secure value', 'object_inputSecureValue_param_type_type_SecureValueType' => 'Type', 'object_inputSecureValue_param_data_type_SecureData' => 'Data', 'object_inputSecureValue_param_front_side_type_InputSecureFile' => 'Front side', 'object_inputSecureValue_param_reverse_side_type_InputSecureFile' => 'Reverse side', 'object_inputSecureValue_param_selfie_type_InputSecureFile' => 'Selfie', 'object_inputSecureValue_param_files_type_Vector t' => 'Files', 'object_inputSecureValue_param_plain_data_type_SecurePlainData' => 'Plain data', 'object_secureValueHash' => 'Secure value hash', 'object_secureValueHash_param_type_type_SecureValueType' => 'Type', 'object_secureValueHash_param_hash_type_bytes' => 'Hash', 'object_secureValueErrorData' => 'Secure value error data', 'object_secureValueErrorData_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorData_param_data_hash_type_bytes' => 'Data hash', 'object_secureValueErrorData_param_field_type_string' => 'Field', 'object_secureValueErrorData_param_text_type_string' => 'Text', 'object_secureValueErrorFrontSide' => 'Secure value error front side', 'object_secureValueErrorFrontSide_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorFrontSide_param_file_hash_type_bytes' => 'File hash', 'object_secureValueErrorFrontSide_param_text_type_string' => 'Text', 'object_secureValueErrorReverseSide' => 'Secure value error reverse side', 'object_secureValueErrorReverseSide_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorReverseSide_param_file_hash_type_bytes' => 'File hash', 'object_secureValueErrorReverseSide_param_text_type_string' => 'Text', 'object_secureValueErrorSelfie' => 'Secure value error selfie', 'object_secureValueErrorSelfie_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorSelfie_param_file_hash_type_bytes' => 'File hash', 'object_secureValueErrorSelfie_param_text_type_string' => 'Text', 'object_secureValueErrorFile' => 'Secure value error file', 'object_secureValueErrorFile_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorFile_param_file_hash_type_bytes' => 'File hash', 'object_secureValueErrorFile_param_text_type_string' => 'Text', 'object_secureValueErrorFiles' => 'Secure value error files', 'object_secureValueErrorFiles_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorFiles_param_file_hash_type_Vector t' => 'File hash', 'object_secureValueErrorFiles_param_text_type_string' => 'Text', 'object_secureCredentialsEncrypted' => 'Secure credentials encrypted', 'object_secureCredentialsEncrypted_param_data_type_bytes' => 'Data', 'object_secureCredentialsEncrypted_param_hash_type_bytes' => 'Hash', 'object_secureCredentialsEncrypted_param_secret_type_bytes' => 'Secret', 'object_account.authorizationForm' => 'Telegram passport authorization form', 'object_account.authorizationForm_param_selfie_required_type_true' => 'Selfie required?', 'object_account.authorizationForm_param_required_types_type_Vector t' => 'Required types', 'object_account.authorizationForm_param_values_type_Vector t' => 'Values', 'object_account.authorizationForm_param_errors_type_Vector t' => 'Errors', 'object_account.authorizationForm_param_users_type_Vector t' => 'Users', 'object_account.authorizationForm_param_privacy_policy_url_type_string' => 'Privacy policy URL', 'object_account.sentEmailCode' => 'Sent email code', 'object_account.sentEmailCode_param_email_pattern_type_string' => 'Email pattern', 'object_account.sentEmailCode_param_length_type_int' => 'Length', 'object_help.deepLinkInfoEmpty' => 'Empty deep link info', 'object_help.deepLinkInfo' => 'Deep link info', 'object_help.deepLinkInfo_param_update_app_type_true' => 'Update app?', 'object_help.deepLinkInfo_param_message_type_string' => 'Message', 'object_help.deepLinkInfo_param_entities_type_Vector t' => 'Entities', 'method_invokeWithMessagesRange' => 'Invoke with messages range', 'method_invokeWithMessagesRange_param_range_type_MessageRange' => 'The range', 'method_invokeWithMessagesRange_param_query_type_!X' => 'The query', 'method_invokeWithTakeout' => 'Invoke method from takeout session', 'method_invokeWithTakeout_param_takeout_id_type_long' => 'The takeout session ID', 'method_invokeWithTakeout_param_query_type_!X' => 'The query', 'method_account.initTakeoutSession' => 'Start account exporting session', 'method_account.initTakeoutSession_param_contacts_type_true' => 'Export contacts?', 'method_account.initTakeoutSession_param_message_users_type_true' => 'Export users?', 'method_account.initTakeoutSession_param_message_chats_type_true' => 'Export chats?', 'method_account.initTakeoutSession_param_message_megagroups_type_true' => 'Export supergroups?', 'method_account.initTakeoutSession_param_message_channels_type_true' => 'Export channel messages?', 'method_account.initTakeoutSession_param_files_type_true' => 'Export files?', 'method_account.initTakeoutSession_param_file_max_size_type_int' => 'Export only files smaller than this size', 'method_account.finishTakeoutSession' => 'Finish account exporting session', 'method_account.finishTakeoutSession_param_success_type_true' => 'Did the data export succeed?', 'method_contacts.getSaved' => 'Get saved contacts', 'method_messages.getSplitRanges' => 'Get message ranges to fetch', 'method_channels.getLeftChannels' => 'Get all channels you left', 'method_channels.getLeftChannels_param_offset_type_int' => 'Offset', 'object_ipPortSecret' => 'Ip port secret', 'object_ipPortSecret_param_ipv4_type_int' => 'Ipv4', 'object_ipPortSecret_param_port_type_int' => 'Port', 'object_ipPortSecret_param_secret_type_bytes' => 'Secret', 'object_accessPointRule' => 'Access point rule', 'object_accessPointRule_param_phone_prefix_rules_type_string' => 'Phone prefix rules', 'object_accessPointRule_param_dc_id_type_int' => 'DC ID', 'object_accessPointRule_param_ips_type_vector' => 'Ips', 'object_help.configSimple_param_rules_type_vector' => 'Rules', 'object_inputTakeoutFileLocation' => 'Takeout file location', 'object_savedPhoneContact' => 'Saved phone contact', 'object_savedPhoneContact_param_phone_type_string' => 'Phone', 'object_savedPhoneContact_param_first_name_type_string' => 'First name', 'object_savedPhoneContact_param_last_name_type_string' => 'Last name', 'object_savedPhoneContact_param_date_type_int' => 'Date', 'object_account.takeout' => 'Takeout', 'object_account.takeout_param_id_type_long' => 'ID', 'method_contacts.toggleTopPeers' => 'Toggle top peers', 'method_contacts.toggleTopPeers_param_enabled_type_Bool' => 'Enable or disable top peer', 'method_messages.getDialogs_param_hash_type_int' => 'IDs of previously fetched dialogs', 'method_messages.markDialogUnread' => 'Mark dialog as unread ', 'method_messages.markDialogUnread_param_unread_type_true' => 'Should it be marked or unmarked as read', 'method_messages.markDialogUnread_param_peer_type_InputDialogPeer' => 'The dialog to mark as unread', 'method_messages.getDialogUnreadMarks' => 'Get dialogs marked as unread manually', 'object_inputMediaContact_param_vcard_type_string' => 'Vcard', 'object_messageMediaContact_param_vcard_type_string' => 'Vcard', 'object_dialog_param_unread_mark_type_true' => 'Unread mark?', 'object_geoPoint_param_access_hash_type_long' => 'Access hash', 'object_messages.dialogsNotModified' => 'Dialogs not modified', 'object_messages.dialogsNotModified_param_count_type_int' => 'Count', 'object_updateDialogUnreadMark' => 'Update dialog unread mark', 'object_updateDialogUnreadMark_param_unread_type_true' => 'Unread?', 'object_updateDialogUnreadMark_param_peer_type_DialogPeer' => 'Peer', 'object_config_param_dc_txt_domain_name_type_string' => 'DC txt domain name', 'object_config_param_gif_search_username_type_string' => 'Gif search username', 'object_config_param_venue_search_username_type_string' => 'Venue search username', 'object_config_param_img_search_username_type_string' => 'Img search username', 'object_config_param_static_maps_provider_type_string' => 'Static maps provider', 'object_config_param_caption_length_max_type_int' => 'Caption length max', 'object_config_param_message_length_max_type_int' => 'Message length max', 'object_config_param_webfile_dc_id_type_int' => 'Webfile DC ID', 'object_inputBotInlineMessageMediaContact_param_vcard_type_string' => 'Vcard', 'object_botInlineMessageMediaContact_param_vcard_type_string' => 'Vcard', 'object_contacts.topPeersDisabled' => 'Top peers disabled', 'object_draftMessageEmpty_param_date_type_int' => 'Date', 'object_inputWebFileGeoPointLocation_param_access_hash_type_long' => 'Access hash', 'method_contacts.getContacts_param_hash_type_Vector t' => 'User IDs of previously cached contacts', 'method_contacts.getTopPeers_param_hash_type_Vector t' => 'Peer IDs of previously cached peers', 'method_messages.getDialogs_param_hash_type_Vector t' => 'IDs of previously fetched dialogs', 'method_messages.getHistory_param_hash_type_Vector t' => 'IDs of messages you already fetched', 'method_messages.search_param_hash_type_Vector t' => 'The IDs of messages you already fetched', 'method_messages.getStickers_param_hash_type_Vector t' => ' the hash parameter of the previous result of this method', 'method_messages.getAllStickers_param_hash_type_Vector t' => 'The hash parameter of the previous result of this method', 'method_messages.getSavedGifs_param_hash_type_Vector t' => ' the hash parameter of the previous result of this method', 'method_messages.getFeaturedStickers_param_hash_type_Vector t' => ' the hash parameter of the previous result of this method', 'method_messages.getRecentStickers_param_hash_type_Vector t' => 'IDs the hash parameter of the previous result of this method', 'method_messages.getMaskStickers_param_hash_type_Vector t' => ' the hash parameter of the previous result of this method', 'method_messages.getWebPage_param_hash_type_Vector t' => ' the hash parameter of the previous result of this method', 'method_messages.getFavedStickers_param_hash_type_Vector t' => ' the hash parameter of the previous result of this method', 'method_messages.getRecentLocations_param_hash_type_Vector t' => 'IDs of locations you already fetched', 'method_messages.searchStickerSets_param_hash_type_Vector t' => 'The IDs of stickersets you already fetched', 'method_channels.getParticipants_param_hash_type_Vector t' => 'IDs of previously fetched participants', 'method_auth.checkPassword_param_password_type_InputCheckPasswordSRP' => 'You cannot use this method directly, use the complete_2fa_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_account.getPasswordSettings_param_password_type_InputCheckPasswordSRP' => 'You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info)', 'method_account.updatePasswordSettings_param_password_type_InputCheckPasswordSRP' => 'You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info)', 'method_account.getTmpPassword_param_password_type_InputCheckPasswordSRP' => 'Password', 'method_account.confirmPasswordEmail' => 'Confirm password recovery using email', 'method_account.confirmPasswordEmail_param_code_type_string' => 'Code', 'method_account.resendPasswordEmail' => 'Resend password recovery email', 'method_account.cancelPasswordEmail' => 'Cancel password recovery email', 'method_account.getContactSignUpNotification' => 'Contact signup notification setting value', 'method_account.setContactSignUpNotification' => 'Set contact sign up notification', 'method_account.setContactSignUpNotification_param_silent_type_Bool' => 'Silent?', 'method_account.getNotifyExceptions' => 'Get notification exceptions', 'method_account.getNotifyExceptions_param_compare_sound_type_true' => 'Compare sound?', 'method_account.getNotifyExceptions_param_peer_type_InputNotifyPeer' => 'Peer', 'method_contacts.getContactIDs' => 'Get contacts by IDs', 'method_contacts.getContactIDs_param_hash_type_Vector t' => 'Previously fetched IDs', 'method_contacts.deleteByPhones' => 'Delete contacts by phones', 'method_contacts.deleteByPhones_param_phones_type_Vector t' => 'Phones', 'method_messages.sendInlineBotResult_param_hide_via_type_true' => 'Hide "via @bot"', 'method_messages.clearAllDrafts' => 'Clear all drafts', 'method_messages.updatePinnedMessage' => 'Update pinned message (private chat only)', 'method_messages.updatePinnedMessage_param_silent_type_true' => 'Silent?', 'method_messages.updatePinnedMessage_param_peer_type_InputPeer' => 'Peer', 'method_messages.updatePinnedMessage_param_id_type_int' => 'Message ID', 'method_messages.sendVote' => 'Send vote', 'method_messages.sendVote_param_peer_type_InputPeer' => 'Peer', 'method_messages.sendVote_param_msg_id_type_int' => 'Message ID', 'method_messages.sendVote_param_options_type_Vector t' => 'Options', 'method_messages.getPollResults' => 'Get poll results', 'method_messages.getPollResults_param_peer_type_InputPeer' => 'Peer', 'method_messages.getPollResults_param_msg_id_type_int' => 'Message ID', 'method_messages.getOnlines' => 'Get online users', 'method_messages.getOnlines_param_peer_type_InputPeer' => 'Peer', 'method_messages.getStatsURL' => 'Get stats URL', 'method_messages.getStatsURL_param_peer_type_InputPeer' => 'Peer', 'method_help.getAppUpdate_param_source_type_string' => 'Source', 'method_help.getAppConfig' => 'Get app config', 'method_help.getPassportConfig' => 'Get passport config', 'method_help.getPassportConfig_param_hash_type_Vector t' => 'Hash', 'method_help.getSupportName' => 'Get support name', 'method_help.getUserInfo' => 'Get user info', 'method_help.getUserInfo_param_user_id_type_InputUser' => 'User ID', 'method_help.editUserInfo' => 'Edit user info', 'method_help.editUserInfo_param_user_id_type_InputUser' => 'User ID', 'method_help.editUserInfo_param_message_type_string' => 'Message', 'method_help.editUserInfo_param_entities_type_Vector t' => 'Entities', 'method_langpack.getLangPack_param_lang_pack_type_string' => 'Lang pack', 'method_langpack.getStrings_param_lang_pack_type_string' => 'Lang pack', 'method_langpack.getDifference_param_lang_code_type_string' => 'Lang code', 'method_langpack.getLanguages_param_lang_pack_type_string' => 'Lang pack', 'method_langpack.getLanguage' => 'Get language', 'method_langpack.getLanguage_param_lang_pack_type_string' => 'Lang pack', 'method_langpack.getLanguage_param_lang_code_type_string' => 'Lang code', 'object_inputMediaGeoLive_param_stopped_type_true' => 'Stopped?', 'object_inputMediaPoll' => 'Media poll', 'object_inputMediaPoll_param_poll_type_Poll' => 'Poll', 'object_inputPhoto_param_file_reference_type_bytes' => 'File reference', 'object_inputFileLocation_param_file_reference_type_bytes' => 'File reference', 'object_inputDocumentFileLocation_param_file_reference_type_bytes' => 'File reference', 'object_fileLocation_param_file_reference_type_bytes' => 'File reference', 'object_chatFull_param_pinned_msg_id_type_int' => 'Pinned msg ID', 'object_channelFull_param_can_view_stats_type_true' => 'Can view stats?', 'object_channelFull_param_online_count_type_int' => 'Online count', 'object_message_param_from_scheduled_type_true' => 'From scheduled?', 'object_messageMediaPoll' => 'Message media poll', 'object_messageMediaPoll_param_poll_type_Poll' => 'Poll', 'object_messageMediaPoll_param_results_type_PollResults' => 'Results', 'object_messageActionContactSignUp' => 'Message action contact sign up', 'object_photo_param_file_reference_type_bytes' => 'File reference', 'object_inputNotifyBroadcasts' => 'Notify broadcasts', 'object_inputReportReasonChildAbuse' => 'Report reason child abuse', 'object_inputReportReasonCopyright' => 'Report reason copyright', 'object_userFull_param_can_pin_message_type_true' => 'Can pin message?', 'object_userFull_param_pinned_msg_id_type_int' => 'Pinned msg ID', 'object_messages.channelMessages_param_inexact_type_true' => 'Inexact?', 'object_updateLangPackTooLong_param_lang_code_type_string' => 'Lang code', 'object_updateUserPinnedMessage' => 'Update user pinned message', 'object_updateUserPinnedMessage_param_user_id_type_int' => 'User ID', 'object_updateUserPinnedMessage_param_id_type_int' => 'ID', 'object_updateChatPinnedMessage' => 'Update chat pinned message', 'object_updateChatPinnedMessage_param_chat_id_type_int' => 'Chat ID', 'object_updateChatPinnedMessage_param_id_type_int' => 'ID', 'object_updateMessagePoll' => 'Update message poll', 'object_updateMessagePoll_param_poll_id_type_long' => 'Poll ID', 'object_updateMessagePoll_param_poll_type_Poll' => 'Poll', 'object_updateMessagePoll_param_results_type_PollResults' => 'Results', 'object_config_param_pfs_enabled_type_true' => 'Pfs enabled?', 'object_config_param_base_lang_pack_version_type_int' => 'Base lang pack version', 'object_help.appUpdate_param_popup_type_true' => 'Popup?', 'object_help.appUpdate_param_version_type_string' => 'Version', 'object_help.appUpdate_param_entities_type_Vector t' => 'Entities', 'object_help.appUpdate_param_document_type_Document' => 'Document', 'object_inputDocument_param_file_reference_type_bytes' => 'File reference', 'object_document_param_file_reference_type_bytes' => 'File reference', 'object_notifyBroadcasts' => 'Notify broadcasts', 'object_inputPrivacyKeyPhoneP2P' => 'Privacy key phone p2p', 'object_privacyKeyPhoneP2P' => 'Privacy key phone p2p', 'object_authorization_param_current_type_true' => 'Current?', 'object_authorization_param_official_app_type_true' => 'Official app?', 'object_authorization_param_password_pending_type_true' => 'Password pending?', 'object_account.password_param_has_password_type_true' => 'Has password?', 'object_account.password_param_current_algo_type_PasswordKdfAlgo' => 'Current algo', 'object_account.password_param_srp_B_type_bytes' => 'Srp b', 'object_account.password_param_srp_id_type_long' => 'Srp ID', 'object_account.password_param_new_algo_type_PasswordKdfAlgo' => 'New algo', 'object_account.password_param_new_secure_algo_type_SecurePasswordKdfAlgo' => 'New secure algo', 'object_account.passwordSettings_param_secure_settings_type_SecureSecretSettings' => 'Secure settings', 'object_account.passwordInputSettings_param_new_algo_type_PasswordKdfAlgo' => 'New algo', 'object_account.passwordInputSettings_param_new_secure_settings_type_SecureSecretSettings' => 'New secure settings', 'object_textSubscript' => 'Text subscript', 'object_textSubscript_param_text_type_RichText' => 'Text', 'object_textSuperscript' => 'Text superscript', 'object_textSuperscript_param_text_type_RichText' => 'Text', 'object_textMarked' => 'Text marked', 'object_textMarked_param_text_type_RichText' => 'Text', 'object_textPhone' => 'Text phone', 'object_textPhone_param_text_type_RichText' => 'Text', 'object_textPhone_param_phone_type_string' => 'Phone', 'object_textImage' => 'Text image', 'object_textImage_param_document_id_type_long' => 'Document ID', 'object_textImage_param_w_type_int' => 'Width', 'object_textImage_param_h_type_int' => 'Height', 'object_textAnchor' => 'Text anchor', 'object_textAnchor_param_text_type_RichText' => 'Text', 'object_textAnchor_param_name_type_string' => 'Name', 'object_pageBlockPhoto_param_caption_type_PageCaption' => 'Caption', 'object_pageBlockPhoto_param_url_type_string' => 'URL', 'object_pageBlockPhoto_param_webpage_id_type_long' => 'Webpage ID', 'object_pageBlockVideo_param_caption_type_PageCaption' => 'Caption', 'object_pageBlockEmbed_param_caption_type_PageCaption' => 'Caption', 'object_pageBlockEmbedPost_param_caption_type_PageCaption' => 'Caption', 'object_pageBlockCollage_param_caption_type_PageCaption' => 'Caption', 'object_pageBlockSlideshow_param_caption_type_PageCaption' => 'Caption', 'object_pageBlockAudio_param_caption_type_PageCaption' => 'Caption', 'object_pageBlockKicker' => 'Page block kicker', 'object_pageBlockKicker_param_text_type_RichText' => 'Text', 'object_pageBlockTable' => 'Page block table', 'object_pageBlockTable_param_bordered_type_true' => 'Bordered?', 'object_pageBlockTable_param_striped_type_true' => 'Striped?', 'object_pageBlockTable_param_title_type_RichText' => 'Title', 'object_pageBlockTable_param_rows_type_Vector t' => 'Rows', 'object_pageBlockOrderedList' => 'Page block ordered list', 'object_pageBlockOrderedList_param_items_type_Vector t' => 'Items', 'object_pageBlockDetails' => 'Page block details', 'object_pageBlockDetails_param_open_type_true' => 'Open?', 'object_pageBlockDetails_param_blocks_type_Vector t' => 'Blocks', 'object_pageBlockDetails_param_title_type_RichText' => 'Title', 'object_pageBlockRelatedArticles' => 'Page block related articles', 'object_pageBlockRelatedArticles_param_title_type_RichText' => 'Title', 'object_pageBlockRelatedArticles_param_articles_type_Vector t' => 'Articles', 'object_pageBlockMap' => 'Page block map', 'object_pageBlockMap_param_geo_type_GeoPoint' => 'Geo', 'object_pageBlockMap_param_zoom_type_int' => 'Zoom', 'object_pageBlockMap_param_w_type_int' => 'Width', 'object_pageBlockMap_param_h_type_int' => 'Height', 'object_pageBlockMap_param_caption_type_PageCaption' => 'Caption', 'object_phoneCall_param_p2p_allowed_type_true' => 'P2p allowed?', 'object_langPackLanguage_param_official_type_true' => 'Official?', 'object_langPackLanguage_param_rtl_type_true' => 'Rtl?', 'object_langPackLanguage_param_beta_type_true' => 'Beta?', 'object_langPackLanguage_param_base_lang_code_type_string' => 'Base lang code', 'object_langPackLanguage_param_plural_code_type_string' => 'Plural code', 'object_langPackLanguage_param_strings_count_type_int' => 'Strings count', 'object_langPackLanguage_param_translated_count_type_int' => 'Translated count', 'object_langPackLanguage_param_translations_url_type_string' => 'Translations URL', 'object_secureValue_param_translation_type_Vector t' => 'Translation', 'object_inputSecureValue_param_translation_type_Vector t' => 'Translation', 'object_secureValueError' => 'Secure value error', 'object_secureValueError_param_type_type_SecureValueType' => 'Type', 'object_secureValueError_param_hash_type_bytes' => 'Hash', 'object_secureValueError_param_text_type_string' => 'Text', 'object_secureValueErrorTranslationFile' => 'Secure value error translation file', 'object_secureValueErrorTranslationFile_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorTranslationFile_param_file_hash_type_bytes' => 'File hash', 'object_secureValueErrorTranslationFile_param_text_type_string' => 'Text', 'object_secureValueErrorTranslationFiles' => 'Secure value error translation files', 'object_secureValueErrorTranslationFiles_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorTranslationFiles_param_file_hash_type_Vector t' => 'File hash', 'object_secureValueErrorTranslationFiles_param_text_type_string' => 'Text', 'object_passwordKdfAlgoUnknown' => 'Password kdf algo unknown', 'object_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow' => 'Password kdf algo sha256sha256pbkdf2hmacsh a512iter100000 sha256 mod pow', 'object_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow_param_salt1_type_bytes' => 'Salt1', 'object_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow_param_salt2_type_bytes' => 'Salt2', 'object_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow_param_g_type_int' => 'G', 'object_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow_param_p_type_bytes' => 'P', 'object_securePasswordKdfAlgoUnknown' => 'Secure password kdf algo unknown', 'object_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000' => 'Secure password kdf algo pbkdf2hmacsh a512iter100000', 'object_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000_param_salt_type_bytes' => 'Salt', 'object_securePasswordKdfAlgoSHA512' => 'Secure password kdf algo sha512', 'object_securePasswordKdfAlgoSHA512_param_salt_type_bytes' => 'Salt', 'object_secureSecretSettings' => 'Secure secret settings', 'object_secureSecretSettings_param_secure_algo_type_SecurePasswordKdfAlgo' => 'Secure algo', 'object_secureSecretSettings_param_secure_secret_type_bytes' => 'Secure secret', 'object_secureSecretSettings_param_secure_secret_id_type_long' => 'Secure secret ID', 'object_inputCheckPasswordEmpty' => 'Empty input check password', 'object_inputCheckPasswordSRP' => 'Check password srp', 'object_inputCheckPasswordSRP_param_srp_id_type_long' => 'Srp ID', 'object_inputCheckPasswordSRP_param_A_type_bytes' => 'A', 'object_inputCheckPasswordSRP_param_M1_type_bytes' => 'M1', 'object_secureRequiredType' => 'Secure required type', 'object_secureRequiredType_param_native_names_type_true' => 'Native names?', 'object_secureRequiredType_param_selfie_required_type_true' => 'Selfie required?', 'object_secureRequiredType_param_translation_required_type_true' => 'Translation required?', 'object_secureRequiredType_param_type_type_SecureValueType' => 'Type', 'object_secureRequiredTypeOneOf' => 'Secure required type one of', 'object_secureRequiredTypeOneOf_param_types_type_Vector t' => 'Types', 'object_help.passportConfigNotModified' => 'Passport config not modified', 'object_help.passportConfig' => 'Passport config', 'object_help.passportConfig_param_hash_type_int' => 'Hash', 'object_help.passportConfig_param_countries_langs_type_DataJSON' => 'Countries langs', 'object_inputAppEvent_param_data_type_JSONValue' => 'Data', 'object_jsonObjectValue' => 'Json object value', 'object_jsonObjectValue_param_key_type_string' => 'Key', 'object_jsonObjectValue_param_value_type_JSONValue' => 'Value', 'object_jsonNull' => 'Json null', 'object_jsonBool' => 'Json bool', 'object_jsonBool_param_value_type_Bool' => 'Value?', 'object_jsonNumber' => 'Json number', 'object_jsonNumber_param_value_type_double' => 'Value', 'object_jsonString' => 'Json string', 'object_jsonString_param_value_type_string' => 'Value', 'object_jsonArray' => 'Json array', 'object_jsonArray_param_value_type_Vector t' => 'Value', 'object_jsonObject' => 'Json object', 'object_jsonObject_param_value_type_Vector t' => 'Value', 'object_pageTableCell' => 'Page table cell', 'object_pageTableCell_param_header_type_true' => 'Header?', 'object_pageTableCell_param_align_center_type_true' => 'Align center?', 'object_pageTableCell_param_align_right_type_true' => 'Align right?', 'object_pageTableCell_param_valign_middle_type_true' => 'Valign middle?', 'object_pageTableCell_param_valign_bottom_type_true' => 'Valign bottom?', 'object_pageTableCell_param_text_type_RichText' => 'Text', 'object_pageTableCell_param_colspan_type_int' => 'Colspan', 'object_pageTableCell_param_rowspan_type_int' => 'Rowspan', 'object_pageTableRow' => 'Page table row', 'object_pageTableRow_param_cells_type_Vector t' => 'Cells', 'object_pageCaption' => 'Page caption', 'object_pageCaption_param_text_type_RichText' => 'Text', 'object_pageCaption_param_credit_type_RichText' => 'Credit', 'object_pageListItemText' => 'Page list item text', 'object_pageListItemText_param_text_type_RichText' => 'Text', 'object_pageListItemBlocks' => 'Page list item blocks', 'object_pageListItemBlocks_param_blocks_type_Vector t' => 'Blocks', 'object_pageListOrderedItemText' => 'Page list ordered item text', 'object_pageListOrderedItemText_param_num_type_string' => 'Num', 'object_pageListOrderedItemText_param_text_type_RichText' => 'Text', 'object_pageListOrderedItemBlocks' => 'Page list ordered item blocks', 'object_pageListOrderedItemBlocks_param_num_type_string' => 'Num', 'object_pageListOrderedItemBlocks_param_blocks_type_Vector t' => 'Blocks', 'object_pageRelatedArticle' => 'Page related article', 'object_pageRelatedArticle_param_url_type_string' => 'URL', 'object_pageRelatedArticle_param_webpage_id_type_long' => 'Webpage ID', 'object_pageRelatedArticle_param_title_type_string' => 'Title', 'object_pageRelatedArticle_param_description_type_string' => 'Description', 'object_pageRelatedArticle_param_photo_id_type_long' => 'Photo ID', 'object_pageRelatedArticle_param_author_type_string' => 'Author', 'object_pageRelatedArticle_param_published_date_type_int' => 'Published date', 'object_page' => 'Page', 'object_page_param_part_type_true' => 'Part?', 'object_page_param_rtl_type_true' => 'Rtl?', 'object_page_param_v2_type_true' => 'V2?', 'object_page_param_url_type_string' => 'URL', 'object_page_param_blocks_type_Vector t' => 'Blocks', 'object_page_param_photos_type_Vector t' => 'Photos', 'object_page_param_documents_type_Vector t' => 'Documents', 'object_help.supportName' => 'Support name', 'object_help.supportName_param_name_type_string' => 'Name', 'object_help.userInfoEmpty' => 'Empty user info', 'object_help.userInfo' => 'User info', 'object_help.userInfo_param_message_type_string' => 'Message', 'object_help.userInfo_param_entities_type_Vector t' => 'Entities', 'object_help.userInfo_param_author_type_string' => 'Author', 'object_help.userInfo_param_date_type_int' => 'Date', 'object_pollAnswer' => 'Poll answer', 'object_pollAnswer_param_text_type_string' => 'Text', 'object_pollAnswer_param_option_type_bytes' => 'Option', 'object_poll' => 'Poll', 'object_poll_param_id_type_long' => 'ID', 'object_poll_param_closed_type_true' => 'Closed?', 'object_poll_param_question_type_string' => 'Question', 'object_poll_param_answers_type_Vector t' => 'Answers', 'object_pollAnswerVoters' => 'Poll answer voters', 'object_pollAnswerVoters_param_chosen_type_true' => 'Chosen?', 'object_pollAnswerVoters_param_option_type_bytes' => 'Option', 'object_pollAnswerVoters_param_voters_type_int' => 'Voters', 'object_pollResults' => 'Poll results', 'object_pollResults_param_min_type_true' => 'Min?', 'object_pollResults_param_results_type_Vector t' => 'Results', 'object_pollResults_param_total_voters_type_int' => 'Total voters', 'object_chatOnlines' => 'Chat onlines', 'object_chatOnlines_param_onlines_type_int' => 'Onlines', 'object_statsURL' => 'Stats URL', 'object_statsURL_param_url_type_string' => 'URL', ), ); // THIS WILL BE OVERWRITTEN BY $lang["en"] public static $current_lang = array ( 'req_pq' => 'Requesting pq...', 'done' => 'Done!', 'cdn_reupload' => 'File is not stored on CDN, requesting reupload!', 'stored_on_cdn' => 'File is stored on CDN!', 'serializing_madelineproto' => 'Serializing MadelineProto...', 'phpseclib_fork' => 'Please install this fork of phpseclib: https://github.com/danog/phpseclib', 'inst_dc' => 'Istantiating DataCenter...', 'load_rsa' => 'Loading RSA keys...', 'TL_translation' => 'Translating TL schemas...', 'dh_prime_check_0' => 'Executing dh_prime checks (0/3)...', 'nearest_dc' => 'We\'re in %s, nearest DC is %d.', 'serialization_ofd' => 'Serialization is out of date, reconstructing object!', 'getupdates_deserialization' => 'Getting updates after deserialization...', 'shutdown_reader_pool' => 'Shutting down reader pool, %d jobs left', 'threading_on' => 'THREADING IS ENABLED', 'socket_reader' => 'Socket reader on DC %s: ', 'socket_status_1' => 'CREATING', 'socket_status_2' => 'SUBMITTING', 'socket_status_3' => 'WAITING', 'socket_status_4' => 'READY', 'socket_status_5' => 'WORKING', 'api_not_set' => 'You must provide an api key and an api id, get your own @ my.telegram.org', 'session_corrupted' => 'The session is corrupted!', 'reset_session_seqno' => 'Resetting session id and seq_no in DC %s...', 'gen_perm_auth_key' => 'Generating permanent authorization key for DC %s...', 'gen_temp_auth_key' => 'Generating temporary authorization key for DC %s...', 'copy_auth_dcs' => 'Copying authorization from DC %s to DC %s...', 'write_client_info' => 'Writing client info (also executing %s)...', 'config_updated' => 'Updated config!', 'length_not_4' => 'Length is not equal to 4', 'length_not_8' => 'Length is not equal to 8', 'value_bigger_than_2147483647' => 'Provided value %s is bigger than 2147483647', 'value_smaller_than_2147483648' => 'Provided value %s is smaller than -2147483648', 'value_bigger_than_9223372036854775807' => 'Provided value %s is bigger than 9223372036854775807', 'value_smaller_than_9223372036854775808' => 'Provided value %s is smaller than -9223372036854775808', 'value_bigger_than_4294967296' => 'Provided value %s is bigger than 4294967296', 'value_smaller_than_0' => 'Provided value %s is smaller than 0', 'encode_double_error' => 'Could not properly encode double', 'file_not_exist' => 'File does not exist', 'deserialization_error' => 'An error occurred on deserialization', 'rsa_init' => 'Istantiating \\phpseclib\\Crypt\\RSA...', 'loading_key' => 'Loading key...', 'computing_fingerprint' => 'Computing fingerprint...', 'rsa_encrypting' => 'Encrypting with rsa key...', 'rpc_tg_error' => 'Telegram returned an RPC error: %s (%s), caused by %s:%sTL trace:', 'v_error' => '506c656173652075706461746520746f20746865206c61746573742076657273696f6e206f66204d6164656c696e6550726f746f2e', 'v_tgerror' => '506c6561736520757064617465207068702d6c69627467766f6970', 'no_mode_specified' => 'No mode was specified!', 'constructor_function_uncalled' => 'The constructor function wasn\'t called! Please call the constructor function before using this method.', 'proxy_class_invalid' => 'Invalid proxy class provided!', 'socket_con_error' => 'Connection: couldn\'t connect to socket.', 'protocol_not_implemented' => 'Connection: This protocol isn\'t implemented yet.', 'protocol_invalid' => 'Connection: invalid protocol specified.', 'nothing_in_socket' => 'Nothing in the socket!', 'wrong_length_read' => 'WARNING: Wrong length was read (should\'ve read %s, read %s)!', 'no_data_in_socket' => 'No data in the socket!', 'dc_con_start' => 'Connecting to DC %s...', 'dc_con_stop' => 'Disconnecting from DC %s...', 'dc_con_test_start' => 'Connecting to DC %s (%s server, %s, %s)...', 'script_not_exist' => 'Provided script does not exist', 'apifactory_start' => 'Running APIFactory...', 'madelineproto_ready' => 'MadelineProto is ready!', 'logout_error' => 'An error occurred while logging out!', 'logout_ok' => 'Logged out successfully!', 'already_logged_in' => 'This instance of MadelineProto is already logged in. Logging out first...', 'login_ok' => 'Logged in successfully!', 'login_user' => 'Logging in as a normal user...', 'login_bot' => 'Logging in as a bot...', 'login_code_sending' => 'Sending code...', 'login_code_sent' => 'Code sent successfully! Once you receive the code you should use the complete_phone_login function.', 'login_code_uncalled' => 'I\'m not waiting for the code! Please call the phone_login method first', 'login_2fa_enabled' => '2FA enabled, you will have to call the complete_2fa_login function...', 'login_need_signup' => 'An account has not been created for this number, you will have to call the complete_signup function...', 'login_auth_key' => 'Logging in using auth key...', 'not_logged_in' => 'I\'m not logged in!', 'signup_uncalled' => 'I\'m not waiting to signup! Please call the phone_login and the complete_phone_login methods first!', 'signing_up' => 'Signing up as a normal user...', 'signup_ok' => 'Signed up in successfully!', '2fa_uncalled' => 'I\'m not waiting for the password! Please call the phone_login and the complete_phone_login methods first!', 'getting_dialogs' => 'Getting dialogs...', 'libtgvoip_required' => 'The php-libtgvoip extension is required to accept and manage calls. See daniil.it/MadelineProto for more info.', 'peer_not_in_db' => 'This peer is not present in the internal peer database', 'calling_user' => 'Calling %s...', 'generating_a' => 'Generating a...', 'generating_g_a' => 'Generating g_a...', 'call_error_1' => 'Could not find and accept call %s', 'accepting_call' => 'Accepting call from %s...', 'generating_b' => 'Generating b...', 'call_already_accepted' => 'Call %s already accepted', 'call_already_declined' => 'Call %s already declined', 'call_error_2' => 'Could not find and confirm call %s', 'call_confirming' => 'Confirming call from %s...', 'call_error_3' => 'Could not find and complete call %s', 'call_completing' => 'Completing call from %s...', 'invalid_g_a' => 'Invalid g_a!', 'fingerprint_invalid' => 'Invalid key fingerprint!', 'call_discarding' => 'Discarding call %s...', 'call_set_rating' => 'Setting rating for call %s...', 'call_debug_saving' => 'Saving debug data for call %s...', 'TL_loading' => 'Loading TL schemes...', 'file_parsing' => 'Parsing %s...', 'crc32_mismatch' => 'CRC32 mismatch (%s, %s) for %s', 'src_file_invalid' => 'Invalid source file was provided: ', 'translating_obj' => 'Translating objects...', 'translating_methods' => 'Translating methods...', 'bool_error' => 'Could not extract boolean', 'not_numeric' => 'Given value isn\'t numeric', 'long_not_16' => 'Given value is not 16 bytes long', 'long_not_32' => 'Given value is not 32 bytes long', 'long_not_64' => 'Given value is not 64 bytes long', 'array_invalid' => 'You didn\'t provide a valid array', 'predicate_not_set' => 'Predicate (value under _) was not set!', 'type_extract_error' => 'Could not extract type "%s"', 'method_not_found' => 'Could not find method: ', 'params_missing' => 'Missing required parameter', 'sec_peer_not_in_db' => 'This secret peer is not present in the internal peer database', 'stream_handle_invalid' => 'An invalid stream handle was provided.', 'length_too_big' => 'Length is too big', 'deserialize_not_str' => 'Deserialize: Generated value isn\'t a string', 'type_extract_error_id' => 'Could not extract type: %s with id %s', 'vector_invalid' => 'Invalid vector constructor: ', 'constructor_not_found' => 'Constructor not found for type: ', 'rand_bytes_too_small' => 'Random_bytes is too small!', 'botapi_conversion_error' => 'Can\'t convert %s to a bot API object', 'non_text_conversion' => 'Can\'t convert non text messages yet!', 'last_byte_invalid' => 'Invalid last byte', 'file_type_invalid' => 'Invalid file type detected (%s)', 'recreate_temp_auth_key' => 'I had to recreate the temporary authorization key', 'resetting_auth_key' => 'WARNING: Resetting auth key...', 'shutting_down_reader_pool' => 'Shutting down reader pool ', 'shutting_down_handler_pool' => 'Shutting down handler pool for dc %s, %d jobs left', 'secret_chat_skipping' => 'I do not have the secret chat %s in the database, skipping message...', 'fingerprint_mismatch' => 'Key fingerprint mismatch', 'msg_data_length_too_big' => 'Message_data_length is too big', 'length_not_divisible_16' => 'Length of decrypted data is not divisible by 16', 'msg_key_mismatch' => 'Msg_key mismatch', 'rand_bytes_too_short' => 'Random_bytes is too short!', 'resending_unsupported' => 'Resending of messages is not yet supported', 'unrecognized_dec_msg' => 'Unrecognized decrypted message received: ', 'method_req_pq' => 'Requests PQ for factorization', 'method_req_pq_param_nonce_type_int128' => 'Random number for cryptographic security', 'method_req_pq_multi' => 'Requests PQ for factorization (new version)', 'method_req_pq_multi_param_nonce_type_int128' => 'Random number for cryptographic security', 'method_req_DH_params' => 'Requests Diffie-hellman parameters for key exchange', 'method_req_DH_params_param_nonce_type_int128' => 'Random number for cryptographic security', 'method_req_DH_params_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'method_req_DH_params_param_p_type_bytes' => 'Factorized p from pq', 'method_req_DH_params_param_q_type_bytes' => 'Factorized q from pq', 'method_req_DH_params_param_public_key_fingerprint_type_long' => 'Server RSA fingerprint', 'method_req_DH_params_param_encrypted_data_type_bytes' => 'Encrypted key exchange message', 'method_set_client_DH_params' => 'Sets client diffie-hellman parameters', 'method_set_client_DH_params_param_nonce_type_int128' => 'Random number for cryptographic security', 'method_set_client_DH_params_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'method_set_client_DH_params_param_encrypted_data_type_bytes' => 'Encrypted key exchange message', 'method_rpc_drop_answer' => 'Do not send answer to provided request', 'method_rpc_drop_answer_param_req_msg_id_type_long' => 'The message ID of the request', 'method_get_future_salts' => 'Get future salts', 'method_get_future_salts_param_num_type_int' => 'How many salts should be fetched', 'method_ping' => 'Pings the server', 'method_ping_param_ping_id_type_long' => 'Ping ID', 'method_ping_delay_disconnect' => 'Pings the server and causes disconection if the same method is not called within ping_disconnect_delay', 'method_ping_delay_disconnect_param_ping_id_type_long' => 'Ping ID', 'method_ping_delay_disconnect_param_disconnect_delay_type_int' => 'Disconection delay', 'method_destroy_session' => 'Destroy the current MTProto session', 'method_destroy_session_param_session_id_type_long' => 'The session to destroy', 'method_http_wait' => 'Makes the server send messages waiting in the buffer', 'method_http_wait_param_max_delay_type_int' => 'Denotes the maximum number of milliseconds that has elapsed between the first message for this session and the transmission of an HTTP response', 'method_http_wait_param_wait_after_type_int' => 'After the receipt of the latest message for a particular session, the server waits another wait_after milliseconds in case there are more messages. If there are no additional messages, the result is transmitted (a container with all the messages).', 'method_http_wait_param_max_wait_type_int' => 'If more messages appear, the wait_after timer is reset.', 'method_invokeAfterMsg' => 'Invokes a query after successfull completion of one of the previous queries.', 'method_invokeAfterMsg_param_msg_id_type_long' => 'Message identifier on which a current query depends', 'method_invokeAfterMsg_param_query_type_!X' => 'The query itself', 'method_invokeAfterMsgs' => 'Result type returned by a current query.', 'method_invokeAfterMsgs_param_msg_ids_type_Vector t' => 'List of messages on which a current query depends', 'method_invokeAfterMsgs_param_query_type_!X' => 'The query itself', 'method_initConnection' => 'Initializes connection and save information on the user\'s device and application.', 'method_initConnection_param_api_id_type_int' => 'Application identifier', 'method_initConnection_param_device_model_type_string' => 'Device model', 'method_initConnection_param_system_version_type_string' => 'System version', 'method_initConnection_param_app_version_type_string' => 'App version', 'method_initConnection_param_system_lang_code_type_string' => 'Language code', 'method_initConnection_param_lang_pack_type_string' => 'Language pack to use', 'method_initConnection_param_lang_code_type_string' => 'Language code to set', 'method_initConnection_param_query_type_!X' => 'Nested query', 'method_invokeWithLayer' => 'Invoke this method with layer X', 'method_invokeWithLayer_param_layer_type_int' => 'The layer version', 'method_invokeWithLayer_param_query_type_!X' => 'The query', 'method_invokeWithoutUpdates' => 'Invoke with method without returning updates in the socket', 'method_invokeWithoutUpdates_param_query_type_!X' => 'The query', 'method_auth.checkPhone' => 'Check if this phone number is registered on telegram', 'method_auth.checkPhone_param_phone_number_type_string' => 'The phone number to check', 'method_auth.sendCode' => 'Use phone_login instead', 'method_auth.sendCode_param_allow_flashcall_type_true' => 'Use phone_login instead', 'method_auth.sendCode_param_phone_number_type_string' => 'Use phone_login instead', 'method_auth.sendCode_param_current_number_type_Bool' => 'Use phone_login instead', 'method_auth.sendCode_param_api_id_type_int' => 'Use phone_login instead', 'method_auth.sendCode_param_api_hash_type_string' => 'Use phone_login instead', 'method_auth.signUp' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signUp_param_phone_number_type_string' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signUp_param_phone_code_hash_type_string' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signUp_param_phone_code_type_string' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signUp_param_first_name_type_string' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signUp_param_last_name_type_string' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signIn' => 'You cannot use this method directly, use the complete_phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signIn_param_phone_number_type_string' => 'You cannot use this method directly, use the complete_phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signIn_param_phone_code_hash_type_string' => 'You cannot use this method directly, use the complete_phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.signIn_param_phone_code_type_string' => 'You cannot use this method directly, use the complete_phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.logOut' => 'You cannot use this method directly, use the logout method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.resetAuthorizations' => 'Delete all logged-in sessions.', 'method_auth.sendInvites' => 'Invite friends to telegram!', 'method_auth.sendInvites_param_phone_numbers_type_Vector t' => 'Phone numbers to invite', 'method_auth.sendInvites_param_message_type_string' => 'The message to send', 'method_auth.exportAuthorization' => 'You cannot use this method directly, use $MadelineProto->export_authorization() instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'method_auth.exportAuthorization_param_dc_id_type_int' => 'You cannot use this method directly, use $MadelineProto->export_authorization() instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'method_auth.importAuthorization' => 'You cannot use this method directly, use $MadelineProto->import_authorization($authorization) instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'method_auth.importAuthorization_param_id_type_int' => 'You cannot use this method directly, use $MadelineProto->import_authorization($authorization) instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'method_auth.importAuthorization_param_bytes_type_bytes' => 'You cannot use this method directly, use $MadelineProto->import_authorization($authorization) instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'method_auth.bindTempAuthKey' => 'You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info', 'method_auth.bindTempAuthKey_param_perm_auth_key_id_type_long' => 'You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info', 'method_auth.bindTempAuthKey_param_nonce_type_long' => 'You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info', 'method_auth.bindTempAuthKey_param_expires_at_type_int' => 'You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info', 'method_auth.bindTempAuthKey_param_encrypted_message_type_bytes' => 'You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info', 'method_auth.importBotAuthorization' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.importBotAuthorization_param_api_id_type_int' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.importBotAuthorization_param_api_hash_type_string' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.importBotAuthorization_param_bot_auth_token_type_string' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.checkPassword' => 'You cannot use this method directly, use the complete_2fa_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.checkPassword_param_password_hash_type_bytes' => 'You cannot use this method directly, use the complete_2fa_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.requestPasswordRecovery' => 'Send an email to recover the 2FA password', 'method_auth.recoverPassword' => 'Use the code that was emailed to you after running $MadelineProto->auth->requestPasswordRecovery to login to your account', 'method_auth.recoverPassword_param_code_type_string' => 'The code that was emailed to you', 'method_auth.resendCode' => 'Resend the SMS verification code', 'method_auth.resendCode_param_phone_number_type_string' => 'The phone number', 'method_auth.resendCode_param_phone_code_hash_type_string' => 'The phone code hash', 'method_auth.cancelCode' => 'Invalidate sent phone code', 'method_auth.cancelCode_param_phone_number_type_string' => 'Phone number', 'method_auth.cancelCode_param_phone_code_hash_type_string' => 'Phone code hash', 'method_auth.dropTempAuthKeys' => 'Delete all temporary authorization keys except the ones provided', 'method_auth.dropTempAuthKeys_param_except_auth_keys_type_Vector t' => 'The temporary authorization keys to keep', 'method_account.registerDevice' => 'Register device for push notifications', 'method_account.registerDevice_param_token_type_type_int' => 'Device token type. Possible values: 1 - APNS, 2 - GCM, 3 - MPNS, 4 - Simple Push, 5 - Ubuntu Phone, 6 - Blackberry, and other, see source code of official apps for more info', 'method_account.registerDevice_param_token_type_string' => 'Device token type. Possible values: 1 - APNS, 2 - GCM, 3 - MPNS, 4 - Simple Push, 5 - Ubuntu Phone,6 - Blackberry, and other, see source code of official apps for more info', 'method_account.registerDevice_param_app_sandbox_type_Bool' => 'Should the app run in a sandbox?', 'method_account.registerDevice_param_other_uids_type_Vector t' => 'Other UIDs', 'method_account.unregisterDevice' => 'Stop sending PUSH notifications to app', 'method_account.unregisterDevice_param_token_type_type_int' => 'Device token type. Possible values: 1 - APNS, 2 - GCM, 3 - MPNS, 4 - Simple Push, 5 - Ubuntu Phone,6 - Blackberry, and other, see source code of official apps for more info', 'method_account.unregisterDevice_param_token_type_string' => 'Device token type. Possible values: 1 - APNS, 2 - GCM, 3 - MPNS, 4 - Simple Push, 5 - Ubuntu Phone,6 - Blackberry, and other, see source code of official apps for more info', 'method_account.unregisterDevice_param_other_uids_type_Vector t' => 'Other UIDs', 'method_account.updateNotifySettings' => 'Change notification settings', 'method_account.updateNotifySettings_param_peer_type_InputNotifyPeer' => 'The peers to which the notification settings should be applied', 'method_account.updateNotifySettings_param_settings_type_InputPeerNotifySettings' => 'Notification settings', 'method_account.getNotifySettings' => 'Get notification settings', 'method_account.getNotifySettings_param_peer_type_InputNotifyPeer' => 'Notification source ', 'method_account.resetNotifySettings' => 'Reset all notification settings', 'method_account.updateProfile' => 'Update profile info', 'method_account.updateProfile_param_first_name_type_string' => 'The first name', 'method_account.updateProfile_param_last_name_type_string' => 'The last name', 'method_account.updateProfile_param_about_type_string' => 'The bio/about field', 'method_account.updateStatus' => 'Update online status', 'method_account.updateStatus_param_offline_type_Bool' => 'Offline to set the status to offline', 'method_account.getWallPapers' => 'Returns a list of available wallpapers.', 'method_account.reportPeer' => 'Report for spam', 'method_account.reportPeer_param_peer_type_InputPeer' => 'The peer to report', 'method_account.reportPeer_param_reason_type_ReportReason' => 'Why are you reporting this peer', 'method_account.checkUsername' => 'Check if this username is available', 'method_account.checkUsername_param_username_type_string' => 'The username to check', 'method_account.updateUsername' => 'Update this user\'s username', 'method_account.updateUsername_param_username_type_string' => 'The new username', 'method_account.getPrivacy' => 'Get privacy settings', 'method_account.getPrivacy_param_key_type_InputPrivacyKey' => 'Privacy setting key', 'method_account.setPrivacy' => 'Set privacy settings', 'method_account.setPrivacy_param_key_type_InputPrivacyKey' => 'Privacy setting', 'method_account.setPrivacy_param_rules_type_Vector t' => 'Privacy settings', 'method_account.deleteAccount' => 'Delete this account', 'method_account.deleteAccount_param_reason_type_string' => 'Why are you going away? :(', 'method_account.getAccountTTL' => 'Get account TTL', 'method_account.setAccountTTL' => 'Set account TTL', 'method_account.setAccountTTL_param_ttl_type_AccountDaysTTL' => 'Time To Live of account', 'method_account.sendChangePhoneCode' => 'Change the phone number', 'method_account.sendChangePhoneCode_param_allow_flashcall_type_true' => 'Can the code be sent using a flash call instead of an SMS?', 'method_account.sendChangePhoneCode_param_phone_number_type_string' => 'New phone number', 'method_account.sendChangePhoneCode_param_current_number_type_Bool' => 'Current phone number', 'method_account.changePhone' => 'Change the phone number associated to this account', 'method_account.changePhone_param_phone_number_type_string' => 'Phone number', 'method_account.changePhone_param_phone_code_hash_type_string' => 'Phone code hash returned by account.sendChangePhoneCode', 'method_account.changePhone_param_phone_code_type_string' => 'The phone code sent by account.sendChangePhoneCode', 'method_account.updateDeviceLocked' => 'Disable all notifications for a certain period', 'method_account.updateDeviceLocked_param_period_type_int' => 'For how long should notifications be disabled', 'method_account.getAuthorizations' => 'Get all logged-in authorizations', 'method_account.resetAuthorization' => 'Delete a certain session', 'method_account.resetAuthorization_param_hash_type_long' => 'The session hash, obtained from $MadelineProto->account->getAuthorizations', 'method_account.getPassword' => 'Get the current password', 'method_account.getPasswordSettings' => 'Get the current 2FA settings', 'method_account.getPasswordSettings_param_current_password_hash_type_bytes' => 'Use only if you have set a 2FA password: `$current_salt = $MadelineProto->account->getPassword()[\'current_salt\']; $current_password_hash = hash(\'sha256\', $current_salt.$password.$current_salt, true);`', 'method_account.updatePasswordSettings' => 'You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info)', 'method_account.updatePasswordSettings_param_current_password_hash_type_bytes' => 'Use only if you have set a 2FA password: `$current_salt = $MadelineProto->account->getPassword()[\'current_salt\']; $current_password_hash = hash(\'sha256\', $current_salt.$password.$current_salt, true);`', 'method_account.updatePasswordSettings_param_new_settings_type_account.PasswordInputSettings' => 'New 2FA settings', 'method_account.sendConfirmPhoneCode' => 'Send confirmation phone code', 'method_account.sendConfirmPhoneCode_param_allow_flashcall_type_true' => 'Can telegram call you instead of sending an SMS?', 'method_account.sendConfirmPhoneCode_param_hash_type_string' => 'The hash', 'method_account.sendConfirmPhoneCode_param_current_number_type_Bool' => 'The current phone number', 'method_account.confirmPhone' => 'Confirm this phone number is associated to this account, obtain phone_code_hash from sendConfirmPhoneCode', 'method_account.confirmPhone_param_phone_code_hash_type_string' => 'Obtain phone_code_hash from sendConfirmPhoneCode', 'method_account.confirmPhone_param_phone_code_type_string' => 'The code sent by sendConfirmPhoneCode', 'method_account.getTmpPassword' => 'Get temporary password for buying products through bots', 'method_account.getTmpPassword_param_password_hash_type_bytes' => 'The password hash', 'method_account.getTmpPassword_param_period_type_int' => 'The validity period', 'method_account.getWebAuthorizations' => 'Get telegram web login authorizations', 'method_account.resetWebAuthorization' => 'Delete a certain telegram web login authorization', 'method_account.resetWebAuthorization_param_hash_type_long' => 'The authorization\'s hash', 'method_account.resetWebAuthorizations' => 'Reset all telegram web login authorizations', 'method_users.getUsers' => 'Get info about users', 'method_users.getUsers_param_id_type_Vector t' => 'The ids of the users', 'method_users.getFullUser' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_users.getFullUser_param_id_type_InputUser' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_contacts.getStatuses' => 'Get online status of all users', 'method_contacts.getContacts' => 'Get all contacts', 'method_contacts.getContacts_param_hash_type_int' => 'User ids of contacts previously fetched with this method', 'method_contacts.importContacts' => 'Add phone number as contact', 'method_contacts.importContacts_param_contacts_type_Vector t' => 'The numbers to import', 'method_contacts.deleteContact' => 'Delete a contact', 'method_contacts.deleteContact_param_id_type_InputUser' => 'The contact to delete', 'method_contacts.deleteContacts' => 'Delete multiple contacts', 'method_contacts.deleteContacts_param_id_type_Vector t' => 'The contacts to delete', 'method_contacts.block' => 'Block a user', 'method_contacts.block_param_id_type_InputUser' => 'The user to block', 'method_contacts.unblock' => 'Unblock a user', 'method_contacts.unblock_param_id_type_InputUser' => 'The user to unblock', 'method_contacts.getBlocked' => 'Get blocked users', 'method_contacts.getBlocked_param_offset_type_int' => 'Initially 0, then set to the number of blocked contacts previously fetched', 'method_contacts.getBlocked_param_limit_type_int' => 'How many blocked contacts to fetch', 'method_contacts.exportCard' => 'Export contact as card', 'method_contacts.importCard' => 'Import card as contact', 'method_contacts.importCard_param_export_card_type_Vector t' => 'The card', 'method_contacts.search' => 'Search contacts', 'method_contacts.search_param_q_type_string' => 'The search query', 'method_contacts.search_param_limit_type_int' => 'How many results should be returned', 'method_contacts.resolveUsername' => 'You cannot use this method directly, use the resolve_username, get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_contacts.resolveUsername_param_username_type_string' => 'You cannot use this method directly, use the resolve_username, get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_contacts.getTopPeers' => 'Get most used chats', 'method_contacts.getTopPeers_param_correspondents_type_true' => 'Fetch users?', 'method_contacts.getTopPeers_param_bots_pm_type_true' => 'Fetch bots?', 'method_contacts.getTopPeers_param_bots_inline_type_true' => 'Fetch inline bots?', 'method_contacts.getTopPeers_param_phone_calls_type_true' => 'Fetch phone calls?', 'method_contacts.getTopPeers_param_groups_type_true' => 'Fetch groups?', 'method_contacts.getTopPeers_param_channels_type_true' => 'Fetch channels and supergroups?', 'method_contacts.getTopPeers_param_offset_type_int' => 'Initially 0, then `$offset += $contacts_TopPeers[\'categories\'][\'count\'];`', 'method_contacts.getTopPeers_param_limit_type_int' => 'How many results to fetch', 'method_contacts.getTopPeers_param_hash_type_int' => 'Peer ids previously fetched with this method', 'method_contacts.resetTopPeerRating' => 'Reset top peer rating for a certain category/peer', 'method_contacts.resetTopPeerRating_param_category_type_TopPeerCategory' => 'The category ', 'method_contacts.resetTopPeerRating_param_peer_type_InputPeer' => 'The peer', 'method_contacts.resetSaved' => 'Reset saved contacts', 'method_messages.getMessages' => 'Get messages', 'method_messages.getMessages_param_id_type_Vector t' => 'The IDs of messages to fetch (only for users and normal groups)', 'method_messages.getDialogs' => 'Gets list of chats: you should use $MadelineProto->get_dialogs() instead: https://docs.madelineproto.xyz/docs/DIALOGS.html', 'method_messages.getDialogs_param_exclude_pinned_type_true' => 'Do not fetch pinned chats', 'method_messages.getDialogs_param_offset_date_type_int' => 'End($res[\'messages\'])[\'date\'];', 'method_messages.getDialogs_param_offset_id_type_int' => 'End($res[\'messages\'])[\'id\'];', 'method_messages.getDialogs_param_offset_peer_type_InputPeer' => 'End($res[\'dialogs\'])[\'peer\'];', 'method_messages.getDialogs_param_limit_type_int' => 'Number of dialogs to fetch', 'method_messages.getHistory' => 'Get previous messages of a group', 'method_messages.getHistory_param_peer_type_InputPeer' => 'The chat', 'method_messages.getHistory_param_offset_id_type_int' => 'The last fetched message ID, initially 0', 'method_messages.getHistory_param_offset_date_type_int' => 'The date of the last previously fetched message, initially 0', 'method_messages.getHistory_param_add_offset_type_int' => 'Additional offset, can be 0', 'method_messages.getHistory_param_limit_type_int' => 'Number of messages to fetch', 'method_messages.getHistory_param_max_id_type_int' => 'Maximum message ID to fetch', 'method_messages.getHistory_param_min_id_type_int' => 'Minumum message ID to fetch', 'method_messages.getHistory_param_hash_type_int' => 'List of IDs of already parsed messages', 'method_messages.search' => 'Search peers or messages', 'method_messages.search_param_peer_type_InputPeer' => 'Where to search', 'method_messages.search_param_q_type_string' => 'What to search', 'method_messages.search_param_from_id_type_InputUser' => 'Show only messages from a certain user?', 'method_messages.search_param_filter_type_MessagesFilter' => 'Message filter', 'method_messages.search_param_min_date_type_int' => 'Minumum date of results to fetch', 'method_messages.search_param_max_date_type_int' => 'Maximum date of results to fetch', 'method_messages.search_param_offset_id_type_int' => 'Message ID offset', 'method_messages.search_param_add_offset_type_int' => 'Additional offset, can be 0', 'method_messages.search_param_limit_type_int' => 'Number of results to return', 'method_messages.search_param_max_id_type_int' => 'Maximum message id to return', 'method_messages.search_param_min_id_type_int' => 'Minumum message id to return', 'method_messages.readHistory' => 'Mark messages as read', 'method_messages.readHistory_param_peer_type_InputPeer' => 'Where to mark messages as read', 'method_messages.readHistory_param_max_id_type_int' => 'Maximum message ID to mark as read', 'method_messages.deleteHistory' => 'Delete chat history', 'method_messages.deleteHistory_param_just_clear_type_true' => 'Only clear it from your side', 'method_messages.deleteHistory_param_peer_type_InputPeer' => 'Where to clear it', 'method_messages.deleteHistory_param_max_id_type_int' => 'Maximum message id of messages to delete', 'method_messages.deleteMessages' => 'Delete messages', 'method_messages.deleteMessages_param_revoke_type_true' => 'Delete the messages for everyone?', 'method_messages.deleteMessages_param_id_type_Vector t' => 'IDs of messages to delete, use channels->deleteMessages for supergroups', 'method_messages.receivedMessages' => 'Mark messages as read', 'method_messages.receivedMessages_param_max_id_type_int' => 'Maximum message id of messages to mark as read', 'method_messages.setTyping' => 'Change typing status', 'method_messages.setTyping_param_peer_type_InputPeer' => 'Where to change typing status', 'method_messages.setTyping_param_action_type_SendMessageAction' => 'Typing status', 'method_messages.sendMessage' => 'Send a message', 'method_messages.sendMessage_param_no_webpage_type_true' => 'Disable webpage preview?', 'method_messages.sendMessage_param_silent_type_true' => 'Disable notifications?', 'method_messages.sendMessage_param_background_type_true' => 'Disable background notifications?', 'method_messages.sendMessage_param_clear_draft_type_true' => 'Clear the message draft of this chat?', 'method_messages.sendMessage_param_peer_type_InputPeer' => 'The chat where to send this message', 'method_messages.sendMessage_param_reply_to_msg_id_type_int' => 'Reply to message by ID', 'method_messages.sendMessage_param_message_type_string' => 'The message to send', 'method_messages.sendMessage_param_reply_markup_type_ReplyMarkup' => 'Keyboards to send', 'method_messages.sendMessage_param_entities_type_Vector t' => 'Entities to send (for styled text)', 'method_messages.sendMedia' => 'Send a media', 'method_messages.sendMedia_param_silent_type_true' => 'Disable notifications?', 'method_messages.sendMedia_param_background_type_true' => 'Disable background notifications?', 'method_messages.sendMedia_param_clear_draft_type_true' => 'Clear the message draft of this chat?', 'method_messages.sendMedia_param_peer_type_InputPeer' => 'Where to send the media', 'method_messages.sendMedia_param_reply_to_msg_id_type_int' => 'Reply to message by ID', 'method_messages.sendMedia_param_media_type_InputMedia' => 'The media to send', 'method_messages.sendMedia_param_message_type_string' => 'The caption', 'method_messages.sendMedia_param_reply_markup_type_ReplyMarkup' => 'Keyboards to send', 'method_messages.sendMedia_param_entities_type_Vector t' => 'Entities for styled text', 'method_messages.forwardMessages' => 'Forward messages', 'method_messages.forwardMessages_param_silent_type_true' => 'Disable notifications', 'method_messages.forwardMessages_param_background_type_true' => 'Disable background notifications', 'method_messages.forwardMessages_param_with_my_score_type_true' => 'If forwarding a game, forward your score, too', 'method_messages.forwardMessages_param_grouped_type_true' => 'Set to true if forwarding albums', 'method_messages.forwardMessages_param_from_peer_type_InputPeer' => 'From where to forward the messages', 'method_messages.forwardMessages_param_id_type_Vector t' => 'The message IDs', 'method_messages.forwardMessages_param_to_peer_type_InputPeer' => 'Where to forward the messages', 'method_messages.reportSpam' => 'Report a peer for spam', 'method_messages.reportSpam_param_peer_type_InputPeer' => 'The peer to report', 'method_messages.hideReportSpam' => 'Hide report spam popup', 'method_messages.hideReportSpam_param_peer_type_InputPeer' => 'Where to hide the popup', 'method_messages.getPeerSettings' => 'Get the settings of apeer', 'method_messages.getPeerSettings_param_peer_type_InputPeer' => 'The peer', 'method_messages.getChats' => 'Get info about chats', 'method_messages.getChats_param_id_type_Vector t' => 'The MTProto IDs of chats to fetch info about', 'method_messages.getFullChat' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_messages.getFullChat_param_chat_id_type_InputPeer' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_messages.editChatTitle' => 'Edit the title of a normal chat (not supergroup)', 'method_messages.editChatTitle_param_chat_id_type_InputPeer' => 'The ID of the chat', 'method_messages.editChatTitle_param_title_type_string' => 'The new title', 'method_messages.editChatPhoto' => 'Edit the photo of a normal chat (not supergroup)', 'method_messages.editChatPhoto_param_chat_id_type_InputPeer' => 'The ID of the chat', 'method_messages.editChatPhoto_param_photo_type_InputChatPhoto' => 'The new phto', 'method_messages.addChatUser' => 'Add a user to a normal chat (use channels->inviteToChannel for supergroups)', 'method_messages.addChatUser_param_chat_id_type_InputPeer' => 'The chat where to invite users', 'method_messages.addChatUser_param_user_id_type_InputUser' => 'The user to invite', 'method_messages.addChatUser_param_fwd_limit_type_int' => 'Number of old messages the user will see', 'method_messages.deleteChatUser' => 'Delete a user from a chat (not supergroup)', 'method_messages.deleteChatUser_param_chat_id_type_InputPeer' => 'The ID of the chat', 'method_messages.deleteChatUser_param_user_id_type_InputUser' => 'The user to delete (pass @me to leave the chat)', 'method_messages.createChat' => 'Create a chat (not supergroup)', 'method_messages.createChat_param_users_type_Vector t' => 'The users to add to the chat', 'method_messages.createChat_param_title_type_string' => 'The new chat\'s title', 'method_messages.getDhConfig' => 'You cannot use this method directly, instead use $MadelineProto->get_dh_config();', 'method_messages.getDhConfig_param_version_type_int' => 'You cannot use this method directly, instead use $MadelineProto->get_dh_config();', 'method_messages.getDhConfig_param_random_length_type_int' => 'You cannot use this method directly, instead use $MadelineProto->get_dh_config();', 'method_messages.requestEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.requestEncryption_param_user_id_type_InputUser' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.requestEncryption_param_g_a_type_bytes' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.acceptEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.acceptEncryption_param_peer_type_InputEncryptedChat' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.acceptEncryption_param_g_b_type_bytes' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.acceptEncryption_param_key_fingerprint_type_long' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.discardEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.discardEncryption_param_chat_id_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'method_messages.setEncryptedTyping' => 'Send typing notification to secret chat', 'method_messages.setEncryptedTyping_param_peer_type_InputEncryptedChat' => 'The secret chat where to send the notification', 'method_messages.setEncryptedTyping_param_typing_type_Bool' => 'Set to true to enable the notification, false to disable it', 'method_messages.readEncryptedHistory' => 'Mark messages as read in secret chats', 'method_messages.readEncryptedHistory_param_peer_type_InputEncryptedChat' => 'The secret chat where to mark messages as read', 'method_messages.readEncryptedHistory_param_max_date_type_int' => 'Maximum date of messages to mark', 'method_messages.sendEncrypted' => 'Send message to secret chat', 'method_messages.sendEncrypted_param_peer_type_InputEncryptedChat' => 'The chat where to send the message', 'method_messages.sendEncrypted_param_message_type_DecryptedMessage' => 'The message to send', 'method_messages.sendEncryptedFile' => 'Send a file to a secret chat', 'method_messages.sendEncryptedFile_param_peer_type_InputEncryptedChat' => 'The chat where to send the file', 'method_messages.sendEncryptedFile_param_message_type_DecryptedMessage' => 'The message with the file', 'method_messages.sendEncryptedFile_param_file_type_InputEncryptedFile' => 'The file (optional)', 'method_messages.sendEncryptedService' => 'Send a service message to a secret chat', 'method_messages.sendEncryptedService_param_peer_type_InputEncryptedChat' => 'The chat where to send the service message', 'method_messages.sendEncryptedService_param_message_type_DecryptedMessage' => 'The service message', 'method_messages.receivedQueue' => 'You cannot use this method directly', 'method_messages.receivedQueue_param_max_qts_type_int' => 'You cannot use this method directly', 'method_messages.reportEncryptedSpam' => 'Report for spam a secret chat', 'method_messages.reportEncryptedSpam_param_peer_type_InputEncryptedChat' => 'The chat to report', 'method_messages.readMessageContents' => 'Mark message as read', 'method_messages.readMessageContents_param_id_type_Vector t' => 'The messages to mark as read (only users and normal chats, not supergroups)', 'method_messages.getStickers' => 'Get stickers', 'method_messages.getStickers_param_emoticon_type_string' => 'Search by emoji', 'method_messages.getStickers_param_hash_type_string' => 'Previously fetched sticker IDs', 'method_messages.getAllStickers' => 'Get all stickerpacks', 'method_messages.getAllStickers_param_hash_type_int' => '0 or $result[\'hash\']', 'method_messages.getWebPagePreview' => 'Get webpage preview', 'method_messages.getWebPagePreview_param_message_type_string' => 'Extract preview from this message', 'method_messages.getWebPagePreview_param_entities_type_Vector t' => 'Entities for styled text', 'method_messages.exportChatInvite' => 'Export chat invite ', 'method_messages.exportChatInvite_param_chat_id_type_InputPeer' => 'The chat id ', 'method_messages.checkChatInvite' => 'Check if an invitation link is valid', 'method_messages.checkChatInvite_param_hash_type_string' => 'The invite link in t.me/joinchat/aflakf format', 'method_messages.importChatInvite' => 'Import chat invite', 'method_messages.importChatInvite_param_hash_type_string' => 'The invite link in t.me/joinchat/aflakf format', 'method_messages.getStickerSet' => 'Get a stickerset', 'method_messages.getStickerSet_param_stickerset_type_InputStickerSet' => 'The stickerset to get', 'method_messages.installStickerSet' => 'Add a sticker set', 'method_messages.installStickerSet_param_stickerset_type_InputStickerSet' => 'The sticker set to add', 'method_messages.installStickerSet_param_archived_type_Bool' => 'Archive this set?', 'method_messages.uninstallStickerSet' => 'Remove a sticker set', 'method_messages.uninstallStickerSet_param_stickerset_type_InputStickerSet' => 'The sticker set to remove', 'method_messages.startBot' => 'Start a bot', 'method_messages.startBot_param_bot_type_InputUser' => 'The bot\'s ID or username', 'method_messages.startBot_param_peer_type_InputPeer' => 'Where to start the bot (@me or group ID/username)', 'method_messages.startBot_param_start_param_type_string' => 'The bot\'s start parameter', 'method_messages.getMessagesViews' => 'Get and increase message views', 'method_messages.getMessagesViews_param_peer_type_InputPeer' => 'The chat where the message is located', 'method_messages.getMessagesViews_param_id_type_Vector t' => 'The IDs messages to get', 'method_messages.getMessagesViews_param_increment_type_Bool' => 'Increase message views?', 'method_messages.toggleChatAdmins' => 'Enable all users are admins in normal groups (not supergroups)', 'method_messages.toggleChatAdmins_param_chat_id_type_InputPeer' => 'Group ID', 'method_messages.toggleChatAdmins_param_enabled_type_Bool' => 'Enable all users are admins', 'method_messages.editChatAdmin' => 'Edit admin permissions', 'method_messages.editChatAdmin_param_chat_id_type_InputPeer' => 'The chat ID (no supergroups)', 'method_messages.editChatAdmin_param_user_id_type_InputUser' => 'The user ID', 'method_messages.editChatAdmin_param_is_admin_type_Bool' => 'Should the user be admin?', 'method_messages.migrateChat' => 'Convert chat to supergroup', 'method_messages.migrateChat_param_chat_id_type_InputPeer' => 'The chat to convert', 'method_messages.searchGlobal' => 'Global message search', 'method_messages.searchGlobal_param_q_type_string' => 'The query', 'method_messages.searchGlobal_param_offset_date_type_int' => '0 or the date offset', 'method_messages.searchGlobal_param_offset_peer_type_InputPeer' => '0 or the peer offset', 'method_messages.searchGlobal_param_offset_id_type_int' => '0 or the message ID offset', 'method_messages.searchGlobal_param_limit_type_int' => 'The number of results to return', 'method_messages.reorderStickerSets' => 'Reorder sticker sets', 'method_messages.reorderStickerSets_param_masks_type_true' => 'Reorder masks?', 'method_messages.reorderStickerSets_param_order_type_Vector t' => 'The order', 'method_messages.getDocumentByHash' => 'Get document by SHA256 hash', 'method_messages.getDocumentByHash_param_sha256_type_bytes' => '`hash(\'sha256\', $filename, true);`', 'method_messages.getDocumentByHash_param_size_type_int' => 'The file size', 'method_messages.getDocumentByHash_param_mime_type_type_string' => 'The mime type of the file', 'method_messages.searchGifs' => 'Search gifs', 'method_messages.searchGifs_param_q_type_string' => 'The search query', 'method_messages.searchGifs_param_offset_type_int' => 'The offset ', 'method_messages.getSavedGifs' => 'Get saved gifs', 'method_messages.getSavedGifs_param_hash_type_int' => '0 or $result[\'hash\']', 'method_messages.saveGif' => 'Save a GIF', 'method_messages.saveGif_param_id_type_InputDocument' => 'The GIF to save', 'method_messages.saveGif_param_unsave_type_Bool' => 'Remove the gif?', 'method_messages.getInlineBotResults' => 'Call inline bot', 'method_messages.getInlineBotResults_param_bot_type_InputUser' => 'The bot to call', 'method_messages.getInlineBotResults_param_peer_type_InputPeer' => 'The chat where to call the bot', 'method_messages.getInlineBotResults_param_geo_point_type_InputGeoPoint' => 'The current location', 'method_messages.getInlineBotResults_param_query_type_string' => 'The query to send to the bot', 'method_messages.getInlineBotResults_param_offset_type_string' => 'The offset to send to the bot', 'method_messages.setInlineBotResults' => 'Bots only: set the results of an inline query', 'method_messages.setInlineBotResults_param_gallery_type_true' => 'Is this a gallery?', 'method_messages.setInlineBotResults_param_private_type_true' => 'Is this result private (not cached)?', 'method_messages.setInlineBotResults_param_query_id_type_long' => 'Query ID', 'method_messages.setInlineBotResults_param_results_type_Vector t' => 'Results', 'method_messages.setInlineBotResults_param_cache_time_type_int' => 'Cache time', 'method_messages.setInlineBotResults_param_next_offset_type_string' => 'The next offset', 'method_messages.setInlineBotResults_param_switch_pm_type_InlineBotSwitchPM' => 'Switch to PM?', 'method_messages.sendInlineBotResult' => 'Send inline bot result obtained with messages.getInlineBotResults to the chat', 'method_messages.sendInlineBotResult_param_silent_type_true' => 'Disable notifications?', 'method_messages.sendInlineBotResult_param_background_type_true' => 'Disable background notifications?', 'method_messages.sendInlineBotResult_param_clear_draft_type_true' => 'Clear the message draft?', 'method_messages.sendInlineBotResult_param_peer_type_InputPeer' => 'Where to send the message', 'method_messages.sendInlineBotResult_param_reply_to_msg_id_type_int' => 'Reply to message by ID', 'method_messages.sendInlineBotResult_param_query_id_type_long' => 'The inline query ID', 'method_messages.sendInlineBotResult_param_id_type_string' => 'The ID of one of the inline results', 'method_messages.getMessageEditData' => 'Check if about to edit a message or a media caption', 'method_messages.getMessageEditData_param_peer_type_InputPeer' => 'The chat', 'method_messages.getMessageEditData_param_id_type_int' => 'The message ID', 'method_messages.editMessage' => 'Edit a message', 'method_messages.editMessage_param_no_webpage_type_true' => 'Disable webpage preview', 'method_messages.editMessage_param_stop_geo_live_type_true' => 'Stop live location', 'method_messages.editMessage_param_peer_type_InputPeer' => 'The chat', 'method_messages.editMessage_param_id_type_int' => 'The message ID', 'method_messages.editMessage_param_message_type_string' => 'The new message', 'method_messages.editMessage_param_reply_markup_type_ReplyMarkup' => 'The new keyboard', 'method_messages.editMessage_param_entities_type_Vector t' => 'The new entities (for styled text)', 'method_messages.editMessage_param_geo_point_type_InputGeoPoint' => 'The new location', 'method_messages.editInlineBotMessage' => 'Edit a sent inline message', 'method_messages.editInlineBotMessage_param_no_webpage_type_true' => 'Disable webpage preview', 'method_messages.editInlineBotMessage_param_stop_geo_live_type_true' => 'Stop live location', 'method_messages.editInlineBotMessage_param_id_type_InputBotInlineMessageID' => 'The message ID', 'method_messages.editInlineBotMessage_param_message_type_string' => 'The new message', 'method_messages.editInlineBotMessage_param_reply_markup_type_ReplyMarkup' => 'The new keyboard', 'method_messages.editInlineBotMessage_param_entities_type_Vector t' => 'The new entities (for styled text)', 'method_messages.editInlineBotMessage_param_geo_point_type_InputGeoPoint' => 'The new location', 'method_messages.getBotCallbackAnswer' => 'Get the callback answer of a bot (after clicking a button)', 'method_messages.getBotCallbackAnswer_param_game_type_true' => 'Is this a game?', 'method_messages.getBotCallbackAnswer_param_peer_type_InputPeer' => 'The chat', 'method_messages.getBotCallbackAnswer_param_msg_id_type_int' => 'The message ID', 'method_messages.getBotCallbackAnswer_param_data_type_bytes' => 'The data to send to the bot', 'method_messages.setBotCallbackAnswer' => 'Bots only: set the callback answer (after a button was clicked)', 'method_messages.setBotCallbackAnswer_param_alert_type_true' => 'Is this an alert?', 'method_messages.setBotCallbackAnswer_param_query_id_type_long' => 'The query ID', 'method_messages.setBotCallbackAnswer_param_message_type_string' => 'The message', 'method_messages.setBotCallbackAnswer_param_url_type_string' => 'The URL', 'method_messages.setBotCallbackAnswer_param_cache_time_type_int' => 'Cache time', 'method_messages.getPeerDialogs' => 'Get dialog info of peers', 'method_messages.getPeerDialogs_param_peers_type_Vector t' => 'The peers', 'method_messages.saveDraft' => 'Save a message draft', 'method_messages.saveDraft_param_no_webpage_type_true' => 'Disable webpage preview', 'method_messages.saveDraft_param_reply_to_msg_id_type_int' => 'Reply to message by ID', 'method_messages.saveDraft_param_peer_type_InputPeer' => 'The chat', 'method_messages.saveDraft_param_message_type_string' => 'The message', 'method_messages.saveDraft_param_entities_type_Vector t' => 'The entities (for styled text)', 'method_messages.getAllDrafts' => 'Get all message drafts', 'method_messages.getFeaturedStickers' => 'Get featured stickers', 'method_messages.getFeaturedStickers_param_hash_type_int' => '0 or $result[\'hash\']', 'method_messages.readFeaturedStickers' => 'Mark new featured stickers as read', 'method_messages.readFeaturedStickers_param_id_type_Vector t' => 'The stickers to mark as read', 'method_messages.getRecentStickers' => 'Get recent stickers', 'method_messages.getRecentStickers_param_attached_type_true' => 'Get stickers attached to image?', 'method_messages.getRecentStickers_param_hash_type_int' => '0 or $result[\'hash\']', 'method_messages.saveRecentSticker' => 'Add a sticker to recent stickers', 'method_messages.saveRecentSticker_param_attached_type_true' => 'Get stickers attached to image?', 'method_messages.saveRecentSticker_param_id_type_InputDocument' => 'The sticker', 'method_messages.saveRecentSticker_param_unsave_type_Bool' => 'Remove the sticker from recent stickers?', 'method_messages.clearRecentStickers' => 'Clear all recent stickers', 'method_messages.clearRecentStickers_param_attached_type_true' => 'Clear recent stickers attached to images?', 'method_messages.getArchivedStickers' => 'Get all archived stickers', 'method_messages.getArchivedStickers_param_masks_type_true' => 'Get masks?', 'method_messages.getArchivedStickers_param_offset_id_type_long' => 'Sticker ID offset', 'method_messages.getArchivedStickers_param_limit_type_int' => 'Number of stickers to fetch', 'method_messages.getMaskStickers' => 'Get masks', 'method_messages.getMaskStickers_param_hash_type_int' => '0 or $result[\'hash\']', 'method_messages.getAttachedStickers' => 'Get stickers attachable to images', 'method_messages.getAttachedStickers_param_media_type_InputStickeredMedia' => 'The stickered media', 'method_messages.setGameScore' => 'Set the game score', 'method_messages.setGameScore_param_edit_message_type_true' => 'Should the message with the game be edited?', 'method_messages.setGameScore_param_force_type_true' => 'Force setting the game score', 'method_messages.setGameScore_param_peer_type_InputPeer' => 'The chat where the game was sent', 'method_messages.setGameScore_param_id_type_int' => 'The message ID', 'method_messages.setGameScore_param_user_id_type_InputUser' => 'The user that set the score', 'method_messages.setGameScore_param_score_type_int' => 'The score', 'method_messages.setInlineGameScore' => 'Set the game score of an inline message', 'method_messages.setInlineGameScore_param_edit_message_type_true' => 'Should the message with the game be edited?', 'method_messages.setInlineGameScore_param_force_type_true' => 'Force setting the game score', 'method_messages.setInlineGameScore_param_id_type_InputBotInlineMessageID' => 'The ID of the inline message', 'method_messages.setInlineGameScore_param_user_id_type_InputUser' => 'The user that set the score', 'method_messages.setInlineGameScore_param_score_type_int' => 'The score', 'method_messages.getGameHighScores' => 'Get high scores of a game', 'method_messages.getGameHighScores_param_peer_type_InputPeer' => 'The chat', 'method_messages.getGameHighScores_param_id_type_int' => 'The message ID', 'method_messages.getGameHighScores_param_user_id_type_InputUser' => 'The user that set the high scores', 'method_messages.getInlineGameHighScores' => 'Get high scores of a game sent in an inline message', 'method_messages.getInlineGameHighScores_param_id_type_InputBotInlineMessageID' => 'The inline message', 'method_messages.getInlineGameHighScores_param_user_id_type_InputUser' => 'The user that set the high scores', 'method_messages.getCommonChats' => 'Get chats in common with a user', 'method_messages.getCommonChats_param_user_id_type_InputUser' => 'The user', 'method_messages.getCommonChats_param_max_id_type_int' => 'The maximum chat ID to fetch', 'method_messages.getCommonChats_param_limit_type_int' => 'Number of results to fetch', 'method_messages.getAllChats' => 'Get all chats (not supergroups or channels)', 'method_messages.getAllChats_param_except_ids_type_Vector t' => 'Do not fetch these chats (MTProto id)', 'method_messages.getWebPage' => 'Get webpage preview', 'method_messages.getWebPage_param_url_type_string' => 'URL', 'method_messages.getWebPage_param_hash_type_int' => '0 or $result[\'hash\']', 'method_messages.toggleDialogPin' => 'Pin or unpin dialog', 'method_messages.toggleDialogPin_param_pinned_type_true' => 'Pin or unpin the dialog?', 'method_messages.toggleDialogPin_param_peer_type_InputPeer' => 'The peer to pin', 'method_messages.reorderPinnedDialogs' => 'Reorder pinned dialogs', 'method_messages.reorderPinnedDialogs_param_force_type_true' => 'Force reordering', 'method_messages.reorderPinnedDialogs_param_order_type_Vector t' => 'New order', 'method_messages.getPinnedDialogs' => 'Get pinned dialogs', 'method_messages.setBotShippingResults' => 'Bots only: set shipping results', 'method_messages.setBotShippingResults_param_query_id_type_long' => 'Query ID', 'method_messages.setBotShippingResults_param_error_type_string' => 'Error', 'method_messages.setBotShippingResults_param_shipping_options_type_Vector t' => 'Shipping options', 'method_messages.setBotPrecheckoutResults' => 'Bots only: set precheckout results', 'method_messages.setBotPrecheckoutResults_param_success_type_true' => 'Success?', 'method_messages.setBotPrecheckoutResults_param_query_id_type_long' => 'Query ID', 'method_messages.setBotPrecheckoutResults_param_error_type_string' => 'Error', 'method_messages.uploadMedia' => 'Upload a file without sending it to anyone', 'method_messages.uploadMedia_param_peer_type_InputPeer' => 'Nothing', 'method_messages.uploadMedia_param_media_type_InputMedia' => 'The media to upload', 'method_messages.sendScreenshotNotification' => 'Send screenshot notification', 'method_messages.sendScreenshotNotification_param_peer_type_InputPeer' => 'Where to send the notification', 'method_messages.sendScreenshotNotification_param_reply_to_msg_id_type_int' => 'Reply to message by ID', 'method_messages.getFavedStickers' => 'Get favorite stickers', 'method_messages.getFavedStickers_param_hash_type_int' => '0 or $result[\'hash\']', 'method_messages.faveSticker' => 'Add a sticker to favorites', 'method_messages.faveSticker_param_id_type_InputDocument' => 'The sticker to add to favorites', 'method_messages.faveSticker_param_unfave_type_Bool' => 'Remove it from favorites?', 'method_messages.getUnreadMentions' => 'Get unread mentions', 'method_messages.getUnreadMentions_param_peer_type_InputPeer' => 'The chat where to get unread mentions', 'method_messages.getUnreadMentions_param_offset_id_type_int' => 'The offset', 'method_messages.getUnreadMentions_param_add_offset_type_int' => 'The additional offset', 'method_messages.getUnreadMentions_param_limit_type_int' => 'The number of results to fetch', 'method_messages.getUnreadMentions_param_max_id_type_int' => 'The maximum message ID to fetch', 'method_messages.getUnreadMentions_param_min_id_type_int' => 'The minumum message ID to fetch', 'method_messages.readMentions' => 'Mark mentions as read', 'method_messages.readMentions_param_peer_type_InputPeer' => 'The chat', 'method_messages.getRecentLocations' => 'Get recent locations', 'method_messages.getRecentLocations_param_peer_type_InputPeer' => 'The chat where to search locations', 'method_messages.getRecentLocations_param_limit_type_int' => 'Number of results to return', 'method_messages.sendMultiMedia' => 'Send an album', 'method_messages.sendMultiMedia_param_silent_type_true' => 'Disable notifications?', 'method_messages.sendMultiMedia_param_background_type_true' => 'Disable background notification?', 'method_messages.sendMultiMedia_param_clear_draft_type_true' => 'Clear draft?', 'method_messages.sendMultiMedia_param_peer_type_InputPeer' => 'Where to send the album', 'method_messages.sendMultiMedia_param_reply_to_msg_id_type_int' => 'Reply to message by ID', 'method_messages.sendMultiMedia_param_multi_media_type_Vector t' => 'The album', 'method_messages.uploadEncryptedFile' => 'Upload a secret chat file without sending it to anyone', 'method_messages.uploadEncryptedFile_param_peer_type_InputEncryptedChat' => 'The chat where to upload the media', 'method_messages.uploadEncryptedFile_param_file_type_InputEncryptedFile' => 'The file', 'method_updates.getState' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getDifference' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getDifference_param_pts_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getDifference_param_pts_total_limit_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getDifference_param_date_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getDifference_param_qts_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getChannelDifference' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getChannelDifference_param_force_type_true' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getChannelDifference_param_channel_type_InputChannel' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getChannelDifference_param_filter_type_ChannelMessagesFilter' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getChannelDifference_param_pts_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_updates.getChannelDifference_param_limit_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_photos.updateProfilePhoto' => 'Change the profile photo', 'method_photos.updateProfilePhoto_param_id_type_InputPhoto' => 'The photo to use', 'method_photos.uploadProfilePhoto' => 'Upload profile photo', 'method_photos.uploadProfilePhoto_param_file_type_InputFile' => 'The photo', 'method_photos.deletePhotos' => 'Delete profile photos', 'method_photos.deletePhotos_param_id_type_Vector t' => 'The profile photos to delete', 'method_photos.getUserPhotos' => 'Get the profile photos of a user', 'method_photos.getUserPhotos_param_user_id_type_InputUser' => 'The user', 'method_photos.getUserPhotos_param_offset_type_int' => 'Offset', 'method_photos.getUserPhotos_param_max_id_type_long' => 'Maximum ID of photo to return', 'method_photos.getUserPhotos_param_limit_type_int' => 'Number of photos to return', 'method_upload.saveFilePart' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveFilePart_param_file_id_type_long' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveFilePart_param_file_part_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveFilePart_param_bytes_type_bytes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getFile_param_location_type_InputFileLocation' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getFile_param_offset_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getFile_param_limit_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveBigFilePart' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveBigFilePart_param_file_id_type_long' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveBigFilePart_param_file_part_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveBigFilePart_param_file_total_parts_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.saveBigFilePart_param_bytes_type_bytes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getWebFile' => 'Download a file through telegram', 'method_upload.getWebFile_param_location_type_InputWebFileLocation' => 'The file', 'method_upload.getWebFile_param_offset_type_int' => 'The offset in bytes', 'method_upload.getWebFile_param_limit_type_int' => 'The number of bytes to fetch', 'method_upload.getCdnFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getCdnFile_param_file_token_type_bytes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getCdnFile_param_offset_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getCdnFile_param_limit_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.reuploadCdnFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.reuploadCdnFile_param_file_token_type_bytes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.reuploadCdnFile_param_request_token_type_bytes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getCdnFileHashes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getCdnFileHashes_param_file_token_type_bytes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_upload.getCdnFileHashes_param_offset_type_int' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://docs.madelineproto.xyz for more info', 'method_help.getConfig' => 'Get server configuration', 'method_help.getNearestDc' => 'Get nearest datacenter', 'method_help.getAppUpdate' => 'Get info about app updates', 'method_help.saveAppLog' => 'Log data for developer of this app', 'method_help.saveAppLog_param_events_type_Vector t' => 'Event list', 'method_help.getInviteText' => 'Get invitation text', 'method_help.getSupport' => 'Get info of support user', 'method_help.getAppChangelog' => 'Get the changelog of this app', 'method_help.getAppChangelog_param_prev_app_version_type_string' => 'Previous app version', 'method_help.getTermsOfService' => 'Get terms of service', 'method_help.setBotUpdatesStatus' => 'Set the update status of webhook', 'method_help.setBotUpdatesStatus_param_pending_updates_count_type_int' => 'Pending update count', 'method_help.setBotUpdatesStatus_param_message_type_string' => 'Message', 'method_help.getCdnConfig' => 'Get CDN configuration', 'method_help.getRecentMeUrls' => 'Get recent t.me URLs', 'method_help.getRecentMeUrls_param_referer_type_string' => 'Referrer', 'method_channels.readHistory' => 'Mark channel/supergroup history as read', 'method_channels.readHistory_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.readHistory_param_max_id_type_int' => 'Maximum message ID to mark as read', 'method_channels.deleteMessages' => 'Delete channel/supergroup messages', 'method_channels.deleteMessages_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.deleteMessages_param_id_type_Vector t' => 'The IDs of messages to delete', 'method_channels.deleteUserHistory' => 'Delete all messages of a user in a channel/supergroup', 'method_channels.deleteUserHistory_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.deleteUserHistory_param_user_id_type_InputUser' => 'The user', 'method_channels.reportSpam' => 'Report a message in a supergroup/channel for spam', 'method_channels.reportSpam_param_channel_type_InputChannel' => 'The channel', 'method_channels.reportSpam_param_user_id_type_InputUser' => 'The user that sent the messages', 'method_channels.reportSpam_param_id_type_Vector t' => 'The IDs of messages to report', 'method_channels.getMessages' => 'Get channel/supergroup messages', 'method_channels.getMessages_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.getMessages_param_id_type_Vector t' => 'The message IDs', 'method_channels.getParticipants' => 'Get channel/supergroup participants (you should use `$MadelineProto->get_pwr_chat($id)` instead)', 'method_channels.getParticipants_param_channel_type_InputChannel' => 'The channel', 'method_channels.getParticipants_param_filter_type_ChannelParticipantsFilter' => 'Member filter', 'method_channels.getParticipants_param_offset_type_int' => 'Offset', 'method_channels.getParticipants_param_limit_type_int' => 'Limit', 'method_channels.getParticipants_param_hash_type_int' => 'Sorted list of IDs of participants you already fetched', 'method_channels.getParticipant' => 'Get info about a certain channel/supergroup participant', 'method_channels.getParticipant_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.getParticipant_param_user_id_type_InputUser' => 'The user to fetch info about', 'method_channels.getChannels' => 'Get info about multiple channels/supergroups', 'method_channels.getChannels_param_id_type_Vector t' => 'The channel/supergroup MTProto IDs', 'method_channels.getFullChannel' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_channels.getFullChannel_param_channel_type_InputChannel' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'method_channels.createChannel' => 'Create channel/supergroup', 'method_channels.createChannel_param_broadcast_type_true' => 'Set this to true to create a channel', 'method_channels.createChannel_param_megagroup_type_true' => 'Set this to true to create a supergroup', 'method_channels.createChannel_param_title_type_string' => 'Supergroup/channel title', 'method_channels.createChannel_param_about_type_string' => 'About text', 'method_channels.editAbout' => 'Edit the about text of a channel/supergroup', 'method_channels.editAbout_param_channel_type_InputChannel' => 'The channel', 'method_channels.editAbout_param_about_type_string' => 'The new about text', 'method_channels.editAdmin' => 'Edit admin permissions of a user in a channel/supergroup', 'method_channels.editAdmin_param_channel_type_InputChannel' => 'The channel', 'method_channels.editAdmin_param_user_id_type_InputUser' => 'The user', 'method_channels.editAdmin_param_admin_rights_type_ChannelAdminRights' => 'The new admin rights', 'method_channels.editTitle' => 'Edit the title of a supergroup/channel', 'method_channels.editTitle_param_channel_type_InputChannel' => 'The channel', 'method_channels.editTitle_param_title_type_string' => 'The new channel/supergroup title', 'method_channels.editPhoto' => 'Edit the photo of a supergroup/channel', 'method_channels.editPhoto_param_channel_type_InputChannel' => 'The channel', 'method_channels.editPhoto_param_photo_type_InputChatPhoto' => 'The new photo', 'method_channels.checkUsername' => 'Check if this username is free and can be assigned to a channel/supergroup', 'method_channels.checkUsername_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.checkUsername_param_username_type_string' => 'The new username for this channel/supergroup', 'method_channels.updateUsername' => 'Update the username of a supergroup/channel', 'method_channels.updateUsername_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.updateUsername_param_username_type_string' => 'The new username', 'method_channels.joinChannel' => 'Join a channel/supergroup', 'method_channels.joinChannel_param_channel_type_InputChannel' => 'The channel/supergroup to join', 'method_channels.leaveChannel' => 'Leave a channel/supergroup', 'method_channels.leaveChannel_param_channel_type_InputChannel' => 'The channel/supergroup to leave', 'method_channels.inviteToChannel' => 'Add users to channel/supergroup', 'method_channels.inviteToChannel_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.inviteToChannel_param_users_type_Vector t' => 'The users to add', 'method_channels.exportInvite' => 'Export the invite link of a channel', 'method_channels.exportInvite_param_channel_type_InputChannel' => 'The channel', 'method_channels.deleteChannel' => 'Delete a channel/supergroup', 'method_channels.deleteChannel_param_channel_type_InputChannel' => 'The channel/supergroup to delete', 'method_channels.toggleInvites' => 'Allow or disallow any user to invite users to this channel/supergroup', 'method_channels.toggleInvites_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.toggleInvites_param_enabled_type_Bool' => 'Allow or disallow', 'method_channels.exportMessageLink' => 'Get the link of a message in a channel', 'method_channels.exportMessageLink_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.exportMessageLink_param_id_type_int' => 'The ID of the message', 'method_channels.exportMessageLink_param_grouped_type_Bool' => 'Is this an album?', 'method_channels.toggleSignatures' => 'Toggle channel signatures', 'method_channels.toggleSignatures_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.toggleSignatures_param_enabled_type_Bool' => 'Enable or disable channel signatures?', 'method_channels.updatePinnedMessage' => 'Set the pinned message of a channel/supergroup', 'method_channels.updatePinnedMessage_param_silent_type_true' => 'Pin silently', 'method_channels.updatePinnedMessage_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.updatePinnedMessage_param_id_type_int' => 'The ID of the message to pin', 'method_channels.getAdminedPublicChannels' => 'Get all supergroups/channels where you\'re admin', 'method_channels.editBanned' => 'Kick or ban a user from a channel/supergroup', 'method_channels.editBanned_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.editBanned_param_user_id_type_InputUser' => 'The user to kick/ban', 'method_channels.editBanned_param_banned_rights_type_ChannelBannedRights' => 'Banned/kicked permissions', 'method_channels.getAdminLog' => 'Get admin log of a channel/supergroup', 'method_channels.getAdminLog_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.getAdminLog_param_q_type_string' => 'Search query', 'method_channels.getAdminLog_param_events_filter_type_ChannelAdminLogEventsFilter' => 'Event filter', 'method_channels.getAdminLog_param_admins_type_Vector t' => 'Fetch only actions from these admins', 'method_channels.getAdminLog_param_max_id_type_long' => 'Maximum message ID to fetch', 'method_channels.getAdminLog_param_min_id_type_long' => 'Minimum message ID to fetch', 'method_channels.getAdminLog_param_limit_type_int' => 'Number of results to fetch', 'method_channels.setStickers' => 'Set the supergroup/channel stickerpack', 'method_channels.setStickers_param_channel_type_InputChannel' => 'The channel/supergoup', 'method_channels.setStickers_param_stickerset_type_InputStickerSet' => 'The stickerset', 'method_channels.readMessageContents' => 'Mark channel/supergroup messages as read', 'method_channels.readMessageContents_param_channel_type_InputChannel' => 'The channel', 'method_channels.readMessageContents_param_id_type_Vector t' => 'List of message IDs', 'method_channels.deleteHistory' => 'Delete the history of a supergroup/channel', 'method_channels.deleteHistory_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.deleteHistory_param_max_id_type_int' => 'Maximum message ID to delete', 'method_channels.togglePreHistoryHidden' => 'Enable or disable hidden history for new channel/supergroup users', 'method_channels.togglePreHistoryHidden_param_channel_type_InputChannel' => 'The channel/supergroup', 'method_channels.togglePreHistoryHidden_param_enabled_type_Bool' => 'Enable or disable hidden history for new channel/supergroup users', 'method_bots.sendCustomRequest' => 'Send a custom request to the bot API', 'method_bots.sendCustomRequest_param_custom_method_type_string' => 'The method to call', 'method_bots.sendCustomRequest_param_params_type_DataJSON' => 'Method parameters', 'method_bots.answerWebhookJSONQuery' => 'Send webhook request via bot API', 'method_bots.answerWebhookJSONQuery_param_query_id_type_long' => 'The query ID', 'method_bots.answerWebhookJSONQuery_param_data_type_DataJSON' => 'The parameters', 'method_payments.getPaymentForm' => 'Get payment form', 'method_payments.getPaymentForm_param_msg_id_type_int' => 'Message ID', 'method_payments.getPaymentReceipt' => 'Get payment receipt', 'method_payments.getPaymentReceipt_param_msg_id_type_int' => 'The message ID', 'method_payments.validateRequestedInfo' => 'Validate requested payment info', 'method_payments.validateRequestedInfo_param_save_type_true' => 'Save payment info?', 'method_payments.validateRequestedInfo_param_msg_id_type_int' => 'The message ID', 'method_payments.validateRequestedInfo_param_info_type_PaymentRequestedInfo' => 'The requested payment info', 'method_payments.sendPaymentForm' => 'Bots only: send payment form', 'method_payments.sendPaymentForm_param_msg_id_type_int' => 'Message ID', 'method_payments.sendPaymentForm_param_requested_info_id_type_string' => 'ID of requested info', 'method_payments.sendPaymentForm_param_shipping_option_id_type_string' => 'Shipping option ID', 'method_payments.sendPaymentForm_param_credentials_type_InputPaymentCredentials' => 'Payment credentials', 'method_payments.getSavedInfo' => 'Get saved payments info', 'method_payments.clearSavedInfo' => 'Clear saved payments info', 'method_payments.clearSavedInfo_param_credentials_type_true' => 'Clear credentials?', 'method_payments.clearSavedInfo_param_info_type_true' => 'Clear payment info?', 'method_stickers.createStickerSet' => 'Create stickerset', 'method_stickers.createStickerSet_param_masks_type_true' => 'Masks?', 'method_stickers.createStickerSet_param_user_id_type_InputUser' => 'The user ID associated to this stickerset', 'method_stickers.createStickerSet_param_title_type_string' => 'The stickerset title', 'method_stickers.createStickerSet_param_short_name_type_string' => 'The stickerset short name', 'method_stickers.createStickerSet_param_stickers_type_Vector t' => 'The stickers to add', 'method_stickers.removeStickerFromSet' => 'Remove sticker from stickerset', 'method_stickers.removeStickerFromSet_param_sticker_type_InputDocument' => 'The sticker to remove', 'method_stickers.changeStickerPosition' => 'Change sticker position in photo', 'method_stickers.changeStickerPosition_param_sticker_type_InputDocument' => 'The sticker', 'method_stickers.changeStickerPosition_param_position_type_int' => 'New position', 'method_stickers.addStickerToSet' => 'Add sticker to stickerset', 'method_stickers.addStickerToSet_param_stickerset_type_InputStickerSet' => 'The stickerset', 'method_stickers.addStickerToSet_param_sticker_type_InputStickerSetItem' => 'The sticker', 'method_phone.getCallConfig' => 'Get call configuration', 'method_phone.requestCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.requestCall_param_user_id_type_InputUser' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.requestCall_param_g_a_hash_type_bytes' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.requestCall_param_protocol_type_PhoneCallProtocol' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.acceptCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.acceptCall_param_peer_type_InputPhoneCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.acceptCall_param_g_b_type_bytes' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.acceptCall_param_protocol_type_PhoneCallProtocol' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.confirmCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.confirmCall_param_peer_type_InputPhoneCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.confirmCall_param_g_a_type_bytes' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.confirmCall_param_key_fingerprint_type_long' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.confirmCall_param_protocol_type_PhoneCallProtocol' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.receivedCall' => 'Notify server that you received a call (server will refuse all incoming calls until the current call is over)', 'method_phone.receivedCall_param_peer_type_InputPhoneCall' => 'The phone call you received', 'method_phone.discardCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.discardCall_param_peer_type_InputPhoneCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.discardCall_param_duration_type_int' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.discardCall_param_reason_type_PhoneCallDiscardReason' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.discardCall_param_connection_id_type_long' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.setCallRating' => 'Set phone call rating', 'method_phone.setCallRating_param_peer_type_InputPhoneCall' => 'The phone call', 'method_phone.setCallRating_param_rating_type_int' => 'Rating (1-5 stars)', 'method_phone.setCallRating_param_comment_type_string' => 'An optional comment', 'method_phone.saveCallDebug' => 'Save call debugging info', 'method_phone.saveCallDebug_param_peer_type_InputPhoneCall' => 'The call', 'method_phone.saveCallDebug_param_debug_type_DataJSON' => 'Debugging info', 'method_langpack.getLangPack' => 'Get language pack', 'method_langpack.getLangPack_param_lang_code_type_string' => 'Language code', 'method_langpack.getStrings' => 'Get language pack strings', 'method_langpack.getStrings_param_lang_code_type_string' => 'Language code', 'method_langpack.getStrings_param_keys_type_Vector t' => 'Keys', 'method_langpack.getDifference' => 'Get language pack updates', 'method_langpack.getDifference_param_from_version_type_int' => 'Previous version', 'method_langpack.getLanguages' => 'Get available languages', 'method_auth.sendCode_param_sms_type_type_int' => 'You cannot use this method directly, use the phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.sendCode_param_lang_code_type_string' => 'You cannot use this method directly, use the phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.sendCall' => 'Send verification phone call', 'method_auth.sendCall_param_phone_number_type_string' => 'The phone number', 'method_auth.sendCall_param_phone_code_hash_type_string' => 'The phone code hash', 'method_account.registerDevice_param_device_model_type_string' => 'Device model', 'method_account.registerDevice_param_system_version_type_string' => 'System version', 'method_account.registerDevice_param_app_version_type_string' => 'App version', 'method_account.registerDevice_param_lang_code_type_string' => 'Language code', 'method_contacts.getContacts_param_hash_type_string' => 'List of contact user IDs you already cached', 'method_contacts.importContacts_param_replace_type_Bool' => 'Replace contacts?', 'method_contacts.getSuggested' => 'Get suggested contacts', 'method_contacts.getSuggested_param_limit_type_int' => 'Number of results to return', 'method_messages.getDialogs_param_offset_type_int' => 'Offset', 'method_messages.getDialogs_param_max_id_type_int' => 'Maximum ID of result to return', 'method_messages.getHistory_param_offset_type_int' => 'Message ID offset', 'method_messages.search_param_offset_type_int' => 'Offset ', 'method_messages.readHistory_param_offset_type_int' => 'Offset', 'method_messages.readHistory_param_read_contents_type_Bool' => 'Mark messages as read?', 'method_messages.deleteHistory_param_offset_type_int' => 'Offset', 'method_messages.forwardMessages_param_peer_type_InputPeer' => 'Peer', 'method_photos.updateProfilePhoto_param_crop_type_InputPhotoCrop' => 'Cropping info', 'method_photos.uploadProfilePhoto_param_caption_type_string' => 'Caption type', 'method_photos.uploadProfilePhoto_param_geo_point_type_InputGeoPoint' => 'Location', 'method_photos.uploadProfilePhoto_param_crop_type_InputPhotoCrop' => 'Cropping info', 'method_help.getAppUpdate_param_device_model_type_string' => 'Device model', 'method_help.getAppUpdate_param_system_version_type_string' => 'System version', 'method_help.getAppUpdate_param_app_version_type_string' => 'App version', 'method_help.getAppUpdate_param_lang_code_type_string' => 'Langauge code', 'method_help.getInviteText_param_lang_code_type_string' => 'Language', 'method_photos.getUserPhotos_param_max_id_type_int' => 'Maximum ID of photo to return', 'method_messages.forwardMessage' => 'Forward message', 'method_messages.forwardMessage_param_peer_type_InputPeer' => 'From where to forward the message', 'method_messages.forwardMessage_param_id_type_int' => 'The message ID', 'method_messages.sendBroadcast' => 'Send a message to all users in the chat list', 'method_messages.sendBroadcast_param_contacts_type_Vector t' => 'The users to which send the message', 'method_messages.sendBroadcast_param_message_type_string' => 'The message', 'method_messages.sendBroadcast_param_media_type_InputMedia' => 'The media', 'method_auth.sendSms' => 'Send SMS verification code', 'method_auth.sendSms_param_phone_number_type_string' => 'Phone number', 'method_auth.sendSms_param_phone_code_hash_type_string' => 'Phone code ash', 'method_invokeWithLayer18' => 'Invoke this method with layer 18', 'method_invokeWithLayer18_param_query_type_!X' => 'The method call', 'method_messages.getAllStickers_param_hash_type_string' => 'Previously fetched stickers', 'method_geochats.getLocated' => 'Get nearby geochats', 'method_geochats.getLocated_param_geo_point_type_InputGeoPoint' => 'Current location', 'method_geochats.getLocated_param_radius_type_int' => 'Radius', 'method_geochats.getLocated_param_limit_type_int' => 'Number of results to return', 'method_geochats.getRecents' => 'Get recent geochats', 'method_geochats.getRecents_param_offset_type_int' => 'Offset', 'method_geochats.getRecents_param_limit_type_int' => 'Number of results to return', 'method_geochats.checkin' => 'Join a geochat', 'method_geochats.checkin_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.getFullChat' => 'Get full info about a geochat', 'method_geochats.getFullChat_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.editChatTitle' => 'Edit geochat title', 'method_geochats.editChatTitle_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.editChatTitle_param_title_type_string' => 'The new title', 'method_geochats.editChatTitle_param_address_type_string' => 'The new address', 'method_geochats.editChatPhoto' => 'Edit geochat photo', 'method_geochats.editChatPhoto_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.editChatPhoto_param_photo_type_InputChatPhoto' => 'The new photo', 'method_geochats.search' => 'Search messages in geocha', 'method_geochats.search_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.search_param_q_type_string' => 'The search query', 'method_geochats.search_param_filter_type_MessagesFilter' => 'Search filter', 'method_geochats.search_param_min_date_type_int' => 'Minumum date', 'method_geochats.search_param_max_date_type_int' => 'Maximum date', 'method_geochats.search_param_offset_type_int' => 'Offset', 'method_geochats.search_param_max_id_type_int' => 'Maximum message ID', 'method_geochats.search_param_limit_type_int' => 'Number of results to return', 'method_geochats.getHistory' => 'Get geochat history', 'method_geochats.getHistory_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.getHistory_param_offset_type_int' => 'Offset', 'method_geochats.getHistory_param_max_id_type_int' => 'Maximum message ID', 'method_geochats.getHistory_param_limit_type_int' => 'Number of results to return', 'method_geochats.setTyping' => 'Send typing notification to geochat', 'method_geochats.setTyping_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.setTyping_param_typing_type_Bool' => 'Typing or not typing', 'method_geochats.sendMessage' => 'Send message to geochat', 'method_geochats.sendMessage_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.sendMessage_param_message_type_string' => 'The message', 'method_geochats.sendMedia' => 'Send media to geochat', 'method_geochats.sendMedia_param_peer_type_InputGeoChat' => 'The geochat', 'method_geochats.sendMedia_param_media_type_InputMedia' => 'The media', 'method_geochats.createGeoChat' => 'Create geochat', 'method_geochats.createGeoChat_param_title_type_string' => 'Geochat title', 'method_geochats.createGeoChat_param_geo_point_type_InputGeoPoint' => 'Geochat location', 'method_geochats.createGeoChat_param_address_type_string' => 'Geochat address', 'method_geochats.createGeoChat_param_venue_type_string' => 'Geochat venue ', 'method_account.setPassword' => 'Set 2FA password', 'method_account.setPassword_param_current_password_hash_type_bytes' => 'Use only if you have set a 2FA password: `$current_salt = $MadelineProto->account->getPassword()[\'current_salt\']; $current_password_hash = hash(\'sha256\', $current_salt.$password.$current_salt, true);`', 'method_account.setPassword_param_new_salt_type_bytes' => 'New salt', 'method_account.setPassword_param_new_password_hash_type_bytes' => '`hash(\'sha256\', $new_salt.$new_password.$new_salt, true)`', 'method_account.setPassword_param_hint_type_string' => 'Hint', 'method_messages.installStickerSet_param_disabled_type_Bool' => 'Disable stickerset?', 'method_messages.startBot_param_chat_id_type_InputPeer' => 'Chat ID', 'method_help.getAppChangelog_param_device_model_type_string' => 'Device model', 'method_help.getAppChangelog_param_system_version_type_string' => 'System version', 'method_help.getAppChangelog_param_app_version_type_string' => 'App version', 'method_help.getAppChangelog_param_lang_code_type_string' => 'Language code', 'method_channels.getDialogs' => 'Get channel dialogs', 'method_channels.getDialogs_param_offset_type_int' => 'Offset', 'method_channels.getDialogs_param_limit_type_int' => 'Number of results to return', 'method_channels.getImportantHistory' => 'Get important channel/supergroup history', 'method_channels.getImportantHistory_param_channel_type_InputChannel' => 'The supergroup/channel', 'method_channels.getImportantHistory_param_offset_id_type_int' => 'Message ID offset', 'method_channels.getImportantHistory_param_add_offset_type_int' => 'Additional offset', 'method_channels.getImportantHistory_param_limit_type_int' => 'Number of results to return', 'method_channels.getImportantHistory_param_max_id_type_int' => 'Maximum message ID', 'method_channels.getImportantHistory_param_min_id_type_int' => 'Minumum message ID', 'method_channels.createChannel_param_users_type_Vector t' => 'Users to add to channel', 'method_channels.editAdmin_param_role_type_ChannelParticipantRole' => 'User role', 'method_channels.toggleComments' => 'Enable channel comments', 'method_channels.toggleComments_param_channel_type_InputChannel' => 'The channel ', 'method_channels.toggleComments_param_enabled_type_Bool' => 'Enable or disable comments', 'method_channels.kickFromChannel' => 'Kick user from channel', 'method_channels.kickFromChannel_param_channel_type_InputChannel' => 'The channel', 'method_channels.kickFromChannel_param_user_id_type_InputUser' => 'The user to kick', 'method_channels.kickFromChannel_param_kicked_type_Bool' => 'Kick or unkick?', 'method_messages.getChannelDialogs' => 'Get channel/supergruop dialogs', 'method_messages.getChannelDialogs_param_offset_type_int' => 'Offset', 'method_messages.getChannelDialogs_param_limit_type_int' => 'Number of results to return', 'method_messages.getImportantHistory' => 'Get important message history', 'method_messages.getImportantHistory_param_peer_type_InputPeer' => 'Peer', 'method_messages.getImportantHistory_param_max_id_type_int' => 'Maximum message ID to fetch', 'method_messages.getImportantHistory_param_min_id_type_int' => 'Minumum message ID to fetch', 'method_messages.getImportantHistory_param_limit_type_int' => 'Number of results to fetch', 'method_messages.readChannelHistory' => 'Mark channel/supergroup history as read', 'method_messages.readChannelHistory_param_peer_type_InputPeer' => 'The channel/supergruop', 'method_messages.readChannelHistory_param_max_id_type_int' => 'Maximum message ID to mark as read', 'method_messages.createChannel' => 'Create channel', 'method_messages.createChannel_param_title_type_string' => 'Channel/supergroup title', 'method_messages.deleteChannelMessages' => 'Delete channel messages', 'method_messages.deleteChannelMessages_param_peer_type_InputPeer' => 'The channel/supergroup', 'method_messages.deleteChannelMessages_param_id_type_Vector t' => 'The IDs of messages to delete', 'method_updates.getChannelDifference_param_peer_type_InputPeer' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'method_messages.search_param_important_only_type_true' => 'Show only important messages', 'method_messages.sendMessage_param_broadcast_type_true' => 'Broadcast this message', 'method_messages.sendMedia_param_broadcast_type_true' => 'Broadcast this message', 'method_messages.forwardMessages_param_broadcast_type_true' => 'Broadcast this message', 'method_messages.deactivateChat' => 'Deactivate chat', 'method_messages.deactivateChat_param_chat_id_type_InputPeer' => 'The chat to deactivate', 'method_messages.deactivateChat_param_enabled_type_Bool' => 'Activate or deactivate?', 'method_help.getTermsOfService_param_lang_code_type_string' => 'Language code', 'method_messages.sendInlineBotResult_param_broadcast_type_true' => 'Broadcast this message?', 'method_channels.getImportantHistory_param_offset_date_type_int' => 'Date offset', 'method_messages.getUnusedStickers' => 'Get unused stickers', 'method_messages.getUnusedStickers_param_limit_type_int' => 'Number of results to return', 'method_destroy_auth_key' => 'Destroy current authorization key', 'method_phone.requestCall_param_g_a_type_bytes' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_phone.acceptCall_param_key_fingerprint_type_long' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'method_req_DH_params_param_p_type_string' => 'Factorized p from pq', 'method_req_DH_params_param_q_type_string' => 'Factorized q from pq', 'method_req_DH_params_param_encrypted_data_type_string' => 'Encrypted message', 'method_set_client_DH_params_param_encrypted_data_type_string' => 'Encrypted message', 'method_contest.saveDeveloperInfo' => 'Save developer info for telegram contest', 'method_contest.saveDeveloperInfo_param_vk_id_type_int' => 'VK user ID', 'method_contest.saveDeveloperInfo_param_name_type_string' => 'Name', 'method_contest.saveDeveloperInfo_param_phone_number_type_string' => 'Phone number', 'method_contest.saveDeveloperInfo_param_age_type_int' => 'Age', 'method_contest.saveDeveloperInfo_param_city_type_string' => 'City', 'method_auth.importBotAuthorization_param_a_type_true' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.importBotAuthorization_param_b_type_true' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.importBotAuthorization_param_c_type_true' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_auth.importBotAuthorization_param_d_type_true' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'object_vector' => 'Array', 'object_resPQ' => 'Contains pq to factorize', 'object_resPQ_param_nonce_type_int128' => 'Nonce', 'object_resPQ_param_server_nonce_type_int128' => 'Server nonce', 'object_resPQ_param_pq_type_bytes' => 'PQ ', 'object_resPQ_param_server_public_key_fingerprints_type_Vector t' => 'RSA key fingerprints', 'object_p_q_inner_data' => 'PQ inner data', 'object_p_q_inner_data_param_pq_type_bytes' => 'PQ', 'object_p_q_inner_data_param_p_type_bytes' => 'P', 'object_p_q_inner_data_param_q_type_bytes' => 'Q', 'object_p_q_inner_data_param_nonce_type_int128' => 'Nonce', 'object_p_q_inner_data_param_server_nonce_type_int128' => 'Nonce', 'object_p_q_inner_data_param_new_nonce_type_int256' => 'Nonce', 'object_p_q_inner_data_temp' => 'Inner data temp', 'object_p_q_inner_data_temp_param_pq_type_bytes' => 'Pq', 'object_p_q_inner_data_temp_param_p_type_bytes' => 'P', 'object_p_q_inner_data_temp_param_q_type_bytes' => 'Q', 'object_p_q_inner_data_temp_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_p_q_inner_data_temp_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_p_q_inner_data_temp_param_new_nonce_type_int256' => 'New nonce', 'object_p_q_inner_data_temp_param_expires_in_type_int' => 'Expires in', 'object_server_DH_params_fail' => 'Server params fail', 'object_server_DH_params_fail_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_server_DH_params_fail_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_server_DH_params_fail_param_new_nonce_hash_type_int128' => 'New nonce hash', 'object_server_DH_params_ok' => 'Server params ok', 'object_server_DH_params_ok_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_server_DH_params_ok_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_server_DH_params_ok_param_encrypted_answer_type_bytes' => 'Encrypted answer', 'object_server_DH_inner_data' => 'Server inner data', 'object_server_DH_inner_data_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_server_DH_inner_data_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_server_DH_inner_data_param_g_type_int' => 'G', 'object_server_DH_inner_data_param_dh_prime_type_bytes' => 'Dh prime', 'object_server_DH_inner_data_param_g_a_type_bytes' => 'G a', 'object_server_DH_inner_data_param_server_time_type_int' => 'Server time', 'object_client_DH_inner_data' => 'Client inner data', 'object_client_DH_inner_data_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_client_DH_inner_data_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_client_DH_inner_data_param_retry_id_type_long' => 'Retry ID', 'object_client_DH_inner_data_param_g_b_type_bytes' => 'G b', 'object_dh_gen_ok' => 'Dh gen ok', 'object_dh_gen_ok_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_dh_gen_ok_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_dh_gen_ok_param_new_nonce_hash1_type_int128' => 'New nonce hash1', 'object_dh_gen_retry' => 'Dh gen retry', 'object_dh_gen_retry_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_dh_gen_retry_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_dh_gen_retry_param_new_nonce_hash2_type_int128' => 'New nonce hash2', 'object_dh_gen_fail' => 'Dh gen fail', 'object_dh_gen_fail_param_nonce_type_int128' => 'Random number for cryptographic security', 'object_dh_gen_fail_param_server_nonce_type_int128' => 'Random number for cryptographic security, given by server', 'object_dh_gen_fail_param_new_nonce_hash3_type_int128' => 'New nonce hash3', 'object_rpc_result' => 'Rpc result', 'object_rpc_result_param_req_msg_id_type_long' => 'Req msg ID', 'object_rpc_result_param_result_type_Object' => 'Result', 'object_rpc_error' => 'Rpc error', 'object_rpc_error_param_error_code_type_int' => 'Error code', 'object_rpc_error_param_error_message_type_string' => 'Error message', 'object_rpc_answer_unknown' => 'Rpc answer unknown', 'object_rpc_answer_dropped_running' => 'Rpc answer dropped running', 'object_rpc_answer_dropped' => 'Rpc answer dropped', 'object_rpc_answer_dropped_param_msg_id_type_long' => 'Msg ID', 'object_rpc_answer_dropped_param_seq_no_type_int' => 'Seq no', 'object_rpc_answer_dropped_param_bytes_type_int' => 'Bytes', 'object_future_salt' => 'Future salt', 'object_future_salt_param_valid_since_type_int' => 'Valid since', 'object_future_salt_param_valid_until_type_int' => 'Valid until', 'object_future_salt_param_salt_type_long' => 'Salt', 'object_future_salts' => 'Future salts', 'object_future_salts_param_req_msg_id_type_long' => 'Req msg ID', 'object_future_salts_param_now_type_int' => 'Now', 'object_future_salts_param_salts_type_vector' => 'Salts', 'object_pong' => 'Pong', 'object_pong_param_msg_id_type_long' => 'Msg ID', 'object_pong_param_ping_id_type_long' => 'Ping ID', 'object_destroy_session_ok' => 'Destroy session ok', 'object_destroy_session_ok_param_session_id_type_long' => 'Session ID', 'object_destroy_session_none' => 'Destroy session none', 'object_destroy_session_none_param_session_id_type_long' => 'Session ID', 'object_new_session_created' => 'New session created', 'object_new_session_created_param_first_msg_id_type_long' => 'First msg ID', 'object_new_session_created_param_unique_id_type_long' => 'Unique ID', 'object_new_session_created_param_server_salt_type_long' => 'Server salt', 'object_msg_container' => 'Msg container', 'object_msg_container_param_messages_type_vector' => 'Messages', 'object_MTmessage' => 'MTProto message', 'object_MTmessage_param_msg_id_type_long' => 'Message ID', 'object_MTmessage_param_seqno_type_int' => 'Seqno', 'object_MTmessage_param_bytes_type_int' => 'Message body', 'object_MTmessage_param_body_type_Object' => 'Message body', 'object_msg_copy' => 'Msg copy', 'object_msg_copy_param_orig_message_type_MTMessage' => 'Orig message', 'object_gzip_packed' => 'Gzip packed', 'object_gzip_packed_param_packed_data_type_bytes' => 'Packed data', 'object_msgs_ack' => 'Msgs ack', 'object_msgs_ack_param_msg_ids_type_Vector t' => 'Msg IDs', 'object_bad_msg_notification' => 'Bad msg notification', 'object_bad_msg_notification_param_bad_msg_id_type_long' => 'Bad msg ID', 'object_bad_msg_notification_param_bad_msg_seqno_type_int' => 'Bad msg seqno', 'object_bad_msg_notification_param_error_code_type_int' => 'Error code', 'object_bad_server_salt' => 'Bad server salt', 'object_bad_server_salt_param_bad_msg_id_type_long' => 'Bad msg ID', 'object_bad_server_salt_param_bad_msg_seqno_type_int' => 'Bad msg seqno', 'object_bad_server_salt_param_error_code_type_int' => 'Error code', 'object_bad_server_salt_param_new_server_salt_type_long' => 'New server salt', 'object_msg_resend_req' => 'Msg resend req', 'object_msg_resend_req_param_msg_ids_type_Vector t' => 'Msg IDs', 'object_msgs_state_req' => 'Msgs state req', 'object_msgs_state_req_param_msg_ids_type_Vector t' => 'Msg IDs', 'object_msgs_state_info' => 'Msgs state info', 'object_msgs_state_info_param_req_msg_id_type_long' => 'Req msg ID', 'object_msgs_state_info_param_info_type_bytes' => 'Info', 'object_msgs_all_info' => 'Msgs all info', 'object_msgs_all_info_param_msg_ids_type_Vector t' => 'Msg IDs', 'object_msgs_all_info_param_info_type_bytes' => 'Info', 'object_msg_detailed_info' => 'Msg detailed info', 'object_msg_detailed_info_param_msg_id_type_long' => 'Msg ID', 'object_msg_detailed_info_param_answer_msg_id_type_long' => 'Answer msg ID', 'object_msg_detailed_info_param_bytes_type_int' => 'Bytes', 'object_msg_detailed_info_param_status_type_int' => 'Status', 'object_msg_new_detailed_info' => 'Msg new detailed info', 'object_msg_new_detailed_info_param_answer_msg_id_type_long' => 'Answer msg ID', 'object_msg_new_detailed_info_param_bytes_type_int' => 'Bytes', 'object_msg_new_detailed_info_param_status_type_int' => 'Status', 'object_bind_auth_key_inner' => 'Bind auth key inner', 'object_bind_auth_key_inner_param_nonce_type_long' => 'Nonce', 'object_bind_auth_key_inner_param_temp_auth_key_id_type_long' => 'Temp auth key ID', 'object_bind_auth_key_inner_param_perm_auth_key_id_type_long' => 'Perm auth key ID', 'object_bind_auth_key_inner_param_temp_session_id_type_long' => 'Temp session ID', 'object_bind_auth_key_inner_param_expires_at_type_int' => 'Expires at', 'object_boolFalse' => 'Bool false', 'object_boolTrue' => 'Bool true', 'object_true' => 'True', 'object_error' => 'Error', 'object_error_param_code_type_int' => 'Code', 'object_error_param_text_type_string' => 'Text', 'object_null' => 'Null', 'object_inputPeerEmpty' => 'Empty input peer', 'object_inputPeerSelf' => 'Peer self', 'object_inputPeerChat' => 'Peer chat', 'object_inputPeerChat_param_chat_id_type_int' => 'Chat ID', 'object_inputPeerUser' => 'Peer user', 'object_inputPeerUser_param_user_id_type_int' => 'User ID', 'object_inputPeerUser_param_access_hash_type_long' => 'Access hash', 'object_inputPeerChannel' => 'Peer channel', 'object_inputPeerChannel_param_channel_id_type_int' => 'Channel ID', 'object_inputPeerChannel_param_access_hash_type_long' => 'Access hash', 'object_inputUserEmpty' => 'Empty input user', 'object_inputUserSelf' => 'User self', 'object_inputUser' => 'User', 'object_inputUser_param_user_id_type_int' => 'User ID', 'object_inputUser_param_access_hash_type_long' => 'Access hash', 'object_inputPhoneContact' => 'Phone contact', 'object_inputPhoneContact_param_client_id_type_long' => 'Client ID', 'object_inputPhoneContact_param_phone_type_string' => 'Phone', 'object_inputPhoneContact_param_first_name_type_string' => 'First name', 'object_inputPhoneContact_param_last_name_type_string' => 'Last name', 'object_inputFile' => 'File', 'object_inputFile_param_id_type_long' => 'ID', 'object_inputFile_param_parts_type_int' => 'Parts', 'object_inputFile_param_name_type_string' => 'Name', 'object_inputFile_param_md5_checksum_type_string' => 'Md5 checksum', 'object_inputFileBig' => 'File big', 'object_inputFileBig_param_id_type_long' => 'ID', 'object_inputFileBig_param_parts_type_int' => 'Parts', 'object_inputFileBig_param_name_type_string' => 'Name', 'object_inputMediaEmpty' => 'Empty input media', 'object_inputMediaUploadedPhoto' => 'Media uploaded photo', 'object_inputMediaUploadedPhoto_param_file_type_InputFile' => 'File', 'object_inputMediaUploadedPhoto_param_stickers_type_Vector t' => 'Stickers', 'object_inputMediaUploadedPhoto_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_inputMediaPhoto' => 'Media photo', 'object_inputMediaPhoto_param_id_type_InputPhoto' => 'ID', 'object_inputMediaPhoto_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_inputMediaGeoPoint' => 'Media geo point', 'object_inputMediaGeoPoint_param_geo_point_type_InputGeoPoint' => 'Geo point', 'object_inputMediaContact' => 'Media contact', 'object_inputMediaContact_param_phone_number_type_string' => 'Phone number', 'object_inputMediaContact_param_first_name_type_string' => 'First name', 'object_inputMediaContact_param_last_name_type_string' => 'Last name', 'object_inputMediaUploadedDocument' => 'Media uploaded document', 'object_inputMediaUploadedDocument_param_nosound_video_type_true' => 'Nosound video?', 'object_inputMediaUploadedDocument_param_file_type_InputFile' => 'File', 'object_inputMediaUploadedDocument_param_thumb_type_InputFile' => 'Thumbnail', 'object_inputMediaUploadedDocument_param_mime_type_type_string' => 'Mime type', 'object_inputMediaUploadedDocument_param_attributes_type_Vector t' => 'Attributes', 'object_inputMediaUploadedDocument_param_stickers_type_Vector t' => 'Stickers', 'object_inputMediaUploadedDocument_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_inputMediaDocument' => 'Media document', 'object_inputMediaDocument_param_id_type_InputDocument' => 'ID', 'object_inputMediaDocument_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_inputMediaVenue' => 'Media venue', 'object_inputMediaVenue_param_geo_point_type_InputGeoPoint' => 'Geo point', 'object_inputMediaVenue_param_title_type_string' => 'Title', 'object_inputMediaVenue_param_address_type_string' => 'Address', 'object_inputMediaVenue_param_provider_type_string' => 'Provider', 'object_inputMediaVenue_param_venue_id_type_string' => 'Venue ID', 'object_inputMediaVenue_param_venue_type_type_string' => 'Venue type', 'object_inputMediaGifExternal' => 'Media gif external', 'object_inputMediaGifExternal_param_url_type_string' => 'URL', 'object_inputMediaGifExternal_param_q_type_string' => 'Q', 'object_inputMediaPhotoExternal' => 'Media photo external', 'object_inputMediaPhotoExternal_param_url_type_string' => 'URL', 'object_inputMediaPhotoExternal_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_inputMediaDocumentExternal' => 'Media document external', 'object_inputMediaDocumentExternal_param_url_type_string' => 'URL', 'object_inputMediaDocumentExternal_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_inputMediaGame' => 'Media game', 'object_inputMediaGame_param_id_type_InputGame' => 'ID', 'object_inputMediaInvoice' => 'Media invoice', 'object_inputMediaInvoice_param_title_type_string' => 'Title', 'object_inputMediaInvoice_param_description_type_string' => 'Description', 'object_inputMediaInvoice_param_photo_type_InputWebDocument' => 'Photo', 'object_inputMediaInvoice_param_invoice_type_Invoice' => 'Invoice', 'object_inputMediaInvoice_param_payload_type_bytes' => 'Payload', 'object_inputMediaInvoice_param_provider_type_string' => 'Provider', 'object_inputMediaInvoice_param_provider_data_type_DataJSON' => 'Provider data', 'object_inputMediaInvoice_param_start_param_type_string' => 'Start param', 'object_inputMediaGeoLive' => 'Media geo live', 'object_inputMediaGeoLive_param_geo_point_type_InputGeoPoint' => 'Geo point', 'object_inputMediaGeoLive_param_period_type_int' => 'Period', 'object_inputChatPhotoEmpty' => 'Empty input chat photo', 'object_inputChatUploadedPhoto' => 'Chat uploaded photo', 'object_inputChatUploadedPhoto_param_file_type_InputFile' => 'File', 'object_inputChatPhoto' => 'Chat photo', 'object_inputChatPhoto_param_id_type_InputPhoto' => 'ID', 'object_inputGeoPointEmpty' => 'Empty input geo point', 'object_inputGeoPoint' => 'Geo point', 'object_inputGeoPoint_param_lat_type_double' => 'Lat', 'object_inputGeoPoint_param_long_type_double' => 'Long', 'object_inputPhotoEmpty' => 'Empty input photo', 'object_inputPhoto' => 'Photo', 'object_inputPhoto_param_id_type_long' => 'ID', 'object_inputPhoto_param_access_hash_type_long' => 'Access hash', 'object_inputFileLocation' => 'File location', 'object_inputFileLocation_param_volume_id_type_long' => 'Volume ID', 'object_inputFileLocation_param_local_id_type_int' => 'Local ID', 'object_inputFileLocation_param_secret_type_long' => 'Secret', 'object_inputEncryptedFileLocation' => 'Encrypted file location', 'object_inputEncryptedFileLocation_param_id_type_long' => 'ID', 'object_inputEncryptedFileLocation_param_access_hash_type_long' => 'Access hash', 'object_inputDocumentFileLocation' => 'Document file location', 'object_inputDocumentFileLocation_param_id_type_long' => 'ID', 'object_inputDocumentFileLocation_param_access_hash_type_long' => 'Access hash', 'object_inputDocumentFileLocation_param_version_type_int' => 'Version', 'object_inputAppEvent' => 'App event', 'object_inputAppEvent_param_time_type_double' => 'Time', 'object_inputAppEvent_param_type_type_string' => 'Type', 'object_inputAppEvent_param_peer_type_long' => 'Peer', 'object_inputAppEvent_param_data_type_string' => 'Data', 'object_peerUser' => 'Peer user', 'object_peerUser_param_user_id_type_int' => 'User ID', 'object_peerChat' => 'Peer chat', 'object_peerChat_param_chat_id_type_int' => 'Chat ID', 'object_peerChannel' => 'Peer channel', 'object_peerChannel_param_channel_id_type_int' => 'Channel ID', 'object_storage.fileUnknown' => 'File unknown', 'object_storage.filePartial' => 'File partial', 'object_storage.fileJpeg' => 'File jpeg', 'object_storage.fileGif' => 'File gif', 'object_storage.filePng' => 'File png', 'object_storage.filePdf' => 'File pdf', 'object_storage.fileMp3' => 'File mp3', 'object_storage.fileMov' => 'File mov', 'object_storage.fileMp4' => 'File mp4', 'object_storage.fileWebp' => 'File webp', 'object_fileLocationUnavailable' => 'File location unavailable', 'object_fileLocationUnavailable_param_volume_id_type_long' => 'Volume ID', 'object_fileLocationUnavailable_param_local_id_type_int' => 'Local ID', 'object_fileLocationUnavailable_param_secret_type_long' => 'Secret', 'object_fileLocation' => 'File location', 'object_fileLocation_param_dc_id_type_int' => 'DC ID', 'object_fileLocation_param_volume_id_type_long' => 'Volume ID', 'object_fileLocation_param_local_id_type_int' => 'Local ID', 'object_fileLocation_param_secret_type_long' => 'Secret', 'object_userEmpty' => 'Empty user', 'object_userEmpty_param_id_type_int' => 'ID', 'object_user' => 'User', 'object_user_param_self_type_true' => 'Self?', 'object_user_param_contact_type_true' => 'Contact?', 'object_user_param_mutual_contact_type_true' => 'Mutual contact?', 'object_user_param_deleted_type_true' => 'Deleted?', 'object_user_param_bot_type_true' => 'Bot?', 'object_user_param_bot_chat_history_type_true' => 'Bot chat history?', 'object_user_param_bot_nochats_type_true' => 'Bot nochats?', 'object_user_param_verified_type_true' => 'Verified?', 'object_user_param_restricted_type_true' => 'Restricted?', 'object_user_param_min_type_true' => 'Min?', 'object_user_param_bot_inline_geo_type_true' => 'Bot inline geo?', 'object_user_param_id_type_int' => 'ID', 'object_user_param_access_hash_type_long' => 'Access hash', 'object_user_param_first_name_type_string' => 'First name', 'object_user_param_last_name_type_string' => 'Last name', 'object_user_param_username_type_string' => 'Username', 'object_user_param_phone_type_string' => 'Phone', 'object_user_param_photo_type_UserProfilePhoto' => 'Photo', 'object_user_param_status_type_UserStatus' => 'Status', 'object_user_param_bot_info_version_type_int' => 'Bot info version', 'object_user_param_restriction_reason_type_string' => 'Restriction reason', 'object_user_param_bot_inline_placeholder_type_string' => 'Bot inline placeholder', 'object_user_param_lang_code_type_string' => 'Lang code', 'object_userProfilePhotoEmpty' => 'Empty user profile photo', 'object_userProfilePhoto' => 'User profile photo', 'object_userProfilePhoto_param_photo_id_type_long' => 'Photo ID', 'object_userProfilePhoto_param_photo_small_type_FileLocation' => 'Photo small', 'object_userProfilePhoto_param_photo_big_type_FileLocation' => 'Photo big', 'object_chatEmpty' => 'Empty chat', 'object_chatEmpty_param_id_type_int' => 'ID', 'object_chat' => 'Chat', 'object_chat_param_creator_type_true' => 'Creator?', 'object_chat_param_kicked_type_true' => 'Kicked?', 'object_chat_param_left_type_true' => 'Left?', 'object_chat_param_admins_enabled_type_true' => 'Admins enabled?', 'object_chat_param_admin_type_true' => 'Admin?', 'object_chat_param_deactivated_type_true' => 'Deactivated?', 'object_chat_param_id_type_int' => 'ID', 'object_chat_param_title_type_string' => 'Title', 'object_chat_param_photo_type_ChatPhoto' => 'Photo', 'object_chat_param_participants_count_type_int' => 'Participants count', 'object_chat_param_date_type_int' => 'Date', 'object_chat_param_version_type_int' => 'Version', 'object_chat_param_migrated_to_type_InputChannel' => 'Migrated to', 'object_chatForbidden' => 'Chat forbidden', 'object_chatForbidden_param_id_type_int' => 'ID', 'object_chatForbidden_param_title_type_string' => 'Title', 'object_channel' => 'Channel', 'object_channel_param_creator_type_true' => 'Creator?', 'object_channel_param_left_type_true' => 'Left?', 'object_channel_param_editor_type_true' => 'Editor?', 'object_channel_param_broadcast_type_true' => 'Broadcast?', 'object_channel_param_verified_type_true' => 'Verified?', 'object_channel_param_megagroup_type_true' => 'Megagroup?', 'object_channel_param_restricted_type_true' => 'Restricted?', 'object_channel_param_democracy_type_true' => 'Democracy?', 'object_channel_param_signatures_type_true' => 'Signatures?', 'object_channel_param_min_type_true' => 'Min?', 'object_channel_param_id_type_int' => 'ID', 'object_channel_param_access_hash_type_long' => 'Access hash', 'object_channel_param_title_type_string' => 'Title', 'object_channel_param_username_type_string' => 'Username', 'object_channel_param_photo_type_ChatPhoto' => 'Photo', 'object_channel_param_date_type_int' => 'Date', 'object_channel_param_version_type_int' => 'Version', 'object_channel_param_restriction_reason_type_string' => 'Restriction reason', 'object_channel_param_admin_rights_type_ChannelAdminRights' => 'Admin rights', 'object_channel_param_banned_rights_type_ChannelBannedRights' => 'Banned rights', 'object_channel_param_participants_count_type_int' => 'Participants count', 'object_channelForbidden' => 'Forbidden channel', 'object_channelForbidden_param_broadcast_type_true' => 'Broadcast?', 'object_channelForbidden_param_megagroup_type_true' => 'Megagroup?', 'object_channelForbidden_param_id_type_int' => 'ID', 'object_channelForbidden_param_access_hash_type_long' => 'Access hash', 'object_channelForbidden_param_title_type_string' => 'Title', 'object_channelForbidden_param_until_date_type_int' => 'Until date', 'object_chatFull' => 'Chat full', 'object_chatFull_param_id_type_int' => 'ID', 'object_chatFull_param_participants_type_ChatParticipants' => 'Participants', 'object_chatFull_param_chat_photo_type_Photo' => 'Chat photo', 'object_chatFull_param_notify_settings_type_PeerNotifySettings' => 'Notify settings', 'object_chatFull_param_exported_invite_type_ExportedChatInvite' => 'Exported invite', 'object_chatFull_param_bot_info_type_Vector t' => 'Bot info', 'object_channelFull' => 'Full channel', 'object_channelFull_param_can_view_participants_type_true' => 'Can view participants?', 'object_channelFull_param_can_set_username_type_true' => 'Can set username?', 'object_channelFull_param_can_set_stickers_type_true' => 'Can set group stickerset?', 'object_channelFull_param_hidden_prehistory_type_true' => 'Hidden prehistory?', 'object_channelFull_param_id_type_int' => 'ID', 'object_channelFull_param_about_type_string' => 'About', 'object_channelFull_param_participants_count_type_int' => 'Participants count', 'object_channelFull_param_admins_count_type_int' => 'Admins count', 'object_channelFull_param_kicked_count_type_int' => 'Kicked count', 'object_channelFull_param_banned_count_type_int' => 'Banned count', 'object_channelFull_param_read_inbox_max_id_type_int' => 'Read inbox max ID', 'object_channelFull_param_read_outbox_max_id_type_int' => 'Read outbox max ID', 'object_channelFull_param_unread_count_type_int' => 'Unread count', 'object_channelFull_param_chat_photo_type_Photo' => 'Chat photo', 'object_channelFull_param_notify_settings_type_PeerNotifySettings' => 'Notify settings', 'object_channelFull_param_exported_invite_type_ExportedChatInvite' => 'Exported invite', 'object_channelFull_param_bot_info_type_Vector t' => 'Bot info', 'object_channelFull_param_migrated_from_chat_id_type_int' => 'Migrated from chat ID', 'object_channelFull_param_migrated_from_max_id_type_int' => 'Migrated from max ID', 'object_channelFull_param_pinned_msg_id_type_int' => 'Pinned msg ID', 'object_channelFull_param_stickerset_type_StickerSet' => 'Stickerset', 'object_channelFull_param_available_min_id_type_int' => 'Available min ID', 'object_chatParticipant' => 'Chat participant', 'object_chatParticipant_param_user_id_type_int' => 'User ID', 'object_chatParticipant_param_inviter_id_type_int' => 'Inviter ID', 'object_chatParticipant_param_date_type_int' => 'Date', 'object_chatParticipantCreator' => 'Chat participant creator', 'object_chatParticipantCreator_param_user_id_type_int' => 'User ID', 'object_chatParticipantAdmin' => 'Chat participant admin', 'object_chatParticipantAdmin_param_user_id_type_int' => 'User ID', 'object_chatParticipantAdmin_param_inviter_id_type_int' => 'Inviter ID', 'object_chatParticipantAdmin_param_date_type_int' => 'Date', 'object_chatParticipantsForbidden' => 'Chat participants forbidden', 'object_chatParticipantsForbidden_param_chat_id_type_int' => 'Chat ID', 'object_chatParticipantsForbidden_param_self_participant_type_ChatParticipant' => 'Self participant', 'object_chatParticipants' => 'Chat participants', 'object_chatParticipants_param_chat_id_type_int' => 'Chat ID', 'object_chatParticipants_param_participants_type_Vector t' => 'Participants', 'object_chatParticipants_param_version_type_int' => 'Version', 'object_chatPhotoEmpty' => 'Empty chat photo', 'object_chatPhoto' => 'Chat photo', 'object_chatPhoto_param_photo_small_type_FileLocation' => 'Photo small', 'object_chatPhoto_param_photo_big_type_FileLocation' => 'Photo big', 'object_messageEmpty' => 'Empty message', 'object_messageEmpty_param_id_type_int' => 'ID', 'object_message' => 'Message', 'object_message_param_out_type_true' => 'Out?', 'object_message_param_mentioned_type_true' => 'Mentioned?', 'object_message_param_media_unread_type_true' => 'Media unread?', 'object_message_param_silent_type_true' => 'Silent?', 'object_message_param_post_type_true' => 'Post?', 'object_message_param_id_type_int' => 'ID', 'object_message_param_from_id_type_int' => 'From ID', 'object_message_param_to_id_type_Peer' => 'To ID', 'object_message_param_fwd_from_type_MessageFwdHeader' => 'Forwarded from', 'object_message_param_via_bot_id_type_int' => 'Via bot ID', 'object_message_param_reply_to_msg_id_type_int' => 'Reply to msg ID', 'object_message_param_date_type_int' => 'Date', 'object_message_param_message_type_string' => 'Message', 'object_message_param_media_type_MessageMedia' => 'Media', 'object_message_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_message_param_entities_type_Vector t' => 'Entities', 'object_message_param_views_type_int' => 'Views', 'object_message_param_edit_date_type_int' => 'Edit date', 'object_message_param_post_author_type_string' => 'Post author', 'object_message_param_grouped_id_type_long' => 'Grouped ID', 'object_messageService' => 'Message service', 'object_messageService_param_out_type_true' => 'Out?', 'object_messageService_param_mentioned_type_true' => 'Mentioned?', 'object_messageService_param_media_unread_type_true' => 'Media unread?', 'object_messageService_param_silent_type_true' => 'Silent?', 'object_messageService_param_post_type_true' => 'Post?', 'object_messageService_param_id_type_int' => 'ID', 'object_messageService_param_from_id_type_int' => 'From ID', 'object_messageService_param_to_id_type_Peer' => 'To ID', 'object_messageService_param_reply_to_msg_id_type_int' => 'Reply to msg ID', 'object_messageService_param_date_type_int' => 'Date', 'object_messageService_param_action_type_MessageAction' => 'Action', 'object_messageMediaEmpty' => 'Empty message media', 'object_messageMediaPhoto' => 'Message media photo', 'object_messageMediaPhoto_param_photo_type_Photo' => 'Photo', 'object_messageMediaPhoto_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_messageMediaGeo' => 'Message media geo', 'object_messageMediaGeo_param_geo_type_GeoPoint' => 'Geo', 'object_messageMediaContact' => 'Message media contact', 'object_messageMediaContact_param_phone_number_type_string' => 'Phone number', 'object_messageMediaContact_param_first_name_type_string' => 'First name', 'object_messageMediaContact_param_last_name_type_string' => 'Last name', 'object_messageMediaContact_param_user_id_type_int' => 'User ID', 'object_messageMediaUnsupported' => 'Message media unsupported', 'object_messageMediaDocument' => 'Message media document', 'object_messageMediaDocument_param_document_type_Document' => 'Document', 'object_messageMediaDocument_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_messageMediaWebPage' => 'Message media web page', 'object_messageMediaWebPage_param_webpage_type_WebPage' => 'Webpage', 'object_messageMediaVenue' => 'Message media venue', 'object_messageMediaVenue_param_geo_type_GeoPoint' => 'Geo', 'object_messageMediaVenue_param_title_type_string' => 'Title', 'object_messageMediaVenue_param_address_type_string' => 'Address', 'object_messageMediaVenue_param_provider_type_string' => 'Provider', 'object_messageMediaVenue_param_venue_id_type_string' => 'Venue ID', 'object_messageMediaVenue_param_venue_type_type_string' => 'Venue type', 'object_messageMediaGame' => 'Message media game', 'object_messageMediaGame_param_game_type_Game' => 'Game', 'object_messageMediaInvoice' => 'Message media invoice', 'object_messageMediaInvoice_param_shipping_address_requested_type_true' => 'Shipping address requested?', 'object_messageMediaInvoice_param_test_type_true' => 'Test?', 'object_messageMediaInvoice_param_title_type_string' => 'Title', 'object_messageMediaInvoice_param_description_type_string' => 'Description', 'object_messageMediaInvoice_param_photo_type_WebDocument' => 'Photo', 'object_messageMediaInvoice_param_receipt_msg_id_type_int' => 'Receipt msg ID', 'object_messageMediaInvoice_param_currency_type_string' => 'Currency', 'object_messageMediaInvoice_param_total_amount_type_long' => 'Total amount', 'object_messageMediaInvoice_param_start_param_type_string' => 'Start param', 'object_messageMediaGeoLive' => 'Message media geo live', 'object_messageMediaGeoLive_param_geo_type_GeoPoint' => 'Geo', 'object_messageMediaGeoLive_param_period_type_int' => 'Period', 'object_messageActionEmpty' => 'Empty message action', 'object_messageActionChatCreate' => 'Message action chat create', 'object_messageActionChatCreate_param_title_type_string' => 'Title', 'object_messageActionChatCreate_param_users_type_Vector t' => 'Users', 'object_messageActionChatEditTitle' => 'Message action chat edit title', 'object_messageActionChatEditTitle_param_title_type_string' => 'Title', 'object_messageActionChatEditPhoto' => 'Message action chat edit photo', 'object_messageActionChatEditPhoto_param_photo_type_Photo' => 'Photo', 'object_messageActionChatDeletePhoto' => 'Message action chat delete photo', 'object_messageActionChatAddUser' => 'Message action chat add user', 'object_messageActionChatAddUser_param_users_type_Vector t' => 'Users', 'object_messageActionChatDeleteUser' => 'Message action chat delete user', 'object_messageActionChatDeleteUser_param_user_id_type_int' => 'User ID', 'object_messageActionChatJoinedByLink' => 'Message action chat joined by link', 'object_messageActionChatJoinedByLink_param_inviter_id_type_int' => 'Inviter ID', 'object_messageActionChannelCreate' => 'Message action channel create', 'object_messageActionChannelCreate_param_title_type_string' => 'Title', 'object_messageActionChatMigrateTo' => 'Message action chat migrate to', 'object_messageActionChatMigrateTo_param_channel_id_type_int' => 'Channel ID', 'object_messageActionChannelMigrateFrom' => 'Message action channel migrate from', 'object_messageActionChannelMigrateFrom_param_title_type_string' => 'Title', 'object_messageActionChannelMigrateFrom_param_chat_id_type_int' => 'Chat ID', 'object_messageActionPinMessage' => 'Message action pin message', 'object_messageActionHistoryClear' => 'Message action history clear', 'object_messageActionGameScore' => 'Message action game score', 'object_messageActionGameScore_param_game_id_type_long' => 'Game ID', 'object_messageActionGameScore_param_score_type_int' => 'Score', 'object_messageActionPaymentSentMe' => 'Message action payment sent me', 'object_messageActionPaymentSentMe_param_currency_type_string' => 'Currency', 'object_messageActionPaymentSentMe_param_total_amount_type_long' => 'Total amount', 'object_messageActionPaymentSentMe_param_payload_type_bytes' => 'Payload', 'object_messageActionPaymentSentMe_param_info_type_PaymentRequestedInfo' => 'Info', 'object_messageActionPaymentSentMe_param_shipping_option_id_type_string' => 'Shipping option ID', 'object_messageActionPaymentSentMe_param_charge_type_PaymentCharge' => 'Charge', 'object_messageActionPaymentSent' => 'Message action payment sent', 'object_messageActionPaymentSent_param_currency_type_string' => 'Currency', 'object_messageActionPaymentSent_param_total_amount_type_long' => 'Total amount', 'object_messageActionPhoneCall' => 'Message action phone call', 'object_messageActionPhoneCall_param_call_id_type_long' => 'Call ID', 'object_messageActionPhoneCall_param_reason_type_PhoneCallDiscardReason' => 'Reason', 'object_messageActionPhoneCall_param_duration_type_int' => 'Duration', 'object_messageActionScreenshotTaken' => 'Message action screenshot taken', 'object_messageActionCustomAction' => 'Message action custom action', 'object_messageActionCustomAction_param_message_type_string' => 'Message', 'object_dialog' => 'Dialog', 'object_dialog_param_pinned_type_true' => 'Pinned?', 'object_dialog_param_peer_type_Peer' => 'Peer', 'object_dialog_param_top_message_type_int' => 'Top message', 'object_dialog_param_read_inbox_max_id_type_int' => 'Read inbox max ID', 'object_dialog_param_read_outbox_max_id_type_int' => 'Read outbox max ID', 'object_dialog_param_unread_count_type_int' => 'Unread count', 'object_dialog_param_unread_mentions_count_type_int' => 'Unread mentions count', 'object_dialog_param_notify_settings_type_PeerNotifySettings' => 'Notify settings', 'object_dialog_param_pts_type_int' => 'Pts', 'object_dialog_param_draft_type_DraftMessage' => 'Draft', 'object_photoEmpty' => 'Empty photo', 'object_photoEmpty_param_id_type_long' => 'ID', 'object_photo' => 'Photo', 'object_photo_param_has_stickers_type_true' => 'Has stickers?', 'object_photo_param_id_type_long' => 'ID', 'object_photo_param_access_hash_type_long' => 'Access hash', 'object_photo_param_date_type_int' => 'Date', 'object_photo_param_sizes_type_Vector t' => 'Sizes', 'object_photoSizeEmpty' => 'Empty photo size', 'object_photoSizeEmpty_param_type_type_string' => 'Type', 'object_photoSize' => 'Photo size', 'object_photoSize_param_type_type_string' => 'Type', 'object_photoSize_param_location_type_FileLocation' => 'Location', 'object_photoSize_param_w_type_int' => 'Width', 'object_photoSize_param_h_type_int' => 'Height', 'object_photoSize_param_size_type_int' => 'Size', 'object_photoCachedSize' => 'Photo cached size', 'object_photoCachedSize_param_type_type_string' => 'Type', 'object_photoCachedSize_param_location_type_FileLocation' => 'Location', 'object_photoCachedSize_param_w_type_int' => 'Width', 'object_photoCachedSize_param_h_type_int' => 'Height', 'object_photoCachedSize_param_bytes_type_bytes' => 'Bytes', 'object_geoPointEmpty' => 'Empty geo point', 'object_geoPoint' => 'Geo point', 'object_geoPoint_param_long_type_double' => 'Long', 'object_geoPoint_param_lat_type_double' => 'Lat', 'object_auth.checkedPhone' => 'Checked phone', 'object_auth.checkedPhone_param_phone_registered_type_Bool' => 'Phone registered?', 'object_auth.sentCode' => 'Sent code', 'object_auth.sentCode_param_phone_registered_type_true' => 'Phone registered?', 'object_auth.sentCode_param_type_type_auth.SentCodeType' => 'Type', 'object_auth.sentCode_param_phone_code_hash_type_string' => 'Phone code hash', 'object_auth.sentCode_param_next_type_type_auth.CodeType' => 'Next type', 'object_auth.sentCode_param_timeout_type_int' => 'Timeout', 'object_auth.authorization' => 'Authorization', 'object_auth.authorization_param_tmp_sessions_type_int' => 'Temporary sessions', 'object_auth.authorization_param_user_type_User' => 'User', 'object_auth.exportedAuthorization' => 'Exported authorization', 'object_auth.exportedAuthorization_param_id_type_int' => 'ID', 'object_auth.exportedAuthorization_param_bytes_type_bytes' => 'Bytes', 'object_inputNotifyPeer' => 'Notify peer', 'object_inputNotifyPeer_param_peer_type_InputPeer' => 'Peer', 'object_inputNotifyUsers' => 'Notify users', 'object_inputNotifyChats' => 'Notify chats', 'object_inputNotifyAll' => 'Notify all', 'object_inputPeerNotifyEventsEmpty' => 'Empty input peer notify events', 'object_inputPeerNotifyEventsAll' => 'Peer notify events all', 'object_inputPeerNotifySettings' => 'Peer notify settings', 'object_inputPeerNotifySettings_param_show_previews_type_true' => 'Show previews?', 'object_inputPeerNotifySettings_param_silent_type_true' => 'Silent?', 'object_inputPeerNotifySettings_param_mute_until_type_int' => 'Mute until', 'object_inputPeerNotifySettings_param_sound_type_string' => 'Sound', 'object_peerNotifyEventsEmpty' => 'Empty peer notify events', 'object_peerNotifyEventsAll' => 'Peer notify events all', 'object_peerNotifySettingsEmpty' => 'Empty peer notify settings', 'object_peerNotifySettings' => 'Peer notify settings', 'object_peerNotifySettings_param_show_previews_type_true' => 'Show previews?', 'object_peerNotifySettings_param_silent_type_true' => 'Silent?', 'object_peerNotifySettings_param_mute_until_type_int' => 'Mute until', 'object_peerNotifySettings_param_sound_type_string' => 'Sound', 'object_peerSettings' => 'Peer settings', 'object_peerSettings_param_report_spam_type_true' => 'Report spam?', 'object_wallPaper' => 'Wall paper', 'object_wallPaper_param_id_type_int' => 'ID', 'object_wallPaper_param_title_type_string' => 'Title', 'object_wallPaper_param_sizes_type_Vector t' => 'Sizes', 'object_wallPaper_param_color_type_int' => 'Color', 'object_wallPaperSolid' => 'Wall paper solid', 'object_wallPaperSolid_param_id_type_int' => 'ID', 'object_wallPaperSolid_param_title_type_string' => 'Title', 'object_wallPaperSolid_param_bg_color_type_int' => 'Bg color', 'object_wallPaperSolid_param_color_type_int' => 'Color', 'object_inputReportReasonSpam' => 'Report reason spam', 'object_inputReportReasonViolence' => 'Report reason violence', 'object_inputReportReasonPornography' => 'Report reason pornography', 'object_inputReportReasonOther' => 'Report reason other', 'object_inputReportReasonOther_param_text_type_string' => 'Text', 'object_userFull' => 'User full', 'object_userFull_param_blocked_type_true' => 'Blocked?', 'object_userFull_param_phone_calls_available_type_true' => 'Phone calls available?', 'object_userFull_param_phone_calls_private_type_true' => 'Phone calls private?', 'object_userFull_param_user_type_User' => 'User', 'object_userFull_param_about_type_string' => 'About', 'object_userFull_param_link_type_contacts.Link' => 'Link', 'object_userFull_param_profile_photo_type_Photo' => 'Profile photo', 'object_userFull_param_notify_settings_type_PeerNotifySettings' => 'Notify settings', 'object_userFull_param_bot_info_type_BotInfo' => 'Bot info', 'object_userFull_param_common_chats_count_type_int' => 'Common chats count', 'object_contact' => 'Contact', 'object_contact_param_user_id_type_int' => 'User ID', 'object_contact_param_mutual_type_Bool' => 'Mutual?', 'object_importedContact' => 'Imported contact', 'object_importedContact_param_user_id_type_int' => 'User ID', 'object_importedContact_param_client_id_type_long' => 'Client ID', 'object_contactBlocked' => 'Contact blocked', 'object_contactBlocked_param_user_id_type_int' => 'User ID', 'object_contactBlocked_param_date_type_int' => 'Date', 'object_contactStatus' => 'Contact status', 'object_contactStatus_param_user_id_type_int' => 'User ID', 'object_contactStatus_param_status_type_UserStatus' => 'Status', 'object_contacts.link' => 'Link', 'object_contacts.link_param_my_link_type_ContactLink' => 'My link', 'object_contacts.link_param_foreign_link_type_ContactLink' => 'Foreign link', 'object_contacts.link_param_user_type_User' => 'User', 'object_contacts.contactsNotModified' => 'Contacts not modified', 'object_contacts.contacts' => 'Contacts', 'object_contacts.contacts_param_contacts_type_Vector t' => 'Contacts', 'object_contacts.contacts_param_saved_count_type_int' => 'Saved count', 'object_contacts.contacts_param_users_type_Vector t' => 'Users', 'object_contacts.importedContacts' => 'Imported contacts', 'object_contacts.importedContacts_param_imported_type_Vector t' => 'Imported', 'object_contacts.importedContacts_param_popular_invites_type_Vector t' => 'Popular invites', 'object_contacts.importedContacts_param_retry_contacts_type_Vector t' => 'Retry importing contacts whose client IDs appear here', 'object_contacts.importedContacts_param_users_type_Vector t' => 'Users', 'object_contacts.blocked' => 'Blocked', 'object_contacts.blocked_param_blocked_type_Vector t' => 'Blocked', 'object_contacts.blocked_param_users_type_Vector t' => 'Users', 'object_contacts.blockedSlice' => 'Blocked slice', 'object_contacts.blockedSlice_param_count_type_int' => 'Count', 'object_contacts.blockedSlice_param_blocked_type_Vector t' => 'Blocked', 'object_contacts.blockedSlice_param_users_type_Vector t' => 'Users', 'object_messages.dialogs' => 'Dialogs', 'object_messages.dialogs_param_dialogs_type_Vector t' => 'Dialogs', 'object_messages.dialogs_param_messages_type_Vector t' => 'Messages', 'object_messages.dialogs_param_chats_type_Vector t' => 'Chats', 'object_messages.dialogs_param_users_type_Vector t' => 'Users', 'object_messages.dialogsSlice' => 'Dialogs slice', 'object_messages.dialogsSlice_param_count_type_int' => 'Count', 'object_messages.dialogsSlice_param_dialogs_type_Vector t' => 'Dialogs', 'object_messages.dialogsSlice_param_messages_type_Vector t' => 'Messages', 'object_messages.dialogsSlice_param_chats_type_Vector t' => 'Chats', 'object_messages.dialogsSlice_param_users_type_Vector t' => 'Users', 'object_messages.messages' => 'Messages', 'object_messages.messages_param_messages_type_Vector t' => 'Messages', 'object_messages.messages_param_chats_type_Vector t' => 'Chats', 'object_messages.messages_param_users_type_Vector t' => 'Users', 'object_messages.messagesSlice' => 'Messages slice', 'object_messages.messagesSlice_param_count_type_int' => 'Count', 'object_messages.messagesSlice_param_messages_type_Vector t' => 'Messages', 'object_messages.messagesSlice_param_chats_type_Vector t' => 'Chats', 'object_messages.messagesSlice_param_users_type_Vector t' => 'Users', 'object_messages.channelMessages' => 'Channel messages', 'object_messages.channelMessages_param_pts_type_int' => 'Pts', 'object_messages.channelMessages_param_count_type_int' => 'Count', 'object_messages.channelMessages_param_messages_type_Vector t' => 'Messages', 'object_messages.channelMessages_param_chats_type_Vector t' => 'Chats', 'object_messages.channelMessages_param_users_type_Vector t' => 'Users', 'object_messages.messagesNotModified' => 'Messages not modified', 'object_messages.messagesNotModified_param_count_type_int' => 'Count', 'object_messages.chats' => 'Chats', 'object_messages.chats_param_chats_type_Vector t' => 'Chats', 'object_messages.chatsSlice' => 'Chats slice', 'object_messages.chatsSlice_param_count_type_int' => 'Count', 'object_messages.chatsSlice_param_chats_type_Vector t' => 'Chats', 'object_messages.chatFull' => 'Chat full', 'object_messages.chatFull_param_full_chat_type_ChatFull' => 'Full chat', 'object_messages.chatFull_param_chats_type_Vector t' => 'Chats', 'object_messages.chatFull_param_users_type_Vector t' => 'Users', 'object_messages.affectedHistory' => 'Affected history', 'object_messages.affectedHistory_param_pts_type_int' => 'Pts', 'object_messages.affectedHistory_param_pts_count_type_int' => 'Pts count', 'object_messages.affectedHistory_param_offset_type_int' => 'Offset', 'object_inputMessagesFilterEmpty' => 'Empty input messages filter', 'object_inputMessagesFilterPhotos' => 'Messages filter photos', 'object_inputMessagesFilterVideo' => 'Messages filter video', 'object_inputMessagesFilterPhotoVideo' => 'Messages filter photo video', 'object_inputMessagesFilterDocument' => 'Messages filter document', 'object_inputMessagesFilterUrl' => 'Messages filter URL', 'object_inputMessagesFilterGif' => 'Messages filter gif', 'object_inputMessagesFilterVoice' => 'Messages filter voice', 'object_inputMessagesFilterMusic' => 'Messages filter music', 'object_inputMessagesFilterChatPhotos' => 'Messages filter chat photos', 'object_inputMessagesFilterPhoneCalls' => 'Messages filter phone calls', 'object_inputMessagesFilterPhoneCalls_param_missed_type_true' => 'Missed?', 'object_inputMessagesFilterRoundVoice' => 'Messages filter round voice', 'object_inputMessagesFilterRoundVideo' => 'Messages filter round video', 'object_inputMessagesFilterMyMentions' => 'Messages filter my mentions', 'object_inputMessagesFilterGeo' => 'Messages filter geo', 'object_inputMessagesFilterContacts' => 'Messages filter contacts', 'object_updateNewMessage' => 'Update new message', 'object_updateNewMessage_param_message_type_Message' => 'Message', 'object_updateNewMessage_param_pts_type_int' => 'Pts', 'object_updateNewMessage_param_pts_count_type_int' => 'Pts count', 'object_updateMessageID' => 'Update message ID', 'object_updateMessageID_param_id_type_int' => 'ID', 'object_updateDeleteMessages' => 'Update delete messages', 'object_updateDeleteMessages_param_messages_type_Vector t' => 'Messages', 'object_updateDeleteMessages_param_pts_type_int' => 'Pts', 'object_updateDeleteMessages_param_pts_count_type_int' => 'Pts count', 'object_updateUserTyping' => 'Update user typing', 'object_updateUserTyping_param_user_id_type_int' => 'User ID', 'object_updateUserTyping_param_action_type_SendMessageAction' => 'Action', 'object_updateChatUserTyping' => 'Update chat user typing', 'object_updateChatUserTyping_param_chat_id_type_int' => 'Chat ID', 'object_updateChatUserTyping_param_user_id_type_int' => 'User ID', 'object_updateChatUserTyping_param_action_type_SendMessageAction' => 'Action', 'object_updateChatParticipants' => 'Update chat participants', 'object_updateChatParticipants_param_participants_type_ChatParticipants' => 'Participants', 'object_updateUserName' => 'Update user name', 'object_updateUserName_param_user_id_type_int' => 'User ID', 'object_updateUserName_param_first_name_type_string' => 'First name', 'object_updateUserName_param_last_name_type_string' => 'Last name', 'object_updateUserName_param_username_type_string' => 'Username', 'object_updateUserPhoto' => 'Update user photo', 'object_updateUserPhoto_param_user_id_type_int' => 'User ID', 'object_updateUserPhoto_param_date_type_int' => 'Date', 'object_updateUserPhoto_param_photo_type_UserProfilePhoto' => 'Photo', 'object_updateUserPhoto_param_previous_type_Bool' => 'Previous?', 'object_updateContactRegistered' => 'Update contact registered', 'object_updateContactRegistered_param_user_id_type_int' => 'User ID', 'object_updateContactRegistered_param_date_type_int' => 'Date', 'object_updateContactLink' => 'Update contact link', 'object_updateContactLink_param_user_id_type_int' => 'User ID', 'object_updateContactLink_param_my_link_type_ContactLink' => 'My link', 'object_updateContactLink_param_foreign_link_type_ContactLink' => 'Foreign link', 'object_updateNewEncryptedMessage' => 'Update new encrypted message', 'object_updateNewEncryptedMessage_param_message_type_EncryptedMessage' => 'Message', 'object_updateNewEncryptedMessage_param_qts_type_int' => 'Qts', 'object_updateEncryptedChatTyping' => 'Update encrypted chat typing', 'object_updateEncryptedChatTyping_param_chat_id_type_int' => 'Chat ID', 'object_updateEncryption' => 'Update encryption', 'object_updateEncryption_param_chat_type_EncryptedChat' => 'Chat', 'object_updateEncryption_param_date_type_int' => 'Date', 'object_updateEncryptedMessagesRead' => 'Update encrypted messages read', 'object_updateEncryptedMessagesRead_param_chat_id_type_int' => 'Chat ID', 'object_updateEncryptedMessagesRead_param_max_date_type_int' => 'Max date', 'object_updateEncryptedMessagesRead_param_date_type_int' => 'Date', 'object_updateChatParticipantAdd' => 'Update chat participant add', 'object_updateChatParticipantAdd_param_chat_id_type_int' => 'Chat ID', 'object_updateChatParticipantAdd_param_user_id_type_int' => 'User ID', 'object_updateChatParticipantAdd_param_inviter_id_type_int' => 'Inviter ID', 'object_updateChatParticipantAdd_param_date_type_int' => 'Date', 'object_updateChatParticipantAdd_param_version_type_int' => 'Version', 'object_updateChatParticipantDelete' => 'Update chat participant delete', 'object_updateChatParticipantDelete_param_chat_id_type_int' => 'Chat ID', 'object_updateChatParticipantDelete_param_user_id_type_int' => 'User ID', 'object_updateChatParticipantDelete_param_version_type_int' => 'Version', 'object_updateDcOptions' => 'Update DC options', 'object_updateDcOptions_param_dc_options_type_Vector t' => 'DC options', 'object_updateUserBlocked' => 'Update user blocked', 'object_updateUserBlocked_param_user_id_type_int' => 'User ID', 'object_updateUserBlocked_param_blocked_type_Bool' => 'Blocked?', 'object_updateNotifySettings' => 'Update notify settings', 'object_updateNotifySettings_param_peer_type_NotifyPeer' => 'Peer', 'object_updateNotifySettings_param_notify_settings_type_PeerNotifySettings' => 'Notify settings', 'object_updateServiceNotification' => 'Update service notification', 'object_updateServiceNotification_param_popup_type_true' => 'Popup?', 'object_updateServiceNotification_param_inbox_date_type_int' => 'Inbox date', 'object_updateServiceNotification_param_type_type_string' => 'Type', 'object_updateServiceNotification_param_message_type_string' => 'Message', 'object_updateServiceNotification_param_media_type_MessageMedia' => 'Media', 'object_updateServiceNotification_param_entities_type_Vector t' => 'Entities', 'object_updatePrivacy' => 'Update privacy', 'object_updatePrivacy_param_key_type_PrivacyKey' => 'Key', 'object_updatePrivacy_param_rules_type_Vector t' => 'Rules', 'object_updateUserPhone' => 'Update user phone', 'object_updateUserPhone_param_user_id_type_int' => 'User ID', 'object_updateUserPhone_param_phone_type_string' => 'Phone', 'object_updateReadHistoryInbox' => 'Update read history inbox', 'object_updateReadHistoryInbox_param_peer_type_Peer' => 'Peer', 'object_updateReadHistoryInbox_param_max_id_type_int' => 'Max ID', 'object_updateReadHistoryInbox_param_pts_type_int' => 'Pts', 'object_updateReadHistoryInbox_param_pts_count_type_int' => 'Pts count', 'object_updateReadHistoryOutbox' => 'Update read history outbox', 'object_updateReadHistoryOutbox_param_peer_type_Peer' => 'Peer', 'object_updateReadHistoryOutbox_param_max_id_type_int' => 'Max ID', 'object_updateReadHistoryOutbox_param_pts_type_int' => 'Pts', 'object_updateReadHistoryOutbox_param_pts_count_type_int' => 'Pts count', 'object_updateWebPage' => 'Update web page', 'object_updateWebPage_param_webpage_type_WebPage' => 'Webpage', 'object_updateWebPage_param_pts_type_int' => 'Pts', 'object_updateWebPage_param_pts_count_type_int' => 'Pts count', 'object_updateReadMessagesContents' => 'Update read messages contents', 'object_updateReadMessagesContents_param_messages_type_Vector t' => 'Messages', 'object_updateReadMessagesContents_param_pts_type_int' => 'Pts', 'object_updateReadMessagesContents_param_pts_count_type_int' => 'Pts count', 'object_updateChannelTooLong' => 'Update channel too long', 'object_updateChannelTooLong_param_channel_id_type_int' => 'Channel ID', 'object_updateChannelTooLong_param_pts_type_int' => 'Pts', 'object_updateChannel' => 'Update channel', 'object_updateChannel_param_channel_id_type_int' => 'Channel ID', 'object_updateNewChannelMessage' => 'Update new channel message', 'object_updateNewChannelMessage_param_message_type_Message' => 'Message', 'object_updateNewChannelMessage_param_pts_type_int' => 'Pts', 'object_updateNewChannelMessage_param_pts_count_type_int' => 'Pts count', 'object_updateReadChannelInbox' => 'Update read channel inbox', 'object_updateReadChannelInbox_param_channel_id_type_int' => 'Channel ID', 'object_updateReadChannelInbox_param_max_id_type_int' => 'Max ID', 'object_updateDeleteChannelMessages' => 'Update delete channel messages', 'object_updateDeleteChannelMessages_param_channel_id_type_int' => 'Channel ID', 'object_updateDeleteChannelMessages_param_messages_type_Vector t' => 'Messages', 'object_updateDeleteChannelMessages_param_pts_type_int' => 'Pts', 'object_updateDeleteChannelMessages_param_pts_count_type_int' => 'Pts count', 'object_updateChannelMessageViews' => 'Update channel message views', 'object_updateChannelMessageViews_param_channel_id_type_int' => 'Channel ID', 'object_updateChannelMessageViews_param_id_type_int' => 'ID', 'object_updateChannelMessageViews_param_views_type_int' => 'Views', 'object_updateChatAdmins' => 'Update chat admins', 'object_updateChatAdmins_param_chat_id_type_int' => 'Chat ID', 'object_updateChatAdmins_param_enabled_type_Bool' => 'Enabled?', 'object_updateChatAdmins_param_version_type_int' => 'Version', 'object_updateChatParticipantAdmin' => 'Update chat participant admin', 'object_updateChatParticipantAdmin_param_chat_id_type_int' => 'Chat ID', 'object_updateChatParticipantAdmin_param_user_id_type_int' => 'User ID', 'object_updateChatParticipantAdmin_param_is_admin_type_Bool' => 'Is admin?', 'object_updateChatParticipantAdmin_param_version_type_int' => 'Version', 'object_updateNewStickerSet' => 'Update new sticker set', 'object_updateNewStickerSet_param_stickerset_type_messages.StickerSet' => 'Stickerset', 'object_updateStickerSetsOrder' => 'Update sticker sets order', 'object_updateStickerSetsOrder_param_masks_type_true' => 'Masks?', 'object_updateStickerSetsOrder_param_order_type_Vector t' => 'Order', 'object_updateStickerSets' => 'Update sticker sets', 'object_updateSavedGifs' => 'Update saved gifs', 'object_updateBotInlineQuery' => 'Update bot inline query', 'object_updateBotInlineQuery_param_query_id_type_long' => 'Query ID', 'object_updateBotInlineQuery_param_user_id_type_int' => 'User ID', 'object_updateBotInlineQuery_param_query_type_string' => 'Query', 'object_updateBotInlineQuery_param_geo_type_GeoPoint' => 'Geo', 'object_updateBotInlineQuery_param_offset_type_string' => 'Offset', 'object_updateBotInlineSend' => 'Update bot inline send', 'object_updateBotInlineSend_param_user_id_type_int' => 'User ID', 'object_updateBotInlineSend_param_query_type_string' => 'Query', 'object_updateBotInlineSend_param_geo_type_GeoPoint' => 'Geo', 'object_updateBotInlineSend_param_id_type_string' => 'ID', 'object_updateBotInlineSend_param_msg_id_type_InputBotInlineMessageID' => 'Msg ID', 'object_updateEditChannelMessage' => 'Update edit channel message', 'object_updateEditChannelMessage_param_message_type_Message' => 'Message', 'object_updateEditChannelMessage_param_pts_type_int' => 'Pts', 'object_updateEditChannelMessage_param_pts_count_type_int' => 'Pts count', 'object_updateChannelPinnedMessage' => 'Update channel pinned message', 'object_updateChannelPinnedMessage_param_channel_id_type_int' => 'Channel ID', 'object_updateChannelPinnedMessage_param_id_type_int' => 'ID', 'object_updateBotCallbackQuery' => 'Update bot callback query', 'object_updateBotCallbackQuery_param_query_id_type_long' => 'Query ID', 'object_updateBotCallbackQuery_param_user_id_type_int' => 'User ID', 'object_updateBotCallbackQuery_param_peer_type_Peer' => 'Peer', 'object_updateBotCallbackQuery_param_msg_id_type_int' => 'Msg ID', 'object_updateBotCallbackQuery_param_chat_instance_type_long' => 'Chat instance', 'object_updateBotCallbackQuery_param_data_type_bytes' => 'Data', 'object_updateBotCallbackQuery_param_game_short_name_type_string' => 'Game short name', 'object_updateEditMessage' => 'Update edit message', 'object_updateEditMessage_param_message_type_Message' => 'Message', 'object_updateEditMessage_param_pts_type_int' => 'Pts', 'object_updateEditMessage_param_pts_count_type_int' => 'Pts count', 'object_updateInlineBotCallbackQuery' => 'Update inline bot callback query', 'object_updateInlineBotCallbackQuery_param_query_id_type_long' => 'Query ID', 'object_updateInlineBotCallbackQuery_param_user_id_type_int' => 'User ID', 'object_updateInlineBotCallbackQuery_param_msg_id_type_InputBotInlineMessageID' => 'Msg ID', 'object_updateInlineBotCallbackQuery_param_chat_instance_type_long' => 'Chat instance', 'object_updateInlineBotCallbackQuery_param_data_type_bytes' => 'Data', 'object_updateInlineBotCallbackQuery_param_game_short_name_type_string' => 'Game short name', 'object_updateReadChannelOutbox' => 'Update read channel outbox', 'object_updateReadChannelOutbox_param_channel_id_type_int' => 'Channel ID', 'object_updateReadChannelOutbox_param_max_id_type_int' => 'Max ID', 'object_updateDraftMessage' => 'Update draft message', 'object_updateDraftMessage_param_peer_type_Peer' => 'Peer', 'object_updateDraftMessage_param_draft_type_DraftMessage' => 'Draft', 'object_updateReadFeaturedStickers' => 'Update read featured stickers', 'object_updateRecentStickers' => 'Update recent stickers', 'object_updateConfig' => 'Update config', 'object_updatePtsChanged' => 'Update pts changed', 'object_updateChannelWebPage' => 'Update channel web page', 'object_updateChannelWebPage_param_channel_id_type_int' => 'Channel ID', 'object_updateChannelWebPage_param_webpage_type_WebPage' => 'Webpage', 'object_updateChannelWebPage_param_pts_type_int' => 'Pts', 'object_updateChannelWebPage_param_pts_count_type_int' => 'Pts count', 'object_updateDialogPinned' => 'Update dialog pinned', 'object_updateDialogPinned_param_pinned_type_true' => 'Pinned?', 'object_updateDialogPinned_param_peer_type_Peer' => 'Peer', 'object_updatePinnedDialogs' => 'Update pinned dialogs', 'object_updatePinnedDialogs_param_order_type_Vector t' => 'Order', 'object_updateBotWebhookJSON' => 'Update bot webhook json', 'object_updateBotWebhookJSON_param_data_type_DataJSON' => 'Data', 'object_updateBotWebhookJSONQuery' => 'Update bot webhook json query', 'object_updateBotWebhookJSONQuery_param_query_id_type_long' => 'Query ID', 'object_updateBotWebhookJSONQuery_param_data_type_DataJSON' => 'Data', 'object_updateBotWebhookJSONQuery_param_timeout_type_int' => 'Timeout', 'object_updateBotShippingQuery' => 'Update bot shipping query', 'object_updateBotShippingQuery_param_query_id_type_long' => 'Query ID', 'object_updateBotShippingQuery_param_user_id_type_int' => 'User ID', 'object_updateBotShippingQuery_param_payload_type_bytes' => 'Payload', 'object_updateBotShippingQuery_param_shipping_address_type_PostAddress' => 'Shipping address', 'object_updateBotPrecheckoutQuery' => 'Update bot precheckout query', 'object_updateBotPrecheckoutQuery_param_query_id_type_long' => 'Query ID', 'object_updateBotPrecheckoutQuery_param_user_id_type_int' => 'User ID', 'object_updateBotPrecheckoutQuery_param_payload_type_bytes' => 'Payload', 'object_updateBotPrecheckoutQuery_param_info_type_PaymentRequestedInfo' => 'Info', 'object_updateBotPrecheckoutQuery_param_shipping_option_id_type_string' => 'Shipping option ID', 'object_updateBotPrecheckoutQuery_param_currency_type_string' => 'Currency', 'object_updateBotPrecheckoutQuery_param_total_amount_type_long' => 'Total amount', 'object_updatePhoneCall' => 'Update phone call', 'object_updatePhoneCall_param_phone_call_type_PhoneCall' => 'Phone call', 'object_updateLangPackTooLong' => 'Update lang pack too long', 'object_updateLangPack' => 'Update lang pack', 'object_updateLangPack_param_difference_type_LangPackDifference' => 'Difference', 'object_updateFavedStickers' => 'Update faved stickers', 'object_updateChannelReadMessagesContents' => 'Update channel read messages contents', 'object_updateChannelReadMessagesContents_param_channel_id_type_int' => 'Channel ID', 'object_updateChannelReadMessagesContents_param_messages_type_Vector t' => 'Messages', 'object_updateContactsReset' => 'Update contacts reset', 'object_updateChannelAvailableMessages' => 'Update channel available messages', 'object_updateChannelAvailableMessages_param_channel_id_type_int' => 'Channel ID', 'object_updateChannelAvailableMessages_param_available_min_id_type_int' => 'Available min ID', 'object_updates.state' => 'State', 'object_updates.state_param_pts_type_int' => 'Pts', 'object_updates.state_param_qts_type_int' => 'Qts', 'object_updates.state_param_date_type_int' => 'Date', 'object_updates.state_param_seq_type_int' => 'Seq', 'object_updates.state_param_unread_count_type_int' => 'Unread count', 'object_updates.differenceEmpty' => 'Empty difference', 'object_updates.differenceEmpty_param_date_type_int' => 'Date', 'object_updates.differenceEmpty_param_seq_type_int' => 'Seq', 'object_updates.difference' => 'Difference', 'object_updates.difference_param_new_messages_type_Vector t' => 'New messages', 'object_updates.difference_param_new_encrypted_messages_type_Vector t' => 'New encrypted messages', 'object_updates.difference_param_other_updates_type_Vector t' => 'Other updates', 'object_updates.difference_param_chats_type_Vector t' => 'Chats', 'object_updates.difference_param_users_type_Vector t' => 'Users', 'object_updates.difference_param_state_type_updates.State' => 'State', 'object_updates.differenceSlice' => 'Difference slice', 'object_updates.differenceSlice_param_new_messages_type_Vector t' => 'New messages', 'object_updates.differenceSlice_param_new_encrypted_messages_type_Vector t' => 'New encrypted messages', 'object_updates.differenceSlice_param_other_updates_type_Vector t' => 'Other updates', 'object_updates.differenceSlice_param_chats_type_Vector t' => 'Chats', 'object_updates.differenceSlice_param_users_type_Vector t' => 'Users', 'object_updates.differenceSlice_param_intermediate_state_type_updates.State' => 'Intermediate state', 'object_updates.differenceTooLong' => 'Difference too long', 'object_updates.differenceTooLong_param_pts_type_int' => 'Pts', 'object_updatesTooLong' => 'Updates too long', 'object_updateShortMessage' => 'Update short message', 'object_updateShortMessage_param_out_type_true' => 'Out?', 'object_updateShortMessage_param_mentioned_type_true' => 'Mentioned?', 'object_updateShortMessage_param_media_unread_type_true' => 'Media unread?', 'object_updateShortMessage_param_silent_type_true' => 'Silent?', 'object_updateShortMessage_param_id_type_int' => 'ID', 'object_updateShortMessage_param_user_id_type_int' => 'User ID', 'object_updateShortMessage_param_message_type_string' => 'Message', 'object_updateShortMessage_param_pts_type_int' => 'Pts', 'object_updateShortMessage_param_pts_count_type_int' => 'Pts count', 'object_updateShortMessage_param_date_type_int' => 'Date', 'object_updateShortMessage_param_fwd_from_type_MessageFwdHeader' => 'Fwd from', 'object_updateShortMessage_param_via_bot_id_type_int' => 'Via bot ID', 'object_updateShortMessage_param_reply_to_msg_id_type_int' => 'Reply to msg ID', 'object_updateShortMessage_param_entities_type_Vector t' => 'Entities', 'object_updateShortChatMessage' => 'Update short chat message', 'object_updateShortChatMessage_param_out_type_true' => 'Out?', 'object_updateShortChatMessage_param_mentioned_type_true' => 'Mentioned?', 'object_updateShortChatMessage_param_media_unread_type_true' => 'Media unread?', 'object_updateShortChatMessage_param_silent_type_true' => 'Silent?', 'object_updateShortChatMessage_param_id_type_int' => 'ID', 'object_updateShortChatMessage_param_from_id_type_int' => 'From ID', 'object_updateShortChatMessage_param_chat_id_type_int' => 'Chat ID', 'object_updateShortChatMessage_param_message_type_string' => 'Message', 'object_updateShortChatMessage_param_pts_type_int' => 'Pts', 'object_updateShortChatMessage_param_pts_count_type_int' => 'Pts count', 'object_updateShortChatMessage_param_date_type_int' => 'Date', 'object_updateShortChatMessage_param_fwd_from_type_MessageFwdHeader' => 'Fwd from', 'object_updateShortChatMessage_param_via_bot_id_type_int' => 'Via bot ID', 'object_updateShortChatMessage_param_reply_to_msg_id_type_int' => 'Reply to msg ID', 'object_updateShortChatMessage_param_entities_type_Vector t' => 'Entities', 'object_updateShort' => 'Update short', 'object_updateShort_param_update_type_Update' => 'Update', 'object_updateShort_param_date_type_int' => 'Date', 'object_updatesCombined' => 'Updates combined', 'object_updatesCombined_param_updates_type_Vector t' => 'Updates', 'object_updatesCombined_param_users_type_Vector t' => 'Users', 'object_updatesCombined_param_chats_type_Vector t' => 'Chats', 'object_updatesCombined_param_date_type_int' => 'Date', 'object_updatesCombined_param_seq_start_type_int' => 'Seq start', 'object_updatesCombined_param_seq_type_int' => 'Seq', 'object_updates' => 'Updates', 'object_updates_param_updates_type_Vector t' => 'Updates', 'object_updates_param_users_type_Vector t' => 'Users', 'object_updates_param_chats_type_Vector t' => 'Chats', 'object_updates_param_date_type_int' => 'Date', 'object_updates_param_seq_type_int' => 'Seq', 'object_updateShortSentMessage' => 'Update short sent message', 'object_updateShortSentMessage_param_out_type_true' => 'Out?', 'object_updateShortSentMessage_param_id_type_int' => 'ID', 'object_updateShortSentMessage_param_pts_type_int' => 'Pts', 'object_updateShortSentMessage_param_pts_count_type_int' => 'Pts count', 'object_updateShortSentMessage_param_date_type_int' => 'Date', 'object_updateShortSentMessage_param_media_type_MessageMedia' => 'Media', 'object_updateShortSentMessage_param_entities_type_Vector t' => 'Entities', 'object_photos.photos' => 'Photos', 'object_photos.photos_param_photos_type_Vector t' => 'Photos', 'object_photos.photos_param_users_type_Vector t' => 'Users', 'object_photos.photosSlice' => 'Photos slice', 'object_photos.photosSlice_param_count_type_int' => 'Count', 'object_photos.photosSlice_param_photos_type_Vector t' => 'Photos', 'object_photos.photosSlice_param_users_type_Vector t' => 'Users', 'object_photos.photo' => 'Photo', 'object_photos.photo_param_photo_type_Photo' => 'Photo', 'object_photos.photo_param_users_type_Vector t' => 'Users', 'object_upload.file' => 'File', 'object_upload.file_param_type_type_storage.FileType' => 'Type', 'object_upload.file_param_mtime_type_int' => 'Mtime', 'object_upload.file_param_bytes_type_bytes' => 'Bytes', 'object_upload.fileCdnRedirect' => 'File cdn redirect', 'object_upload.fileCdnRedirect_param_dc_id_type_int' => 'DC ID', 'object_upload.fileCdnRedirect_param_file_token_type_bytes' => 'File token', 'object_upload.fileCdnRedirect_param_encryption_key_type_bytes' => 'Encryption key', 'object_upload.fileCdnRedirect_param_encryption_iv_type_bytes' => 'Encryption iv', 'object_upload.fileCdnRedirect_param_cdn_file_hashes_type_Vector t' => 'Cdn file hashes', 'object_dcOption' => 'DC option', 'object_dcOption_param_ipv6_type_true' => 'Ipv6?', 'object_dcOption_param_media_only_type_true' => 'Media only?', 'object_dcOption_param_tcpo_only_type_true' => 'Tcpo only?', 'object_dcOption_param_cdn_type_true' => 'Cdn?', 'object_dcOption_param_static_type_true' => 'Static?', 'object_dcOption_param_id_type_int' => 'ID', 'object_dcOption_param_ip_address_type_string' => 'Ip address', 'object_dcOption_param_port_type_int' => 'Port', 'object_config' => 'Config', 'object_config_param_phonecalls_enabled_type_true' => 'Phonecalls enabled?', 'object_config_param_default_p2p_contacts_type_true' => 'Default p2p contacts?', 'object_config_param_date_type_int' => 'Date', 'object_config_param_expires_type_int' => 'Expires', 'object_config_param_test_mode_type_Bool' => 'Test mode?', 'object_config_param_this_dc_type_int' => 'This DC', 'object_config_param_dc_options_type_Vector t' => 'DC options', 'object_config_param_chat_size_max_type_int' => 'Chat size max', 'object_config_param_megagroup_size_max_type_int' => 'Megagroup size max', 'object_config_param_forwarded_count_max_type_int' => 'Forwarded count max', 'object_config_param_online_update_period_ms_type_int' => 'Online update period ms', 'object_config_param_offline_blur_timeout_ms_type_int' => 'Offline blur timeout ms', 'object_config_param_offline_idle_timeout_ms_type_int' => 'Offline IDle timeout ms', 'object_config_param_online_cloud_timeout_ms_type_int' => 'Online cloud timeout ms', 'object_config_param_notify_cloud_delay_ms_type_int' => 'Notify cloud delay ms', 'object_config_param_notify_default_delay_ms_type_int' => 'Notify default delay ms', 'object_config_param_chat_big_size_type_int' => 'Chat big size', 'object_config_param_push_chat_period_ms_type_int' => 'Push chat period ms', 'object_config_param_push_chat_limit_type_int' => 'Push chat limit', 'object_config_param_saved_gifs_limit_type_int' => 'Saved gifs limit', 'object_config_param_edit_time_limit_type_int' => 'Edit time limit', 'object_config_param_rating_e_decay_type_int' => 'Rating e decay', 'object_config_param_stickers_recent_limit_type_int' => 'Stickers recent limit', 'object_config_param_stickers_faved_limit_type_int' => 'Stickers faved limit', 'object_config_param_channels_read_media_period_type_int' => 'Channels read media period', 'object_config_param_tmp_sessions_type_int' => 'Tmp sessions', 'object_config_param_pinned_dialogs_count_max_type_int' => 'Pinned dialogs count max', 'object_config_param_call_receive_timeout_ms_type_int' => 'Call receive timeout ms', 'object_config_param_call_ring_timeout_ms_type_int' => 'Call ring timeout ms', 'object_config_param_call_connect_timeout_ms_type_int' => 'Call connect timeout ms', 'object_config_param_call_packet_timeout_ms_type_int' => 'Call packet timeout ms', 'object_config_param_me_url_prefix_type_string' => 'Me URL prefix', 'object_config_param_suggested_lang_code_type_string' => 'Suggested lang code', 'object_config_param_lang_pack_version_type_int' => 'Lang pack version', 'object_config_param_disabled_features_type_Vector t' => 'Disabled features', 'object_nearestDc' => 'Nearest DC', 'object_nearestDc_param_country_type_string' => 'Country', 'object_nearestDc_param_this_dc_type_int' => 'This DC', 'object_nearestDc_param_nearest_dc_type_int' => 'Nearest DC', 'object_help.appUpdate' => 'App update', 'object_help.appUpdate_param_id_type_int' => 'ID', 'object_help.appUpdate_param_critical_type_Bool' => 'Critical?', 'object_help.appUpdate_param_url_type_string' => 'URL', 'object_help.appUpdate_param_text_type_string' => 'Text', 'object_help.noAppUpdate' => 'No app update', 'object_help.inviteText' => 'Invite text', 'object_help.inviteText_param_message_type_string' => 'Message', 'object_encryptedChatEmpty' => 'Empty encrypted chat', 'object_encryptedChatEmpty_param_id_type_int' => 'ID', 'object_encryptedChatWaiting' => 'Encrypted chat waiting', 'object_encryptedChatWaiting_param_id_type_int' => 'ID', 'object_encryptedChatWaiting_param_access_hash_type_long' => 'Access hash', 'object_encryptedChatWaiting_param_date_type_int' => 'Date', 'object_encryptedChatWaiting_param_admin_id_type_int' => 'Admin ID', 'object_encryptedChatWaiting_param_participant_id_type_int' => 'Participant ID', 'object_encryptedChatRequested' => 'Encrypted chat requested', 'object_encryptedChatRequested_param_id_type_int' => 'ID', 'object_encryptedChatRequested_param_access_hash_type_long' => 'Access hash', 'object_encryptedChatRequested_param_date_type_int' => 'Date', 'object_encryptedChatRequested_param_admin_id_type_int' => 'Admin ID', 'object_encryptedChatRequested_param_participant_id_type_int' => 'Participant ID', 'object_encryptedChatRequested_param_g_a_type_bytes' => 'G a', 'object_encryptedChat' => 'Encrypted chat', 'object_encryptedChat_param_id_type_int' => 'ID', 'object_encryptedChat_param_access_hash_type_long' => 'Access hash', 'object_encryptedChat_param_date_type_int' => 'Date', 'object_encryptedChat_param_admin_id_type_int' => 'Admin ID', 'object_encryptedChat_param_participant_id_type_int' => 'Participant ID', 'object_encryptedChat_param_g_a_or_b_type_bytes' => 'G a or b', 'object_encryptedChat_param_key_fingerprint_type_long' => 'Key fingerprint', 'object_encryptedChatDiscarded' => 'Encrypted chat discarded', 'object_encryptedChatDiscarded_param_id_type_int' => 'ID', 'object_inputEncryptedChat' => 'Encrypted chat', 'object_inputEncryptedChat_param_chat_id_type_int' => 'Chat ID', 'object_inputEncryptedChat_param_access_hash_type_long' => 'Access hash', 'object_encryptedFileEmpty' => 'Empty encrypted file', 'object_encryptedFile' => 'Encrypted file', 'object_encryptedFile_param_id_type_long' => 'ID', 'object_encryptedFile_param_access_hash_type_long' => 'Access hash', 'object_encryptedFile_param_size_type_int' => 'Size', 'object_encryptedFile_param_dc_id_type_int' => 'DC ID', 'object_encryptedFile_param_key_fingerprint_type_int' => 'Key fingerprint', 'object_inputEncryptedFileEmpty' => 'Empty input encrypted file', 'object_inputEncryptedFileUploaded' => 'Encrypted file uploaded', 'object_inputEncryptedFileUploaded_param_id_type_long' => 'ID', 'object_inputEncryptedFileUploaded_param_parts_type_int' => 'Parts', 'object_inputEncryptedFileUploaded_param_md5_checksum_type_string' => 'Md5 checksum', 'object_inputEncryptedFileUploaded_param_key_fingerprint_type_int' => 'Key fingerprint', 'object_inputEncryptedFile' => 'Encrypted file', 'object_inputEncryptedFile_param_id_type_long' => 'ID', 'object_inputEncryptedFile_param_access_hash_type_long' => 'Access hash', 'object_inputEncryptedFileBigUploaded' => 'Encrypted file big uploaded', 'object_inputEncryptedFileBigUploaded_param_id_type_long' => 'ID', 'object_inputEncryptedFileBigUploaded_param_parts_type_int' => 'Parts', 'object_inputEncryptedFileBigUploaded_param_key_fingerprint_type_int' => 'Key fingerprint', 'object_encryptedMessage' => 'Encrypted message', 'object_encryptedMessage_param_chat_id_type_int' => 'Chat ID', 'object_encryptedMessage_param_date_type_int' => 'Date', 'object_encryptedMessage_param_decrypted_message_type_DecryptedMessage' => 'Decrypted message', 'object_encryptedMessage_param_file_type_EncryptedFile' => 'File', 'object_encryptedMessageService' => 'Encrypted message service', 'object_encryptedMessageService_param_chat_id_type_int' => 'Chat ID', 'object_encryptedMessageService_param_date_type_int' => 'Date', 'object_encryptedMessageService_param_decrypted_message_type_DecryptedMessage' => 'Decrypted message', 'object_messages.dhConfigNotModified' => 'Dh config not modified', 'object_messages.dhConfigNotModified_param_random_type_bytes' => 'Random', 'object_messages.dhConfig' => 'Dh config', 'object_messages.dhConfig_param_g_type_int' => 'G', 'object_messages.dhConfig_param_p_type_bytes' => 'P', 'object_messages.dhConfig_param_version_type_int' => 'Version', 'object_messages.dhConfig_param_random_type_bytes' => 'Random', 'object_messages.sentEncryptedMessage' => 'Sent encrypted message', 'object_messages.sentEncryptedMessage_param_date_type_int' => 'Date', 'object_messages.sentEncryptedFile' => 'Sent encrypted file', 'object_messages.sentEncryptedFile_param_date_type_int' => 'Date', 'object_messages.sentEncryptedFile_param_file_type_EncryptedFile' => 'File', 'object_inputDocumentEmpty' => 'Empty input document', 'object_inputDocument' => 'Document', 'object_inputDocument_param_id_type_long' => 'ID', 'object_inputDocument_param_access_hash_type_long' => 'Access hash', 'object_documentEmpty' => 'Empty document', 'object_documentEmpty_param_id_type_long' => 'ID', 'object_document' => 'Document', 'object_document_param_id_type_long' => 'ID', 'object_document_param_access_hash_type_long' => 'Access hash', 'object_document_param_date_type_int' => 'Date', 'object_document_param_mime_type_type_string' => 'Mime type', 'object_document_param_size_type_int' => 'Size', 'object_document_param_thumb_type_PhotoSize' => 'Thumbnail', 'object_document_param_dc_id_type_int' => 'DC ID', 'object_document_param_version_type_int' => 'Version', 'object_document_param_attributes_type_Vector t' => 'Attributes', 'object_help.support' => 'Support', 'object_help.support_param_phone_number_type_string' => 'Phone number', 'object_help.support_param_user_type_User' => 'User', 'object_notifyPeer' => 'Notify peer', 'object_notifyPeer_param_peer_type_Peer' => 'Peer', 'object_notifyUsers' => 'Notify users', 'object_notifyChats' => 'Notify chats', 'object_notifyAll' => 'Notify all', 'object_sendMessageTypingAction' => 'Send message typing action', 'object_sendMessageCancelAction' => 'Send message cancel action', 'object_sendMessageRecordVideoAction' => 'Send message record video action', 'object_sendMessageUploadVideoAction' => 'Send message upload video action', 'object_sendMessageUploadVideoAction_param_progress_type_int' => 'Progress', 'object_sendMessageRecordAudioAction' => 'Send message record audio action', 'object_sendMessageUploadAudioAction' => 'Send message upload audio action', 'object_sendMessageUploadAudioAction_param_progress_type_int' => 'Progress', 'object_sendMessageUploadPhotoAction' => 'Send message upload photo action', 'object_sendMessageUploadPhotoAction_param_progress_type_int' => 'Progress', 'object_sendMessageUploadDocumentAction' => 'Send message upload document action', 'object_sendMessageUploadDocumentAction_param_progress_type_int' => 'Progress', 'object_sendMessageGeoLocationAction' => 'Send message geo location action', 'object_sendMessageChooseContactAction' => 'Send message choose contact action', 'object_sendMessageGamePlayAction' => 'Send message game play action', 'object_sendMessageRecordRoundAction' => 'Send message record round action', 'object_sendMessageUploadRoundAction' => 'Send message upload round action', 'object_sendMessageUploadRoundAction_param_progress_type_int' => 'Progress', 'object_contacts.found' => 'Found', 'object_contacts.found_param_my_results_type_Vector t' => 'My results', 'object_contacts.found_param_results_type_Vector t' => 'Results', 'object_contacts.found_param_chats_type_Vector t' => 'Chats', 'object_contacts.found_param_users_type_Vector t' => 'Users', 'object_inputPrivacyKeyStatusTimestamp' => 'Privacy key status timestamp', 'object_inputPrivacyKeyChatInvite' => 'Privacy key chat invite', 'object_inputPrivacyKeyPhoneCall' => 'Privacy key phone call', 'object_privacyKeyStatusTimestamp' => 'Privacy key status timestamp', 'object_privacyKeyPhoneCall' => 'Privacy key phone call', 'object_inputPrivacyValueAllowContacts' => 'Privacy value allow contacts', 'object_inputPrivacyValueAllowAll' => 'Privacy value allow all', 'object_inputPrivacyValueAllowUsers' => 'Privacy value allow users', 'object_inputPrivacyValueAllowUsers_param_users_type_Vector t' => 'Users', 'object_inputPrivacyValueDisallowContacts' => 'Privacy value disallow contacts', 'object_inputPrivacyValueDisallowAll' => 'Privacy value disallow all', 'object_inputPrivacyValueDisallowUsers' => 'Privacy value disallow users', 'object_inputPrivacyValueDisallowUsers_param_users_type_Vector t' => 'Users', 'object_privacyValueAllowContacts' => 'Privacy value allow contacts', 'object_privacyValueAllowAll' => 'Privacy value allow all', 'object_privacyValueAllowUsers' => 'Privacy value allow users', 'object_privacyValueAllowUsers_param_users_type_Vector t' => 'Users', 'object_privacyValueDisallowContacts' => 'Privacy value disallow contacts', 'object_privacyValueDisallowAll' => 'Privacy value disallow all', 'object_privacyValueDisallowUsers' => 'Privacy value disallow users', 'object_privacyValueDisallowUsers_param_users_type_Vector t' => 'Users', 'object_account.privacyRules' => 'Privacy rules', 'object_account.privacyRules_param_rules_type_Vector t' => 'Rules', 'object_account.privacyRules_param_users_type_Vector t' => 'Users', 'object_accountDaysTTL' => 'Account TTL in days', 'object_accountDaysTTL_param_days_type_int' => 'Days', 'object_documentAttributeImageSize' => 'Document attribute image size', 'object_documentAttributeImageSize_param_w_type_int' => 'Width', 'object_documentAttributeImageSize_param_h_type_int' => 'Height', 'object_documentAttributeAnimated' => 'Document attribute animated', 'object_documentAttributeSticker' => 'Document attribute sticker', 'object_documentAttributeSticker_param_mask_type_true' => 'Mask?', 'object_documentAttributeSticker_param_alt_type_string' => 'Alt', 'object_documentAttributeSticker_param_stickerset_type_InputStickerSet' => 'Stickerset', 'object_documentAttributeSticker_param_mask_coords_type_MaskCoords' => 'Mask coords', 'object_documentAttributeVideo' => 'Document attribute video', 'object_documentAttributeVideo_param_round_message_type_true' => 'Round message?', 'object_documentAttributeVideo_param_supports_streaming_type_true' => 'Supports streaming?', 'object_documentAttributeVideo_param_duration_type_int' => 'Duration', 'object_documentAttributeVideo_param_w_type_int' => 'Width', 'object_documentAttributeVideo_param_h_type_int' => 'Height', 'object_documentAttributeAudio' => 'Document attribute audio', 'object_documentAttributeAudio_param_voice_type_true' => 'Voice?', 'object_documentAttributeAudio_param_duration_type_int' => 'Duration', 'object_documentAttributeAudio_param_title_type_string' => 'Title', 'object_documentAttributeAudio_param_performer_type_string' => 'Performer', 'object_documentAttributeAudio_param_waveform_type_bytes' => 'Waveform', 'object_documentAttributeFilename' => 'Document attribute filename', 'object_documentAttributeFilename_param_file_name_type_string' => 'File name', 'object_documentAttributeHasStickers' => 'Document attribute has stickers', 'object_messages.stickersNotModified' => 'Stickers not modified', 'object_messages.stickers' => 'Stickers', 'object_messages.stickers_param_hash_type_string' => 'Hash', 'object_messages.stickers_param_stickers_type_Vector t' => 'Stickers', 'object_stickerPack' => 'Sticker pack', 'object_stickerPack_param_emoticon_type_string' => 'Emoticon', 'object_stickerPack_param_documents_type_Vector t' => 'Documents', 'object_messages.allStickersNotModified' => 'All stickers not modified', 'object_messages.allStickers' => 'All stickers', 'object_messages.allStickers_param_hash_type_int' => 'Hash', 'object_messages.allStickers_param_sets_type_Vector t' => 'Sets', 'object_disabledFeature' => 'Disabled feature', 'object_disabledFeature_param_feature_type_string' => 'Feature', 'object_disabledFeature_param_description_type_string' => 'Description', 'object_messages.affectedMessages' => 'Affected messages', 'object_messages.affectedMessages_param_pts_type_int' => 'Pts', 'object_messages.affectedMessages_param_pts_count_type_int' => 'Pts count', 'object_contactLinkUnknown' => 'Contact link unknown', 'object_contactLinkNone' => 'Contact link none', 'object_contactLinkHasPhone' => 'Contact link has phone', 'object_contactLinkContact' => 'Contact link contact', 'object_webPageEmpty' => 'Empty web page', 'object_webPageEmpty_param_id_type_long' => 'ID', 'object_webPagePending' => 'Web page pending', 'object_webPagePending_param_id_type_long' => 'ID', 'object_webPagePending_param_date_type_int' => 'Date', 'object_webPage' => 'Web page', 'object_webPage_param_id_type_long' => 'ID', 'object_webPage_param_url_type_string' => 'URL', 'object_webPage_param_display_url_type_string' => 'Display URL', 'object_webPage_param_hash_type_int' => 'Hash', 'object_webPage_param_type_type_string' => 'Type', 'object_webPage_param_site_name_type_string' => 'Site name', 'object_webPage_param_title_type_string' => 'Title', 'object_webPage_param_description_type_string' => 'Description', 'object_webPage_param_photo_type_Photo' => 'Photo', 'object_webPage_param_embed_url_type_string' => 'Embed URL', 'object_webPage_param_embed_type_type_string' => 'Embed type', 'object_webPage_param_embed_width_type_int' => 'Embed width', 'object_webPage_param_embed_height_type_int' => 'Embed height', 'object_webPage_param_duration_type_int' => 'Duration', 'object_webPage_param_author_type_string' => 'Author', 'object_webPage_param_document_type_Document' => 'Document', 'object_webPage_param_cached_page_type_Page' => 'Cached page', 'object_webPageNotModified' => 'Web page not modified', 'object_authorization' => 'Authorization', 'object_authorization_param_hash_type_long' => 'Hash', 'object_authorization_param_device_model_type_string' => 'Device model', 'object_authorization_param_platform_type_string' => 'Platform', 'object_authorization_param_system_version_type_string' => 'System version', 'object_authorization_param_api_id_type_int' => 'Api ID', 'object_authorization_param_app_name_type_string' => 'App name', 'object_authorization_param_app_version_type_string' => 'App version', 'object_authorization_param_date_created_type_int' => 'Date created', 'object_authorization_param_date_active_type_int' => 'Date active', 'object_authorization_param_ip_type_string' => 'Ip', 'object_authorization_param_country_type_string' => 'Country', 'object_authorization_param_region_type_string' => 'Region', 'object_account.authorizations' => 'Authorized clients for this account', 'object_account.authorizations_param_authorizations_type_Vector t' => 'Authorizations', 'object_account.noPassword' => 'No password', 'object_account.noPassword_param_new_salt_type_bytes' => 'New salt', 'object_account.noPassword_param_email_unconfirmed_pattern_type_string' => 'Email unconfirmed pattern', 'object_account.password' => 'Password', 'object_account.password_param_current_salt_type_bytes' => 'Current salt', 'object_account.password_param_new_salt_type_bytes' => 'New salt', 'object_account.password_param_hint_type_string' => 'Hint', 'object_account.password_param_has_recovery_type_Bool' => 'Has recovery?', 'object_account.password_param_email_unconfirmed_pattern_type_string' => 'Email unconfirmed pattern', 'object_account.passwordSettings' => 'Password settings', 'object_account.passwordSettings_param_email_type_string' => 'Email', 'object_account.passwordInputSettings' => '2FA password settings', 'object_account.passwordInputSettings_param_new_salt_type_bytes' => '`$new_salt = $MadelineProto->account->getPassword()[\'new_salt\'].$MadelineProto->random(8);`', 'object_account.passwordInputSettings_param_new_password_hash_type_bytes' => '`hash(\'sha256\', $new_salt.$new_password.$new_salt, true)`', 'object_account.passwordInputSettings_param_hint_type_string' => 'Hint', 'object_account.passwordInputSettings_param_email_type_string' => 'Email', 'object_auth.passwordRecovery' => 'Password recovery', 'object_auth.passwordRecovery_param_email_pattern_type_string' => 'Email pattern', 'object_receivedNotifyMessage' => 'Received notify message', 'object_receivedNotifyMessage_param_id_type_int' => 'ID', 'object_chatInviteEmpty' => 'Empty chat invite', 'object_chatInviteExported' => 'Exported chat invite', 'object_chatInviteExported_param_link_type_string' => 'Link', 'object_chatInviteAlready' => 'Invite of a chat of which I am already member ', 'object_chatInviteAlready_param_chat_type_Chat' => 'Chat', 'object_chatInvite' => 'Chat invite', 'object_chatInvite_param_channel_type_true' => 'Channel?', 'object_chatInvite_param_broadcast_type_true' => 'Broadcast?', 'object_chatInvite_param_public_type_true' => 'Public?', 'object_chatInvite_param_megagroup_type_true' => 'Megagroup?', 'object_chatInvite_param_title_type_string' => 'Title', 'object_chatInvite_param_photo_type_ChatPhoto' => 'Photo', 'object_chatInvite_param_participants_count_type_int' => 'Participants count', 'object_chatInvite_param_participants_type_Vector t' => 'Participants', 'object_inputStickerSetEmpty' => 'Empty input sticker set', 'object_inputStickerSetID' => 'Sticker set ID', 'object_inputStickerSetID_param_id_type_long' => 'ID', 'object_inputStickerSetID_param_access_hash_type_long' => 'Access hash', 'object_inputStickerSetShortName' => 'Sticker set short name', 'object_inputStickerSetShortName_param_short_name_type_string' => 'Short name', 'object_stickerSet' => 'Sticker set', 'object_stickerSet_param_installed_type_true' => 'Installed?', 'object_stickerSet_param_archived_type_true' => 'Archived?', 'object_stickerSet_param_official_type_true' => 'Official?', 'object_stickerSet_param_masks_type_true' => 'Masks?', 'object_stickerSet_param_id_type_long' => 'ID', 'object_stickerSet_param_access_hash_type_long' => 'Access hash', 'object_stickerSet_param_title_type_string' => 'Title', 'object_stickerSet_param_short_name_type_string' => 'Short name', 'object_stickerSet_param_count_type_int' => 'Count', 'object_stickerSet_param_hash_type_int' => 'Hash', 'object_messages.stickerSet' => 'Sticker set', 'object_messages.stickerSet_param_set_type_StickerSet' => 'Set', 'object_messages.stickerSet_param_packs_type_Vector t' => 'Packs', 'object_messages.stickerSet_param_documents_type_Vector t' => 'Documents', 'object_botInfo' => 'Bot info', 'object_botInfo_param_user_id_type_int' => 'User ID', 'object_botInfo_param_description_type_string' => 'Description', 'object_botInfo_param_commands_type_Vector t' => 'Commands', 'object_keyboardButton' => 'Keyboard button', 'object_keyboardButton_param_text_type_string' => 'Text', 'object_keyboardButtonUrl' => 'Keyboard button URL', 'object_keyboardButtonUrl_param_text_type_string' => 'Text', 'object_keyboardButtonUrl_param_url_type_string' => 'URL', 'object_keyboardButtonCallback' => 'Keyboard button callback', 'object_keyboardButtonCallback_param_text_type_string' => 'Text', 'object_keyboardButtonCallback_param_data_type_bytes' => 'Data', 'object_keyboardButtonRequestPhone' => 'Keyboard button request phone', 'object_keyboardButtonRequestPhone_param_text_type_string' => 'Text', 'object_keyboardButtonRequestGeoLocation' => 'Keyboard button request geo location', 'object_keyboardButtonRequestGeoLocation_param_text_type_string' => 'Text', 'object_keyboardButtonSwitchInline' => 'Keyboard button switch inline', 'object_keyboardButtonSwitchInline_param_same_peer_type_true' => 'Same peer?', 'object_keyboardButtonSwitchInline_param_text_type_string' => 'Text', 'object_keyboardButtonSwitchInline_param_query_type_string' => 'Query', 'object_keyboardButtonGame' => 'Keyboard button game', 'object_keyboardButtonGame_param_text_type_string' => 'Text', 'object_keyboardButtonBuy' => 'Keyboard button buy', 'object_keyboardButtonBuy_param_text_type_string' => 'Text', 'object_keyboardButtonRow' => 'Keyboard button row', 'object_keyboardButtonRow_param_buttons_type_Vector t' => 'Buttons', 'object_replyKeyboardHide' => 'Reply keyboard hide', 'object_replyKeyboardHide_param_selective_type_true' => 'Selective?', 'object_replyKeyboardForceReply' => 'Reply keyboard force reply', 'object_replyKeyboardForceReply_param_single_use_type_true' => 'Single use?', 'object_replyKeyboardForceReply_param_selective_type_true' => 'Selective?', 'object_replyKeyboardMarkup' => 'Reply keyboard markup', 'object_replyKeyboardMarkup_param_resize_type_true' => 'Resize?', 'object_replyKeyboardMarkup_param_single_use_type_true' => 'Single use?', 'object_replyKeyboardMarkup_param_selective_type_true' => 'Selective?', 'object_replyKeyboardMarkup_param_rows_type_Vector t' => 'Rows', 'object_replyInlineMarkup' => 'Reply inline markup', 'object_replyInlineMarkup_param_rows_type_Vector t' => 'Rows', 'object_messageEntityUnknown' => 'Message entity unknown', 'object_messageEntityUnknown_param_offset_type_int' => 'Offset', 'object_messageEntityUnknown_param_length_type_int' => 'Length', 'object_messageEntityMention' => 'Message entity mention', 'object_messageEntityMention_param_offset_type_int' => 'Offset', 'object_messageEntityMention_param_length_type_int' => 'Length', 'object_messageEntityHashtag' => 'Message entity hashtag', 'object_messageEntityHashtag_param_offset_type_int' => 'Offset', 'object_messageEntityHashtag_param_length_type_int' => 'Length', 'object_messageEntityBotCommand' => 'Message entity bot command', 'object_messageEntityBotCommand_param_offset_type_int' => 'Offset', 'object_messageEntityBotCommand_param_length_type_int' => 'Length', 'object_messageEntityUrl' => 'Message entity URL', 'object_messageEntityUrl_param_offset_type_int' => 'Offset', 'object_messageEntityUrl_param_length_type_int' => 'Length', 'object_messageEntityEmail' => 'Message entity email', 'object_messageEntityEmail_param_offset_type_int' => 'Offset', 'object_messageEntityEmail_param_length_type_int' => 'Length', 'object_messageEntityBold' => 'Message entity bold', 'object_messageEntityBold_param_offset_type_int' => 'Offset', 'object_messageEntityBold_param_length_type_int' => 'Length', 'object_messageEntityItalic' => 'Message entity italic', 'object_messageEntityItalic_param_offset_type_int' => 'Offset', 'object_messageEntityItalic_param_length_type_int' => 'Length', 'object_messageEntityCode' => 'Message entity code', 'object_messageEntityCode_param_offset_type_int' => 'Offset', 'object_messageEntityCode_param_length_type_int' => 'Length', 'object_messageEntityPre' => 'Message entity pre', 'object_messageEntityPre_param_offset_type_int' => 'Offset', 'object_messageEntityPre_param_length_type_int' => 'Length', 'object_messageEntityPre_param_language_type_string' => 'Language', 'object_messageEntityTextUrl' => 'Message entity text URL', 'object_messageEntityTextUrl_param_offset_type_int' => 'Offset', 'object_messageEntityTextUrl_param_length_type_int' => 'Length', 'object_messageEntityTextUrl_param_url_type_string' => 'URL', 'object_messageEntityMentionName' => 'Message entity mention name', 'object_messageEntityMentionName_param_offset_type_int' => 'Offset', 'object_messageEntityMentionName_param_length_type_int' => 'Length', 'object_messageEntityMentionName_param_user_id_type_int' => 'User ID', 'object_inputMessageEntityMentionName' => 'Message entity mention name', 'object_inputMessageEntityMentionName_param_offset_type_int' => 'Offset', 'object_inputMessageEntityMentionName_param_length_type_int' => 'Length', 'object_inputMessageEntityMentionName_param_user_id_type_InputUser' => 'User ID', 'object_inputChannelEmpty' => 'Empty input channel', 'object_inputChannel' => 'Channel', 'object_inputChannel_param_channel_id_type_int' => 'Channel ID', 'object_inputChannel_param_access_hash_type_long' => 'Access hash', 'object_contacts.resolvedPeer' => 'Resolved peer', 'object_contacts.resolvedPeer_param_peer_type_Peer' => 'Peer', 'object_contacts.resolvedPeer_param_chats_type_Vector t' => 'Chats', 'object_contacts.resolvedPeer_param_users_type_Vector t' => 'Users', 'object_messageRange' => 'Message range', 'object_messageRange_param_min_id_type_int' => 'Min ID', 'object_messageRange_param_max_id_type_int' => 'Max ID', 'object_updates.channelDifferenceEmpty' => 'Empty channel difference', 'object_updates.channelDifferenceEmpty_param_final_type_true' => 'Final?', 'object_updates.channelDifferenceEmpty_param_pts_type_int' => 'Pts', 'object_updates.channelDifferenceEmpty_param_timeout_type_int' => 'Timeout', 'object_updates.channelDifferenceTooLong' => 'Channel difference too long', 'object_updates.channelDifferenceTooLong_param_final_type_true' => 'Final?', 'object_updates.channelDifferenceTooLong_param_pts_type_int' => 'Pts', 'object_updates.channelDifferenceTooLong_param_timeout_type_int' => 'Timeout', 'object_updates.channelDifferenceTooLong_param_top_message_type_int' => 'Top message', 'object_updates.channelDifferenceTooLong_param_read_inbox_max_id_type_int' => 'Read inbox max ID', 'object_updates.channelDifferenceTooLong_param_read_outbox_max_id_type_int' => 'Read outbox max ID', 'object_updates.channelDifferenceTooLong_param_unread_count_type_int' => 'Unread count', 'object_updates.channelDifferenceTooLong_param_unread_mentions_count_type_int' => 'Unread mentions count', 'object_updates.channelDifferenceTooLong_param_messages_type_Vector t' => 'Messages', 'object_updates.channelDifferenceTooLong_param_chats_type_Vector t' => 'Chats', 'object_updates.channelDifferenceTooLong_param_users_type_Vector t' => 'Users', 'object_updates.channelDifference' => 'Channel difference', 'object_updates.channelDifference_param_final_type_true' => 'Final?', 'object_updates.channelDifference_param_pts_type_int' => 'Pts', 'object_updates.channelDifference_param_timeout_type_int' => 'Timeout', 'object_updates.channelDifference_param_new_messages_type_Vector t' => 'New messages', 'object_updates.channelDifference_param_other_updates_type_Vector t' => 'Other updates', 'object_updates.channelDifference_param_chats_type_Vector t' => 'Chats', 'object_updates.channelDifference_param_users_type_Vector t' => 'Users', 'object_channelMessagesFilterEmpty' => 'Empty channel messages filter', 'object_channelMessagesFilter' => 'Channel messages filter', 'object_channelMessagesFilter_param_exclude_new_messages_type_true' => 'Exclude new messages?', 'object_channelMessagesFilter_param_ranges_type_Vector t' => 'Ranges', 'object_channelParticipant' => 'Channel participant', 'object_channelParticipant_param_user_id_type_int' => 'User ID', 'object_channelParticipant_param_date_type_int' => 'Date', 'object_channelParticipantSelf' => 'Channel participant self', 'object_channelParticipantSelf_param_user_id_type_int' => 'User ID', 'object_channelParticipantSelf_param_inviter_id_type_int' => 'Inviter ID', 'object_channelParticipantSelf_param_date_type_int' => 'Date', 'object_channelParticipantCreator' => 'Channel participant creator', 'object_channelParticipantCreator_param_user_id_type_int' => 'User ID', 'object_channelParticipantAdmin' => 'Channel participant admin', 'object_channelParticipantAdmin_param_can_edit_type_true' => 'Can edit?', 'object_channelParticipantAdmin_param_user_id_type_int' => 'User ID', 'object_channelParticipantAdmin_param_inviter_id_type_int' => 'Inviter ID', 'object_channelParticipantAdmin_param_promoted_by_type_int' => 'Promoted by', 'object_channelParticipantAdmin_param_date_type_int' => 'Date', 'object_channelParticipantAdmin_param_admin_rights_type_ChannelAdminRights' => 'Admin rights', 'object_channelParticipantBanned' => 'Channel participant banned', 'object_channelParticipantBanned_param_left_type_true' => 'Left?', 'object_channelParticipantBanned_param_user_id_type_int' => 'User ID', 'object_channelParticipantBanned_param_kicked_by_type_int' => 'Kicked by', 'object_channelParticipantBanned_param_date_type_int' => 'Date', 'object_channelParticipantBanned_param_banned_rights_type_ChannelBannedRights' => 'Banned rights', 'object_channelParticipantsRecent' => 'Channel participants recent', 'object_channelParticipantsAdmins' => 'Channel participants admins', 'object_channelParticipantsKicked' => 'Channel participants kicked', 'object_channelParticipantsKicked_param_q_type_string' => 'Query', 'object_channelParticipantsBots' => 'Channel participants bots', 'object_channelParticipantsBanned' => 'Channel participants banned', 'object_channelParticipantsBanned_param_q_type_string' => 'Query', 'object_channelParticipantsSearch' => 'Channel participants search', 'object_channelParticipantsSearch_param_q_type_string' => 'Query', 'object_channels.channelParticipants' => 'Channel participants', 'object_channels.channelParticipants_param_count_type_int' => 'Count', 'object_channels.channelParticipants_param_participants_type_Vector t' => 'Participants', 'object_channels.channelParticipants_param_users_type_Vector t' => 'Users', 'object_channels.channelParticipantsNotModified' => 'Channel participants not modified', 'object_channels.channelParticipant' => 'Channel participant', 'object_channels.channelParticipant_param_participant_type_ChannelParticipant' => 'Participant', 'object_channels.channelParticipant_param_users_type_Vector t' => 'Users', 'object_help.termsOfService' => 'Terms of service', 'object_help.termsOfService_param_text_type_string' => 'Text', 'object_foundGif' => 'Found gif', 'object_foundGif_param_url_type_string' => 'URL', 'object_foundGif_param_thumb_url_type_string' => 'Thumbnail URL', 'object_foundGif_param_content_url_type_string' => 'Content URL', 'object_foundGif_param_content_type_type_string' => 'Content type', 'object_foundGif_param_w_type_int' => 'Width', 'object_foundGif_param_h_type_int' => 'Height', 'object_foundGifCached' => 'Found gif cached', 'object_foundGifCached_param_url_type_string' => 'URL', 'object_foundGifCached_param_photo_type_Photo' => 'Photo', 'object_foundGifCached_param_document_type_Document' => 'Document', 'object_messages.foundGifs' => 'Found gifs', 'object_messages.foundGifs_param_next_offset_type_int' => 'Next offset', 'object_messages.foundGifs_param_results_type_Vector t' => 'Results', 'object_messages.savedGifsNotModified' => 'Saved gifs not modified', 'object_messages.savedGifs' => 'Saved gifs', 'object_messages.savedGifs_param_hash_type_int' => 'Hash', 'object_messages.savedGifs_param_gifs_type_Vector t' => 'Gifs', 'object_inputBotInlineMessageMediaAuto' => 'Bot inline message media auto', 'object_inputBotInlineMessageMediaAuto_param_message_type_string' => 'Message', 'object_inputBotInlineMessageMediaAuto_param_entities_type_Vector t' => 'Entities', 'object_inputBotInlineMessageMediaAuto_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_inputBotInlineMessageText' => 'Bot inline message text', 'object_inputBotInlineMessageText_param_no_webpage_type_true' => 'No webpage?', 'object_inputBotInlineMessageText_param_message_type_string' => 'Message', 'object_inputBotInlineMessageText_param_entities_type_Vector t' => 'Entities', 'object_inputBotInlineMessageText_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_inputBotInlineMessageMediaGeo' => 'Bot inline message media geo', 'object_inputBotInlineMessageMediaGeo_param_geo_point_type_InputGeoPoint' => 'Geo point', 'object_inputBotInlineMessageMediaGeo_param_period_type_int' => 'Period', 'object_inputBotInlineMessageMediaGeo_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_inputBotInlineMessageMediaVenue' => 'Bot inline message media venue', 'object_inputBotInlineMessageMediaVenue_param_geo_point_type_InputGeoPoint' => 'Geo point', 'object_inputBotInlineMessageMediaVenue_param_title_type_string' => 'Title', 'object_inputBotInlineMessageMediaVenue_param_address_type_string' => 'Address', 'object_inputBotInlineMessageMediaVenue_param_provider_type_string' => 'Provider', 'object_inputBotInlineMessageMediaVenue_param_venue_id_type_string' => 'Venue ID', 'object_inputBotInlineMessageMediaVenue_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_inputBotInlineMessageMediaContact' => 'Bot inline message media contact', 'object_inputBotInlineMessageMediaContact_param_phone_number_type_string' => 'Phone number', 'object_inputBotInlineMessageMediaContact_param_first_name_type_string' => 'First name', 'object_inputBotInlineMessageMediaContact_param_last_name_type_string' => 'Last name', 'object_inputBotInlineMessageMediaContact_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_inputBotInlineMessageGame' => 'Bot inline message game', 'object_inputBotInlineMessageGame_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_inputBotInlineResult' => 'Bot inline result', 'object_inputBotInlineResult_param_id_type_string' => 'ID', 'object_inputBotInlineResult_param_type_type_string' => 'Type', 'object_inputBotInlineResult_param_title_type_string' => 'Title', 'object_inputBotInlineResult_param_description_type_string' => 'Description', 'object_inputBotInlineResult_param_url_type_string' => 'URL', 'object_inputBotInlineResult_param_thumb_url_type_string' => 'Thumbnail URL', 'object_inputBotInlineResult_param_content_url_type_string' => 'Content URL', 'object_inputBotInlineResult_param_content_type_type_string' => 'Content type', 'object_inputBotInlineResult_param_w_type_int' => 'Width', 'object_inputBotInlineResult_param_h_type_int' => 'Height', 'object_inputBotInlineResult_param_duration_type_int' => 'Duration', 'object_inputBotInlineResult_param_send_message_type_InputBotInlineMessage' => 'Message to send', 'object_inputBotInlineResultPhoto' => 'Bot inline result photo', 'object_inputBotInlineResultPhoto_param_id_type_string' => 'ID', 'object_inputBotInlineResultPhoto_param_type_type_string' => 'Type', 'object_inputBotInlineResultPhoto_param_photo_type_InputPhoto' => 'Photo', 'object_inputBotInlineResultPhoto_param_send_message_type_InputBotInlineMessage' => 'Message to send', 'object_inputBotInlineResultDocument' => 'Bot inline result document', 'object_inputBotInlineResultDocument_param_id_type_string' => 'ID', 'object_inputBotInlineResultDocument_param_type_type_string' => 'Type', 'object_inputBotInlineResultDocument_param_title_type_string' => 'Title', 'object_inputBotInlineResultDocument_param_description_type_string' => 'Description', 'object_inputBotInlineResultDocument_param_document_type_InputDocument' => 'Document', 'object_inputBotInlineResultDocument_param_send_message_type_InputBotInlineMessage' => 'Message to send', 'object_inputBotInlineResultGame' => 'Bot inline result game', 'object_inputBotInlineResultGame_param_id_type_string' => 'ID', 'object_inputBotInlineResultGame_param_short_name_type_string' => 'Short name', 'object_inputBotInlineResultGame_param_send_message_type_InputBotInlineMessage' => 'Message to send', 'object_botInlineMessageMediaAuto' => 'Bot inline message media auto', 'object_botInlineMessageMediaAuto_param_message_type_string' => 'Message', 'object_botInlineMessageMediaAuto_param_entities_type_Vector t' => 'Entities', 'object_botInlineMessageMediaAuto_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_botInlineMessageText' => 'Bot inline message text', 'object_botInlineMessageText_param_no_webpage_type_true' => 'No webpage?', 'object_botInlineMessageText_param_message_type_string' => 'Message', 'object_botInlineMessageText_param_entities_type_Vector t' => 'Entities', 'object_botInlineMessageText_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_botInlineMessageMediaGeo' => 'Bot inline message media geo', 'object_botInlineMessageMediaGeo_param_geo_type_GeoPoint' => 'Geo', 'object_botInlineMessageMediaGeo_param_period_type_int' => 'Period', 'object_botInlineMessageMediaGeo_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_botInlineMessageMediaVenue' => 'Bot inline message media venue', 'object_botInlineMessageMediaVenue_param_geo_type_GeoPoint' => 'Geo', 'object_botInlineMessageMediaVenue_param_title_type_string' => 'Title', 'object_botInlineMessageMediaVenue_param_address_type_string' => 'Address', 'object_botInlineMessageMediaVenue_param_provider_type_string' => 'Provider', 'object_botInlineMessageMediaVenue_param_venue_id_type_string' => 'Venue ID', 'object_botInlineMessageMediaVenue_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_botInlineMessageMediaContact' => 'Bot inline message media contact', 'object_botInlineMessageMediaContact_param_phone_number_type_string' => 'Phone number', 'object_botInlineMessageMediaContact_param_first_name_type_string' => 'First name', 'object_botInlineMessageMediaContact_param_last_name_type_string' => 'Last name', 'object_botInlineMessageMediaContact_param_reply_markup_type_ReplyMarkup' => 'Reply markup', 'object_botInlineResult' => 'Bot inline result', 'object_botInlineResult_param_id_type_string' => 'ID', 'object_botInlineResult_param_type_type_string' => 'Type', 'object_botInlineResult_param_title_type_string' => 'Title', 'object_botInlineResult_param_description_type_string' => 'Description', 'object_botInlineResult_param_url_type_string' => 'URL', 'object_botInlineResult_param_thumb_url_type_string' => 'Thumbnail URL', 'object_botInlineResult_param_content_url_type_string' => 'Content URL', 'object_botInlineResult_param_content_type_type_string' => 'Content type', 'object_botInlineResult_param_w_type_int' => 'Width', 'object_botInlineResult_param_h_type_int' => 'Height', 'object_botInlineResult_param_duration_type_int' => 'Duration', 'object_botInlineResult_param_send_message_type_BotInlineMessage' => 'Message to send', 'object_botInlineMediaResult' => 'Bot inline media result', 'object_botInlineMediaResult_param_id_type_string' => 'ID', 'object_botInlineMediaResult_param_type_type_string' => 'Type', 'object_botInlineMediaResult_param_photo_type_Photo' => 'Photo', 'object_botInlineMediaResult_param_document_type_Document' => 'Document', 'object_botInlineMediaResult_param_title_type_string' => 'Title', 'object_botInlineMediaResult_param_description_type_string' => 'Description', 'object_botInlineMediaResult_param_send_message_type_BotInlineMessage' => 'Send message', 'object_messages.botResults' => 'Bot results', 'object_messages.botResults_param_gallery_type_true' => 'Gallery?', 'object_messages.botResults_param_query_id_type_long' => 'Query ID', 'object_messages.botResults_param_next_offset_type_string' => 'Next offset', 'object_messages.botResults_param_switch_pm_type_InlineBotSwitchPM' => 'Switch pm', 'object_messages.botResults_param_results_type_Vector t' => 'Results', 'object_messages.botResults_param_cache_time_type_int' => 'Cache time', 'object_messages.botResults_param_users_type_Vector t' => 'Users', 'object_exportedMessageLink' => 'Exported message link', 'object_exportedMessageLink_param_link_type_string' => 'Link', 'object_exportedMessageLink_param_html_type_string' => 'Html', 'object_messageFwdHeader' => 'Forwarded message info', 'object_messageFwdHeader_param_from_id_type_int' => 'From ID', 'object_messageFwdHeader_param_date_type_int' => 'Date', 'object_messageFwdHeader_param_channel_id_type_int' => 'Channel ID', 'object_messageFwdHeader_param_channel_post_type_int' => 'Channel post', 'object_messageFwdHeader_param_post_author_type_string' => 'Post author', 'object_messageFwdHeader_param_saved_from_peer_type_Peer' => 'Saved from peer', 'object_messageFwdHeader_param_saved_from_msg_id_type_int' => 'Saved from msg ID', 'object_auth.codeTypeSms' => 'Auth code type: SMS', 'object_auth.codeTypeCall' => 'Auth code type: call', 'object_auth.codeTypeFlashCall' => 'Auth code type: flash call', 'object_auth.sentCodeTypeApp' => 'Sent code type app', 'object_auth.sentCodeTypeApp_param_length_type_int' => 'Length', 'object_auth.sentCodeTypeSms' => 'Sent code type sms', 'object_auth.sentCodeTypeSms_param_length_type_int' => 'Length', 'object_auth.sentCodeTypeCall' => 'Sent code type call', 'object_auth.sentCodeTypeCall_param_length_type_int' => 'Length', 'object_auth.sentCodeTypeFlashCall' => 'Sent code type flash call', 'object_auth.sentCodeTypeFlashCall_param_pattern_type_string' => 'Pattern', 'object_messages.botCallbackAnswer' => 'Bot callback answer', 'object_messages.botCallbackAnswer_param_alert_type_true' => 'Alert?', 'object_messages.botCallbackAnswer_param_has_url_type_true' => 'Has URL?', 'object_messages.botCallbackAnswer_param_native_ui_type_true' => 'Native ui?', 'object_messages.botCallbackAnswer_param_message_type_string' => 'Message', 'object_messages.botCallbackAnswer_param_url_type_string' => 'URL', 'object_messages.botCallbackAnswer_param_cache_time_type_int' => 'Cache time', 'object_messages.messageEditData' => 'Message edit data', 'object_messages.messageEditData_param_caption_type_true' => 'Caption?', 'object_inputBotInlineMessageID' => 'Bot inline message ID', 'object_inputBotInlineMessageID_param_dc_id_type_int' => 'DC ID', 'object_inputBotInlineMessageID_param_id_type_long' => 'ID', 'object_inputBotInlineMessageID_param_access_hash_type_long' => 'Access hash', 'object_inlineBotSwitchPM' => 'Inline bot switch pm', 'object_inlineBotSwitchPM_param_text_type_string' => 'Text', 'object_inlineBotSwitchPM_param_start_param_type_string' => 'Start param', 'object_messages.peerDialogs' => 'Peer dialogs', 'object_messages.peerDialogs_param_dialogs_type_Vector t' => 'Dialogs', 'object_messages.peerDialogs_param_messages_type_Vector t' => 'Messages', 'object_messages.peerDialogs_param_chats_type_Vector t' => 'Chats', 'object_messages.peerDialogs_param_users_type_Vector t' => 'Users', 'object_messages.peerDialogs_param_state_type_updates.State' => 'State', 'object_topPeer' => 'Top peer', 'object_topPeer_param_peer_type_Peer' => 'Peer', 'object_topPeer_param_rating_type_double' => 'Rating', 'object_topPeerCategoryBotsPM' => 'Top peer category bots pm', 'object_topPeerCategoryBotsInline' => 'Top peer category bots inline', 'object_topPeerCategoryCorrespondents' => 'Top peer category correspondents', 'object_topPeerCategoryGroups' => 'Top peer category groups', 'object_topPeerCategoryChannels' => 'Top peer category channels', 'object_topPeerCategoryPhoneCalls' => 'Top peer category phone calls', 'object_topPeerCategoryPeers' => 'Top peer category peers', 'object_topPeerCategoryPeers_param_category_type_TopPeerCategory' => 'Category', 'object_topPeerCategoryPeers_param_count_type_int' => 'Count', 'object_topPeerCategoryPeers_param_peers_type_Vector t' => 'Peers', 'object_contacts.topPeersNotModified' => 'Top peers not modified', 'object_contacts.topPeers' => 'Top peers', 'object_contacts.topPeers_param_categories_type_Vector t' => 'Categories', 'object_contacts.topPeers_param_chats_type_Vector t' => 'Chats', 'object_contacts.topPeers_param_users_type_Vector t' => 'Users', 'object_draftMessageEmpty' => 'Empty draft message', 'object_draftMessage' => 'Draft message', 'object_draftMessage_param_no_webpage_type_true' => 'No webpage?', 'object_draftMessage_param_reply_to_msg_id_type_int' => 'Reply to msg ID', 'object_draftMessage_param_message_type_string' => 'Message', 'object_draftMessage_param_entities_type_Vector t' => 'Entities', 'object_draftMessage_param_date_type_int' => 'Date', 'object_messages.featuredStickersNotModified' => 'Featured stickers not modified', 'object_messages.featuredStickers' => 'Featured stickers', 'object_messages.featuredStickers_param_hash_type_int' => 'Hash', 'object_messages.featuredStickers_param_sets_type_Vector t' => 'Sets', 'object_messages.featuredStickers_param_unread_type_Vector t' => 'Unread', 'object_messages.recentStickersNotModified' => 'Recent stickers not modified', 'object_messages.recentStickers' => 'Recent stickers', 'object_messages.recentStickers_param_hash_type_int' => 'Hash', 'object_messages.recentStickers_param_stickers_type_Vector t' => 'Stickers', 'object_messages.archivedStickers' => 'Archived stickers', 'object_messages.archivedStickers_param_count_type_int' => 'Count', 'object_messages.archivedStickers_param_sets_type_Vector t' => 'Sets', 'object_messages.stickerSetInstallResultSuccess' => 'Sticker set install result success', 'object_messages.stickerSetInstallResultArchive' => 'Sticker set install result archive', 'object_messages.stickerSetInstallResultArchive_param_sets_type_Vector t' => 'Sets', 'object_stickerSetCovered' => 'Sticker set covered', 'object_stickerSetCovered_param_set_type_StickerSet' => 'Set', 'object_stickerSetCovered_param_cover_type_Document' => 'Cover', 'object_stickerSetMultiCovered' => 'Sticker set multi covered', 'object_stickerSetMultiCovered_param_set_type_StickerSet' => 'Set', 'object_stickerSetMultiCovered_param_covers_type_Vector t' => 'Covers', 'object_maskCoords' => 'Mask coords', 'object_maskCoords_param_n_type_int' => 'N', 'object_maskCoords_param_x_type_double' => 'X', 'object_maskCoords_param_y_type_double' => 'Y', 'object_maskCoords_param_zoom_type_double' => 'Zoom', 'object_inputStickeredMediaPhoto' => 'Stickered media photo', 'object_inputStickeredMediaPhoto_param_id_type_InputPhoto' => 'ID', 'object_inputStickeredMediaDocument' => 'Stickered media document', 'object_inputStickeredMediaDocument_param_id_type_InputDocument' => 'ID', 'object_game' => 'Game', 'object_game_param_id_type_long' => 'ID', 'object_game_param_access_hash_type_long' => 'Access hash', 'object_game_param_short_name_type_string' => 'Short name', 'object_game_param_title_type_string' => 'Title', 'object_game_param_description_type_string' => 'Description', 'object_game_param_photo_type_Photo' => 'Photo', 'object_game_param_document_type_Document' => 'Document', 'object_inputGameID' => 'Game ID', 'object_inputGameID_param_id_type_long' => 'ID', 'object_inputGameID_param_access_hash_type_long' => 'Access hash', 'object_inputGameShortName' => 'Game short name', 'object_inputGameShortName_param_bot_id_type_InputUser' => 'Bot ID', 'object_inputGameShortName_param_short_name_type_string' => 'Short name', 'object_highScore' => 'High score', 'object_highScore_param_pos_type_int' => 'Pos', 'object_highScore_param_user_id_type_int' => 'User ID', 'object_highScore_param_score_type_int' => 'Score', 'object_messages.highScores' => 'High scores', 'object_messages.highScores_param_scores_type_Vector t' => 'Scores', 'object_messages.highScores_param_users_type_Vector t' => 'Users', 'object_textEmpty' => 'Empty text', 'object_textPlain' => 'Text plain', 'object_textPlain_param_text_type_string' => 'Text', 'object_textBold' => 'Text bold', 'object_textBold_param_text_type_RichText' => 'Text', 'object_textItalic' => 'Text italic', 'object_textItalic_param_text_type_RichText' => 'Text', 'object_textUnderline' => 'Text underline', 'object_textUnderline_param_text_type_RichText' => 'Text', 'object_textStrike' => 'Text strike', 'object_textStrike_param_text_type_RichText' => 'Text', 'object_textFixed' => 'Text fixed', 'object_textFixed_param_text_type_RichText' => 'Text', 'object_textUrl' => 'Text URL', 'object_textUrl_param_text_type_RichText' => 'Text', 'object_textUrl_param_url_type_string' => 'URL', 'object_textUrl_param_webpage_id_type_long' => 'Webpage ID', 'object_textEmail' => 'Text email', 'object_textEmail_param_text_type_RichText' => 'Text', 'object_textEmail_param_email_type_string' => 'Email', 'object_textConcat' => 'Text concat', 'object_textConcat_param_texts_type_Vector t' => 'Texts', 'object_pageBlockUnsupported' => 'Page block unsupported', 'object_pageBlockTitle' => 'Page block title', 'object_pageBlockTitle_param_text_type_RichText' => 'Text', 'object_pageBlockSubtitle' => 'Page block subtitle', 'object_pageBlockSubtitle_param_text_type_RichText' => 'Text', 'object_pageBlockAuthorDate' => 'Page block author date', 'object_pageBlockAuthorDate_param_author_type_RichText' => 'Author', 'object_pageBlockAuthorDate_param_published_date_type_int' => 'Published date', 'object_pageBlockHeader' => 'Page block header', 'object_pageBlockHeader_param_text_type_RichText' => 'Text', 'object_pageBlockSubheader' => 'Page block subheader', 'object_pageBlockSubheader_param_text_type_RichText' => 'Text', 'object_pageBlockFooter' => 'Page block footer', 'object_pageBlockFooter_param_text_type_RichText' => 'Text', 'object_pageBlockList' => 'Page block list', 'object_pageBlockList_param_ordered_type_Bool' => 'Ordered?', 'object_pageBlockList_param_items_type_Vector t' => 'Items', 'object_pageBlockBlockquote' => 'Page block blockquote', 'object_pageBlockBlockquote_param_text_type_RichText' => 'Text', 'object_pageBlockBlockquote_param_caption_type_RichText' => 'Caption', 'object_pageBlockPullquote' => 'Page block pullquote', 'object_pageBlockPullquote_param_text_type_RichText' => 'Text', 'object_pageBlockPullquote_param_caption_type_RichText' => 'Caption', 'object_pageBlockPhoto' => 'Page block photo', 'object_pageBlockPhoto_param_photo_id_type_long' => 'Photo ID', 'object_pageBlockPhoto_param_caption_type_RichText' => 'Caption', 'object_pageBlockVideo' => 'Page block video', 'object_pageBlockVideo_param_autoplay_type_true' => 'Autoplay?', 'object_pageBlockVideo_param_loop_type_true' => 'Loop?', 'object_pageBlockVideo_param_video_id_type_long' => 'Video ID', 'object_pageBlockVideo_param_caption_type_RichText' => 'Caption', 'object_pageBlockEmbed' => 'Page block embed', 'object_pageBlockEmbed_param_full_width_type_true' => 'Full width?', 'object_pageBlockEmbed_param_allow_scrolling_type_true' => 'Allow scrolling?', 'object_pageBlockEmbed_param_url_type_string' => 'URL', 'object_pageBlockEmbed_param_html_type_string' => 'Html', 'object_pageBlockEmbed_param_poster_photo_id_type_long' => 'Poster photo ID', 'object_pageBlockEmbed_param_w_type_int' => 'Width', 'object_pageBlockEmbed_param_h_type_int' => 'Height', 'object_pageBlockEmbed_param_caption_type_RichText' => 'Caption', 'object_pageBlockEmbedPost' => 'Page block embed post', 'object_pageBlockEmbedPost_param_url_type_string' => 'URL', 'object_pageBlockEmbedPost_param_webpage_id_type_long' => 'Webpage ID', 'object_pageBlockEmbedPost_param_author_photo_id_type_long' => 'Author photo ID', 'object_pageBlockEmbedPost_param_author_type_string' => 'Author', 'object_pageBlockEmbedPost_param_date_type_int' => 'Date', 'object_pageBlockEmbedPost_param_blocks_type_Vector t' => 'Blocks', 'object_pageBlockEmbedPost_param_caption_type_RichText' => 'Caption', 'object_pageBlockCollage' => 'Page block collage', 'object_pageBlockCollage_param_items_type_Vector t' => 'Items', 'object_pageBlockCollage_param_caption_type_RichText' => 'Caption', 'object_pageBlockSlideshow' => 'Page block slideshow', 'object_pageBlockSlideshow_param_items_type_Vector t' => 'Items', 'object_pageBlockSlideshow_param_caption_type_RichText' => 'Caption', 'object_pageBlockChannel' => 'Page block channel', 'object_pageBlockChannel_param_channel_type_Chat' => 'Channel', 'object_pageBlockAudio' => 'Page block audio', 'object_pageBlockAudio_param_audio_id_type_long' => 'Audio ID', 'object_pageBlockAudio_param_caption_type_RichText' => 'Caption', 'object_pagePart' => 'Page part', 'object_pagePart_param_blocks_type_Vector t' => 'Blocks', 'object_pagePart_param_photos_type_Vector t' => 'Photos', 'object_pagePart_param_documents_type_Vector t' => 'Documents', 'object_pageFull' => 'Page full', 'object_pageFull_param_blocks_type_Vector t' => 'Blocks', 'object_pageFull_param_photos_type_Vector t' => 'Photos', 'object_pageFull_param_documents_type_Vector t' => 'Documents', 'object_phoneCallDiscardReasonMissed' => 'Phone call discard reason missed', 'object_phoneCallDiscardReasonDisconnect' => 'Phone call discard reason disconnect', 'object_phoneCallDiscardReasonHangup' => 'Phone call discard reason hangup', 'object_phoneCallDiscardReasonBusy' => 'Phone call discard reason busy', 'object_dataJSON' => 'Data json', 'object_dataJSON_param_data_type_string' => 'Data', 'object_labeledPrice' => 'Labeled price', 'object_labeledPrice_param_label_type_string' => 'Label', 'object_labeledPrice_param_amount_type_long' => 'Amount', 'object_invoice' => 'Invoice', 'object_invoice_param_test_type_true' => 'Test?', 'object_invoice_param_name_requested_type_true' => 'Name requested?', 'object_invoice_param_phone_requested_type_true' => 'Phone requested?', 'object_invoice_param_email_requested_type_true' => 'Email requested?', 'object_invoice_param_shipping_address_requested_type_true' => 'Shipping address requested?', 'object_invoice_param_flexible_type_true' => 'Flexible?', 'object_invoice_param_phone_to_provider_type_true' => 'Phone to provider?', 'object_invoice_param_email_to_provider_type_true' => 'Email to provider?', 'object_invoice_param_currency_type_string' => 'Currency', 'object_invoice_param_prices_type_Vector t' => 'Prices', 'object_paymentCharge' => 'Payment charge', 'object_paymentCharge_param_id_type_string' => 'ID', 'object_paymentCharge_param_provider_charge_id_type_string' => 'Provider charge ID', 'object_postAddress' => 'Post address', 'object_postAddress_param_street_line1_type_string' => 'Street line1', 'object_postAddress_param_street_line2_type_string' => 'Street line2', 'object_postAddress_param_city_type_string' => 'City', 'object_postAddress_param_state_type_string' => 'State', 'object_postAddress_param_country_iso2_type_string' => 'Country iso2', 'object_postAddress_param_post_code_type_string' => 'Post code', 'object_paymentRequestedInfo' => 'Payment requested info', 'object_paymentRequestedInfo_param_name_type_string' => 'Name', 'object_paymentRequestedInfo_param_phone_type_string' => 'Phone', 'object_paymentRequestedInfo_param_email_type_string' => 'Email', 'object_paymentRequestedInfo_param_shipping_address_type_PostAddress' => 'Shipping address', 'object_paymentSavedCredentialsCard' => 'Payment saved credentials card', 'object_paymentSavedCredentialsCard_param_id_type_string' => 'ID', 'object_paymentSavedCredentialsCard_param_title_type_string' => 'Title', 'object_webDocument' => 'Web document', 'object_webDocument_param_url_type_string' => 'URL', 'object_webDocument_param_access_hash_type_long' => 'Access hash', 'object_webDocument_param_size_type_int' => 'Size', 'object_webDocument_param_mime_type_type_string' => 'Mime type', 'object_webDocument_param_attributes_type_Vector t' => 'Attributes', 'object_webDocument_param_dc_id_type_int' => 'DC ID', 'object_inputWebDocument' => 'Web document', 'object_inputWebDocument_param_url_type_string' => 'URL', 'object_inputWebDocument_param_size_type_int' => 'Size', 'object_inputWebDocument_param_mime_type_type_string' => 'Mime type', 'object_inputWebDocument_param_attributes_type_Vector t' => 'Attributes', 'object_inputWebFileLocation' => 'Web file location', 'object_inputWebFileLocation_param_url_type_string' => 'URL', 'object_inputWebFileLocation_param_access_hash_type_long' => 'Access hash', 'object_upload.webFile' => 'Web file', 'object_upload.webFile_param_size_type_int' => 'Size', 'object_upload.webFile_param_mime_type_type_string' => 'Mime type', 'object_upload.webFile_param_file_type_type_storage.FileType' => 'File type', 'object_upload.webFile_param_mtime_type_int' => 'Mtime', 'object_upload.webFile_param_bytes_type_bytes' => 'Bytes', 'object_payments.paymentForm' => 'Payment form', 'object_payments.paymentForm_param_can_save_credentials_type_true' => 'Can save credentials?', 'object_payments.paymentForm_param_password_missing_type_true' => 'Password missing?', 'object_payments.paymentForm_param_bot_id_type_int' => 'Bot ID', 'object_payments.paymentForm_param_invoice_type_Invoice' => 'Invoice', 'object_payments.paymentForm_param_provider_id_type_int' => 'Provider ID', 'object_payments.paymentForm_param_url_type_string' => 'URL', 'object_payments.paymentForm_param_native_provider_type_string' => 'Native provider', 'object_payments.paymentForm_param_native_params_type_DataJSON' => 'Native params', 'object_payments.paymentForm_param_saved_info_type_PaymentRequestedInfo' => 'Saved info', 'object_payments.paymentForm_param_saved_credentials_type_PaymentSavedCredentials' => 'Saved credentials', 'object_payments.paymentForm_param_users_type_Vector t' => 'Users', 'object_payments.validatedRequestedInfo' => 'Validated requested info', 'object_payments.validatedRequestedInfo_param_id_type_string' => 'ID', 'object_payments.validatedRequestedInfo_param_shipping_options_type_Vector t' => 'Shipping options', 'object_payments.paymentResult' => 'Payment result', 'object_payments.paymentResult_param_updates_type_Updates' => 'Updates', 'object_payments.paymentVerficationNeeded' => 'Payment verfication needed', 'object_payments.paymentVerficationNeeded_param_url_type_string' => 'URL', 'object_payments.paymentReceipt' => 'Payment receipt', 'object_payments.paymentReceipt_param_date_type_int' => 'Date', 'object_payments.paymentReceipt_param_bot_id_type_int' => 'Bot ID', 'object_payments.paymentReceipt_param_invoice_type_Invoice' => 'Invoice', 'object_payments.paymentReceipt_param_provider_id_type_int' => 'Provider ID', 'object_payments.paymentReceipt_param_info_type_PaymentRequestedInfo' => 'Info', 'object_payments.paymentReceipt_param_shipping_type_ShippingOption' => 'Shipping', 'object_payments.paymentReceipt_param_currency_type_string' => 'Currency', 'object_payments.paymentReceipt_param_total_amount_type_long' => 'Total amount', 'object_payments.paymentReceipt_param_credentials_title_type_string' => 'Credentials title', 'object_payments.paymentReceipt_param_users_type_Vector t' => 'Users', 'object_payments.savedInfo' => 'Saved info', 'object_payments.savedInfo_param_has_saved_credentials_type_true' => 'Has saved credentials?', 'object_payments.savedInfo_param_saved_info_type_PaymentRequestedInfo' => 'Saved info', 'object_inputPaymentCredentialsSaved' => 'Payment credentials saved', 'object_inputPaymentCredentialsSaved_param_id_type_string' => 'ID', 'object_inputPaymentCredentialsSaved_param_tmp_password_type_bytes' => 'Tmp password', 'object_inputPaymentCredentials' => 'Payment credentials', 'object_inputPaymentCredentials_param_save_type_true' => 'Save?', 'object_inputPaymentCredentials_param_data_type_DataJSON' => 'Data', 'object_inputPaymentCredentialsApplePay' => 'Payment credentials apple pay', 'object_inputPaymentCredentialsApplePay_param_payment_data_type_DataJSON' => 'Payment data', 'object_inputPaymentCredentialsAndroidPay' => 'Payment credentials android pay', 'object_inputPaymentCredentialsAndroidPay_param_payment_token_type_DataJSON' => 'Payment token', 'object_inputPaymentCredentialsAndroidPay_param_google_transaction_id_type_string' => 'Google transaction ID', 'object_account.tmpPassword' => 'Tmp password', 'object_account.tmpPassword_param_tmp_password_type_bytes' => 'Tmp password', 'object_account.tmpPassword_param_valid_until_type_int' => 'Valid until', 'object_shippingOption' => 'Shipping option', 'object_shippingOption_param_id_type_string' => 'ID', 'object_shippingOption_param_title_type_string' => 'Title', 'object_shippingOption_param_prices_type_Vector t' => 'Prices', 'object_inputStickerSetItem' => 'Sticker set item', 'object_inputStickerSetItem_param_document_type_InputDocument' => 'Document', 'object_inputStickerSetItem_param_emoji_type_string' => 'Emoji', 'object_inputStickerSetItem_param_mask_coords_type_MaskCoords' => 'Mask coords', 'object_inputPhoneCall' => 'Phone call', 'object_inputPhoneCall_param_id_type_long' => 'ID', 'object_inputPhoneCall_param_access_hash_type_long' => 'Access hash', 'object_phoneCallEmpty' => 'Empty phone call', 'object_phoneCallEmpty_param_id_type_long' => 'ID', 'object_phoneCallWaiting' => 'Phone call waiting', 'object_phoneCallWaiting_param_id_type_long' => 'ID', 'object_phoneCallWaiting_param_access_hash_type_long' => 'Access hash', 'object_phoneCallWaiting_param_date_type_int' => 'Date', 'object_phoneCallWaiting_param_admin_id_type_int' => 'Admin ID', 'object_phoneCallWaiting_param_participant_id_type_int' => 'Participant ID', 'object_phoneCallWaiting_param_protocol_type_PhoneCallProtocol' => 'Protocol', 'object_phoneCallWaiting_param_receive_date_type_int' => 'Receive date', 'object_phoneCallRequested' => 'Phone call requested', 'object_phoneCallRequested_param_id_type_long' => 'ID', 'object_phoneCallRequested_param_access_hash_type_long' => 'Access hash', 'object_phoneCallRequested_param_date_type_int' => 'Date', 'object_phoneCallRequested_param_admin_id_type_int' => 'Admin ID', 'object_phoneCallRequested_param_participant_id_type_int' => 'Participant ID', 'object_phoneCallRequested_param_g_a_hash_type_bytes' => 'G a hash', 'object_phoneCallRequested_param_protocol_type_PhoneCallProtocol' => 'Protocol', 'object_phoneCallAccepted' => 'Phone call accepted', 'object_phoneCallAccepted_param_id_type_long' => 'ID', 'object_phoneCallAccepted_param_access_hash_type_long' => 'Access hash', 'object_phoneCallAccepted_param_date_type_int' => 'Date', 'object_phoneCallAccepted_param_admin_id_type_int' => 'Admin ID', 'object_phoneCallAccepted_param_participant_id_type_int' => 'Participant ID', 'object_phoneCallAccepted_param_g_b_type_bytes' => 'G b', 'object_phoneCallAccepted_param_protocol_type_PhoneCallProtocol' => 'Protocol', 'object_phoneCall' => 'Phone call', 'object_phoneCall_param_id_type_long' => 'ID', 'object_phoneCall_param_access_hash_type_long' => 'Access hash', 'object_phoneCall_param_date_type_int' => 'Date', 'object_phoneCall_param_admin_id_type_int' => 'Admin ID', 'object_phoneCall_param_participant_id_type_int' => 'Participant ID', 'object_phoneCall_param_g_a_or_b_type_bytes' => 'G a or b', 'object_phoneCall_param_key_fingerprint_type_long' => 'Key fingerprint', 'object_phoneCall_param_protocol_type_PhoneCallProtocol' => 'Protocol', 'object_phoneCall_param_connection_type_PhoneConnection' => 'Connection', 'object_phoneCall_param_alternative_connections_type_Vector t' => 'Alternative connections', 'object_phoneCall_param_start_date_type_int' => 'Start date', 'object_phoneCallDiscarded' => 'Phone call discarded', 'object_phoneCallDiscarded_param_need_rating_type_true' => 'Need rating?', 'object_phoneCallDiscarded_param_need_debug_type_true' => 'Need debug?', 'object_phoneCallDiscarded_param_id_type_long' => 'ID', 'object_phoneCallDiscarded_param_reason_type_PhoneCallDiscardReason' => 'Reason', 'object_phoneCallDiscarded_param_duration_type_int' => 'Duration', 'object_phoneConnection' => 'Phone connection', 'object_phoneConnection_param_id_type_long' => 'ID', 'object_phoneConnection_param_ip_type_string' => 'Ip', 'object_phoneConnection_param_ipv6_type_string' => 'Ipv6', 'object_phoneConnection_param_port_type_int' => 'Port', 'object_phoneConnection_param_peer_tag_type_bytes' => 'Peer tag', 'object_phoneCallProtocol' => 'Phone call protocol', 'object_phoneCallProtocol_param_udp_p2p_type_true' => 'Udp p2p?', 'object_phoneCallProtocol_param_udp_reflector_type_true' => 'Udp reflector?', 'object_phoneCallProtocol_param_min_layer_type_int' => 'Min layer', 'object_phoneCallProtocol_param_max_layer_type_int' => 'Max layer', 'object_phone.phoneCall' => 'Phone call', 'object_phone.phoneCall_param_phone_call_type_PhoneCall' => 'Phone call', 'object_phone.phoneCall_param_users_type_Vector t' => 'Users', 'object_upload.cdnFileReuploadNeeded' => 'Cdn file reupload needed', 'object_upload.cdnFileReuploadNeeded_param_request_token_type_bytes' => 'Request token', 'object_upload.cdnFile' => 'Cdn file', 'object_upload.cdnFile_param_bytes_type_bytes' => 'Bytes', 'object_cdnPublicKey' => 'Cdn public key', 'object_cdnPublicKey_param_dc_id_type_int' => 'DC ID', 'object_cdnPublicKey_param_public_key_type_string' => 'Public key', 'object_cdnConfig' => 'CDN configuration', 'object_cdnConfig_param_public_keys_type_Vector t' => 'Public keys', 'object_langPackString' => 'Lang pack string', 'object_langPackString_param_key_type_string' => 'Key', 'object_langPackString_param_value_type_string' => 'Value', 'object_langPackStringPluralized' => 'Lang pack string pluralized', 'object_langPackStringPluralized_param_key_type_string' => 'Key', 'object_langPackStringPluralized_param_zero_value_type_string' => 'Zero value', 'object_langPackStringPluralized_param_one_value_type_string' => 'One value', 'object_langPackStringPluralized_param_two_value_type_string' => 'Two value', 'object_langPackStringPluralized_param_few_value_type_string' => 'Few value', 'object_langPackStringPluralized_param_many_value_type_string' => 'Many value', 'object_langPackStringPluralized_param_other_value_type_string' => 'Other value', 'object_langPackStringDeleted' => 'Lang pack string deleted', 'object_langPackStringDeleted_param_key_type_string' => 'Key', 'object_langPackDifference' => 'Lang pack difference', 'object_langPackDifference_param_lang_code_type_string' => 'Lang code', 'object_langPackDifference_param_from_version_type_int' => 'From version', 'object_langPackDifference_param_version_type_int' => 'Version', 'object_langPackDifference_param_strings_type_Vector t' => 'Strings', 'object_langPackLanguage' => 'Lang pack language', 'object_langPackLanguage_param_name_type_string' => 'Name', 'object_langPackLanguage_param_native_name_type_string' => 'Native name', 'object_langPackLanguage_param_lang_code_type_string' => 'Lang code', 'object_channelAdminRights' => 'Admin rights', 'object_channelAdminRights_param_change_info_type_true' => 'Change info', 'object_channelAdminRights_param_post_messages_type_true' => 'Post messages', 'object_channelAdminRights_param_edit_messages_type_true' => 'Edit messages', 'object_channelAdminRights_param_delete_messages_type_true' => 'Delete messages', 'object_channelAdminRights_param_ban_users_type_true' => 'Ban users', 'object_channelAdminRights_param_invite_users_type_true' => 'Invite users', 'object_channelAdminRights_param_invite_link_type_true' => 'Generate an invite link', 'object_channelAdminRights_param_pin_messages_type_true' => 'Pin messages', 'object_channelAdminRights_param_add_admins_type_true' => 'Add other admins', 'object_channelBannedRights' => 'Banned user rights (when true, the user will NOT be able to do that thing)', 'object_channelBannedRights_param_view_messages_type_true' => 'Disallow viewing messages', 'object_channelBannedRights_param_send_messages_type_true' => 'Disallow sending messages', 'object_channelBannedRights_param_send_media_type_true' => 'Disallow sending media', 'object_channelBannedRights_param_send_stickers_type_true' => 'Disallow sending stickers', 'object_channelBannedRights_param_send_gifs_type_true' => 'Disallow sending gifs', 'object_channelBannedRights_param_send_games_type_true' => 'Disallow sending games', 'object_channelBannedRights_param_send_inline_type_true' => 'Disallow sending inline keyboards', 'object_channelBannedRights_param_embed_links_type_true' => 'Disallow embedding links', 'object_channelBannedRights_param_until_date_type_int' => 'Until date', 'object_channelAdminLogEventActionChangeTitle' => 'Change title', 'object_channelAdminLogEventActionChangeTitle_param_prev_value_type_string' => 'Previous value', 'object_channelAdminLogEventActionChangeTitle_param_new_value_type_string' => 'New value', 'object_channelAdminLogEventActionChangeAbout' => 'Change about text', 'object_channelAdminLogEventActionChangeAbout_param_prev_value_type_string' => 'Previous value', 'object_channelAdminLogEventActionChangeAbout_param_new_value_type_string' => 'New value', 'object_channelAdminLogEventActionChangeUsername' => 'Change username', 'object_channelAdminLogEventActionChangeUsername_param_prev_value_type_string' => 'Prev value', 'object_channelAdminLogEventActionChangeUsername_param_new_value_type_string' => 'New value', 'object_channelAdminLogEventActionChangePhoto' => 'Change photo', 'object_channelAdminLogEventActionChangePhoto_param_prev_photo_type_ChatPhoto' => 'Previous photo', 'object_channelAdminLogEventActionChangePhoto_param_new_photo_type_ChatPhoto' => 'New photo', 'object_channelAdminLogEventActionToggleInvites' => 'Invite setting toggled', 'object_channelAdminLogEventActionToggleInvites_param_new_value_type_Bool' => 'New value', 'object_channelAdminLogEventActionToggleSignatures' => 'Toggle channel signatures', 'object_channelAdminLogEventActionToggleSignatures_param_new_value_type_Bool' => 'New value?', 'object_channelAdminLogEventActionUpdatePinned' => 'Message pinned', 'object_channelAdminLogEventActionUpdatePinned_param_message_type_Message' => 'Message', 'object_channelAdminLogEventActionEditMessage' => 'Edit message', 'object_channelAdminLogEventActionEditMessage_param_prev_message_type_Message' => 'Prev message', 'object_channelAdminLogEventActionEditMessage_param_new_message_type_Message' => 'New message', 'object_channelAdminLogEventActionDeleteMessage' => 'Delete message', 'object_channelAdminLogEventActionDeleteMessage_param_message_type_Message' => 'Message', 'object_channelAdminLogEventActionParticipantJoin' => 'Joined participant', 'object_channelAdminLogEventActionParticipantLeave' => 'Left participant', 'object_channelAdminLogEventActionParticipantInvite' => 'Invite participant', 'object_channelAdminLogEventActionParticipantInvite_param_participant_type_ChannelParticipant' => 'Participant', 'object_channelAdminLogEventActionParticipantToggleBan' => 'User banned', 'object_channelAdminLogEventActionParticipantToggleBan_param_prev_participant_type_ChannelParticipant' => 'Prev participant', 'object_channelAdminLogEventActionParticipantToggleBan_param_new_participant_type_ChannelParticipant' => 'New participant', 'object_channelAdminLogEventActionParticipantToggleAdmin' => 'Admin toggled', 'object_channelAdminLogEventActionParticipantToggleAdmin_param_prev_participant_type_ChannelParticipant' => 'Prev participant', 'object_channelAdminLogEventActionParticipantToggleAdmin_param_new_participant_type_ChannelParticipant' => 'New participant', 'object_channelAdminLogEventActionChangeStickerSet' => 'Change stickerset', 'object_channelAdminLogEventActionChangeStickerSet_param_prev_stickerset_type_InputStickerSet' => 'Previous stickerset', 'object_channelAdminLogEventActionChangeStickerSet_param_new_stickerset_type_InputStickerSet' => 'New stickerset', 'object_channelAdminLogEventActionTogglePreHistoryHidden' => 'Previous history hidden', 'object_channelAdminLogEventActionTogglePreHistoryHidden_param_new_value_type_Bool' => 'New value', 'object_channelAdminLogEvent' => 'Channel admin log event', 'object_channelAdminLogEvent_param_id_type_long' => 'ID', 'object_channelAdminLogEvent_param_date_type_int' => 'Date', 'object_channelAdminLogEvent_param_user_id_type_int' => 'User ID', 'object_channelAdminLogEvent_param_action_type_ChannelAdminLogEventAction' => 'Action', 'object_channels.adminLogResults' => 'Admin log results', 'object_channels.adminLogResults_param_events_type_Vector t' => 'Events', 'object_channels.adminLogResults_param_chats_type_Vector t' => 'Chats', 'object_channels.adminLogResults_param_users_type_Vector t' => 'Users', 'object_channelAdminLogEventsFilter' => 'Event filter', 'object_channelAdminLogEventsFilter_param_join_type_true' => 'Join users events', 'object_channelAdminLogEventsFilter_param_leave_type_true' => 'Left users events', 'object_channelAdminLogEventsFilter_param_invite_type_true' => 'Invite users events', 'object_channelAdminLogEventsFilter_param_ban_type_true' => 'Ban events', 'object_channelAdminLogEventsFilter_param_unban_type_true' => 'Unban events', 'object_channelAdminLogEventsFilter_param_kick_type_true' => 'Kicked users events', 'object_channelAdminLogEventsFilter_param_unkick_type_true' => 'Unkick events', 'object_channelAdminLogEventsFilter_param_promote_type_true' => 'Admin promotion events', 'object_channelAdminLogEventsFilter_param_demote_type_true' => 'Demote admin events', 'object_channelAdminLogEventsFilter_param_info_type_true' => 'Change info events', 'object_channelAdminLogEventsFilter_param_settings_type_true' => 'Setting changes', 'object_channelAdminLogEventsFilter_param_pinned_type_true' => 'Pinned message events', 'object_channelAdminLogEventsFilter_param_edit_type_true' => 'Edit message events', 'object_channelAdminLogEventsFilter_param_delete_type_true' => 'Delete message events', 'object_popularContact' => 'Popular contact', 'object_popularContact_param_client_id_type_long' => 'Client ID', 'object_popularContact_param_importers_type_int' => 'Importers', 'object_cdnFileHash' => 'CDN file hash', 'object_cdnFileHash_param_offset_type_int' => 'Offset', 'object_cdnFileHash_param_limit_type_int' => 'Limit', 'object_cdnFileHash_param_hash_type_bytes' => 'Hash', 'object_messages.favedStickersNotModified' => 'Faved stickers not modified', 'object_messages.favedStickers' => 'Faved stickers', 'object_messages.favedStickers_param_hash_type_int' => 'Hash', 'object_messages.favedStickers_param_packs_type_Vector t' => 'Packs', 'object_messages.favedStickers_param_stickers_type_Vector t' => 'Stickers', 'object_recentMeUrlUnknown' => 'Recent me URL unknown', 'object_recentMeUrlUnknown_param_url_type_string' => 'URL', 'object_recentMeUrlUser' => 'Recent me URL user', 'object_recentMeUrlUser_param_url_type_string' => 'URL', 'object_recentMeUrlUser_param_user_id_type_int' => 'User ID', 'object_recentMeUrlChat' => 'Recent me URL chat', 'object_recentMeUrlChat_param_url_type_string' => 'URL', 'object_recentMeUrlChat_param_chat_id_type_int' => 'Chat ID', 'object_recentMeUrlChatInvite' => 'Recent me URL chat invite', 'object_recentMeUrlChatInvite_param_url_type_string' => 'URL', 'object_recentMeUrlChatInvite_param_chat_invite_type_ChatInvite' => 'Chat invite', 'object_recentMeUrlStickerSet' => 'Recent me URL sticker set', 'object_recentMeUrlStickerSet_param_url_type_string' => 'URL', 'object_recentMeUrlStickerSet_param_set_type_StickerSetCovered' => 'Set', 'object_help.recentMeUrls' => 'Recent me URLs', 'object_help.recentMeUrls_param_urls_type_Vector t' => 'URLs', 'object_help.recentMeUrls_param_chats_type_Vector t' => 'Chats', 'object_help.recentMeUrls_param_users_type_Vector t' => 'Users', 'object_inputSingleMedia' => 'Single media', 'object_inputSingleMedia_param_media_type_InputMedia' => 'Media', 'object_inputSingleMedia_param_message_type_string' => 'Message', 'object_inputSingleMedia_param_entities_type_Vector t' => 'Entities', 'object_webAuthorization' => 'Web authorization', 'object_webAuthorization_param_hash_type_long' => 'Hash', 'object_webAuthorization_param_bot_id_type_int' => 'Bot ID', 'object_webAuthorization_param_domain_type_string' => 'Domain', 'object_webAuthorization_param_browser_type_string' => 'Browser', 'object_webAuthorization_param_platform_type_string' => 'Platform', 'object_webAuthorization_param_date_created_type_int' => 'Date created', 'object_webAuthorization_param_date_active_type_int' => 'Date active', 'object_webAuthorization_param_ip_type_string' => 'Ip', 'object_webAuthorization_param_region_type_string' => 'Region', 'object_account.webAuthorizations' => 'Telegram login authorizations', 'object_account.webAuthorizations_param_authorizations_type_Vector t' => 'Authorizations', 'object_account.webAuthorizations_param_users_type_Vector t' => 'Users', 'object_inputMessageID' => 'Message ID', 'object_inputMessageID_param_id_type_int' => 'ID', 'object_inputMessageReplyTo' => 'Message reply to', 'object_inputMessageReplyTo_param_id_type_int' => 'ID', 'object_inputMessagePinned' => 'Message pinned', 'object_decryptedDataBlock' => 'Decrypted data block', 'object_decryptedDataBlock_param_voice_call_id_type_int128' => 'Voice call ID', 'object_decryptedDataBlock_param_in_seq_no_type_int' => 'In seq no', 'object_decryptedDataBlock_param_out_seq_no_type_int' => 'Out seq no', 'object_decryptedDataBlock_param_recent_received_mask_type_int' => 'Recent received mask', 'object_decryptedDataBlock_param_proto_type_int' => 'Proto', 'object_decryptedDataBlock_param_extra_type_string' => 'Extra', 'object_decryptedDataBlock_param_raw_data_type_string' => 'Raw data', 'object_simpleDataBlock' => 'Simple data block', 'object_simpleDataBlock_param_raw_data_type_string' => 'Raw data', 'object_decryptedMessage' => 'Decrypted message', 'object_decryptedMessage_param_message_type_string' => 'Message', 'object_decryptedMessage_param_media_type_DecryptedMessageMedia' => 'Media', 'object_decryptedMessageService' => 'Decrypted message service', 'object_decryptedMessageService_param_action_type_DecryptedMessageAction' => 'Action', 'object_decryptedMessageMediaEmpty' => 'Empty decrypted message media', 'object_decryptedMessageMediaPhoto' => 'Decrypted message media photo', 'object_decryptedMessageMediaPhoto_param_thumb_type_bytes' => 'Thumbnail', 'object_decryptedMessageMediaPhoto_param_thumb_w_type_int' => 'Thumbnail width', 'object_decryptedMessageMediaPhoto_param_thumb_h_type_int' => 'Thumbnail height', 'object_decryptedMessageMediaPhoto_param_w_type_int' => 'Width', 'object_decryptedMessageMediaPhoto_param_h_type_int' => 'Height', 'object_decryptedMessageMediaPhoto_param_size_type_int' => 'Size', 'object_decryptedMessageMediaPhoto_param_key_type_bytes' => 'Key', 'object_decryptedMessageMediaPhoto_param_iv_type_bytes' => 'Iv', 'object_decryptedMessageMediaVideo' => 'Decrypted message media video', 'object_decryptedMessageMediaVideo_param_thumb_type_bytes' => 'Thumbnail', 'object_decryptedMessageMediaVideo_param_thumb_w_type_int' => 'Thumbnail width', 'object_decryptedMessageMediaVideo_param_thumb_h_type_int' => 'Thumbnail height', 'object_decryptedMessageMediaVideo_param_duration_type_int' => 'Duration', 'object_decryptedMessageMediaVideo_param_w_type_int' => 'Width', 'object_decryptedMessageMediaVideo_param_h_type_int' => 'Height', 'object_decryptedMessageMediaVideo_param_size_type_int' => 'Size', 'object_decryptedMessageMediaVideo_param_key_type_bytes' => 'Key', 'object_decryptedMessageMediaVideo_param_iv_type_bytes' => 'Iv', 'object_decryptedMessageMediaGeoPoint' => 'Decrypted message media geo point', 'object_decryptedMessageMediaGeoPoint_param_lat_type_double' => 'Lat', 'object_decryptedMessageMediaGeoPoint_param_long_type_double' => 'Long', 'object_decryptedMessageMediaContact' => 'Decrypted message media contact', 'object_decryptedMessageMediaContact_param_phone_number_type_string' => 'Phone number', 'object_decryptedMessageMediaContact_param_first_name_type_string' => 'First name', 'object_decryptedMessageMediaContact_param_last_name_type_string' => 'Last name', 'object_decryptedMessageMediaContact_param_user_id_type_int' => 'User ID', 'object_decryptedMessageActionSetMessageTTL' => 'Decrypted message action set message ttl', 'object_decryptedMessageActionSetMessageTTL_param_ttl_seconds_type_int' => 'Ttl seconds', 'object_decryptedMessageMediaDocument' => 'Decrypted message media document', 'object_decryptedMessageMediaDocument_param_thumb_type_bytes' => 'Thumbnail', 'object_decryptedMessageMediaDocument_param_thumb_w_type_int' => 'Thumbnail w', 'object_decryptedMessageMediaDocument_param_thumb_h_type_int' => 'Thumbnail h', 'object_decryptedMessageMediaDocument_param_file_name_type_string' => 'File name', 'object_decryptedMessageMediaDocument_param_mime_type_type_string' => 'Mime type', 'object_decryptedMessageMediaDocument_param_size_type_int' => 'Size', 'object_decryptedMessageMediaDocument_param_key_type_bytes' => 'Key', 'object_decryptedMessageMediaDocument_param_iv_type_bytes' => 'Iv', 'object_decryptedMessageMediaAudio' => 'Decrypted message media audio', 'object_decryptedMessageMediaAudio_param_duration_type_int' => 'Duration', 'object_decryptedMessageMediaAudio_param_size_type_int' => 'Size', 'object_decryptedMessageMediaAudio_param_key_type_bytes' => 'Key', 'object_decryptedMessageMediaAudio_param_iv_type_bytes' => 'Iv', 'object_decryptedMessageActionReadMessages' => 'Decrypted message action read messages', 'object_decryptedMessageActionReadMessages_param_random_ids_type_Vector t' => 'Random IDs', 'object_decryptedMessageActionDeleteMessages' => 'Decrypted message action delete messages', 'object_decryptedMessageActionDeleteMessages_param_random_ids_type_Vector t' => 'Random IDs', 'object_decryptedMessageActionScreenshotMessages' => 'Decrypted message action screenshot messages', 'object_decryptedMessageActionScreenshotMessages_param_random_ids_type_Vector t' => 'Random IDs', 'object_decryptedMessageActionFlushHistory' => 'Decrypted message action flush history', 'object_decryptedMessage_param_ttl_type_int' => 'Ttl', 'object_decryptedMessageMediaVideo_param_mime_type_type_string' => 'Mime type', 'object_decryptedMessageMediaAudio_param_mime_type_type_string' => 'Mime type', 'object_decryptedMessageLayer' => 'Decrypted message layer', 'object_decryptedMessageLayer_param_layer_type_int' => 'Layer', 'object_decryptedMessageLayer_param_in_seq_no_type_int' => 'In seq no', 'object_decryptedMessageLayer_param_out_seq_no_type_int' => 'Out seq no', 'object_decryptedMessageLayer_param_message_type_DecryptedMessage' => 'Message', 'object_decryptedMessageActionResend' => 'Decrypted message action resend', 'object_decryptedMessageActionResend_param_start_seq_no_type_int' => 'Start seq no', 'object_decryptedMessageActionResend_param_end_seq_no_type_int' => 'End seq no', 'object_decryptedMessageActionNotifyLayer' => 'Decrypted message action notify layer', 'object_decryptedMessageActionNotifyLayer_param_layer_type_int' => 'Layer', 'object_decryptedMessageActionTyping' => 'Decrypted message action typing', 'object_decryptedMessageActionTyping_param_action_type_SendMessageAction' => 'Action', 'object_decryptedMessageActionRequestKey' => 'Decrypted message action request key', 'object_decryptedMessageActionRequestKey_param_exchange_id_type_long' => 'Exchange ID', 'object_decryptedMessageActionRequestKey_param_g_a_type_bytes' => 'G a', 'object_decryptedMessageActionAcceptKey' => 'Decrypted message action accept key', 'object_decryptedMessageActionAcceptKey_param_exchange_id_type_long' => 'Exchange ID', 'object_decryptedMessageActionAcceptKey_param_g_b_type_bytes' => 'G b', 'object_decryptedMessageActionAcceptKey_param_key_fingerprint_type_long' => 'Key fingerprint', 'object_decryptedMessageActionAbortKey' => 'Decrypted message action abort key', 'object_decryptedMessageActionAbortKey_param_exchange_id_type_long' => 'Exchange ID', 'object_decryptedMessageActionCommitKey' => 'Decrypted message action commit key', 'object_decryptedMessageActionCommitKey_param_exchange_id_type_long' => 'Exchange ID', 'object_decryptedMessageActionCommitKey_param_key_fingerprint_type_long' => 'Key fingerprint', 'object_decryptedMessageActionNoop' => 'Decrypted message action noop', 'object_decryptedMessageMediaExternalDocument' => 'Decrypted message media external document', 'object_decryptedMessageMediaExternalDocument_param_id_type_long' => 'ID', 'object_decryptedMessageMediaExternalDocument_param_access_hash_type_long' => 'Access hash', 'object_decryptedMessageMediaExternalDocument_param_date_type_int' => 'Date', 'object_decryptedMessageMediaExternalDocument_param_mime_type_type_string' => 'Mime type', 'object_decryptedMessageMediaExternalDocument_param_size_type_int' => 'Size', 'object_decryptedMessageMediaExternalDocument_param_thumb_type_PhotoSize' => 'Thumbnail', 'object_decryptedMessageMediaExternalDocument_param_dc_id_type_int' => 'DC ID', 'object_decryptedMessageMediaExternalDocument_param_attributes_type_Vector t' => 'Attributes', 'object_decryptedMessage_param_entities_type_Vector t' => 'Entities', 'object_decryptedMessage_param_via_bot_name_type_string' => 'Via bot name', 'object_decryptedMessage_param_reply_to_random_id_type_long' => 'Reply to random ID', 'object_decryptedMessageMediaPhoto_param_caption_type_string' => 'Caption', 'object_decryptedMessageMediaVideo_param_caption_type_string' => 'Caption', 'object_decryptedMessageMediaDocument_param_attributes_type_Vector t' => 'Attributes', 'object_decryptedMessageMediaDocument_param_caption_type_string' => 'Caption', 'object_decryptedMessageMediaVenue' => 'Decrypted message media venue', 'object_decryptedMessageMediaVenue_param_lat_type_double' => 'Lat', 'object_decryptedMessageMediaVenue_param_long_type_double' => 'Long', 'object_decryptedMessageMediaVenue_param_title_type_string' => 'Title', 'object_decryptedMessageMediaVenue_param_address_type_string' => 'Address', 'object_decryptedMessageMediaVenue_param_provider_type_string' => 'Provider', 'object_decryptedMessageMediaVenue_param_venue_id_type_string' => 'Venue ID', 'object_decryptedMessageMediaWebPage' => 'Decrypted message media web page', 'object_decryptedMessageMediaWebPage_param_url_type_string' => 'URL', 'object_decryptedMessage_param_grouped_id_type_long' => 'Grouped ID', 'object_inputPeerContact' => 'Peer contact', 'object_inputPeerContact_param_user_id_type_int' => 'User ID', 'object_inputPeerForeign' => 'Peer foreign', 'object_inputPeerForeign_param_user_id_type_int' => 'User ID', 'object_inputPeerForeign_param_access_hash_type_long' => 'Access hash', 'object_inputUserContact' => 'User contact', 'object_inputUserContact_param_user_id_type_int' => 'User ID', 'object_inputUserForeign' => 'User foreign', 'object_inputUserForeign_param_user_id_type_int' => 'User ID', 'object_inputUserForeign_param_access_hash_type_long' => 'Access hash', 'object_inputMediaUploadedVideo' => 'Media uploaded video', 'object_inputMediaUploadedVideo_param_file_type_InputFile' => 'File', 'object_inputMediaUploadedVideo_param_duration_type_int' => 'Duration', 'object_inputMediaUploadedVideo_param_w_type_int' => 'Width', 'object_inputMediaUploadedVideo_param_h_type_int' => 'Height', 'object_inputMediaUploadedVideo_param_mime_type_type_string' => 'Mime type', 'object_inputMediaUploadedThumbVideo' => 'Media uploaded thumb video', 'object_inputMediaUploadedThumbVideo_param_file_type_InputFile' => 'File', 'object_inputMediaUploadedThumbVideo_param_thumb_type_InputFile' => 'Thumbnail', 'object_inputMediaUploadedThumbVideo_param_duration_type_int' => 'Duration', 'object_inputMediaUploadedThumbVideo_param_w_type_int' => 'Width', 'object_inputMediaUploadedThumbVideo_param_h_type_int' => 'Height', 'object_inputMediaUploadedThumbVideo_param_mime_type_type_string' => 'Mime type', 'object_inputMediaVideo' => 'Media video', 'object_inputMediaVideo_param_id_type_InputVideo' => 'ID', 'object_inputChatUploadedPhoto_param_crop_type_InputPhotoCrop' => 'Crop', 'object_inputChatPhoto_param_crop_type_InputPhotoCrop' => 'Crop', 'object_inputVideoEmpty' => 'Empty input video', 'object_inputVideo' => 'Video', 'object_inputVideo_param_id_type_long' => 'ID', 'object_inputVideo_param_access_hash_type_long' => 'Access hash', 'object_inputVideoFileLocation' => 'Video file location', 'object_inputVideoFileLocation_param_id_type_long' => 'ID', 'object_inputVideoFileLocation_param_access_hash_type_long' => 'Access hash', 'object_inputPhotoCropAuto' => 'Photo crop auto', 'object_inputPhotoCrop' => 'Photo crop', 'object_inputPhotoCrop_param_crop_left_type_double' => 'Crop left', 'object_inputPhotoCrop_param_crop_top_type_double' => 'Crop top', 'object_inputPhotoCrop_param_crop_width_type_double' => 'Crop width', 'object_userSelf' => 'User self', 'object_userSelf_param_id_type_int' => 'ID', 'object_userSelf_param_first_name_type_string' => 'First name', 'object_userSelf_param_last_name_type_string' => 'Last name', 'object_userSelf_param_username_type_string' => 'Username', 'object_userSelf_param_phone_type_string' => 'Phone', 'object_userSelf_param_photo_type_UserProfilePhoto' => 'Photo', 'object_userSelf_param_status_type_UserStatus' => 'Status', 'object_userSelf_param_inactive_type_Bool' => 'Inactive?', 'object_userContact' => 'User contact', 'object_userContact_param_id_type_int' => 'ID', 'object_userContact_param_first_name_type_string' => 'First name', 'object_userContact_param_last_name_type_string' => 'Last name', 'object_userContact_param_username_type_string' => 'Username', 'object_userContact_param_access_hash_type_long' => 'Access hash', 'object_userContact_param_phone_type_string' => 'Phone', 'object_userContact_param_photo_type_UserProfilePhoto' => 'Photo', 'object_userContact_param_status_type_UserStatus' => 'Status', 'object_userRequest' => 'User request', 'object_userRequest_param_id_type_int' => 'ID', 'object_userRequest_param_first_name_type_string' => 'First name', 'object_userRequest_param_last_name_type_string' => 'Last name', 'object_userRequest_param_username_type_string' => 'Username', 'object_userRequest_param_access_hash_type_long' => 'Access hash', 'object_userRequest_param_phone_type_string' => 'Phone', 'object_userRequest_param_photo_type_UserProfilePhoto' => 'Photo', 'object_userRequest_param_status_type_UserStatus' => 'Status', 'object_userForeign' => 'User foreign', 'object_userForeign_param_id_type_int' => 'ID', 'object_userForeign_param_first_name_type_string' => 'First name', 'object_userForeign_param_last_name_type_string' => 'Last name', 'object_userForeign_param_username_type_string' => 'Username', 'object_userForeign_param_access_hash_type_long' => 'Access hash', 'object_userForeign_param_photo_type_UserProfilePhoto' => 'Photo', 'object_userForeign_param_status_type_UserStatus' => 'Status', 'object_userDeleted' => 'User deleted', 'object_userDeleted_param_id_type_int' => 'ID', 'object_userDeleted_param_first_name_type_string' => 'First name', 'object_userDeleted_param_last_name_type_string' => 'Last name', 'object_userDeleted_param_username_type_string' => 'Username', 'object_userStatusEmpty' => 'Empty user status', 'object_userStatusOnline' => 'User status online', 'object_userStatusOnline_param_expires_type_int' => 'Expires', 'object_userStatusOffline' => 'User status offline', 'object_userStatusOffline_param_was_online_type_int' => 'Was online', 'object_chat_param_left_type_Bool' => 'Left?', 'object_chatForbidden_param_date_type_int' => 'Date', 'object_chatParticipants_param_admin_id_type_int' => 'Admin ID', 'object_messageForwarded' => 'Message forwarded', 'object_messageForwarded_param_id_type_int' => 'ID', 'object_messageForwarded_param_fwd_from_id_type_int' => 'Forwarded from ID', 'object_messageForwarded_param_fwd_date_type_int' => 'Forwarded date', 'object_messageForwarded_param_from_id_type_int' => 'From ID', 'object_messageForwarded_param_to_id_type_Peer' => 'To ID', 'object_messageForwarded_param_date_type_int' => 'Date', 'object_messageForwarded_param_message_type_string' => 'Message', 'object_messageForwarded_param_media_type_MessageMedia' => 'Media', 'object_messageMediaVideo' => 'Message media video', 'object_messageMediaVideo_param_video_type_Video' => 'Video', 'object_messageMediaUnsupported_param_bytes_type_bytes' => 'Bytes', 'object_messageActionChatAddUser_param_user_id_type_int' => 'User ID', 'object_photo_param_user_id_type_int' => 'User ID', 'object_photo_param_caption_type_string' => 'Caption', 'object_photo_param_geo_type_GeoPoint' => 'Geo', 'object_videoEmpty' => 'Empty video', 'object_videoEmpty_param_id_type_long' => 'ID', 'object_video' => 'Video', 'object_video_param_id_type_long' => 'ID', 'object_video_param_access_hash_type_long' => 'Access hash', 'object_video_param_user_id_type_int' => 'User ID', 'object_video_param_date_type_int' => 'Date', 'object_video_param_caption_type_string' => 'Caption', 'object_video_param_duration_type_int' => 'Duration', 'object_video_param_mime_type_type_string' => 'Mime type', 'object_video_param_size_type_int' => 'Size', 'object_video_param_thumb_type_PhotoSize' => 'Thumbnail', 'object_video_param_dc_id_type_int' => 'DC ID', 'object_video_param_w_type_int' => 'Width', 'object_video_param_h_type_int' => 'Height', 'object_auth.checkedPhone_param_phone_invited_type_Bool' => 'Phone invited?', 'object_auth.sentCode_param_phone_registered_type_Bool' => 'Phone registered?', 'object_auth.sentCode_param_send_call_timeout_type_int' => 'Send call timeout', 'object_auth.sentCode_param_is_password_type_Bool' => 'Is password?', 'object_auth.authorization_param_expires_type_int' => 'Expiration date', 'object_inputPeerNotifySettings_param_show_previews_type_Bool' => 'Show previews?', 'object_inputPeerNotifySettings_param_events_mask_type_int' => 'Events mask', 'object_peerNotifySettings_param_show_previews_type_Bool' => 'Show previews?', 'object_peerNotifySettings_param_events_mask_type_int' => 'Events mask', 'object_userFull_param_blocked_type_Bool' => 'Blocked?', 'object_userFull_param_real_first_name_type_string' => 'Real first name', 'object_userFull_param_real_last_name_type_string' => 'Real last name', 'object_contactSuggested' => 'Contact suggested', 'object_contactSuggested_param_user_id_type_int' => 'User ID', 'object_contactSuggested_param_mutual_contacts_type_int' => 'Mutual contacts', 'object_contactStatus_param_expires_type_int' => 'Expires', 'object_contacts.foreignLinkUnknown' => 'Foreign link unknown', 'object_contacts.foreignLinkRequested' => 'Foreign link requested', 'object_contacts.foreignLinkRequested_param_has_phone_type_Bool' => 'Has phone?', 'object_contacts.foreignLinkMutual' => 'Foreign link mutual', 'object_contacts.myLinkEmpty' => 'Empty my link', 'object_contacts.myLinkRequested' => 'My link requested', 'object_contacts.myLinkRequested_param_contact_type_Bool' => 'Contact?', 'object_contacts.myLinkContact' => 'My link contact', 'object_contacts.link_param_my_link_type_contacts.MyLink' => 'My link', 'object_contacts.link_param_foreign_link_type_contacts.ForeignLink' => 'Foreign link', 'object_contacts.suggested' => 'Suggested', 'object_contacts.suggested_param_results_type_Vector t' => 'Results', 'object_contacts.suggested_param_users_type_Vector t' => 'Users', 'object_messages.statedMessages' => 'Stated messages', 'object_messages.statedMessages_param_messages_type_Vector t' => 'Messages', 'object_messages.statedMessages_param_chats_type_Vector t' => 'Chats', 'object_messages.statedMessages_param_users_type_Vector t' => 'Users', 'object_messages.statedMessages_param_pts_type_int' => 'Pts', 'object_messages.statedMessages_param_seq_type_int' => 'Seq', 'object_messages.statedMessage' => 'Stated message', 'object_messages.statedMessage_param_message_type_Message' => 'Message', 'object_messages.statedMessage_param_chats_type_Vector t' => 'Chats', 'object_messages.statedMessage_param_users_type_Vector t' => 'Users', 'object_messages.statedMessage_param_pts_type_int' => 'Pts', 'object_messages.statedMessage_param_seq_type_int' => 'Seq', 'object_messages.sentMessage' => 'Sent message', 'object_messages.sentMessage_param_id_type_int' => 'ID', 'object_messages.sentMessage_param_date_type_int' => 'Date', 'object_messages.sentMessage_param_pts_type_int' => 'Pts', 'object_messages.sentMessage_param_seq_type_int' => 'Seq', 'object_messages.chats_param_users_type_Vector t' => 'Users', 'object_messages.affectedHistory_param_seq_type_int' => 'Seq', 'object_inputMessagesFilterPhotoVideoDocuments' => 'Messages filter photo video documents', 'object_inputMessagesFilterAudio' => 'Messages filter audio', 'object_inputMessagesFilterAudioDocuments' => 'Messages filter audio documents', 'object_updateReadMessages' => 'Update read messages', 'object_updateReadMessages_param_messages_type_Vector t' => 'Messages', 'object_updateReadMessages_param_pts_type_int' => 'Pts', 'object_updateUserStatus' => 'Update user status', 'object_updateUserStatus_param_user_id_type_int' => 'User ID', 'object_updateUserStatus_param_status_type_UserStatus' => 'Status', 'object_updateContactLink_param_my_link_type_contacts.MyLink' => 'My link', 'object_updateContactLink_param_foreign_link_type_contacts.ForeignLink' => 'Foreign link', 'object_updateNewAuthorization' => 'Update new authorization', 'object_updateNewAuthorization_param_auth_key_id_type_long' => 'Auth key ID', 'object_updateNewAuthorization_param_date_type_int' => 'Date', 'object_updateNewAuthorization_param_device_type_string' => 'Device', 'object_updateNewAuthorization_param_location_type_string' => 'Location', 'object_updateShortMessage_param_from_id_type_int' => 'From ID', 'object_updateShortMessage_param_seq_type_int' => 'Seq', 'object_updateShortChatMessage_param_seq_type_int' => 'Seq', 'object_dcOption_param_hostname_type_string' => 'Hostname', 'object_config_param_broadcast_size_max_type_int' => 'Broadcast size max', 'object_messages.statedMessagesLinks' => 'Stated messages links', 'object_messages.statedMessagesLinks_param_messages_type_Vector t' => 'Messages', 'object_messages.statedMessagesLinks_param_chats_type_Vector t' => 'Chats', 'object_messages.statedMessagesLinks_param_users_type_Vector t' => 'Users', 'object_messages.statedMessagesLinks_param_links_type_Vector t' => 'Links', 'object_messages.statedMessagesLinks_param_pts_type_int' => 'Pts', 'object_messages.statedMessagesLinks_param_seq_type_int' => 'Seq', 'object_messages.statedMessageLink' => 'Stated message link', 'object_messages.statedMessageLink_param_message_type_Message' => 'Message', 'object_messages.statedMessageLink_param_chats_type_Vector t' => 'Chats', 'object_messages.statedMessageLink_param_users_type_Vector t' => 'Users', 'object_messages.statedMessageLink_param_links_type_Vector t' => 'Links', 'object_messages.statedMessageLink_param_pts_type_int' => 'Pts', 'object_messages.statedMessageLink_param_seq_type_int' => 'Seq', 'object_messages.sentMessageLink' => 'Sent message link', 'object_messages.sentMessageLink_param_id_type_int' => 'ID', 'object_messages.sentMessageLink_param_date_type_int' => 'Date', 'object_messages.sentMessageLink_param_pts_type_int' => 'Pts', 'object_messages.sentMessageLink_param_seq_type_int' => 'Seq', 'object_messages.sentMessageLink_param_links_type_Vector t' => 'Links', 'object_inputMediaUploadedAudio' => 'Media uploaded audio', 'object_inputMediaUploadedAudio_param_file_type_InputFile' => 'File', 'object_inputMediaUploadedAudio_param_duration_type_int' => 'Duration', 'object_inputMediaUploadedAudio_param_mime_type_type_string' => 'Mime type', 'object_inputMediaAudio' => 'Media audio', 'object_inputMediaAudio_param_id_type_InputAudio' => 'ID', 'object_inputMediaUploadedDocument_param_file_name_type_string' => 'File name', 'object_inputMediaUploadedThumbDocument' => 'Media uploaded thumb document', 'object_inputMediaUploadedThumbDocument_param_file_type_InputFile' => 'File', 'object_inputMediaUploadedThumbDocument_param_thumb_type_InputFile' => 'Thumbnail', 'object_inputMediaUploadedThumbDocument_param_file_name_type_string' => 'File name', 'object_inputMediaUploadedThumbDocument_param_mime_type_type_string' => 'Mime type', 'object_messageMediaAudio' => 'Message media audio', 'object_messageMediaAudio_param_audio_type_Audio' => 'Audio', 'object_inputAudioEmpty' => 'Empty input audio', 'object_inputAudio' => 'Audio', 'object_inputAudio_param_id_type_long' => 'ID', 'object_inputAudio_param_access_hash_type_long' => 'Access hash', 'object_inputAudioFileLocation' => 'Audio file location', 'object_inputAudioFileLocation_param_id_type_long' => 'ID', 'object_inputAudioFileLocation_param_access_hash_type_long' => 'Access hash', 'object_audioEmpty' => 'Empty audio', 'object_audioEmpty_param_id_type_long' => 'ID', 'object_audio' => 'Audio', 'object_audio_param_id_type_long' => 'ID', 'object_audio_param_access_hash_type_long' => 'Access hash', 'object_audio_param_user_id_type_int' => 'User ID', 'object_audio_param_date_type_int' => 'Date', 'object_audio_param_duration_type_int' => 'Duration', 'object_audio_param_mime_type_type_string' => 'Mime type', 'object_audio_param_size_type_int' => 'Size', 'object_audio_param_dc_id_type_int' => 'DC ID', 'object_document_param_user_id_type_int' => 'User ID', 'object_document_param_file_name_type_string' => 'File name', 'object_auth.sentAppCode' => 'Sent app code', 'object_auth.sentAppCode_param_phone_registered_type_Bool' => 'Phone registered?', 'object_auth.sentAppCode_param_phone_code_hash_type_string' => 'Phone code hash', 'object_auth.sentAppCode_param_send_call_timeout_type_int' => 'Send call timeout', 'object_auth.sentAppCode_param_is_password_type_Bool' => 'Is password?', 'object_contactFound' => 'Contact found', 'object_contactFound_param_user_id_type_int' => 'User ID', 'object_updateServiceNotification_param_popup_type_Bool' => 'Popup?', 'object_inputMediaUploadedThumbDocument_param_attributes_type_Vector t' => 'Attributes', 'object_userStatusRecently' => 'User status recently', 'object_userStatusLastWeek' => 'User status last week', 'object_userStatusLastMonth' => 'User status last month', 'object_account.sentChangePhoneCode' => 'Sent change phone code', 'object_account.sentChangePhoneCode_param_phone_code_hash_type_string' => 'Phone code hash', 'object_account.sentChangePhoneCode_param_send_call_timeout_type_int' => 'Send call timeout', 'object_messages.allStickers_param_hash_type_string' => 'Hash', 'object_messages.allStickers_param_packs_type_Vector t' => 'Packs', 'object_messages.allStickers_param_documents_type_Vector t' => 'Documents', 'object_message_param_fwd_from_id_type_int' => 'Forwarded from ID', 'object_message_param_fwd_date_type_int' => 'Forwarded date', 'object_chatLocated' => 'Chat located', 'object_chatLocated_param_chat_id_type_int' => 'Chat ID', 'object_chatLocated_param_distance_type_int' => 'Distance', 'object_messages.messageEmpty' => 'Empty message', 'object_messages.statedMessages_param_pts_count_type_int' => 'Pts count', 'object_messages.statedMessage_param_pts_count_type_int' => 'Pts count', 'object_messages.sentMessage_param_pts_count_type_int' => 'Pts count', 'object_updateReadMessages_param_pts_count_type_int' => 'Pts count', 'object_updateShortMessage_param_fwd_from_id_type_int' => 'Fwd from ID', 'object_updateShortMessage_param_fwd_date_type_int' => 'Fwd date', 'object_updateShortChatMessage_param_fwd_from_id_type_int' => 'Fwd from ID', 'object_updateShortChatMessage_param_fwd_date_type_int' => 'Fwd date', 'object_messages.statedMessagesLinks_param_pts_count_type_int' => 'Pts count', 'object_messages.statedMessageLink_param_pts_count_type_int' => 'Pts count', 'object_messages.sentMessageLink_param_pts_count_type_int' => 'Pts count', 'object_inputGeoChat' => 'Geo chat', 'object_inputGeoChat_param_chat_id_type_int' => 'Chat ID', 'object_inputGeoChat_param_access_hash_type_long' => 'Access hash', 'object_inputNotifyGeoChatPeer' => 'Notify geo chat peer', 'object_inputNotifyGeoChatPeer_param_peer_type_InputGeoChat' => 'Peer', 'object_geoChat' => 'Geo chat', 'object_geoChat_param_id_type_int' => 'ID', 'object_geoChat_param_access_hash_type_long' => 'Access hash', 'object_geoChat_param_title_type_string' => 'Title', 'object_geoChat_param_address_type_string' => 'Address', 'object_geoChat_param_venue_type_string' => 'Venue', 'object_geoChat_param_geo_type_GeoPoint' => 'Geo', 'object_geoChat_param_photo_type_ChatPhoto' => 'Photo', 'object_geoChat_param_participants_count_type_int' => 'Participants count', 'object_geoChat_param_date_type_int' => 'Date', 'object_geoChat_param_checked_in_type_Bool' => 'Checked in?', 'object_geoChat_param_version_type_int' => 'Version', 'object_geoChatMessageEmpty' => 'Empty geo chat message', 'object_geoChatMessageEmpty_param_chat_id_type_int' => 'Chat ID', 'object_geoChatMessageEmpty_param_id_type_int' => 'ID', 'object_geoChatMessage' => 'Geo chat message', 'object_geoChatMessage_param_chat_id_type_int' => 'Chat ID', 'object_geoChatMessage_param_id_type_int' => 'ID', 'object_geoChatMessage_param_from_id_type_int' => 'From ID', 'object_geoChatMessage_param_date_type_int' => 'Date', 'object_geoChatMessage_param_message_type_string' => 'Message', 'object_geoChatMessage_param_media_type_MessageMedia' => 'Media', 'object_geoChatMessageService' => 'Geo chat message service', 'object_geoChatMessageService_param_chat_id_type_int' => 'Chat ID', 'object_geoChatMessageService_param_id_type_int' => 'ID', 'object_geoChatMessageService_param_from_id_type_int' => 'From ID', 'object_geoChatMessageService_param_date_type_int' => 'Date', 'object_geoChatMessageService_param_action_type_MessageAction' => 'Action', 'object_geochats.statedMessage' => 'Stated message', 'object_geochats.statedMessage_param_message_type_GeoChatMessage' => 'Message', 'object_geochats.statedMessage_param_chats_type_Vector t' => 'Chats', 'object_geochats.statedMessage_param_users_type_Vector t' => 'Users', 'object_geochats.statedMessage_param_seq_type_int' => 'Seq', 'object_geochats.located' => 'Located', 'object_geochats.located_param_results_type_Vector t' => 'Results', 'object_geochats.located_param_messages_type_Vector t' => 'Messages', 'object_geochats.located_param_chats_type_Vector t' => 'Chats', 'object_geochats.located_param_users_type_Vector t' => 'Users', 'object_geochats.messages' => 'Messages', 'object_geochats.messages_param_messages_type_Vector t' => 'Messages', 'object_geochats.messages_param_chats_type_Vector t' => 'Chats', 'object_geochats.messages_param_users_type_Vector t' => 'Users', 'object_geochats.messagesSlice' => 'Messages slice', 'object_geochats.messagesSlice_param_count_type_int' => 'Count', 'object_geochats.messagesSlice_param_messages_type_Vector t' => 'Messages', 'object_geochats.messagesSlice_param_chats_type_Vector t' => 'Chats', 'object_geochats.messagesSlice_param_users_type_Vector t' => 'Users', 'object_messageActionGeoChatCreate' => 'Message action geo chat create', 'object_messageActionGeoChatCreate_param_title_type_string' => 'Title', 'object_messageActionGeoChatCreate_param_address_type_string' => 'Address', 'object_messageActionGeoChatCheckin' => 'Message action geo chat checkin', 'object_updateNewGeoChatMessage' => 'Update new geo chat message', 'object_updateNewGeoChatMessage_param_message_type_GeoChatMessage' => 'Message', 'object_messages.sentMessage_param_media_type_MessageMedia' => 'Media', 'object_messages.sentMessageLink_param_media_type_MessageMedia' => 'Media', 'object_inputMediaUploadedPhoto_param_caption_type_string' => 'Caption', 'object_inputMediaPhoto_param_caption_type_string' => 'Caption', 'object_inputMediaUploadedVideo_param_caption_type_string' => 'Caption', 'object_inputMediaUploadedThumbVideo_param_caption_type_string' => 'Caption', 'object_inputMediaVideo_param_caption_type_string' => 'Caption', 'object_messageMediaPhoto_param_caption_type_string' => 'Caption', 'object_messageMediaVideo_param_caption_type_string' => 'Caption', 'object_botCommand' => 'Bot command', 'object_botCommand_param_command_type_string' => 'Command', 'object_botCommand_param_description_type_string' => 'Description', 'object_botInfoEmpty' => 'Empty bot info', 'object_botInfo_param_version_type_int' => 'Version', 'object_botInfo_param_share_text_type_string' => 'Share text', 'object_help.appChangelogEmpty' => 'Empty app changelog', 'object_help.appChangelog' => 'App changelog', 'object_help.appChangelog_param_text_type_string' => 'Text', 'object_message_param_fwd_from_id_type_Peer' => 'Forwarded from ID', 'object_updateShortMessage_param_fwd_from_id_type_Peer' => 'Fwd from ID', 'object_updateShortChatMessage_param_fwd_from_id_type_Peer' => 'Fwd from ID', 'object_channelFull_param_unread_important_count_type_int' => 'Unread important count', 'object_dialogChannel' => 'Dialog channel', 'object_dialogChannel_param_peer_type_Peer' => 'Peer', 'object_dialogChannel_param_top_message_type_int' => 'Top message', 'object_dialogChannel_param_top_important_message_type_int' => 'Top important message', 'object_dialogChannel_param_read_inbox_max_id_type_int' => 'Read inbox max ID', 'object_dialogChannel_param_unread_count_type_int' => 'Unread count', 'object_dialogChannel_param_unread_important_count_type_int' => 'Unread important count', 'object_dialogChannel_param_notify_settings_type_PeerNotifySettings' => 'Notify settings', 'object_dialogChannel_param_pts_type_int' => 'Pts', 'object_messageGroup' => 'Message group', 'object_messageGroup_param_min_id_type_int' => 'Min ID', 'object_messageGroup_param_max_id_type_int' => 'Max ID', 'object_messageGroup_param_count_type_int' => 'Count', 'object_messageGroup_param_date_type_int' => 'Date', 'object_messages.channelMessages_param_collapsed_type_Vector t' => 'Collapsed', 'object_updateChannelGroup' => 'Update channel group', 'object_updateChannelGroup_param_channel_id_type_int' => 'Channel ID', 'object_updateChannelGroup_param_group_type_MessageGroup' => 'Group', 'object_updates.channelDifferenceTooLong_param_top_important_message_type_int' => 'Top important message', 'object_updates.channelDifferenceTooLong_param_unread_important_count_type_int' => 'Unread important count', 'object_channelMessagesFilterCollapsed' => 'Channel messages filter collapsed', 'object_channelParticipantModerator' => 'Channel participant moderator', 'object_channelParticipantModerator_param_user_id_type_int' => 'User ID', 'object_channelParticipantModerator_param_inviter_id_type_int' => 'Inviter ID', 'object_channelParticipantModerator_param_date_type_int' => 'Date', 'object_channelParticipantEditor' => 'Channel participant editor', 'object_channelParticipantEditor_param_user_id_type_int' => 'User ID', 'object_channelParticipantEditor_param_inviter_id_type_int' => 'Inviter ID', 'object_channelParticipantEditor_param_date_type_int' => 'Date', 'object_channelParticipantKicked' => 'Channel participant kicked', 'object_channelParticipantKicked_param_user_id_type_int' => 'User ID', 'object_channelParticipantKicked_param_kicked_by_type_int' => 'Kicked by', 'object_channelParticipantKicked_param_date_type_int' => 'Date', 'object_channelRoleEmpty' => 'Empty channel role', 'object_channelRoleModerator' => 'Channel role moderator', 'object_channelRoleEditor' => 'Channel role editor', 'object_inputChatEmpty' => 'Empty input chat', 'object_inputChat' => 'Chat', 'object_inputChat_param_chat_id_type_int' => 'Chat ID', 'object_updateReadChannelInbox_param_peer_type_Peer' => 'Peer', 'object_updateDeleteChannelMessages_param_peer_type_Peer' => 'Peer', 'object_message_param_unread_type_true' => 'Unread?', 'object_messageService_param_unread_type_true' => 'Unread?', 'object_updateShortMessage_param_unread_type_true' => 'Unread?', 'object_updateShortChatMessage_param_unread_type_true' => 'Unread?', 'object_stickerSet_param_disabled_type_true' => 'Disabled?', 'object_updateShortSentMessage_param_unread_type_true' => 'Unread?', 'object_channel_param_kicked_type_true' => 'Kicked?', 'object_channel_param_moderator_type_true' => 'Moderator?', 'object_channelMessagesFilter_param_important_only_type_true' => 'Important only?', 'object_messageActionChatDeactivate' => 'Message action chat deactivate', 'object_messageActionChatActivate' => 'Message action chat activate', 'object_user_param_restiction_reason_type_string' => 'Restiction reason', 'object_channel_param_restiction_reason_type_string' => 'Restiction reason', 'object_webPageExternal' => 'Web page external', 'object_webPageExternal_param_url_type_string' => 'URL', 'object_webPageExternal_param_display_url_type_string' => 'Display URL', 'object_webPageExternal_param_type_type_string' => 'Type', 'object_webPageExternal_param_title_type_string' => 'Title', 'object_webPageExternal_param_description_type_string' => 'Description', 'object_webPageExternal_param_thumb_url_type_string' => 'Thumbnail URL', 'object_webPageExternal_param_content_url_type_string' => 'Content URL', 'object_webPageExternal_param_w_type_int' => 'Width', 'object_webPageExternal_param_h_type_int' => 'Height', 'object_webPageExternal_param_duration_type_int' => 'Duration', 'object_foundGif_param_webpage_type_WebPage' => 'Webpage', 'object_inputMediaUploadedDocument_param_caption_type_string' => 'Caption', 'object_inputMediaUploadedThumbDocument_param_caption_type_string' => 'Caption', 'object_inputMediaDocument_param_caption_type_string' => 'Caption', 'object_messageMediaDocument_param_caption_type_string' => 'Caption', 'object_inputBotInlineMessageMediaAuto_param_caption_type_string' => 'Caption', 'object_botInlineMessageMediaAuto_param_caption_type_string' => 'Caption', 'object_botInlineMediaResultDocument' => 'Bot inline media result document', 'object_botInlineMediaResultDocument_param_id_type_string' => 'ID', 'object_botInlineMediaResultDocument_param_type_type_string' => 'Type', 'object_botInlineMediaResultDocument_param_document_type_Document' => 'Document', 'object_botInlineMediaResultDocument_param_send_message_type_BotInlineMessage' => 'Send message', 'object_botInlineMediaResultPhoto' => 'Bot inline media result photo', 'object_botInlineMediaResultPhoto_param_id_type_string' => 'ID', 'object_botInlineMediaResultPhoto_param_type_type_string' => 'Type', 'object_botInlineMediaResultPhoto_param_photo_type_Photo' => 'Photo', 'object_botInlineMediaResultPhoto_param_send_message_type_BotInlineMessage' => 'Send message', 'object_inputMediaVideo_param_video_type_InputVideo' => 'Video', 'object_inputMediaAudio_param_audio_type_InputAudio' => 'Audio', 'object_inputMediaDocument_param_document_id_type_InputDocument' => 'Document ID', 'object_inputGeoPoint_param_latitude_type_double' => 'Latitude', 'object_inputGeoPoint_param_longitude_type_double' => 'Longitude', 'object_geoPoint_param_longitude_type_double' => 'Longitude', 'object_geoPoint_param_latitude_type_double' => 'Latitude', 'object_updateNewEncryptedMessage_param_encr_message_type_EncryptedMessage' => 'Encr message', 'object_updateEncryption_param_encr_chat_type_EncryptedChat' => 'Encr chat', 'object_updateNotifySettings_param_notify_peer_type_NotifyPeer' => 'Notify peer', 'object_updateServiceNotification_param_message_text_type_string' => 'Message text', 'object_updateNewChannelMessage_param_channel_pts_type_int' => 'Channel pts', 'object_updateNewChannelMessage_param_channel_pts_count_type_int' => 'Channel pts count', 'object_updateDeleteChannelMessages_param_channel_pts_type_int' => 'Channel pts', 'object_updateDeleteChannelMessages_param_channel_pts_count_type_int' => 'Channel pts count', 'object_updates.channelDifferenceEmpty_param_channel_pts_type_int' => 'Channel pts', 'object_updates.channelDifferenceTooLong_param_channel_pts_type_int' => 'Channel pts', 'object_updates.channelDifference_param_channel_pts_type_int' => 'Channel pts', 'object_privacyKeyChatInvite' => 'Privacy key chat invite', 'object_inputMediaUploadedThumbDocument_param_stickers_type_Vector t' => 'Stickers', 'object_inputMediaPhotoExternal_param_caption_type_string' => 'Caption', 'object_inputMediaDocumentExternal_param_caption_type_string' => 'Caption', 'object_destroy_auth_key_ok' => 'Destroy auth key ok', 'object_destroy_auth_key_none' => 'Destroy auth key none', 'object_destroy_auth_key_fail' => 'Destroy auth key fail', 'object_help.appChangelog_param_message_type_string' => 'Message', 'object_help.appChangelog_param_media_type_MessageMedia' => 'Media', 'object_help.appChangelog_param_entities_type_Vector t' => 'Entities', 'object_pageBlockParagraph' => 'Page block paragraph', 'object_pageBlockParagraph_param_text_type_RichText' => 'Text', 'object_pageBlockPreformatted' => 'Page block preformatted', 'object_pageBlockPreformatted_param_text_type_RichText' => 'Text', 'object_pageBlockPreformatted_param_language_type_string' => 'Language', 'object_pageBlockDivider' => 'Page block divider', 'object_pageBlockAnchor' => 'Page block anchor', 'object_pageBlockAnchor_param_name_type_string' => 'Name', 'object_pageBlockCover' => 'Page block cover', 'object_pageBlockCover_param_cover_type_PageBlock' => 'Cover', 'object_pagePart_param_videos_type_Vector t' => 'Videos', 'object_pageFull_param_videos_type_Vector t' => 'Videos', 'object_phoneCallRequested_param_g_a_type_bytes' => 'G a', 'object_resPQ_param_pq_type_string' => 'Pq', 'object_p_q_inner_data_param_pq_type_string' => 'Pq', 'object_p_q_inner_data_param_p_type_string' => 'P', 'object_p_q_inner_data_param_q_type_string' => 'Q', 'object_server_DH_params_ok_param_encrypted_answer_type_string' => 'Encrypted answer', 'object_server_DH_inner_data_param_dh_prime_type_string' => 'Dh prime', 'object_server_DH_inner_data_param_g_a_type_string' => 'G a', 'object_client_DH_inner_data_param_g_b_type_string' => 'G b', 'object_msgs_state_info_param_info_type_string' => 'Info', 'object_msgs_all_info_param_info_type_string' => 'Info', 'object_http_wait' => 'Http wait', 'object_http_wait_param_max_delay_type_int' => 'Max delay', 'object_http_wait_param_wait_after_type_int' => 'Wait after', 'object_http_wait_param_max_wait_type_int' => 'Max wait', 'object_ipPort' => 'Ip port', 'object_ipPort_param_ipv4_type_int' => 'Ipv4', 'object_ipPort_param_port_type_int' => 'Port', 'object_help.configSimple' => 'Config simple', 'object_help.configSimple_param_date_type_int' => 'Date', 'object_help.configSimple_param_expires_type_int' => 'Expires', 'object_help.configSimple_param_dc_id_type_int' => 'DC ID', 'object_help.configSimple_param_ip_port_list_type_Vector t' => 'Ip port list', 'object_inputMessagesFilterMyMentionsUnread' => 'Messages filter my mentions unread', 'method_initConnection_param_proxy_type_InputClientProxy' => 'The current proxy', 'method_account.registerDevice_param_secret_type_bytes' => 'Secret', 'method_account.getAllSecureValues' => 'Get all secure telegram passport values', 'method_account.getSecureValue' => 'Get secure value for telegram passport', 'method_account.getSecureValue_param_types_type_Vector t' => 'Get telegram passport secure parameters', 'method_account.saveSecureValue' => 'Save telegram passport secure value', 'method_account.saveSecureValue_param_value_type_InputSecureValue' => 'Encrypted value', 'method_account.saveSecureValue_param_secure_secret_id_type_long' => 'Secret', 'method_account.deleteSecureValue' => 'Delete secure telegram passport value', 'method_account.deleteSecureValue_param_types_type_Vector t' => 'The values to delete', 'method_account.getAuthorizationForm' => 'Bots only: get telegram passport authorization form', 'method_account.getAuthorizationForm_param_bot_id_type_int' => 'Bot ID', 'method_account.getAuthorizationForm_param_scope_type_string' => 'Scope', 'method_account.getAuthorizationForm_param_public_key_type_string' => 'Bot\'s public key', 'method_account.acceptAuthorization' => 'Accept telegram passport authorization', 'method_account.acceptAuthorization_param_bot_id_type_int' => 'Bot ID', 'method_account.acceptAuthorization_param_scope_type_string' => 'Scope', 'method_account.acceptAuthorization_param_public_key_type_string' => 'The bot\'s RSA public key', 'method_account.acceptAuthorization_param_value_hashes_type_Vector t' => 'Hashes of the encrypted credentials', 'method_account.acceptAuthorization_param_credentials_type_SecureCredentialsEncrypted' => 'Encrypted secure credentials', 'method_account.sendVerifyPhoneCode' => 'Send phone verification code', 'method_account.sendVerifyPhoneCode_param_allow_flashcall_type_true' => 'Allow phone calls?', 'method_account.sendVerifyPhoneCode_param_phone_number_type_string' => 'The phone number', 'method_account.sendVerifyPhoneCode_param_current_number_type_Bool' => 'Is this the current number?', 'method_account.verifyPhone' => 'Verify phone number', 'method_account.verifyPhone_param_phone_number_type_string' => 'The phone number', 'method_account.verifyPhone_param_phone_code_hash_type_string' => 'The phone code hash returned by account.sendVerifyPhoneCode', 'method_account.verifyPhone_param_phone_code_type_string' => 'The phone code type returned by account.sendVerifyPhoneCode', 'method_account.sendVerifyEmailCode' => 'Send email verification code', 'method_account.sendVerifyEmailCode_param_email_type_string' => 'Email', 'method_account.verifyEmail' => 'Verify email address', 'method_account.verifyEmail_param_email_type_string' => 'The email address', 'method_account.verifyEmail_param_code_type_string' => 'The received code', 'method_users.setSecureValueErrors' => 'Set secure value error for telegram passport', 'method_users.setSecureValueErrors_param_id_type_InputUser' => 'The user ID', 'method_users.setSecureValueErrors_param_errors_type_Vector t' => 'The errors', 'method_messages.search_param_hash_type_int' => 'IDs of messages you already fetched', 'method_messages.report' => 'Report a message', 'method_messages.report_param_peer_type_InputPeer' => 'The user that sent the messages', 'method_messages.report_param_id_type_Vector t' => 'The messages to report', 'method_messages.report_param_reason_type_ReportReason' => 'The reason why you\'re sending this report', 'method_messages.getStickers_param_hash_type_int' => 'IDs of previously fetched stickers', 'method_messages.editMessage_param_media_type_InputMedia' => 'The media to substitute', 'method_messages.editInlineBotMessage_param_media_type_InputMedia' => 'The media to substitute', 'method_messages.toggleDialogPin_param_peer_type_InputDialogPeer' => 'The dialog to pin', 'method_messages.getRecentLocations_param_hash_type_int' => 'IDs of previously fetched locations', 'method_messages.searchStickerSets' => 'Find a sticker set', 'method_messages.searchStickerSets_param_exclude_featured_type_true' => 'Exclude featured sticker sets from the search?', 'method_messages.searchStickerSets_param_q_type_string' => 'The search query', 'method_messages.searchStickerSets_param_hash_type_int' => 'Ids of stickers you already cached', 'method_upload.getFileHashes' => 'Get file hashes', 'method_upload.getFileHashes_param_location_type_InputFileLocation' => 'The file', 'method_upload.getFileHashes_param_offset_type_int' => 'Offset', 'method_help.getProxyData' => 'Get information about the current proxy', 'method_help.getTermsOfServiceUpdate' => 'Get updated TOS', 'method_help.acceptTermsOfService' => 'Accept telegram\'s TOS', 'method_help.acceptTermsOfService_param_id_type_DataJSON' => 'TOS', 'method_help.getDeepLinkInfo' => 'Get deep link info', 'method_help.getDeepLinkInfo_param_path_type_string' => 'Deep link', 'object_inputSecureFileLocation' => 'Secure file location', 'object_inputSecureFileLocation_param_id_type_long' => 'ID', 'object_inputSecureFileLocation_param_access_hash_type_long' => 'Access hash', 'object_messageActionBotAllowed' => 'Message action bot allowed', 'object_messageActionBotAllowed_param_domain_type_string' => 'Domain', 'object_messageActionSecureValuesSentMe' => 'Message action secure values sent me', 'object_messageActionSecureValuesSentMe_param_values_type_Vector t' => 'Values', 'object_messageActionSecureValuesSentMe_param_credentials_type_SecureCredentialsEncrypted' => 'Credentials', 'object_messageActionSecureValuesSent' => 'Message action secure values sent', 'object_messageActionSecureValuesSent_param_types_type_Vector t' => 'Types', 'object_auth.sentCode_param_terms_of_service_type_help.TermsOfService' => 'Terms of service', 'object_inputPeerNotifySettings_param_silent_type_Bool' => 'Silent?', 'object_peerNotifySettings_param_silent_type_Bool' => 'Silent?', 'object_updateDialogPinned_param_peer_type_DialogPeer' => 'Peer', 'object_upload.fileCdnRedirect_param_file_hashes_type_Vector t' => 'File hashes', 'object_dcOption_param_secret_type_bytes' => 'Secret', 'object_config_param_preload_featured_stickers_type_true' => 'Preload featured stickers?', 'object_config_param_ignore_phone_entities_type_true' => 'Ignore phone entities?', 'object_config_param_revoke_pm_inbox_type_true' => 'Revoke pm inbox?', 'object_config_param_blocked_mode_type_true' => 'Blocked mode?', 'object_config_param_revoke_time_limit_type_int' => 'Revoke time limit', 'object_config_param_revoke_pm_time_limit_type_int' => 'Revoke pm time limit', 'object_config_param_autoupdate_url_prefix_type_string' => 'Autoupdate URL prefix', 'object_messages.stickers_param_hash_type_int' => 'Hash', 'object_account.noPassword_param_new_secure_salt_type_bytes' => 'New secure salt', 'object_account.noPassword_param_secure_random_type_bytes' => 'Secure random', 'object_account.password_param_has_recovery_type_true' => 'Has recovery?', 'object_account.password_param_has_secure_values_type_true' => 'Has secure values?', 'object_account.password_param_new_secure_salt_type_bytes' => 'New secure salt', 'object_account.password_param_secure_random_type_bytes' => 'Secure random', 'object_account.passwordSettings_param_secure_salt_type_bytes' => 'Secure salt', 'object_account.passwordSettings_param_secure_secret_type_bytes' => 'Secure secret', 'object_account.passwordSettings_param_secure_secret_id_type_long' => 'Secure secret ID', 'object_account.passwordInputSettings_param_new_secure_salt_type_bytes' => 'New secure salt', 'object_account.passwordInputSettings_param_new_secure_secret_type_bytes' => 'New secure secret', 'object_account.passwordInputSettings_param_new_secure_secret_id_type_long' => 'New secure secret ID', 'object_stickerSet_param_installed_date_type_int' => 'Installed date', 'object_messageEntityPhone' => 'Message entity phone', 'object_messageEntityPhone_param_offset_type_int' => 'Offset', 'object_messageEntityPhone_param_length_type_int' => 'Length', 'object_messageEntityCashtag' => 'Message entity cashtag', 'object_messageEntityCashtag_param_offset_type_int' => 'Offset', 'object_messageEntityCashtag_param_length_type_int' => 'Length', 'object_help.termsOfService_param_popup_type_true' => 'Popup?', 'object_help.termsOfService_param_id_type_DataJSON' => 'ID', 'object_help.termsOfService_param_entities_type_Vector t' => 'Entities', 'object_help.termsOfService_param_min_age_confirm_type_int' => 'Min age confirm', 'object_inputBotInlineMessageMediaVenue_param_venue_type_type_string' => 'Venue type', 'object_inputBotInlineResult_param_thumb_type_InputWebDocument' => 'Thumbnail', 'object_inputBotInlineResult_param_content_type_InputWebDocument' => 'Content', 'object_botInlineMessageMediaVenue_param_venue_type_type_string' => 'Venue type', 'object_botInlineResult_param_thumb_type_WebDocument' => 'Thumbnailnail', 'object_botInlineResult_param_content_type_WebDocument' => 'Content', 'object_messages.recentStickers_param_packs_type_Vector t' => 'Packs', 'object_messages.recentStickers_param_dates_type_Vector t' => 'Dates', 'object_webDocumentNoProxy' => 'Web document no proxy', 'object_webDocumentNoProxy_param_url_type_string' => 'URL', 'object_webDocumentNoProxy_param_size_type_int' => 'Size', 'object_webDocumentNoProxy_param_mime_type_type_string' => 'Mime type', 'object_webDocumentNoProxy_param_attributes_type_Vector t' => 'Attributes', 'object_inputWebFileGeoPointLocation' => 'Web file geo point location', 'object_inputWebFileGeoPointLocation_param_geo_point_type_InputGeoPoint' => 'Geo point', 'object_inputWebFileGeoPointLocation_param_w_type_int' => 'Width', 'object_inputWebFileGeoPointLocation_param_h_type_int' => 'Height', 'object_inputWebFileGeoPointLocation_param_zoom_type_int' => 'Zoom', 'object_inputWebFileGeoPointLocation_param_scale_type_int' => 'Scale', 'object_inputWebFileGeoMessageLocation' => 'Web file geo message location', 'object_inputWebFileGeoMessageLocation_param_peer_type_InputPeer' => 'Peer', 'object_inputWebFileGeoMessageLocation_param_msg_id_type_int' => 'Msg ID', 'object_inputWebFileGeoMessageLocation_param_w_type_int' => 'Width', 'object_inputWebFileGeoMessageLocation_param_h_type_int' => 'Height', 'object_inputWebFileGeoMessageLocation_param_zoom_type_int' => 'Zoom', 'object_inputWebFileGeoMessageLocation_param_scale_type_int' => 'Scale', 'object_channelAdminRights_param_manage_call_type_true' => 'Manage group calls', 'object_inputDialogPeer' => 'Dialog peer', 'object_inputDialogPeer_param_peer_type_InputPeer' => 'Peer', 'object_dialogPeer' => 'Dialog peer', 'object_dialogPeer_param_peer_type_Peer' => 'Peer', 'object_messages.foundStickerSetsNotModified' => 'Found sticker sets not modified', 'object_messages.foundStickerSets' => 'Found sticker sets', 'object_messages.foundStickerSets_param_hash_type_int' => 'Hash', 'object_messages.foundStickerSets_param_sets_type_Vector t' => 'Sets', 'object_fileHash' => 'File hash', 'object_fileHash_param_offset_type_int' => 'Offset', 'object_fileHash_param_limit_type_int' => 'Limit', 'object_fileHash_param_hash_type_bytes' => 'Hash', 'object_inputClientProxy' => 'Client proxy', 'object_inputClientProxy_param_address_type_string' => 'Address', 'object_inputClientProxy_param_port_type_int' => 'Port', 'object_help.proxyDataEmpty' => 'Empty proxy data', 'object_help.proxyDataEmpty_param_expires_type_int' => 'Expires', 'object_help.proxyDataPromo' => 'Proxy data promo', 'object_help.proxyDataPromo_param_expires_type_int' => 'Expires', 'object_help.proxyDataPromo_param_peer_type_Peer' => 'Peer', 'object_help.proxyDataPromo_param_chats_type_Vector t' => 'Chats', 'object_help.proxyDataPromo_param_users_type_Vector t' => 'Users', 'object_help.termsOfServiceUpdateEmpty' => 'Empty terms of service update', 'object_help.termsOfServiceUpdateEmpty_param_expires_type_int' => 'Expires', 'object_help.termsOfServiceUpdate' => 'Terms of service update', 'object_help.termsOfServiceUpdate_param_expires_type_int' => 'Expires', 'object_help.termsOfServiceUpdate_param_terms_of_service_type_help.TermsOfService' => 'Terms of service', 'object_inputSecureFileUploaded' => 'Secure file uploaded', 'object_inputSecureFileUploaded_param_id_type_long' => 'ID', 'object_inputSecureFileUploaded_param_parts_type_int' => 'Parts', 'object_inputSecureFileUploaded_param_md5_checksum_type_string' => 'Md5 checksum', 'object_inputSecureFileUploaded_param_file_hash_type_bytes' => 'File hash', 'object_inputSecureFileUploaded_param_secret_type_bytes' => 'Secret', 'object_inputSecureFile' => 'Secure file', 'object_inputSecureFile_param_id_type_long' => 'ID', 'object_inputSecureFile_param_access_hash_type_long' => 'Access hash', 'object_secureFileEmpty' => 'Empty secure file', 'object_secureFile' => 'Secure file', 'object_secureFile_param_id_type_long' => 'ID', 'object_secureFile_param_access_hash_type_long' => 'Access hash', 'object_secureFile_param_size_type_int' => 'Size', 'object_secureFile_param_dc_id_type_int' => 'DC ID', 'object_secureFile_param_date_type_int' => 'Date', 'object_secureFile_param_file_hash_type_bytes' => 'File hash', 'object_secureFile_param_secret_type_bytes' => 'Secret', 'object_secureData' => 'Secure data', 'object_secureData_param_data_type_bytes' => 'Data', 'object_secureData_param_data_hash_type_bytes' => 'Data hash', 'object_secureData_param_secret_type_bytes' => 'Secret', 'object_securePlainPhone' => 'Secure plain phone', 'object_securePlainPhone_param_phone_type_string' => 'Phone', 'object_securePlainEmail' => 'Secure plain email', 'object_securePlainEmail_param_email_type_string' => 'Email', 'object_secureValueTypePersonalDetails' => 'Secure value type personal details', 'object_secureValueTypePassport' => 'Secure value type passport', 'object_secureValueTypeDriverLicense' => 'Secure value type driver license', 'object_secureValueTypeIdentityCard' => 'Secure value type IDentity card', 'object_secureValueTypeInternalPassport' => 'Secure value type internal passport', 'object_secureValueTypeAddress' => 'Secure value type address', 'object_secureValueTypeUtilityBill' => 'Secure value type utility bill', 'object_secureValueTypeBankStatement' => 'Secure value type bank statement', 'object_secureValueTypeRentalAgreement' => 'Secure value type rental agreement', 'object_secureValueTypePassportRegistration' => 'Secure value type passport registration', 'object_secureValueTypeTemporaryRegistration' => 'Secure value type temporary registration', 'object_secureValueTypePhone' => 'Secure value type phone', 'object_secureValueTypeEmail' => 'Secure value type email', 'object_secureValue' => 'Secure value', 'object_secureValue_param_type_type_SecureValueType' => 'Type', 'object_secureValue_param_data_type_SecureData' => 'Data', 'object_secureValue_param_front_side_type_SecureFile' => 'Front side', 'object_secureValue_param_reverse_side_type_SecureFile' => 'Reverse side', 'object_secureValue_param_selfie_type_SecureFile' => 'Selfie', 'object_secureValue_param_files_type_Vector t' => 'Files', 'object_secureValue_param_plain_data_type_SecurePlainData' => 'Plain data', 'object_secureValue_param_hash_type_bytes' => 'Hash', 'object_inputSecureValue' => 'Secure value', 'object_inputSecureValue_param_type_type_SecureValueType' => 'Type', 'object_inputSecureValue_param_data_type_SecureData' => 'Data', 'object_inputSecureValue_param_front_side_type_InputSecureFile' => 'Front side', 'object_inputSecureValue_param_reverse_side_type_InputSecureFile' => 'Reverse side', 'object_inputSecureValue_param_selfie_type_InputSecureFile' => 'Selfie', 'object_inputSecureValue_param_files_type_Vector t' => 'Files', 'object_inputSecureValue_param_plain_data_type_SecurePlainData' => 'Plain data', 'object_secureValueHash' => 'Secure value hash', 'object_secureValueHash_param_type_type_SecureValueType' => 'Type', 'object_secureValueHash_param_hash_type_bytes' => 'Hash', 'object_secureValueErrorData' => 'Secure value error data', 'object_secureValueErrorData_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorData_param_data_hash_type_bytes' => 'Data hash', 'object_secureValueErrorData_param_field_type_string' => 'Field', 'object_secureValueErrorData_param_text_type_string' => 'Text', 'object_secureValueErrorFrontSide' => 'Secure value error front side', 'object_secureValueErrorFrontSide_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorFrontSide_param_file_hash_type_bytes' => 'File hash', 'object_secureValueErrorFrontSide_param_text_type_string' => 'Text', 'object_secureValueErrorReverseSide' => 'Secure value error reverse side', 'object_secureValueErrorReverseSide_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorReverseSide_param_file_hash_type_bytes' => 'File hash', 'object_secureValueErrorReverseSide_param_text_type_string' => 'Text', 'object_secureValueErrorSelfie' => 'Secure value error selfie', 'object_secureValueErrorSelfie_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorSelfie_param_file_hash_type_bytes' => 'File hash', 'object_secureValueErrorSelfie_param_text_type_string' => 'Text', 'object_secureValueErrorFile' => 'Secure value error file', 'object_secureValueErrorFile_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorFile_param_file_hash_type_bytes' => 'File hash', 'object_secureValueErrorFile_param_text_type_string' => 'Text', 'object_secureValueErrorFiles' => 'Secure value error files', 'object_secureValueErrorFiles_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorFiles_param_file_hash_type_Vector t' => 'File hash', 'object_secureValueErrorFiles_param_text_type_string' => 'Text', 'object_secureCredentialsEncrypted' => 'Secure credentials encrypted', 'object_secureCredentialsEncrypted_param_data_type_bytes' => 'Data', 'object_secureCredentialsEncrypted_param_hash_type_bytes' => 'Hash', 'object_secureCredentialsEncrypted_param_secret_type_bytes' => 'Secret', 'object_account.authorizationForm' => 'Telegram passport authorization form', 'object_account.authorizationForm_param_selfie_required_type_true' => 'Selfie required?', 'object_account.authorizationForm_param_required_types_type_Vector t' => 'Required types', 'object_account.authorizationForm_param_values_type_Vector t' => 'Values', 'object_account.authorizationForm_param_errors_type_Vector t' => 'Errors', 'object_account.authorizationForm_param_users_type_Vector t' => 'Users', 'object_account.authorizationForm_param_privacy_policy_url_type_string' => 'Privacy policy URL', 'object_account.sentEmailCode' => 'Sent email code', 'object_account.sentEmailCode_param_email_pattern_type_string' => 'Email pattern', 'object_account.sentEmailCode_param_length_type_int' => 'Length', 'object_help.deepLinkInfoEmpty' => 'Empty deep link info', 'object_help.deepLinkInfo' => 'Deep link info', 'object_help.deepLinkInfo_param_update_app_type_true' => 'Update app?', 'object_help.deepLinkInfo_param_message_type_string' => 'Message', 'object_help.deepLinkInfo_param_entities_type_Vector t' => 'Entities', 'method_invokeWithMessagesRange' => 'Invoke with messages range', 'method_invokeWithMessagesRange_param_range_type_MessageRange' => 'The range', 'method_invokeWithMessagesRange_param_query_type_!X' => 'The query', 'method_invokeWithTakeout' => 'Invoke method from takeout session', 'method_invokeWithTakeout_param_takeout_id_type_long' => 'The takeout session ID', 'method_invokeWithTakeout_param_query_type_!X' => 'The query', 'method_account.initTakeoutSession' => 'Start account exporting session', 'method_account.initTakeoutSession_param_contacts_type_true' => 'Export contacts?', 'method_account.initTakeoutSession_param_message_users_type_true' => 'Export users?', 'method_account.initTakeoutSession_param_message_chats_type_true' => 'Export chats?', 'method_account.initTakeoutSession_param_message_megagroups_type_true' => 'Export supergroups?', 'method_account.initTakeoutSession_param_message_channels_type_true' => 'Export channel messages?', 'method_account.initTakeoutSession_param_files_type_true' => 'Export files?', 'method_account.initTakeoutSession_param_file_max_size_type_int' => 'Export only files smaller than this size', 'method_account.finishTakeoutSession' => 'Finish account exporting session', 'method_account.finishTakeoutSession_param_success_type_true' => 'Did the data export succeed?', 'method_contacts.getSaved' => 'Get saved contacts', 'method_messages.getSplitRanges' => 'Get message ranges to fetch', 'method_channels.getLeftChannels' => 'Get all channels you left', 'method_channels.getLeftChannels_param_offset_type_int' => 'Offset', 'object_ipPortSecret' => 'Ip port secret', 'object_ipPortSecret_param_ipv4_type_int' => 'Ipv4', 'object_ipPortSecret_param_port_type_int' => 'Port', 'object_ipPortSecret_param_secret_type_bytes' => 'Secret', 'object_accessPointRule' => 'Access point rule', 'object_accessPointRule_param_phone_prefix_rules_type_string' => 'Phone prefix rules', 'object_accessPointRule_param_dc_id_type_int' => 'DC ID', 'object_accessPointRule_param_ips_type_vector' => 'Ips', 'object_help.configSimple_param_rules_type_vector' => 'Rules', 'object_inputTakeoutFileLocation' => 'Takeout file location', 'object_savedPhoneContact' => 'Saved phone contact', 'object_savedPhoneContact_param_phone_type_string' => 'Phone', 'object_savedPhoneContact_param_first_name_type_string' => 'First name', 'object_savedPhoneContact_param_last_name_type_string' => 'Last name', 'object_savedPhoneContact_param_date_type_int' => 'Date', 'object_account.takeout' => 'Takeout', 'object_account.takeout_param_id_type_long' => 'ID', 'method_contacts.toggleTopPeers' => 'Toggle top peers', 'method_contacts.toggleTopPeers_param_enabled_type_Bool' => 'Enable or disable top peer', 'method_messages.getDialogs_param_hash_type_int' => 'IDs of previously fetched dialogs', 'method_messages.markDialogUnread' => 'Mark dialog as unread ', 'method_messages.markDialogUnread_param_unread_type_true' => 'Should it be marked or unmarked as read', 'method_messages.markDialogUnread_param_peer_type_InputDialogPeer' => 'The dialog to mark as unread', 'method_messages.getDialogUnreadMarks' => 'Get dialogs marked as unread manually', 'object_inputMediaContact_param_vcard_type_string' => 'Vcard', 'object_messageMediaContact_param_vcard_type_string' => 'Vcard', 'object_dialog_param_unread_mark_type_true' => 'Unread mark?', 'object_geoPoint_param_access_hash_type_long' => 'Access hash', 'object_messages.dialogsNotModified' => 'Dialogs not modified', 'object_messages.dialogsNotModified_param_count_type_int' => 'Count', 'object_updateDialogUnreadMark' => 'Update dialog unread mark', 'object_updateDialogUnreadMark_param_unread_type_true' => 'Unread?', 'object_updateDialogUnreadMark_param_peer_type_DialogPeer' => 'Peer', 'object_config_param_dc_txt_domain_name_type_string' => 'DC txt domain name', 'object_config_param_gif_search_username_type_string' => 'Gif search username', 'object_config_param_venue_search_username_type_string' => 'Venue search username', 'object_config_param_img_search_username_type_string' => 'Img search username', 'object_config_param_static_maps_provider_type_string' => 'Static maps provider', 'object_config_param_caption_length_max_type_int' => 'Caption length max', 'object_config_param_message_length_max_type_int' => 'Message length max', 'object_config_param_webfile_dc_id_type_int' => 'Webfile DC ID', 'object_inputBotInlineMessageMediaContact_param_vcard_type_string' => 'Vcard', 'object_botInlineMessageMediaContact_param_vcard_type_string' => 'Vcard', 'object_contacts.topPeersDisabled' => 'Top peers disabled', 'object_draftMessageEmpty_param_date_type_int' => 'Date', 'object_inputWebFileGeoPointLocation_param_access_hash_type_long' => 'Access hash', 'method_contacts.getContacts_param_hash_type_Vector t' => 'User IDs of previously cached contacts', 'method_contacts.getTopPeers_param_hash_type_Vector t' => 'Peer IDs of previously cached peers', 'method_messages.getDialogs_param_hash_type_Vector t' => 'IDs of previously fetched dialogs', 'method_messages.getHistory_param_hash_type_Vector t' => 'IDs of messages you already fetched', 'method_messages.search_param_hash_type_Vector t' => 'The IDs of messages you already fetched', 'method_messages.getStickers_param_hash_type_Vector t' => ' the hash parameter of the previous result of this method', 'method_messages.getAllStickers_param_hash_type_Vector t' => 'The hash parameter of the previous result of this method', 'method_messages.getSavedGifs_param_hash_type_Vector t' => ' the hash parameter of the previous result of this method', 'method_messages.getFeaturedStickers_param_hash_type_Vector t' => ' the hash parameter of the previous result of this method', 'method_messages.getRecentStickers_param_hash_type_Vector t' => 'IDs the hash parameter of the previous result of this method', 'method_messages.getMaskStickers_param_hash_type_Vector t' => ' the hash parameter of the previous result of this method', 'method_messages.getWebPage_param_hash_type_Vector t' => ' the hash parameter of the previous result of this method', 'method_messages.getFavedStickers_param_hash_type_Vector t' => ' the hash parameter of the previous result of this method', 'method_messages.getRecentLocations_param_hash_type_Vector t' => 'IDs of locations you already fetched', 'method_messages.searchStickerSets_param_hash_type_Vector t' => 'The IDs of stickersets you already fetched', 'method_channels.getParticipants_param_hash_type_Vector t' => 'IDs of previously fetched participants', 'method_auth.checkPassword_param_password_type_InputCheckPasswordSRP' => 'You cannot use this method directly, use the complete_2fa_login method instead (see https://docs.madelineproto.xyz for more info)', 'method_account.getPasswordSettings_param_password_type_InputCheckPasswordSRP' => 'You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info)', 'method_account.updatePasswordSettings_param_password_type_InputCheckPasswordSRP' => 'You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info)', 'method_account.getTmpPassword_param_password_type_InputCheckPasswordSRP' => 'Password', 'method_account.confirmPasswordEmail' => 'Confirm password recovery using email', 'method_account.confirmPasswordEmail_param_code_type_string' => 'Code', 'method_account.resendPasswordEmail' => 'Resend password recovery email', 'method_account.cancelPasswordEmail' => 'Cancel password recovery email', 'method_account.getContactSignUpNotification' => 'Contact signup notification setting value', 'method_account.setContactSignUpNotification' => 'Set contact sign up notification', 'method_account.setContactSignUpNotification_param_silent_type_Bool' => 'Silent?', 'method_account.getNotifyExceptions' => 'Get notification exceptions', 'method_account.getNotifyExceptions_param_compare_sound_type_true' => 'Compare sound?', 'method_account.getNotifyExceptions_param_peer_type_InputNotifyPeer' => 'Peer', 'method_contacts.getContactIDs' => 'Get contacts by IDs', 'method_contacts.getContactIDs_param_hash_type_Vector t' => 'Previously fetched IDs', 'method_contacts.deleteByPhones' => 'Delete contacts by phones', 'method_contacts.deleteByPhones_param_phones_type_Vector t' => 'Phones', 'method_messages.sendInlineBotResult_param_hide_via_type_true' => 'Hide "via @bot"', 'method_messages.clearAllDrafts' => 'Clear all drafts', 'method_messages.updatePinnedMessage' => 'Update pinned message (private chat only)', 'method_messages.updatePinnedMessage_param_silent_type_true' => 'Silent?', 'method_messages.updatePinnedMessage_param_peer_type_InputPeer' => 'Peer', 'method_messages.updatePinnedMessage_param_id_type_int' => 'Message ID', 'method_messages.sendVote' => 'Send vote', 'method_messages.sendVote_param_peer_type_InputPeer' => 'Peer', 'method_messages.sendVote_param_msg_id_type_int' => 'Message ID', 'method_messages.sendVote_param_options_type_Vector t' => 'Options', 'method_messages.getPollResults' => 'Get poll results', 'method_messages.getPollResults_param_peer_type_InputPeer' => 'Peer', 'method_messages.getPollResults_param_msg_id_type_int' => 'Message ID', 'method_messages.getOnlines' => 'Get online users', 'method_messages.getOnlines_param_peer_type_InputPeer' => 'Peer', 'method_messages.getStatsURL' => 'Get stats URL', 'method_messages.getStatsURL_param_peer_type_InputPeer' => 'Peer', 'method_help.getAppUpdate_param_source_type_string' => 'Source', 'method_help.getAppConfig' => 'Get app config', 'method_help.getPassportConfig' => 'Get passport config', 'method_help.getPassportConfig_param_hash_type_Vector t' => 'Hash', 'method_help.getSupportName' => 'Get support name', 'method_help.getUserInfo' => 'Get user info', 'method_help.getUserInfo_param_user_id_type_InputUser' => 'User ID', 'method_help.editUserInfo' => 'Edit user info', 'method_help.editUserInfo_param_user_id_type_InputUser' => 'User ID', 'method_help.editUserInfo_param_message_type_string' => 'Message', 'method_help.editUserInfo_param_entities_type_Vector t' => 'Entities', 'method_langpack.getLangPack_param_lang_pack_type_string' => 'Lang pack', 'method_langpack.getStrings_param_lang_pack_type_string' => 'Lang pack', 'method_langpack.getDifference_param_lang_code_type_string' => 'Lang code', 'method_langpack.getLanguages_param_lang_pack_type_string' => 'Lang pack', 'method_langpack.getLanguage' => 'Get language', 'method_langpack.getLanguage_param_lang_pack_type_string' => 'Lang pack', 'method_langpack.getLanguage_param_lang_code_type_string' => 'Lang code', 'object_inputMediaGeoLive_param_stopped_type_true' => 'Stopped?', 'object_inputMediaPoll' => 'Media poll', 'object_inputMediaPoll_param_poll_type_Poll' => 'Poll', 'object_inputPhoto_param_file_reference_type_bytes' => 'File reference', 'object_inputFileLocation_param_file_reference_type_bytes' => 'File reference', 'object_inputDocumentFileLocation_param_file_reference_type_bytes' => 'File reference', 'object_fileLocation_param_file_reference_type_bytes' => 'File reference', 'object_chatFull_param_pinned_msg_id_type_int' => 'Pinned msg ID', 'object_channelFull_param_can_view_stats_type_true' => 'Can view stats?', 'object_channelFull_param_online_count_type_int' => 'Online count', 'object_message_param_from_scheduled_type_true' => 'From scheduled?', 'object_messageMediaPoll' => 'Message media poll', 'object_messageMediaPoll_param_poll_type_Poll' => 'Poll', 'object_messageMediaPoll_param_results_type_PollResults' => 'Results', 'object_messageActionContactSignUp' => 'Message action contact sign up', 'object_photo_param_file_reference_type_bytes' => 'File reference', 'object_inputNotifyBroadcasts' => 'Notify broadcasts', 'object_inputReportReasonChildAbuse' => 'Report reason child abuse', 'object_inputReportReasonCopyright' => 'Report reason copyright', 'object_userFull_param_can_pin_message_type_true' => 'Can pin message?', 'object_userFull_param_pinned_msg_id_type_int' => 'Pinned msg ID', 'object_messages.channelMessages_param_inexact_type_true' => 'Inexact?', 'object_updateLangPackTooLong_param_lang_code_type_string' => 'Lang code', 'object_updateUserPinnedMessage' => 'Update user pinned message', 'object_updateUserPinnedMessage_param_user_id_type_int' => 'User ID', 'object_updateUserPinnedMessage_param_id_type_int' => 'ID', 'object_updateChatPinnedMessage' => 'Update chat pinned message', 'object_updateChatPinnedMessage_param_chat_id_type_int' => 'Chat ID', 'object_updateChatPinnedMessage_param_id_type_int' => 'ID', 'object_updateMessagePoll' => 'Update message poll', 'object_updateMessagePoll_param_poll_id_type_long' => 'Poll ID', 'object_updateMessagePoll_param_poll_type_Poll' => 'Poll', 'object_updateMessagePoll_param_results_type_PollResults' => 'Results', 'object_config_param_pfs_enabled_type_true' => 'Pfs enabled?', 'object_config_param_base_lang_pack_version_type_int' => 'Base lang pack version', 'object_help.appUpdate_param_popup_type_true' => 'Popup?', 'object_help.appUpdate_param_version_type_string' => 'Version', 'object_help.appUpdate_param_entities_type_Vector t' => 'Entities', 'object_help.appUpdate_param_document_type_Document' => 'Document', 'object_inputDocument_param_file_reference_type_bytes' => 'File reference', 'object_document_param_file_reference_type_bytes' => 'File reference', 'object_notifyBroadcasts' => 'Notify broadcasts', 'object_inputPrivacyKeyPhoneP2P' => 'Privacy key phone p2p', 'object_privacyKeyPhoneP2P' => 'Privacy key phone p2p', 'object_authorization_param_current_type_true' => 'Current?', 'object_authorization_param_official_app_type_true' => 'Official app?', 'object_authorization_param_password_pending_type_true' => 'Password pending?', 'object_account.password_param_has_password_type_true' => 'Has password?', 'object_account.password_param_current_algo_type_PasswordKdfAlgo' => 'Current algo', 'object_account.password_param_srp_B_type_bytes' => 'Srp b', 'object_account.password_param_srp_id_type_long' => 'Srp ID', 'object_account.password_param_new_algo_type_PasswordKdfAlgo' => 'New algo', 'object_account.password_param_new_secure_algo_type_SecurePasswordKdfAlgo' => 'New secure algo', 'object_account.passwordSettings_param_secure_settings_type_SecureSecretSettings' => 'Secure settings', 'object_account.passwordInputSettings_param_new_algo_type_PasswordKdfAlgo' => 'New algo', 'object_account.passwordInputSettings_param_new_secure_settings_type_SecureSecretSettings' => 'New secure settings', 'object_textSubscript' => 'Text subscript', 'object_textSubscript_param_text_type_RichText' => 'Text', 'object_textSuperscript' => 'Text superscript', 'object_textSuperscript_param_text_type_RichText' => 'Text', 'object_textMarked' => 'Text marked', 'object_textMarked_param_text_type_RichText' => 'Text', 'object_textPhone' => 'Text phone', 'object_textPhone_param_text_type_RichText' => 'Text', 'object_textPhone_param_phone_type_string' => 'Phone', 'object_textImage' => 'Text image', 'object_textImage_param_document_id_type_long' => 'Document ID', 'object_textImage_param_w_type_int' => 'Width', 'object_textImage_param_h_type_int' => 'Height', 'object_textAnchor' => 'Text anchor', 'object_textAnchor_param_text_type_RichText' => 'Text', 'object_textAnchor_param_name_type_string' => 'Name', 'object_pageBlockPhoto_param_caption_type_PageCaption' => 'Caption', 'object_pageBlockPhoto_param_url_type_string' => 'URL', 'object_pageBlockPhoto_param_webpage_id_type_long' => 'Webpage ID', 'object_pageBlockVideo_param_caption_type_PageCaption' => 'Caption', 'object_pageBlockEmbed_param_caption_type_PageCaption' => 'Caption', 'object_pageBlockEmbedPost_param_caption_type_PageCaption' => 'Caption', 'object_pageBlockCollage_param_caption_type_PageCaption' => 'Caption', 'object_pageBlockSlideshow_param_caption_type_PageCaption' => 'Caption', 'object_pageBlockAudio_param_caption_type_PageCaption' => 'Caption', 'object_pageBlockKicker' => 'Page block kicker', 'object_pageBlockKicker_param_text_type_RichText' => 'Text', 'object_pageBlockTable' => 'Page block table', 'object_pageBlockTable_param_bordered_type_true' => 'Bordered?', 'object_pageBlockTable_param_striped_type_true' => 'Striped?', 'object_pageBlockTable_param_title_type_RichText' => 'Title', 'object_pageBlockTable_param_rows_type_Vector t' => 'Rows', 'object_pageBlockOrderedList' => 'Page block ordered list', 'object_pageBlockOrderedList_param_items_type_Vector t' => 'Items', 'object_pageBlockDetails' => 'Page block details', 'object_pageBlockDetails_param_open_type_true' => 'Open?', 'object_pageBlockDetails_param_blocks_type_Vector t' => 'Blocks', 'object_pageBlockDetails_param_title_type_RichText' => 'Title', 'object_pageBlockRelatedArticles' => 'Page block related articles', 'object_pageBlockRelatedArticles_param_title_type_RichText' => 'Title', 'object_pageBlockRelatedArticles_param_articles_type_Vector t' => 'Articles', 'object_pageBlockMap' => 'Page block map', 'object_pageBlockMap_param_geo_type_GeoPoint' => 'Geo', 'object_pageBlockMap_param_zoom_type_int' => 'Zoom', 'object_pageBlockMap_param_w_type_int' => 'Width', 'object_pageBlockMap_param_h_type_int' => 'Height', 'object_pageBlockMap_param_caption_type_PageCaption' => 'Caption', 'object_phoneCall_param_p2p_allowed_type_true' => 'P2p allowed?', 'object_langPackLanguage_param_official_type_true' => 'Official?', 'object_langPackLanguage_param_rtl_type_true' => 'Rtl?', 'object_langPackLanguage_param_beta_type_true' => 'Beta?', 'object_langPackLanguage_param_base_lang_code_type_string' => 'Base lang code', 'object_langPackLanguage_param_plural_code_type_string' => 'Plural code', 'object_langPackLanguage_param_strings_count_type_int' => 'Strings count', 'object_langPackLanguage_param_translated_count_type_int' => 'Translated count', 'object_langPackLanguage_param_translations_url_type_string' => 'Translations URL', 'object_secureValue_param_translation_type_Vector t' => 'Translation', 'object_inputSecureValue_param_translation_type_Vector t' => 'Translation', 'object_secureValueError' => 'Secure value error', 'object_secureValueError_param_type_type_SecureValueType' => 'Type', 'object_secureValueError_param_hash_type_bytes' => 'Hash', 'object_secureValueError_param_text_type_string' => 'Text', 'object_secureValueErrorTranslationFile' => 'Secure value error translation file', 'object_secureValueErrorTranslationFile_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorTranslationFile_param_file_hash_type_bytes' => 'File hash', 'object_secureValueErrorTranslationFile_param_text_type_string' => 'Text', 'object_secureValueErrorTranslationFiles' => 'Secure value error translation files', 'object_secureValueErrorTranslationFiles_param_type_type_SecureValueType' => 'Type', 'object_secureValueErrorTranslationFiles_param_file_hash_type_Vector t' => 'File hash', 'object_secureValueErrorTranslationFiles_param_text_type_string' => 'Text', 'object_passwordKdfAlgoUnknown' => 'Password kdf algo unknown', 'object_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow' => 'Password kdf algo sha256sha256pbkdf2hmacsh a512iter100000 sha256 mod pow', 'object_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow_param_salt1_type_bytes' => 'Salt1', 'object_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow_param_salt2_type_bytes' => 'Salt2', 'object_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow_param_g_type_int' => 'G', 'object_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow_param_p_type_bytes' => 'P', 'object_securePasswordKdfAlgoUnknown' => 'Secure password kdf algo unknown', 'object_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000' => 'Secure password kdf algo pbkdf2hmacsh a512iter100000', 'object_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000_param_salt_type_bytes' => 'Salt', 'object_securePasswordKdfAlgoSHA512' => 'Secure password kdf algo sha512', 'object_securePasswordKdfAlgoSHA512_param_salt_type_bytes' => 'Salt', 'object_secureSecretSettings' => 'Secure secret settings', 'object_secureSecretSettings_param_secure_algo_type_SecurePasswordKdfAlgo' => 'Secure algo', 'object_secureSecretSettings_param_secure_secret_type_bytes' => 'Secure secret', 'object_secureSecretSettings_param_secure_secret_id_type_long' => 'Secure secret ID', 'object_inputCheckPasswordEmpty' => 'Empty input check password', 'object_inputCheckPasswordSRP' => 'Check password srp', 'object_inputCheckPasswordSRP_param_srp_id_type_long' => 'Srp ID', 'object_inputCheckPasswordSRP_param_A_type_bytes' => 'A', 'object_inputCheckPasswordSRP_param_M1_type_bytes' => 'M1', 'object_secureRequiredType' => 'Secure required type', 'object_secureRequiredType_param_native_names_type_true' => 'Native names?', 'object_secureRequiredType_param_selfie_required_type_true' => 'Selfie required?', 'object_secureRequiredType_param_translation_required_type_true' => 'Translation required?', 'object_secureRequiredType_param_type_type_SecureValueType' => 'Type', 'object_secureRequiredTypeOneOf' => 'Secure required type one of', 'object_secureRequiredTypeOneOf_param_types_type_Vector t' => 'Types', 'object_help.passportConfigNotModified' => 'Passport config not modified', 'object_help.passportConfig' => 'Passport config', 'object_help.passportConfig_param_hash_type_int' => 'Hash', 'object_help.passportConfig_param_countries_langs_type_DataJSON' => 'Countries langs', 'object_inputAppEvent_param_data_type_JSONValue' => 'Data', 'object_jsonObjectValue' => 'Json object value', 'object_jsonObjectValue_param_key_type_string' => 'Key', 'object_jsonObjectValue_param_value_type_JSONValue' => 'Value', 'object_jsonNull' => 'Json null', 'object_jsonBool' => 'Json bool', 'object_jsonBool_param_value_type_Bool' => 'Value?', 'object_jsonNumber' => 'Json number', 'object_jsonNumber_param_value_type_double' => 'Value', 'object_jsonString' => 'Json string', 'object_jsonString_param_value_type_string' => 'Value', 'object_jsonArray' => 'Json array', 'object_jsonArray_param_value_type_Vector t' => 'Value', 'object_jsonObject' => 'Json object', 'object_jsonObject_param_value_type_Vector t' => 'Value', 'object_pageTableCell' => 'Page table cell', 'object_pageTableCell_param_header_type_true' => 'Header?', 'object_pageTableCell_param_align_center_type_true' => 'Align center?', 'object_pageTableCell_param_align_right_type_true' => 'Align right?', 'object_pageTableCell_param_valign_middle_type_true' => 'Valign middle?', 'object_pageTableCell_param_valign_bottom_type_true' => 'Valign bottom?', 'object_pageTableCell_param_text_type_RichText' => 'Text', 'object_pageTableCell_param_colspan_type_int' => 'Colspan', 'object_pageTableCell_param_rowspan_type_int' => 'Rowspan', 'object_pageTableRow' => 'Page table row', 'object_pageTableRow_param_cells_type_Vector t' => 'Cells', 'object_pageCaption' => 'Page caption', 'object_pageCaption_param_text_type_RichText' => 'Text', 'object_pageCaption_param_credit_type_RichText' => 'Credit', 'object_pageListItemText' => 'Page list item text', 'object_pageListItemText_param_text_type_RichText' => 'Text', 'object_pageListItemBlocks' => 'Page list item blocks', 'object_pageListItemBlocks_param_blocks_type_Vector t' => 'Blocks', 'object_pageListOrderedItemText' => 'Page list ordered item text', 'object_pageListOrderedItemText_param_num_type_string' => 'Num', 'object_pageListOrderedItemText_param_text_type_RichText' => 'Text', 'object_pageListOrderedItemBlocks' => 'Page list ordered item blocks', 'object_pageListOrderedItemBlocks_param_num_type_string' => 'Num', 'object_pageListOrderedItemBlocks_param_blocks_type_Vector t' => 'Blocks', 'object_pageRelatedArticle' => 'Page related article', 'object_pageRelatedArticle_param_url_type_string' => 'URL', 'object_pageRelatedArticle_param_webpage_id_type_long' => 'Webpage ID', 'object_pageRelatedArticle_param_title_type_string' => 'Title', 'object_pageRelatedArticle_param_description_type_string' => 'Description', 'object_pageRelatedArticle_param_photo_id_type_long' => 'Photo ID', 'object_pageRelatedArticle_param_author_type_string' => 'Author', 'object_pageRelatedArticle_param_published_date_type_int' => 'Published date', 'object_page' => 'Page', 'object_page_param_part_type_true' => 'Part?', 'object_page_param_rtl_type_true' => 'Rtl?', 'object_page_param_v2_type_true' => 'V2?', 'object_page_param_url_type_string' => 'URL', 'object_page_param_blocks_type_Vector t' => 'Blocks', 'object_page_param_photos_type_Vector t' => 'Photos', 'object_page_param_documents_type_Vector t' => 'Documents', 'object_help.supportName' => 'Support name', 'object_help.supportName_param_name_type_string' => 'Name', 'object_help.userInfoEmpty' => 'Empty user info', 'object_help.userInfo' => 'User info', 'object_help.userInfo_param_message_type_string' => 'Message', 'object_help.userInfo_param_entities_type_Vector t' => 'Entities', 'object_help.userInfo_param_author_type_string' => 'Author', 'object_help.userInfo_param_date_type_int' => 'Date', 'object_pollAnswer' => 'Poll answer', 'object_pollAnswer_param_text_type_string' => 'Text', 'object_pollAnswer_param_option_type_bytes' => 'Option', 'object_poll' => 'Poll', 'object_poll_param_id_type_long' => 'ID', 'object_poll_param_closed_type_true' => 'Closed?', 'object_poll_param_question_type_string' => 'Question', 'object_poll_param_answers_type_Vector t' => 'Answers', 'object_pollAnswerVoters' => 'Poll answer voters', 'object_pollAnswerVoters_param_chosen_type_true' => 'Chosen?', 'object_pollAnswerVoters_param_option_type_bytes' => 'Option', 'object_pollAnswerVoters_param_voters_type_int' => 'Voters', 'object_pollResults' => 'Poll results', 'object_pollResults_param_min_type_true' => 'Min?', 'object_pollResults_param_results_type_Vector t' => 'Results', 'object_pollResults_param_total_voters_type_int' => 'Total voters', 'object_chatOnlines' => 'Chat onlines', 'object_chatOnlines_param_onlines_type_int' => 'Onlines', 'object_statsURL' => 'Stats URL', 'object_statsURL_param_url_type_string' => 'URL', ); } <?php /** * DocsBuilder module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class DocsBuilder { use \danog\MadelineProto\TL\TL; use \danog\MadelineProto\DocsBuilder\Methods; use \danog\MadelineProto\DocsBuilder\Constructors; use Tools; public $td = false; public function __construct($logger, $settings) { $this->logger = $logger; set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']); $this->construct_TL($settings['tl_schema']); if (isset($settings['tl_schema']['td']) && !isset($settings['tl_schema']['telegram'])) { $this->constructors = $this->td_constructors; $this->methods = $this->td_methods; $this->td = true; } $this->settings = $settings; if (!file_exists($this->settings['output_dir'])) { mkdir($this->settings['output_dir']); } chdir($this->settings['output_dir']); $this->index = $settings['readme'] ? 'README.md' : 'index.md'; } public $types = []; public $any = '*'; public function end($what) { return end($what); } public function escape($hwat) { return str_replace('_', '\\_', $hwat); } public function mk_docs() { \danog\MadelineProto\Logger::log('Generating documentation index...', \danog\MadelineProto\Logger::NOTICE); file_put_contents($this->index, '--- title: '.$this->settings['title'].' description: '.$this->settings['description'].' image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- # '.$this->settings['description'].' [Back to main documentation](..) [Methods](methods/) [Constructors](constructors/) [Types](types/)'); $this->mk_methodS(); $this->mk_constructors(); foreach (glob('types/*') as $unlink) { unlink($unlink); } if (file_exists('types')) { rmdir('types'); } mkdir('types'); ksort($this->types); $index = ''; \danog\MadelineProto\Logger::log('Generating types documentation...', \danog\MadelineProto\Logger::NOTICE); $last_namespace = ''; foreach ($this->types as $otype => $keys) { $new_namespace = preg_replace('/_.*/', '', $otype); //$br = $new_namespace != $last_namespace ? '***<br><br>' : ''; $type = str_replace(['.', '<', '>'], ['_', '_of_', ''], $otype); $type = preg_replace('/.*_of_/', '', $type); $index .= '['.str_replace('_', '\\_', $type).']('.$type.'.md)<a name="'.$type.'"></a> '; $constructors = ''; foreach ($keys['constructors'] as $data) { $predicate = str_replace('.', '_', $data['predicate']).(isset($data['layer']) && $data['layer'] !== '' ? '_'.$data['layer'] : ''); $md_predicate = str_replace('_', '\\_', $predicate); $constructors .= '['.$md_predicate.'](../constructors/'.$predicate.'.md) '; } $methods = ''; foreach ($keys['methods'] as $data) { $name = str_replace('.', '_', $data['method']); $md_name = str_replace('_', '->', $name); $methods .= '[$MadelineProto->'.$md_name.'](../methods/'.$name.'.md) '; } $description = isset($this->td_descriptions['types'][$otype]) ? $this->td_descriptions['types'][$otype] : 'constructors and methods of typr '.$type; $header = '--- title: '.$type.' description: constructors and methods of type '.$type.' image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- # Type: '.str_replace('_', '\\_', $type).' [Back to types index](index.md) '; $header .= isset($this->td_descriptions['types'][$otype]) ? $this->td_descriptions['types'][$otype].PHP_EOL.PHP_EOL : ''; if (!isset($this->settings['td'])) { if (in_array($type, ['User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputDialogPeer', 'DialogPeer', 'InputPeer', 'NotifyPeer', 'InputNotifyPeer'])) { $header .= 'You can directly provide the [Update](Update.md) or [Message](Message.md) object here, MadelineProto will automatically extract the destination chat id. The following syntaxes can also be used: ``` $'.$type." = '@username'; // Username \$".$type." = 'me'; // The currently logged-in user \$".$type.' = 44700; // bot API id (users) $'.$type.' = -492772765; // bot API id (chats) $'.$type.' = -10038575794; // bot API id (channels) $'.$type." = 'https://t.me/danogentili'; // t.me URLs \$".$type." = 'https://t.me/joinchat/asfln1-21fa_'; // t.me invite links \$".$type." = 'user#44700'; // tg-cli style id (users) \$".$type." = 'chat#492772765'; // tg-cli style id (chats) \$".$type." = 'channel#38575794'; // tg-cli style id (channels) ``` A [Chat](Chat.md), a [User](User.md), an [InputPeer](InputPeer.md), an [InputDialogPeer](InputDialogPeer.md), an [InputNotifyPeer](InputNotifyPeer.md), an [InputUser](InputUser.md), an [InputChannel](InputChannel.md), a [Peer](Peer.md), an [DialogPeer](DialogPeer.md), [NotifyPeer](NotifyPeer.md), or a [Chat](Chat.md) object can also be used.\n\n\n"; } if (in_array($type, ['InputEncryptedChat'])) { $header .= 'You can directly provide the [Update](Update.md) or [EncryptedMessage](EncryptedMessage.md) object here, MadelineProto will automatically extract the destination chat id. The following syntax can also be used: ``` $'.$type.' = -147286699; // Numeric chat id returned by request_secret_chat, can be positive or negative ``` '; } if (in_array($type, ['InputFile', 'InputEncryptedFile'])) { $header .= 'The following syntax can also be used: ``` $'.$type.' = \'filename.mp4\'; // The file path can also be used ``` '; } if (in_array($type, ['InputPhoto'])) { $header .= 'You can also provide a [MessageMedia](MessageMedia.md), [Message](Message.md), [Update](Update.md), [Photo](Photo.md) here, MadelineProto will automatically convert it to the right type. '; } if (in_array($type, ['InputDocument'])) { $header .= 'You can also provide a [MessageMedia](MessageMedia.md), [Message](Message.md), [Update](Update.md), [Document](Document.md) here, MadelineProto will automatically convert it to the right type. '; } if (in_array($type, ['InputMedia'])) { $header .= 'You can also provide a [MessageMedia](MessageMedia.md), [Message](Message.md), [Update](Update.md), [Document](Document.md), [Photo](Photo.md), [InputDocument](InputDocument.md), [InputPhoto](InputPhoto.md) here, MadelineProto will automatically convert it to the right type. '; } if (in_array($type, ['InputMessage'])) { $header .= 'The following syntax can also be used: ``` $'.$type.' = 142; // Numeric message ID ``` '; } if (in_array($type, ['KeyboardButton'])) { $header .= 'Clicking these buttons: To click these buttons simply run the `click` method: ``` $result = $'.$type.'->click(); ``` `$result` can be one of the following: * A string - If the button is a keyboardButtonUrl * [Updates](Updates.md) - If the button is a keyboardButton, the message will be sent to the chat, in reply to the message with the keyboard * [messages_BotCallbackAnswer](messages_BotCallbackAnswer.md) - If the button is a keyboardButtonCallback or a keyboardButtonGame the button will be pressed and the result will be returned * `false` - If the button is an unsupported button, like keyboardButtonRequestPhone, keyboardButtonRequestGeoLocation, keyboardButtonSwitchInlinekeyboardButtonBuy; you will have to parse data from these buttons manually You can also access the properties of the constructor as a normal array, for example $button[\'name\'] '; } } $constructors = '### Possible values (constructors): '.$constructors.' '; $methods = '### Methods that return an object of this type (methods): '.$methods.' '; if (!isset($this->settings['td'])) { if (in_array($type, ['PhoneCall'])) { $methods = ''; $constructors = ''; $header .= 'This is an object of type `\\danog\\MadelineProto\\VoIP`. It will only be available if the [php-libtgvoip](https://github.com/danog/php-libtgvoip) extension is installed, see [the main docs](https://docs.madelineproto.xyz#calls) for an easy installation script. You MUST know [OOP](http://php.net/manual/en/language.oop5.php) to use this class. ## Constants: VoIPController states (these constants are incrementing integers, thus can be compared like numbers): * `STATE_CREATED` - controller created * `STATE_WAIT_INIT` - controller inited * `STATE_WAIT_INIT_ACK` - controller inited * `STATE_ESTABLISHED` - connection established * `STATE_FAILED` - connection failed * `STATE_RECONNECTING` - reconnecting VoIPController errors: * `TGVOIP_ERROR_UNKNOWN` - An unknown error occurred * `TGVOIP_ERROR_INCOMPATIBLE` - The other side is using an unsupported client/protocol * `TGVOIP_ERROR_TIMEOUT` - A timeout occurred * `TGVOIP_ERROR_AUDIO_IO` - An I/O error occurred Network types (these constants are incrementing integers, thus can be compared like numbers): * `NET_TYPE_UNKNOWN` - Unknown network type * `NET_TYPE_GPRS` - GPRS connection * `NET_TYPE_EDGE` - EDGE connection * `NET_TYPE_3G` - 3G connection * `NET_TYPE_HSPA` - HSPA connection * `NET_TYPE_LTE` - LTE connection * `NET_TYPE_WIFI` - WIFI connection * `NET_TYPE_ETHERNET` - Ethernet connection (this guarantees high audio quality) * `NET_TYPE_OTHER_HIGH_SPEED` - Other high speed connection * `NET_TYPE_OTHER_LOW_SPEED` - Other low speed connection * `NET_TYPE_DIALUP` - Dialup connection * `NET_TYPE_OTHER_MOBILE` - Other mobile network connection Data saving modes (these constants are incrementing integers, thus can be compared like numbers): * `DATA_SAVING_NEVER` - Never save data (this guarantees high audio quality) * `DATA_SAVING_MOBILE` - Use mobile data saving profiles * `DATA_SAVING_ALWAYS` - Always use data saving profiles Proxy settings (these constants are incrementing integers, thus can be compared like numbers): * `PROXY_NONE` - No proxy * `PROXY_SOCKS5` - Use the socks5 protocol Audio states (these constants are incrementing integers, thus can be compared like numbers): * `AUDIO_STATE_NONE` - The audio module was not created yet * `AUDIO_STATE_CREATED` - The audio module was created * `AUDIO_STATE_CONFIGURED` - The audio module was configured * `AUDIO_STATE_RUNNING` - The audio module is running Call states (these constants are incrementing integers, thus can be compared like numbers): * `CALL_STATE_NONE` - The call was not created yet * `CALL_STATE_REQUESTED` - This is an outgoing call * `CALL_STATE_INCOMING` - This is an incoming call * `CALL_STATE_ACCEPTED` - The incoming call was accepted, but not yet ready * `CALL_STATE_CONFIRMED` - The outgoing call was accepted, but not yet ready * `CALL_STATE_READY` - The call is ready. Audio data is being sent and received * `CALL_STATE_ENDED` - The call is over. ## Methods: * `getState()` - Gets the controller state, as a VoIPController state constant * `getCallState()` - Gets the call state, as a call state constant * `getVisualization()` - Gets the visualization of the encryption key, as an array of emojis, can be called only when the call state is bigger than or equal to `CALL_STATE_READY`. If called sooner, returns false. * `getStats()` Gets connection stats * `getOtherID()` - Gets the id of the other call participant, as a bot API ID * `getProtocol()` - Gets the protocol used by the current call, as a [PhoneCallProtocol](https://docs.madelineproto.xyz/API_docs/types/PhoneCallProtocol.html) object * `getCallID()` - Gets the call ID, as an [InputPhoneCall](https://docs.madelineproto.xyz/API_docs/types/InputPhoneCall.html) object * `isCreator()` - Returns a boolean that indicates whether you are the creator of the call * `whenCreated()` - Returns the unix timestamp of when the call was started (when was the call state set to `CALL_STATE_READY`) * `getOutputState()` - Returns the state of the audio output module, as an audio state constant * `getInputState()` - Returns the state of the audio input module, as an audio state constant * `getDebugLog()` - Gets VoIPController debug log * `getDebugString()` - Gets VoIPController debug string * `getLastError()` - Gets the last error as a VoIPController error constant * `getVersion()` - Gets VoIPController version * `getSignalBarsCount()` - Gets number of signal bars (0-4) * `parseConfig()` - Parses the configuration * `accept()` - Accepts the phone call, returns `$this` * `discard($reason = ["_" => "phoneCallDiscardReasonDisconnect"], $rating = [])` - Ends the phone call. Accepts two optional parameters: `$reason` - can be a [PhoneCallDiscardReason](https://docs.madelineproto.xyz/API_docs/types/PhoneCallDiscardReason.html) object (defaults to a [phoneCallDiscardReasonDisconnect](https://docs.madelineproto.xyz/API_docs/constructors/phoneCallDiscardReasonDisconnect.html) object). `$rating` - Can be an array that must contain a rating, and a comment (`["rating" => 5, "comment" => "MadelineProto is very easy to use!"]). Defaults to an empty array.` * `getOutputParams()` - Returns the output audio configuration MadelineProto works using raw signed PCM audio, internally split in packets with `sampleNumber` samples. The audio configuration is an array structured in the following way: ``` [ "bitsPerSample" => int. // Bits in each PCM sample "sampleRate" => int, // PCM sample rate "channels" => int, // Number of PCM audio channels "sampleNumber" => int, // The audio data is internally split in packets, each having this number of samples "samplePeriod" => double, // PCM sample period in seconds, useful if you want to generate audio data manually "writePeriod" => double, // PCM write period in seconds (samplePeriod*sampleNumber), useful if you want to generate audio data manually "samplesSize" => int, // The audio data is internally split in packets, each having this number of bytes (sampleNumber*bitsPerSample/8) "level" => int // idk ]; ``` * `getInputParams()` - Returns the input audio configuration MadelineProto works using raw signed PCM audio, internally split in packets with `sampleNumber` samples. The audio configuration is an array structured in the following way: ``` [ "bitsPerSample" => int. // Bits in each PCM sample "sampleRate" => int, // PCM sample rate "channels" => int, // Number of PCM audio channels "sampleNumber" => int, // The audio data is internally split in packets, each having this number of samples "samplePeriod" => double, // PCM sample period in seconds, useful if you want to generate audio data manually "writePeriod" => double, // PCM write period in seconds (samplePeriod*sampleNumber), useful if you want to generate audio data manually "samplesSize" => int, // The audio data is internally split in packets, each having this number of bytes (sampleNumber*bitsPerSample/8) ]; ``` * `play(string $file)` and `then(string $file)` - Play a certain audio file encoded in PCM, with the audio input configuration, returns `$this` * `playOnHold(array $files)` - Array of audio files encoded in PCM, with the audio input configuration to loop on hold (when the files given with play/then have finished playing). If not called, no data will be played, returns `$this` * `isPlaying()` - Returns true if MadelineProto is still playing the files given with play/then, false if the hold files (or nothing) is being played * `setMicMute(bool $mute)` - Stops/resumes playing files/hold files, returns `$this` * `setOutputFile(string $outputfile)` - Writes incoming audio data to file encoded in PCM, with the audio output configuration, returns `$this` * `unsetOutputFile()` - Stops writing audio data to previously set file, returns `$this` ## Properties: * `storage`: An array that can be used to store data related to this call. Easy as pie: ``` $call->storage["pony"] = "fluttershy"; \danog\MadelineProto\Logger::log($call->storage["pony"]); // fluttershy ``` Note: when modifying this property, *never* overwrite the previous values. Always either modify the values of the array separately like showed above, or use array_merge. * `configuration`: An array containing the libtgvoip configuration. You can only modify the data saving mode, the network type, the logging file path and the stats dump file path: Example: ``` $call->configuration["log_file_path"] = "logs".$call->getOtherID().".log"; // Default is /dev/null $call->configuration["stats_dump_file_path"] = "stats".$call->getOtherID().".log"; // Default is /dev/null $call->configuration["network_type"] = \\danog\\MadelineProto\\VoIP::NET_TYPE_WIFI; // Default is NET_TYPE_ETHERNET $call->configuration["data_saving"] = \\danog\\MadelineProto\\VoIP::DATA_SAVING_MOBILE; // Default is DATA_SAVING_NEVER $call->parseConfig(); // Always call this after changing settings ``` Note: when modifying this property, *never* overwrite the previous values. Always either modify the values of the array separately like showed above, or use array_merge. After modifying it, you must always parse the new configuration with a call to `parseConfig`. '; } } if (file_exists('types/'.$type.'.md')) { \danog\MadelineProto\Logger::log($type); } file_put_contents('types/'.$type.'.md', $header.$constructors.$methods); $last_namespace = $new_namespace; } \danog\MadelineProto\Logger::log('Generating types index...', \danog\MadelineProto\Logger::NOTICE); file_put_contents('types/'.$this->index, '--- title: Types description: List of types image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- # Types [Back to API documentation index](..) '.$index); \danog\MadelineProto\Logger::log('Generating additional types...', \danog\MadelineProto\Logger::NOTICE); file_put_contents('types/string.md', '--- title: string description: A UTF8 string of variable length image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- ## Type: string [Back to constructor index](index.md) A UTF8 string of variable length. The total length in bytes of the string must not be bigger than 16777215. '); file_put_contents('types/bytes.md', '--- title: bytes description: A string of variable length image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- ## Type: bytes [Back to constructor index](index.md) An object of type `\danog\MadelineProto\TL\Types\Bytes`. When casted to string, turns into a string of bytes of variable length, with length smaller than or equal to 16777215. When JSON-serialized, turns into an array of the following format: ``` [ \'_\' => \'bytes\', \'bytes\' => base64_encode($contents) ]; ``` '); file_put_contents('types/int.md', '--- title: integer description: A 32 bit signed integer ranging from -2147483648 to 2147483647 image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- ## Type: int [Back to constructor index](index.md) A 32 bit signed integer ranging from `-2147483648` to `2147483647`. '); file_put_contents('types/int53.md', '--- title: integer description: A 53 bit signed integer image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- ## Type: int53 [Back to constructor index](index.md) A 53 bit signed integer. '); file_put_contents('types/long.md', '--- title: long description: A 32 bit signed integer ranging from -9223372036854775808 to 9223372036854775807 image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- ## Type: long [Back to constructor index](index.md) A 64 bit signed integer ranging from `-9223372036854775808` to `9223372036854775807`. '); file_put_contents('types/int128.md', '--- title: int128 description: A 128 bit signed integer image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- ## Type: int128 [Back to constructor index](index.md) A 128 bit signed integer represented in little-endian base256 (`string`) format. '); file_put_contents('types/int256.md', '--- title: int256 description: A 256 bit signed integer image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- ## Type: int256 [Back to constructor index](index.md) A 256 bit signed integer represented in little-endian base256 (`string`) format. '); file_put_contents('types/int512.md', '--- title: int512 description: A 512 bit signed integer image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- ## Type: int512 [Back to constructor index](index.md) A 512 bit signed integer represented in little-endian base256 (`string`) format. '); file_put_contents('types/double.md', '--- title: double description: A double precision floating point number image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- ## Type: double [Back to constructor index](index.md) A double precision floating point number, single precision can also be used (float). '); file_put_contents('types/!X.md', '--- title: !X description: Represents a TL serialized payload image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- ## Type: !X [Back to constructor index](index.md) Represents a TL serialized payload. '); file_put_contents('types/X.md', '--- title: X description: Represents a TL serialized payload image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- ## Type: X [Back to constructor index](index.md) Represents a TL serialized payload. '); file_put_contents('constructors/boolFalse.md', '--- title: boolFalse description: Represents a boolean with value equal to false image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- # boolFalse [Back to constructor index](index.md) Represents a boolean with value equal to `false`. '); file_put_contents('constructors/boolTrue.md', '--- title: boolTrue description: Represents a boolean with value equal to true image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- # boolTrue [Back to constructor index](index.md) Represents a boolean with value equal to `true`. '); file_put_contents('constructors/null.md', '--- title: null description: Represents a null value image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- # null [Back to constructor index](index.md) Represents a `null` value. '); file_put_contents('types/Bool.md', '--- title: Bool description: Represents a boolean. image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- # Bool [Back to types index](index.md) Represents a boolean. '); file_put_contents('types/DataJSON.md', '--- title: DataJSON description: Any json-encodable data image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- ## Type: DataJSON [Back to constructor index](index.md) Any json-encodable data. '); \danog\MadelineProto\Logger::log('Done!', \danog\MadelineProto\Logger::NOTICE); } public $template = '<?php /** * Lang module * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; class Lang { public static $lang = %s; // THIS WILL BE OVERWRITTEN BY $lang["en"] public static $current_lang = %s; }'; public function add_to_lang($key) { if (!isset(\danog\MadelineProto\Lang::$lang['en'][$key])) { \danog\MadelineProto\Lang::$lang['en'][$key] = ''; file_put_contents(__DIR__.'/Lang.php', sprintf($this->template, var_export(\danog\MadelineProto\Lang::$lang, true), var_export(\danog\MadelineProto\Lang::$lang['en'], true))); } } } <?php if (!extension_loaded('pthreads')) { class Pool { public function __construct($size, $class = \Worker::class, $ctor = []) { $this->size = $size; $this->clazz = $class; $this->ctor = $ctor; } public function submit(Threaded $collectable) { if ($this->last > $this->size) { $this->last = 0; } if (!isset($this->workers[$this->last])) { $this->workers[$this->last] = new $this->clazz(...$this->ctor); $this->workers[$this->last]->start(); } $this->workers[$this->last++]->stack($collectable); } public function submitTo($worker, Threaded $collectable) { if (isset($this->workers[$worker])) { $this->workers[$worker]->stack($collectable); } } public function collect(Closure $collector = null) { $total = 0; foreach ($this->workers as $worker) { $total += $worker->collect($collector); } return $total; } public function resize($size) { if ($size < $this->size) { while ($this->size > $size) { if (isset($this->workers[$this->size - 1])) { $this->workers[$this->size - 1]->shutdown(); } unset($this->workers[$this->size - 1]); $this->size--; } } } public function shutdown() { $this->workers = null; } protected $workers; protected $size; protected $last; protected $clazz; protected $ctor; } } <?php if (!extension_loaded('pthreads')) { class Volatile extends Threaded { public function __set($offset, $value) { if ($offset === null) { $offset = count((array) $this); } return $this->{$offset} = $value; } } } <?php if (!extension_loaded('pthreads')) { class Thread extends Threaded { public function isStarted() { return (bool) ($this->state & self::STARTED); } public function isJoined() { return (bool) ($this->state & self::JOINED); } public function kill() { $this->state |= self::ERROR; return true; } public static function getCurrentThreadId() { return 1; } public function getThreadId() { return 1; } public function start() { if (!isset($this->state)) { $this->state = 0; } if ($this->state & self::STARTED) { throw new \RuntimeException(); } $this->state |= self::STARTED; $this->state |= self::RUNNING; try { $this->run(); } catch (Exception $t) { $this->state |= self::ERROR; } $this->state &= ~self::RUNNING; return true; } public function join() { if ($this->state & self::JOINED) { throw new \RuntimeException(); } $this->state |= self::JOINED; return true; } } } <?php /** * Socket module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ class FSocket { private $sock; private $protocol; private $timeout = ['sec' => 0, 'usec' => 0]; private $blocking = false; private $domain; private $type; public function __construct(int $domain, int $type, int $protocol) { $this->domain = $domain; $this->type = $type; $this->protocol = $protocol === PHP_INT_MAX ? 'tls' : ($protocol === PHP_INT_MAX - 1 ? 'tcp' : getprotobynumber($protocol)); } public function __destruct() { if ($this->sock !== null) { fclose($this->sock); } } public function setOption(int $level, int $name, $value) { if (in_array($name, [\SO_RCVTIMEO, \SO_SNDTIMEO])) { $this->timeout = ['sec' => (int) $value, 'usec' => (int) (($value - (int) $value) * 1000000)]; return true; } throw new \danog\MadelineProto\Exception('Not supported'); } public function getOption(int $level, int $name) { throw new \danog\MadelineProto\Exception('Not supported'); } public function setBlocking(bool $blocking) { return stream_set_blocking($this->sock, $blocking); } public function bind(string $address, int $port = 0) { throw new \danog\MadelineProto\Exception('Not supported'); } public function listen(int $backlog = 0) { throw new \danog\MadelineProto\Exception('Not supported'); } public function accept() { throw new \danog\MadelineProto\Exception('Not supported'); } public function connect(string $address, int $port = -1) { if ($this->domain === AF_INET6 && strpos($address, ':') !== false) { $address = '['.$address.']'; } $errno = 0; $errstr = ''; $this->sock = fsockopen($this->protocol.'://'.$address, $port, $errno, $errstr, $this->timeout['sec'] + ($this->timeout['usec'] / 1000000)); stream_set_timeout($this->sock, $this->timeout['sec'], $this->timeout['usec']); return true; } public static function select(array &$read, array &$write, array &$except, int $tv_sec, int $tv_usec = 0) { $actual_read = []; foreach ($read as $key => $resource) { $actual_read[$key] = $resource->getResource(); } $actual_write = []; foreach ($write as $key => $resource) { $actual_write[$key] = $resource->getResource(); } $actual_except = []; foreach ($except as $key => $resource) { $actual_except[$key] = $resource->getResource(); } $res = stream_select($actual_read, $actual_write, $actual_except, $tv_sec, $tv_usec); foreach ($read as $key => $resource) { if (!isset($actual_read[$key])) { unset($read[$key]); } } foreach ($write as $key => $resource) { if (!isset($actual_write[$key])) { unset($write[$key]); } } foreach ($except as $key => $resource) { if (!isset($actual_except[$key])) { unset($except[$key]); } } return $res; } public function read(int $length, int $flags = 0) { $packet = ''; $try = 0; while (($current_length = strlen($packet)) < $length) { $read = stream_get_contents($this->sock, $length - $current_length); if ($read === false || (strlen($read) === 0 && $try > 10)) { throw new \danog\MadelineProto\NothingInTheSocketException('Nothing in the socket!'); } $packet .= $read; $try++; } return $packet; } public function write(string $buffer, int $length = -1) { if ($length === -1) { $length = strlen($buffer); } else { $buffer = substr($buffer, 0, $length); } $try = 0; $wrote = fwrite($this->sock, $buffer, $length); while ($wrote < $length) { $wrote_now = fwrite($this->sock, substr($buffer, $wrote), $length - $wrote); if ($wrote_now === false || ($wrote_now === 0 && $try > 10)) { throw new \danog\MadelineProto\NothingInTheSocketException('Nothing could be written in the socket!'); } $wrote += $wrote_now; $try++; } return $wrote; } public function send(string $data, int $length, int $flags) { throw new \danog\MadelineProto\Exception('Not supported'); } public function close() { fclose($this->sock); $this->sock = null; } public function getPeerName(bool $port = true) { throw new \danog\MadelineProto\Exception('Not supported'); } public function getSockName(bool $port = true) { throw new \danog\MadelineProto\Exception('Not supported'); } public function setExtra(array $extra = []) { } public function getProxyHeaders() { return ''; } public function getResource() { return $this->sock; } } if (!extension_loaded('pthreads')) { if (extension_loaded('sockets')) { class SocketBase { private $sock; public function __construct($sock) { $this->sock = $sock; } public function __destruct() { socket_close($this->sock); unset($this->sock); } public function setOption(int $level, int $name, $value) { if (in_array($name, [\SO_RCVTIMEO, \SO_SNDTIMEO])) { $value = ['sec' => (int) $value, 'usec' => (int) (($value - (int) $value) * 1000000)]; } return socket_set_option($this->sock, $level, $name, $value); } public function getOption(int $level, int $name) { return socket_get_option($this->sock, $level, $name); } public function setBlocking(bool $blocking) { if ($blocking) { return socket_set_block($this->sock); } return socket_set_nonblock($this->sock); } public function bind(string $address, int $port = 0) { return socket_bind($this->sock, $address, $port); } public function listen(int $backlog = 0) { return socket_listen($this->sock, $backlog); } public function accept() { if ($socket = socket_accept($this->sock)) { return new self($socket); } else { return $socket; } } public function connect(string $address, int $port = 0) { return socket_connect($this->sock, $address, $port); } public static function select(array &$read, array &$write, array &$except, int $tv_sec, int $tv_usec = 0) { $actual_read = []; foreach ($read as $key => $resource) { $actual_read[$key] = $resource->getResource(); } $actual_write = []; foreach ($write as $key => $resource) { $actual_write[$key] = $resource->getResource(); } $actual_except = []; foreach ($except as $key => $resource) { $actual_except[$key] = $resource->getResource(); } $res = socket_select($actual_read, $actual_write, $actual_except, $tv_sec, $tv_usec); foreach ($read as $key => $resource) { if (!isset($actual_read[$key])) { unset($read[$key]); } } foreach ($write as $key => $resource) { if (!isset($actual_write[$key])) { unset($write[$key]); } } foreach ($except as $key => $resource) { if (!isset($actual_except[$key])) { unset($except[$key]); } } return $res; } public function read(int $length, int $flags = 0) { $packet = ''; $try = 0; while (strlen($packet) < $length) { $read = socket_read($this->sock, $length - strlen($packet), $flags); if ($read === false || (strlen($read) === 0 && $try > 10)) { throw new \danog\MadelineProto\NothingInTheSocketException('Nothing in the socket!'); } $packet .= $read; $try++; } return $packet; } public function write(string $buffer, int $length = -1) { if ($length === -1) { $length = strlen($buffer); } else { $buffer = substr($buffer, 0, $length); } $try = 0; $wrote = socket_write($this->sock, $buffer, $length); while ($wrote < $length) { $wrote_now = socket_write($this->sock, substr($buffer, $wrote), $length - $wrote); if ($wrote_now === false || ($wrote_now === 0 && $try > 10)) { throw new \danog\MadelineProto\NothingInTheSocketException('Nothing could be written in the socket!'); } $wrote += $wrote_now; $try++; } return $wrote; } public function send(string $data, int $length, int $flags) { return socket_send($data, $length, $flags); } public function close() { socket_close($this->sock); $this->sock = null; } public function getPeerName(bool $port = true) { $address = ''; $port = 0; $port ? socket_getpeername($this->sock, $address, $ip) : socket_getpeername($this->sock, $address); return $port ? ['host' => $address, 'port' => $port] : ['host' => $address]; } public function getSockName(bool $port = true) { $address = ''; $port = 0; $port ? socket_getsockname($this->sock, $address, $ip) : socket_getsockname($this->sock, $address); return $port ? ['host' => $address, 'port' => $port] : ['host' => $address]; } public function getProxyHeaders() { return ''; } public function getResource() { return $this->sock; } } class Socket extends SocketBase { public function __construct(int $domain, int $type, int $protocol) { parent::__construct(socket_create($domain, $type, $protocol)); } } } else { define('AF_INET', 0); define('AF_INET6', 1); define('SOCK_STREAM', 2); define('SOL_SOCKET', 3); define('SO_RCVTIMEO', 4); define('SO_SNDTIMEO', 5); class Socket extends FSocket { } } } <?php /** * SocksProxy module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ class SocksProxy implements \danog\MadelineProto\Proxy { private $domain; private $type; private $protocol; private $extra; private $sock; public function __construct(int $domain, int $type, int $protocol) { if (!in_array($domain, [AF_INET, AF_INET6])) { throw new \danog\MadelineProto\Exception('Wrong protocol family provided'); } if (!in_array($type, [SOCK_STREAM, SOCK_DGRAM])) { throw new \danog\MadelineProto\Exception('Wrong connection type provided'); } if (!in_array($protocol, [getprotobyname('tcp'), getprotobyname('udp'), PHP_INT_MAX])) { throw new \danog\MadelineProto\Exception('Wrong protocol provided'); } $this->domain = $domain; $this->type = $type; $this->protocol = $protocol; } public function setExtra(array $extra = []) { $this->extra = $extra; $name = $this->protocol === PHP_INT_MAX ? '\\FSocket' : '\\Socket'; $this->sock = new $name(strlen(@inet_pton($this->extra['address'])) !== 4 ? \AF_INET6 : \AF_INET, \SOCK_STREAM, $this->protocol); } public function setOption(int $level, int $name, $value) { return $this->sock->setOption($level, $name, $value); } public function getOption(int $level, int $name) { return $this->sock->getOption($level, $name); } public function setBlocking(bool $blocking) { return $this->sock->setBlocking($blocking); } public function bind(string $address, int $port = 0) { throw new \danog\MadelineProto\Exception('Not Implemented'); } public function listen(int $backlog = 0) { throw new \danog\MadelineProto\Exception('Not Implemented'); } public function accept() { throw new \danog\MadelineProto\Exception('Not Implemented'); } public function select(array &$read, array &$write, array &$except, int $tv_sec, int $tv_usec = 0) { return $this->sock->select($read, $write, $except, $tv_sec, $tv_usec); } public function connect(string $address, int $port = 0) { $this->sock->connect($this->extra['address'], $this->extra['port']); $methods = chr(0); if (isset($this->extra['username']) && isset($this->extra['password'])) { $methods .= chr(2); } $this->sock->write(chr(5).chr(strlen($methods)).$methods); $version = ord($this->sock->read(1)); $method = ord($this->sock->read(1)); if ($version !== 5) { throw new \danog\MadelineProto\Exception("Wrong SOCKS5 version: $version"); } if ($method === 2) { $this->sock->write(chr(1).chr(strlen($this->extra['username'])).$this->extra['username'].chr(strlen($this->extra['password'])).$this->extra['password']); $version = ord($this->sock->read(1)); if ($version !== 1) { throw new \danog\MadelineProto\Exception("Wrong authorized SOCKS version: $version"); } $result = ord($this->sock->read(1)); if ($result !== 0) { throw new \danog\MadelineProto\Exception("Wrong authorization status: $version"); } } elseif ($method !== 0) { throw new \danog\MadelineProto\Exception("Wrong method: $method"); } $payload = pack('C3', 0x05, 0x01, 0x00); try { $ip = inet_pton($address); $payload .= pack('C1', strlen($ip) === 4 ? 0x01 : 0x04).$ip; } catch (\danog\MadelineProto\Exception $e) { $payload .= pack('C2', 0x03, strlen($address)).$address; } $payload .= pack('n', $port); $this->sock->write($payload); $version = ord($this->sock->read(1)); if ($version !== 5) { throw new \danog\MadelineProto\Exception("Wrong SOCKS5 version: $version"); } $rep = ord($this->sock->read(1)); if ($rep !== 0) { throw new \danog\MadelineProto\Exception("Wrong SOCKS5 rep: $rep"); } $rsv = ord($this->sock->read(1)); if ($rsv !== 0) { throw new \danog\MadelineProto\Exception("Wrong socks5 final RSV: $rsv"); } switch (ord($this->sock->read(1))) { case 1: $ip = inet_ntop($this->sock->read(4)); break; case 4: $ip = inet_ntop($this->sock->read(16)); break; case 3: $ip = $this->sock->read(ord($this->sock->read(1))); break; } $port = unpack('n', $this->sock->read(2))[1]; \danog\MadelineProto\Logger::log(['Connected to '.$ip.':'.$port.' via socks5']); return true; } public function read(int $length, int $flags = 0) { return $this->sock->read($length, $flags); } public function write(string $buffer, int $length = -1) { return $this->sock->write($buffer, $length); } public function send(string $data, int $length, int $flags) { throw new \danog\MadelineProto\Exception('Not Implemented'); } public function close() { $this->sock->close(); } public function getPeerName(bool $port = true) { throw new \danog\MadelineProto\Exception('Not Implemented'); } public function getSockName(bool $port = true) { throw new \danog\MadelineProto\Exception('Not Implemented'); } public function getProxyHeaders() { return ''; } public function getResource() { return $this->sock->getResource(); } } <?php /** * BigInteger placeholder for deserialization. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace phpseclib\Math; if (PHP_MAJOR_VERSION < 7 && !(class_exists('\\Phar') && \Phar::running())) { throw new \Exception('MadelineProto requires php 7 to run natively, use phar.madelineproto.xyz to run on PHP 5.6'); } if (defined('HHVM_VERSION')) { $engines = [['PHP64', ['OpenSSL']], ['BCMath', ['OpenSSL']], ['PHP32', ['OpenSSL']]]; foreach ($engines as $engine) { try { \phpseclib\Math\BigInteger::setEngine($engine[0], isset($engine[1]) ? $engine[1] : []); break; } catch (\Exception $e) { } } } class BigIntegor { } <?php if (!extension_loaded('pthreads')) { class Worker extends Thread { public function collect(Closure $collector = null) { foreach ($this->gc as $idx => $collectable) { if ($collector) { if ($collector($collectable)) { unset($this->gc[$idx]); } } else { if ($this->collector($collectable)) { unset($this->gc[$idx]); } } } return count($this->gc) + count($this->stack); } public function collector(Collectable $collectable) { return $collectable->isGarbage(); } public function shutdown() { return $this->join(); } public function isShutdown() { return $this->isJoined(); } public function getStacked() { return count($this->stack); } public function unstack() { return array_shift($this->stack); } public function stack(Threaded $collectable) { $this->stack[] = $collectable; if ($this->isStarted()) { $this->runCollectable(count($this->stack) - 1, $collectable); } } public function run() { foreach ($this->stack as $idx => $collectable) { $this ->runCollectable($idx, $collectable); } } private function runCollectable($idx, Collectable $collectable) { $collectable->worker = $this; if (!isset($collectable->state)) { $collectable->state = 0; } $collectable->state |= THREAD::RUNNING; $collectable->run(); $collectable->state &= ~THREAD::RUNNING; $this->gc[] = $collectable; unset($this->stack[$idx]); } private $stack = []; private $gc = []; } } <?php /** * CustomHTTPProxy module. * * This file is part of MadelineProto. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU General Public License along with MadelineProto. * If not, see <http://www.gnu.org/licenses/>. * * @author Daniil Gentili <daniil@daniil.it> * @copyright 2016-2018 Daniil Gentili <daniil@daniil.it> * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * * @link https://docs.madelineproto.xyz MadelineProto documentation */ class CustomHTTPProxy implements \danog\MadelineProto\Proxy { private $sock; private $protocol; private $timeout = ['sec' => 0, 'usec' => 0]; private $domain; private $type; private $options = []; private $use_connect = false; private $use_ssl = false; public function __construct($domain, $type, $protocol) { $this->domain = $domain; $this->type = $type; $this->protocol = $protocol === PHP_INT_MAX ? 'tls' : 'tcp'; if ($protocol === PHP_INT_MAX) { /* https */ $this->use_connect = $this->use_ssl = true; } elseif ($protocol !== PHP_INT_MAX - 1) { /* http */ $this->use_connect = true; } } public function __destruct() { if ($this->sock !== null) { fclose($this->sock); $this->sock = null; } } public function accept() { throw new \danog\MadelineProto\Exception('Not supported'); } public function bind($address, $port = 0) { throw new \danog\MadelineProto\Exception('Not supported'); } public function close() { fclose($this->sock); $this->sock = null; } public function connect($address, $port = 0) { $errno = 0; $errstr = ''; if (isset($this->options['host']) && isset($this->options['port'])) { $this->sock = @fsockopen($this->options['host'], $this->options['port'], $errno, $errstr, $this->timeout['sec'] + ($this->timeout['usec'] / 1000000)); } else { $this->sock = @fsockopen($address, $port, $errno, $errstr, $this->timeout['sec'] + ($this->timeout['usec'] / 1000000)); } stream_set_timeout($this->sock, $this->timeout['sec'], $this->timeout['usec']); if (isset($this->options['host']) && isset($this->options['port']) && true === $this->use_connect) { if ($this->domain === AF_INET6 && strpos($address, ':') !== false) { $address = '['.$address.']'; } fwrite($this->sock, 'CONNECT '.$address.':'.$port." HTTP/1.1\r\n". "Accept: */*\r\n". 'Host: '.$address.':'.$port."\r\n". $this->getProxyAuthHeader(). "connection: keep-Alive\r\n". "\r\n"); $response = ''; $status = false; while ($line = @fgets($this->sock)) { $status = $status || (strpos($line, 'HTTP') !== false); if ($status) { $response .= $line; if (!rtrim($line)) { break; } } } if (substr($response, 0, 13) !== 'HTTP/1.1 200 ') { return false; } } if (true === $this->use_ssl) { $modes = [ STREAM_CRYPTO_METHOD_TLS_CLIENT, STREAM_CRYPTO_METHOD_SSLv3_CLIENT, STREAM_CRYPTO_METHOD_SSLv23_CLIENT, STREAM_CRYPTO_METHOD_SSLv2_CLIENT, ]; $contextOptions = [ 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false, ], ]; stream_context_set_option($this->sock, $contextOptions); $success = false; foreach ($modes as $mode) { $success = stream_socket_enable_crypto($this->sock, true, $mode); if ($success) { return true; } } return false; } return true; } public function getOption($level, $name) { throw new \danog\MadelineProto\Exception('Not supported'); } public function getPeerName($port = true) { throw new \danog\MadelineProto\Exception('Not supported'); } public function getSockName($port = true) { throw new \danog\MadelineProto\Exception('Not supported'); } public function listen($backlog = 0) { throw new \danog\MadelineProto\Exception('Not supported'); } public function read($length, $flags = 0) { return stream_get_contents($this->sock, $length); } public function select(array &$read, array &$write, array &$except, $tv_sec, $tv_usec = 0) { return stream_select($read, $write, $except, $tv_sec, $tv_usec); } public function send($data, $length, $flags) { throw new \danog\MadelineProto\Exception('Not supported'); } public function setBlocking($blocking) { return stream_set_blocking($this->sock, $blocking); } public function setOption($level, $name, $value) { if (in_array($name, [\SO_RCVTIMEO, \SO_SNDTIMEO])) { $this->timeout = ['sec' => (int) $value, 'usec' => (int) (($value - (int) $value) * 1000000)]; return true; } throw new \danog\MadelineProto\Exception('Not supported'); } public function write($buffer, $length = -1) { return $length === -1 ? fwrite($this->sock, $buffer) : fwrite($this->sock, $buffer, $length); } private function getProxyAuthHeader() { if (!isset($this->options['user']) || !isset($this->options['pass'])) { return ''; } return 'Proxy-Authorization: Basic '.base64_encode($this->options['user'].':'.$this->options['pass'])."\r\n"; } public function getProxyHeaders() { return ($this->use_connect === true) ? '' : $this->getProxyAuthHeader(); } public function setExtra(array $extra = []) { $this->options = $extra; } public function getResource() { return $this->sock->getResource(); } } <?php if (!extension_loaded('pthreads')) { class Threaded implements ArrayAccess, Countable, IteratorAggregate, Collectable { const NOTHING = (0); const STARTED = (1 << 0); const RUNNING = (1 << 1); const JOINED = (1 << 2); const ERROR = (1 << 3); public function offsetSet($offset, $value) { $this->__set($offset, $value); } public function offsetGet($offset) { return $this->__get($offset); } public function offsetUnset($offset) { $this->__unset($offset); } public function offsetExists($offset) { return $this->__isset($offset); } public function count() { return count((array) $this); } public function getIterator() { return new ArrayIterator($this); } public function __set($offset, $value) { if ($offset === null) { $offset = count($this); } if (!$this instanceof Volatile) { if (isset($this->{$offset}) && $this->{$offset} instanceof self) { throw new \RuntimeException(); } } return $this->{$offset} = $value; } public function __get($offset) { return $this->{$offset}; } public function __isset($offset) { return isset($this->{$offset}); } public function __unset($offset) { if (!$this instanceof Volatile) { if (isset($this->{$offset}) && $this->{$offset} instanceof self) { throw new \RuntimeException(); } } unset($this->{$offset}); } public function shift() { } public function chunk($size) { $chunk = []; while (count($chunk) < $size) { $chunk[] = $this->shift(); } return $chunk; } public function pop() { } public function merge($merge) { foreach ($merge as $k => $v) { $this->{$k} = $v; } } public function wait($timeout = 0) { return true; } public function notify() { return true; } public function synchronized(Closure $closure,...$args) { return $closure(...$args); } public function isRunning() { return $this->state & THREAD::RUNNING; } public function isTerminated() { return $this->state & THREAD::ERROR; } public static function extend($class) { return true; } public function addRef() { } public function delRef() { } public function getRefCount() { } public function lock() { return true; } public function unlock() { return true; } public function isWaiting() { return false; } public function run() { } public function isGarbage() { return true; } public function convertToVolatile($value) { /* if (is_array($value)) { foreach ($value as $k => $v) { if (is_array($v)) { $value[$k] = new Volatile(); $value[$k]->merge( $this->convertToVolatile($v)); } } } */ return $value; } } } #!/usr/bin/env php <?php /* Copyright 2016-2018 Daniil Gentili (https://daniil.it) This file is part of MadelineProto. MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU General Public License along with MadelineProto. If not, see <http://www.gnu.org/licenses/>. */ set_include_path(get_include_path().':'.realpath(dirname(__FILE__).'/MadelineProto/')); if (!file_exists(__DIR__.'/vendor/autoload.php')) { echo 'You did not run composer update, using madeline.php'.PHP_EOL; if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; } else { require_once 'vendor/autoload.php'; } if (!file_exists('songs.php')) { copy('https://github.com/danog/MadelineProto/raw/master/songs.php', 'songs.php'); } echo 'Deserializing MadelineProto from session.madeline...'.PHP_EOL; /*if (!isset($MadelineProto->inputEncryptedFilePhoto) && false) { $MadelineProto->inputEncryptedFilePhoto = $MadelineProto->upload_encrypted('tests/faust.jpg', 'fausticorn.jpg'); // This gets an inputFile object with file name magic $MadelineProto->inputEncryptedFileGif = $MadelineProto->upload_encrypted('tests/pony.mp4'); $MadelineProto->inputEncryptedFileSticker = $MadelineProto->upload_encrypted('tests/lel.webp'); $MadelineProto->inputEncryptedFileDocument = $MadelineProto->upload_encrypted('tests/60', 'magic'); // This gets an inputFile object with file name magic $MadelineProto->inputEncryptedFileVideo = $MadelineProto->upload_encrypted('tests/swing.mp4'); $MadelineProto->inputEncryptedFileAudio = $MadelineProto->upload_encrypted('tests/mosconi.mp3'); }*/ class EventHandler extends \danog\MadelineProto\EventHandler { public function configureCall($call) { include 'songs.php'; $call->configuration['enable_NS'] = false; $call->configuration['enable_AGC'] = false; $call->configuration['enable_AEC'] = false; $call->configuration['shared_config'] = [ 'audio_init_bitrate' => 100 * 1000, 'audio_max_bitrate' => 100 * 1000, 'audio_min_bitrate' => 10 * 1000, 'audio_congestion_window' => 4 * 1024, //'audio_bitrate_step_decr' => 0, //'audio_bitrate_step_incr' => 2000, ]; $call->configuration['log_file_path'] = '/tmp/logs'.$call->getCallID()['id'].'.log'; // Default is /dev/null //$call->configuration["stats_dump_file_path"] = "/tmp/stats".$call->getCallID()['id'].".txt"; // Default is /dev/null $call->parseConfig(); $call->playOnHold($songs); //$this->messages->sendMessage(['message' => var_export($call->configuration, true), 'peer' => $call->getOtherID()]); } public function handleMessage($chat_id, $from_id, $message) { try { if (!isset($this->my_users[$from_id]) || $message === '/start') { $this->my_users[$from_id] = true; $message = '/call'; $this->messages->sendMessage(['no_webpage' => true, 'peer' => $chat_id, 'message' => "Hi, I'm @magnaluna the webradio. Call _me_ to listen to some **awesome** music, or send /call to make _me_ call _you_ (don't forget to disable call privacy settings!). You can also program a phone call with /program: /program 29 August 2018 - call me the 29th of august 2018 /program +1 hour 30 minutes - call me in one hour and thirty minutes /program next Thursday - call me next Thursday at midnight Send /start to see this message again. I also provide advanced stats during calls! I'm a userbot powered by @MadelineProto, created by @danogentili. Source code: https://github.com/danog/MadelineProto Propic art by @magnaluna on [deviantart](https://magnaluna.deviantart.com).", 'parse_mode' => 'Markdown']); } if (!isset($this->calls[$from_id]) && $message === '/call') { $call = $this->request_call($from_id); $this->configureCall($call); if ($call->getCallState() !== \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { $this->calls[$call->getOtherID()] = $call; $this->times[$call->getOtherID()] = [time(), $this->messages->sendMessage(['peer' => $call->getOtherID(), 'message' => 'Total running calls: '.count($this->calls).PHP_EOL.PHP_EOL.$call->getDebugString()])['id']]; } } if (strpos($message, '/program') === 0) { $time = strtotime(str_replace('/program ', '', $message)); if ($time === false) { $this->messages->sendMessage(['peer' => $chat_id, 'message' => 'Invalid time provided']); } else { $this->programmed_call[] = [$from_id, $time]; $this->messages->sendMessage(['peer' => $chat_id, 'message' => 'OK']); } } if ($message === '/broadcast' && $from_id === 101374607) { $time = time() + 100; $message = explode(' ', $message, 2); unset($message[0]); $message = implode(' ', $message); foreach ($this->get_dialogs() as $peer) { $this->times_messages[] = [$peer, $time, $message]; if (isset($peer['user_id'])) { $this->programmed_call[] = [$peer['user_id'], $time]; } $time += 30; } } } catch (\danog\MadelineProto\RPCErrorException $e) { try { if ($e->rpc === 'USER_PRIVACY_RESTRICTED') { $e = 'Please disable call privacy settings to make me call you'; } elseif (strpos($e->rpc, 'FLOOD_WAIT_') === 0) { $t = str_replace('FLOOD_WAIT_', '', $e->rpc); $this->programmed_call[] = [$from_id, time() + 1 + $t]; $e = "Too many people used the /call function. I'll call you back in $t seconds.\nYou can also call me right now."; } $this->messages->sendMessage(['peer' => $chat_id, 'message' => (string) $e]); } catch (\danog\MadelineProto\RPCErrorException $e) { } echo $e; } catch (\danog\MadelineProto\Exception $e) { echo $e; } } public function onUpdateNewMessage($update) { if ($update['message']['out'] || $update['message']['to_id']['_'] !== 'peerUser' || !isset($update['message']['from_id'])) { return; } \danog\MadelineProto\Logger::log($update); $chat_id = $from_id = $this->get_info($update)['bot_api_id']; $message = isset($update['message']['message']) ? $update['message']['message'] : ''; $this->handleMessage($chat_id, $from_id, $message); } public function onUpdateNewEncryptedMessage($update) { return; $chat_id = $this->get_info($update)['InputEncryptedChat']; $from_id = $this->get_secret_chat($chat_id)['user_id']; $message = isset($update['message']['decrypted_message']['message']) ? $update['message']['decrypted_message']['message'] : ''; $this->handleMessage($chat_id, $from_id, $message); } public function onUpdateEncryption($update) { return; try { if ($update['chat']['_'] !== 'encryptedChat') { return; } $chat_id = $this->get_info($update)['InputEncryptedChat']; $from_id = $this->get_secret_chat($chat_id)['user_id']; $message = ''; } catch (\danog\MadelineProto\Exception $e) { return; } $this->handleMessage($chat_id, $from_id, $message); } public function onUpdatePhoneCall($update) { if (is_object($update['phone_call']) && isset($update['phone_call']->madeline) && $update['phone_call']->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_INCOMING) { $this->configureCall($update['phone_call']); if ($update['phone_call']->accept() === false) { echo 'DID NOT ACCEPT A CALL'; } $this->calls[$update['phone_call']->getOtherID()] = $update['phone_call']; try { $this->times[$update['phone_call']->getOtherID()] = [time(), $this->messages->sendMessage(['peer' => $update['phone_call']->getOtherID(), 'message' => 'Total running calls: '.count($this->calls).PHP_EOL.PHP_EOL])['id']]; } catch (\danog\MadelineProto\RPCErrorException $e) { } } } public function onAny($update) { \danog\MadelineProto\Logger::log($update); } public function onLoop() { foreach ($this->programmed_call as $key => $pair) { list($user, $time) = $pair; if ($time < time()) { if (!isset($this->calls[$user])) { try { $call = $this->request_call($user); $this->configureCall($call); if ($call->getCallState() !== \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { $this->calls[$call->getOtherID()] = $call; $this->times[$call->getOtherID()] = [time(), $this->messages->sendMessage(['peer' => $call->getOtherID(), 'message' => 'Total running calls: '.count($this->calls).PHP_EOL.PHP_EOL.$call->getDebugString()])['id']]; } } catch (\danog\MadelineProto\RPCErrorException $e) { try { if ($e->rpc === 'USER_PRIVACY_RESTRICTED') { $e = 'Please disable call privacy settings to make me call you'; } elseif (strpos($e->rpc, 'FLOOD_WAIT_') === 0) { $t = str_replace('FLOOD_WAIT_', '', $e->rpc); $this->programmed_call[] = [$user, time() + 1 + $t]; $e = "I'll call you back in $t seconds.\nYou can also call me right now."; } $this->messages->sendMessage(['peer' => $user, 'message' => (string) $e]); } catch (\danog\MadelineProto\RPCErrorException $e) { } } } unset($this->programmed_call[$key]); } break; } foreach ($this->times_messages as $key => $pair) { list($peer, $time, $message) = $pair; if ($time < time()) { try { $this->messages->sendMessage(['peer' => $peer, 'message' => $message]); } catch (\danog\MadelineProto\RPCErrorException $e) { if (strpos($e->rpc, 'FLOOD_WAIT_') === 0) { $t = str_replace('FLOOD_WAIT_', '', $e->rpc); $this->times_messages[] = [$peer, time() + 1 + $t, $message]; } echo $e; } unset($this->times_messages[$key]); } break; } \danog\MadelineProto\Logger::log(count($this->calls).' calls running!'); foreach ($this->calls as $key => $call) { if ($call->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { try { if (isset($this->times[$call->getOtherID()][1])) { /*$this->messages->sendMedia([ 'reply_to_msg_id' => $this->times[$call->getOtherID()][1], 'peer' => $call->getOtherID(), 'message' => 'Call statistics by @magnaluna', 'media' => [ '_' => 'inputMediaUploadedDocument', 'file' => "/tmp/stats".$call->getCallID()['id'].".txt", 'attributes' => [ ['_' => 'documentAttributeFilename', 'file_name' => "stats".$call->getCallID()['id'].".txt"] ] ], ]);*/ $this->messages->sendMedia([ 'reply_to_msg_id' => $this->times[$call->getOtherID()][1], 'peer' => $call->getOtherID(), 'message' => 'Debug info by @magnaluna', 'media' => [ '_' => 'inputMediaUploadedDocument', 'file' => '/tmp/logs'.$call->getCallID()['id'].'.log', 'attributes' => [ ['_' => 'documentAttributeFilename', 'file_name' => 'logs'.$call->getCallID()['id'].'.log'], ], ], ]); } } catch (\danog\MadelineProto\Exception $e) { echo $e; } catch (\danog\MadelineProto\RPCErrorException $e) { echo $e; } catch (\danog\MadelineProto\Exception $e) { echo $e; } @unlink('/tmp/logs'.$call->getCallID()['id'].'.log'); @unlink('/tmp/stats'.$call->getCallID()['id'].'.txt'); unset($this->calls[$key]); } elseif (isset($this->times[$call->getOtherID()]) && $this->times[$call->getOtherID()][0] < time()) { $this->times[$call->getOtherID()][0] += 30 + count($this->calls); try { $this->messages->editMessage(['id' => $this->times[$call->getOtherID()][1], 'peer' => $call->getOtherID(), 'message' => 'Total running calls: '.count($this->calls).PHP_EOL.PHP_EOL.$call->getDebugString()]); } catch (\danog\MadelineProto\RPCErrorException $e) { echo $e; } } } } } $MadelineProto = new \danog\MadelineProto\API('session.madeline', ['secret_chats' => ['accept_chats' => false], 'logger' => ['logger' => 3, 'logger_param' => getcwd().'/MadelineProto.log']]); $MadelineProto->start(); if (!isset($MadelineProto->programmed_call)) { $MadelineProto->programmed_call = []; } foreach (['my_users', 'times', 'times_messages', 'calls'] as $key) { if (!isset($MadelineProto->{$key})) { $MadelineProto->{$key} = []; } } $MadelineProto->setEventHandler('\EventHandler'); $MadelineProto->loop(); <?php require 'vendor/autoload.php'; class a { use \danog\Serializable; protected $a; public function ___construct() { var_dump('CONSTRUCTED a'); } public function __wakeup() { var_dump('WOKE UP a'); } } new a(); class b { use \danog\Serializable; } $result = \danog\Serialization::unserialize(file_get_contents('test')); var_dump($result); file_put_contents('testb', \danog\Serialization::serialize($result)); { "name": "danog/magicalserializer", "description": "Serialize Volatile, Threaded or any other internal PHP class!", "type": "library", "license": "AGPL-3.0-only", "homepage": "https://daniil.it/MagicalSerializer", "keywords": ["pthreads", "volatile", "serialize", "threading", "serializable"], "authors": [ { "name": "Daniil Gentili", "email": "daniil@daniil.it" } ], "autoload": { "psr-0": { "danog\\": "src/" } } } <?php class a { } class b { } $a = new a(); $a->a = ['lel', ['lel', [new a()]]]; $a->b = new a(); $a->b->c = [new a()]; $a->b->c[0]->d = 'cos'; $a->b->c[0]->e = new b(); $a->b->c[0]->e->f = new a(); $a = [$a]; file_put_contents('test', serialize($a)); var_dump(serialize($a), $a); var_dump(unserialize(file_get_contents('testb'))); <?php /* Copyright 2016-2018 Daniil Gentili (https://daniil.it) This file is part of MagicalSerializer. MagicalSerializer is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. MagicalSerializer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU General Public License along with the MagicalSerializer. If not, see <http://www.gnu.org/licenses/>. */ namespace danog; trait Serializable { final public function __construct(...$params) { if (count($params) === 1 && is_array($params[0]) && isset($params[0]['originalclassnamepony'])) { unset($params[0]['originalclassnamepony']); foreach ($params[0] as $key => $value) { if (strpos($key, chr(0).get_class($this).chr(0)) === 0) { $key = substr($key, strlen(get_class($this)) + 2); } elseif (strpos($key, chr(0).'*'.chr(0)) === 0) { $key = substr($key, 3); } elseif ($key[0] === "\0") { $key = substr($key, 1); } $this->{$key} = \danog\Serialization::extractponyobject($value); } return; } if (method_exists($this, '__magic_construct')) { $this->__magic_construct(...$params); } elseif (method_exists($this, '___construct')) { $this->___construct(...$params); } } final public function fetchserializableobject($hash) { $values = get_object_vars($this); if (method_exists($this, '__sleep')) { $newvalues = []; foreach ($this->__sleep() as $key) { $newvalues[$key] = $values[$key]; } $values = $newvalues; } return new \danog\PlaceHolder($hash, get_class($this), $values); } } <?php /* Copyright 2016-2018 Daniil Gentili (https://daniil.it) This file is part of MagicalSerializer. MagicalSerializer is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. MagicalSerializer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU General Public License along with the MagicalSerializer. If not, see <http://www.gnu.org/licenses/>. */ namespace danog; class Serialization { public static $extracted = []; public static function unserialize($data) { foreach (get_declared_classes() as $class) { if (isset(class_uses($class)['danog\Serializable'])) { $namelength = strlen($class); if (strpos($data, 'O:'.$namelength.':"'.$class.'":') === false) { continue; } $data = explode('O:'.$namelength.':"'.$class.'":', $data); $stringdata = array_shift($data); foreach ($data as $chunk) { list($attributecount, $value) = explode(':{', $chunk, 2); $attributecount++; $stringdata .= 'O:17:"danog\PlaceHolder":'.$attributecount.':{s:21:"originalclassnamepony";s:'.$namelength.':"'.$class.'";'.$value; } $data = $stringdata; } } self::$extracted = []; $data = self::extractponyobject(unserialize($data)); self::$extracted = []; return $data; } public static function extractponyobject($orig) { if (isset($orig->realactualponyobject)) { return self::extractponyobject($orig->realactualponyobject); } if (is_array($orig) || $orig instanceof \Volatile) { foreach ($orig as $key => $value) { $orig[$key] = self::extractponyobject($value); } return $orig; } if (is_object($orig) && !isset(self::$extracted[$hash = spl_object_hash($orig)])) { self::$extracted[$hash] = true; foreach ($orig as $key => $value) { $orig->{$key} = self::extractponyobject($value); } } return $orig; } public static function serialize($object, $not_compatible = false) { self::$extracted = []; $object = serialize(self::createserializableobject($object)); self::$extracted = []; if ($not_compatible === true) { return $object; } $object = explode('O:17:"danog\PlaceHolder":', $object); $newobject = array_shift($object); foreach ($object as $chunk) { list($attributecount, $value) = explode(':{', $chunk, 2); $attributecount--; list($pre, $value) = explode('s:21:"originalclassnamepony";s:', $value, 2); list($length, $value) = explode(':', $value, 2); $classname = substr($value, 1, $length); $value = $pre.substr($value, $length + 3); $newobject .= 'O:'.strlen($classname).':"'.$classname.'":'.$attributecount.':{'.$value; } return $newobject; } public static function createserializableobject($orig) { if (is_object($orig) && $orig instanceof \danog\MadelineProto\VoIP) { $orig = false; } if (is_object($orig)) { if (isset(self::$extracted[$hash = spl_object_hash($orig)])) { return self::$extracted[$hash]; } if (method_exists($orig, 'fetchserializableobject')) { return $orig->fetchserializableobject($hash); } self::$extracted[$hash] = $orig; } if (is_array($orig) || $orig instanceof \Volatile) { foreach ($orig as $key => $value) { $orig[$key] = self::createserializableobject($value); } } return $orig; } } <?php /* Copyright 2016-2018 Daniil Gentili (https://daniil.it) This file is part of MagicalSerializer. MagicalSerializer is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. MagicalSerializer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU General Public License along with the MagicalSerializer. If not, see <http://www.gnu.org/licenses/>. */ namespace danog; class PlaceHolder { public function __construct($hash, $originalclassnamepony, $elements) { Serialization::$extracted[$hash] = $this; $this->originalclassnamepony = $originalclassnamepony; foreach ($elements as $key => $value) { $this->{$key} = Serialization::createserializableobject($value); } } public function __wakeup() { $this->realactualponyobject = new $this->originalclassnamepony(get_object_vars($this)); if (method_exists($this->realactualponyobject, '__wakeup')) { $this->realactualponyobject->__wakeup(); } } } { "name": "danog/primemodule", "description": "Prime module capable of doing prime factorization of huge numbers very quickly.\"", "type": "library", "license": "AGPL-3.0-only", "authors": [ { "name": "Daniil Gentili", "email": "daniil@daniil.it" } ], "require": {}, "suggest": { "ext-primemodule": "Install the native C++ extension for extremely fast factorization (https://github.com/danog/PrimeModule-ext)" }, "autoload": { "psr-0": { "danog\\": "lib/" } } } # NOTICE!!! This is copied from https://stackoverflow.com/questions/4643647/fast-prime-factorization-module import sys import random def primesbelow(N): # http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188 #""" Input N>=6, Returns a list of primes, 2 <= p < N """ correction = N % 6 > 1 N = {0:N, 1:N-1, 2:N+4, 3:N+3, 4:N+2, 5:N+1}[N%6] sieve = [True] * (N // 3) sieve[0] = False for i in range(int(N ** .5) // 3 + 1): if sieve[i]: k = (3 * i + 1) | 1 sieve[k*k // 3::2*k] = [False] * ((N//6 - (k*k)//6 - 1)//k + 1) sieve[(k*k + 4*k - 2*k*(i%2)) // 3::2*k] = [False] * ((N // 6 - (k*k + 4*k - 2*k*(i%2))//6 - 1) // k + 1) return [2, 3] + [(3 * i + 1) | 1 for i in range(1, N//3 - correction) if sieve[i]] smallprimeset = set(primesbelow(100000)) _smallprimeset = 100000 def isprime(n, precision=7): # http://en.wikipedia.org/wiki/Miller-Rabin_primality_test#Algorithm_and_running_time if n == 1 or n % 2 == 0: return False elif n < 1: raise ValueError("Out of bounds, first argument must be > 0") elif n < _smallprimeset: return n in smallprimeset d = n - 1 s = 0 while d % 2 == 0: d //= 2 s += 1 for repeat in range(precision): a = random.randrange(2, n - 2) x = pow(a, d, n) if x == 1 or x == n - 1: continue for r in range(s - 1): x = pow(x, 2, n) if x == 1: return False if x == n - 1: break else: return False return True # https://comeoncodeon.wordpress.com/2010/09/18/pollard-rho-brent-integer-factorization/ def pollard_brent(n): if n % 2 == 0: return 2 if n % 3 == 0: return 3 y, c, m = random.randint(1, n-1), random.randint(1, n-1), random.randint(1, n-1) g, r, q = 1, 1, 1 while g == 1: x = y for i in range(r): y = (pow(y, 2, n) + c) % n k = 0 while k < r and g==1: ys = y for i in range(min(m, r-k)): y = (pow(y, 2, n) + c) % n q = q * abs(x-y) % n g = gcd(q, n) k += m r *= 2 if g == n: while True: ys = (pow(ys, 2, n) + c) % n g = gcd(abs(x - ys), n) if g > 1: break return g smallprimes = primesbelow(10000) # might seem low, but 1000*1000 = 1000000, so this will fully factor every composite < 1000000 def primefactors(n, sort=False): factors = [] limit = int(n ** .5) + 1 for checker in smallprimes: if checker > limit: break while n % checker == 0: factors.append(checker) n //= checker limit = int(n ** .5) + 1 if checker > limit: break if n < 2: return factors while n > 1: if isprime(n): factors.append(n) break factor = pollard_brent(n) # trial division did not fully factor, switch to pollard-brent factors.extend(primefactors(factor)) # recurse to factor the not necessarily prime factor returned by pollard-brent n //= factor if sort: factors.sort() return factors def factorization(n): factors = {} for p1 in primefactors(n): try: factors[p1] += 1 except KeyError: factors[p1] = 1 return factors totients = {} def totient(n): if n == 0: return 1 try: return totients[n] except KeyError: pass tot = 1 for p, exp in factorization(n).items(): tot *= (p - 1) * p ** (exp - 1) totients[n] = tot return tot def gcd(a, b): if a == b: return a while b > 0: a, b = b, a % b return a def lcm(a, b): return abs(a * b) // gcd(a, b) print(primefactors(int(sys.argv[1]))[0])from math import log from argparse import ArgumentParser # Multiple Polynomial Quadratic Sieve def mpqs(n, verbose=False): if verbose: time1 = clock() root_n = isqrt(n) root_2n = isqrt(n+n) # formula chosen by experimentation # seems to be close to optimal for n < 10^50 bound = int(5 * log(n, 10)**2) prime = [] mod_root = [] log_p = [] num_prime = 0 # find a number of small primes for which n is a quadratic residue p = 2 while p < bound or num_prime < 3: # legendre (n|p) is only defined for odd p if p > 2: leg = legendre(n, p) else: leg = n & 1 if leg == 1: prime += [p] mod_root += [int(mod_sqrt(n, p))] log_p += [log(p, 10)] num_prime += 1 elif leg == 0: return p p = next_prime(p) # size of the sieve x_max = len(prime)*60 # maximum value on the sieved range m_val = (x_max * root_2n) >> 1 # fudging the threshold down a bit makes it easier to find powers of primes as factors # as well as partial-partial relationships, but it also makes the smoothness check slower. # there's a happy medium somewhere, depending on how efficient the smoothness check is thresh = log(m_val, 10) * 0.735 # skip small primes. they contribute very little to the log sum # and add a lot of unnecessary entries to the table # instead, fudge the threshold down a bit, assuming ~1/4 of them pass min_prime = int(thresh*3) fudge = sum(log_p[i] for i,p in enumerate(prime) if p < min_prime)/4 thresh -= fudge smooth = [] used_prime = set() partial = {} num_smooth = 0 num_used_prime = 0 num_partial = 0 num_poly = 0 root_A = isqrt(root_2n / x_max) while True: # find an integer value A such that: # A is =~ sqrt(2*n) / x_max # A is a perfect square # sqrt(A) is prime, and n is a quadratic residue mod sqrt(A) while True: root_A = next_prime(root_A) leg = legendre(n, root_A) if leg == 1: break elif leg == 0: return root_A A = root_A * root_A # solve for an adequate B # B*B is a quadratic residue mod n, such that B*B-A*C = n # this is unsolvable if n is not a quadratic residue mod sqrt(A) b = mod_sqrt(n, root_A) B = (b + (n - b*b) * mod_inv(b + b, root_A))%A # B*B-A*C = n <=> C = (B*B-n)/A C = (B*B - n) / A num_poly += 1 # sieve for prime factors sums = [0.0]*(2*x_max) i = 0 for p in prime: if p < min_prime: i += 1 continue logp = log_p[i] inv_A = mod_inv(A, p) # modular root of the quadratic a = int(((mod_root[i] - B) * inv_A)%p) b = int(((p - mod_root[i] - B) * inv_A)%p) k = 0 while k < x_max: if k+a < x_max: sums[k+a] += logp if k+b < x_max: sums[k+b] += logp if k: sums[k-a+x_max] += logp sums[k-b+x_max] += logp k += p i += 1 # check for smooths i = 0 for v in sums: if v > thresh: x = x_max-i if i > x_max else i vec = set() sqr = [] # because B*B-n = A*C # (A*x+B)^2 - n = A*A*x*x+2*A*B*x + B*B - n # = A*(A*x*x+2*B*x+C) # gives the congruency # (A*x+B)^2 = A*(A*x*x+2*B*x+C) (mod n) # because A is chosen to be square, it doesn't need to be sieved val = sieve_val = A*x*x + 2*B*x + C if sieve_val < 0: vec = set([-1]) sieve_val = -sieve_val for p in prime: while sieve_val%p == 0: if p in vec: # keep track of perfect square factors # to avoid taking the sqrt of a gigantic number at the end sqr += [p] vec ^= set([p]) sieve_val = int(sieve_val / p) if sieve_val == 1: # smooth smooth += [(vec, (sqr, (A*x+B), root_A))] used_prime |= vec elif sieve_val in partial: # combine two partials to make a (xor) smooth # that is, every prime factor with an odd power is in our factor base pair_vec, pair_vals = partial[sieve_val] sqr += list(vec & pair_vec) + [sieve_val] vec ^= pair_vec smooth += [(vec, (sqr + pair_vals[0], (A*x+B)*pair_vals[1], root_A*pair_vals[2]))] used_prime |= vec num_partial += 1 else: # save partial for later pairing partial[sieve_val] = (vec, (sqr, A*x+B, root_A)) i += 1 num_smooth = len(smooth) num_used_prime = len(used_prime) if num_smooth > num_used_prime: used_prime_list = sorted(list(used_prime)) # set up bit fields for gaussian elimination masks = [] mask = 1 bit_fields = [0]*num_used_prime for vec, vals in smooth: masks += [mask] i = 0 for p in used_prime_list: if p in vec: bit_fields[i] |= mask i += 1 mask <<= 1 # row echelon form col_offset = 0 null_cols = [] for col in xrange(num_smooth): pivot = col-col_offset == num_used_prime or bit_fields[col-col_offset] & masks[col] == 0 for row in xrange(col+1-col_offset, num_used_prime): if bit_fields[row] & masks[col]: if pivot: bit_fields[col-col_offset], bit_fields[row] = bit_fields[row], bit_fields[col-col_offset] pivot = False else: bit_fields[row] ^= bit_fields[col-col_offset] if pivot: null_cols += [col] col_offset += 1 # reduced row echelon form for row in xrange(num_used_prime): # lowest set bit mask = bit_fields[row] & -bit_fields[row] for up_row in xrange(row): if bit_fields[up_row] & mask: bit_fields[up_row] ^= bit_fields[row] # check for non-trivial congruencies for col in null_cols: all_vec, (lh, rh, rA) = smooth[col] lhs = lh # sieved values (left hand side) rhs = [rh] # sieved values - n (right hand side) rAs = [rA] # root_As (cofactor of lhs) i = 0 for field in bit_fields: if field & masks[col]: vec, (lh, rh, rA) = smooth[i] lhs += list(all_vec & vec) + lh all_vec ^= vec rhs += [rh] rAs += [rA] i += 1 factor = gcd(list_prod(rAs)*list_prod(lhs) - list_prod(rhs), n) if factor != 1 and factor != n: break else: continue break return factor # divide and conquer list product def list_prod(a): size = len(a) if size == 1: return a[0] return list_prod(a[:size>>1]) * list_prod(a[size>>1:]) # greatest common divisor of a and b def gcd(a, b): while b: a, b = b, a%b return a # modular inverse of a mod m def mod_inv(a, m): a = int(a%m) x, u = 0, 1 while a: x, u = u, x - (m/a)*u m, a = a, m%a return x # legendre symbol (a|m) # note: returns m-1 if a is a non-residue, instead of -1 def legendre(a, m): return pow(a, (m-1) >> 1, m) # modular sqrt(n) mod p # p must be prime def mod_sqrt(n, p): a = n%p if p%4 == 3: return pow(a, (p+1) >> 2, p) elif p%8 == 5: v = pow(a << 1, (p-5) >> 3, p) i = ((a*v*v << 1) % p) - 1 return (a*v*i)%p elif p%8 == 1: # Shank's method q = p-1 e = 0 while q&1 == 0: e += 1 q >>= 1 n = 2 while legendre(n, p) != p-1: n += 1 w = pow(a, q, p) x = pow(a, (q+1) >> 1, p) y = pow(n, q, p) r = e while True: if w == 1: return x v = w k = 0 while v != 1 and k+1 < r: v = (v*v)%p k += 1 if k == 0: return x d = pow(y, 1 << (r-k-1), p) x = (x*d)%p y = (d*d)%p w = (w*y)%p r = k else: # p == 2 return a #integer sqrt of n def isqrt(n): c = n*4/3 d = c.bit_length() a = d>>1 if d&1: x = 1 << a y = (x + (n >> a)) >> 1 else: x = (3 << a) >> 2 y = (x + (c >> a)) >> 1 if x != y: x = y y = (x + n/x) >> 1 while y < x: x = y y = (x + n/x) >> 1 return x # strong probable prime def is_sprp(n, b=2): if n < 2: return False d = n-1 s = 0 while d&1 == 0: s += 1 d >>= 1 x = pow(b, d, n) if x == 1 or x == n-1: return True for r in xrange(1, s): x = (x * x)%n if x == 1: return False elif x == n-1: return True return False # lucas probable prime # assumes D = 1 (mod 4), (D|n) = -1 def is_lucas_prp(n, D): P = 1 Q = (1-D) >> 2 # n+1 = 2**r*s where s is odd s = n+1 r = 0 while s&1 == 0: r += 1 s >>= 1 # calculate the bit reversal of (odd) s # e.g. 19 (10011) <=> 25 (11001) t = 0 while s: if s&1: t += 1 s -= 1 else: t <<= 1 s >>= 1 # use the same bit reversal process to calculate the sth Lucas number # keep track of q = Q**n as we go U = 0 V = 2 q = 1 # mod_inv(2, n) inv_2 = (n+1) >> 1 while t: if t&1: # U, V of n+1 U, V = ((U + V) * inv_2)%n, ((D*U + V) * inv_2)%n q = (q * Q)%n t -= 1 else: # U, V of n*2 U, V = (U * V)%n, (V * V - 2 * q)%n q = (q * q)%n t >>= 1 # double s until we have the 2**r*sth Lucas number while r: U, V = (U * V)%n, (V * V - 2 * q)%n q = (q * q)%n r -= 1 # primality check # if n is prime, n divides the n+1st Lucas number, given the assumptions return U == 0 # primes less than 212 small_primes = set([ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,101,103,107,109,113, 127,131,137,139,149,151,157,163,167,173, 179,181,191,193,197,199,211]) # pre-calced sieve of eratosthenes for n = 2, 3, 5, 7 indices = [ 1, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,101,103,107,109,113,121,127,131, 137,139,143,149,151,157,163,167,169,173, 179,181,187,191,193,197,199,209] # distances between sieve values offsets = [ 10, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2, 4, 2, 4, 8, 6, 4, 6, 2, 4, 6, 2, 6, 6, 4, 2, 4, 6, 2, 6, 4, 2, 4, 2,10, 2] max_int = 2147483647 # an 'almost certain' primality check def is_prime(n): if n < 212: return n in small_primes for p in small_primes: if n%p == 0: return False # if n is a 32-bit integer, perform full trial division if n <= max_int: i = 211 while i*i < n: for o in offsets: i += o if n%i == 0: return False return True # Baillie-PSW # this is technically a probabalistic test, but there are no known pseudoprimes if not is_sprp(n, 2): return False # idea shamelessly stolen from Mathmatica # if n is a 2-sprp and a 3-sprp, n is necessarily square-free if not is_sprp(n, 3): return False a = 5 s = 2 # if n is a perfect square, this will never terminate while legendre(a, n) != n-1: s = -s a = s-a return is_lucas_prp(n, a) # next prime strictly larger than n def next_prime(n): if n < 2: return 2 # first odd larger than n n = (n + 1) | 1 if n < 212: while True: if n in small_primes: return n n += 2 # find our position in the sieve rotation via binary search x = int(n%210) s = 0 e = 47 m = 24 while m != e: if indices[m] < x: s = m m = (s + e + 1) >> 1 else: e = m m = (s + e) >> 1 i = int(n + (indices[m] - x)) # adjust offsets offs = offsets[m:] + offsets[:m] while True: for o in offs: if is_prime(i): return i i += o if __name__ == "__main__": parser =ArgumentParser(description='Uses a MPQS to factor a composite number') parser.add_argument('composite', metavar='number_to_factor', type=long, help='the composite number to factor') parser.add_argument('--verbose', dest='verbose', action='store_true', help="enable verbose output") args = parser.parse_args() print mpqs(args.composite) <?php /* Copyright 2016-2018 Daniil Gentili (https://daniil.it) This file is part of MadelineProto. MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU General Public License along with the MadelineProto. If not, see <http://www.gnu.org/licenses/>. */ namespace danog; class PrimeModule { public static function native_single($what) { if (!is_int($what)) { return false; } foreach ([2, 3, 5, 7, 11, 13, 17, 19, 23] as $s) { if ($what % $s === 0) { return $s; } } $g = 0; for ($i = 0; $i < 3; $i++) { $q = (rand(0, 127) & 15) + 17; $x = rand(0, 1000000000) + 1; $y = $x; $lim = 1 << ($i + 18); for ($j = 1; $j <= $lim; $j++) { list($a, $b, $c) = [$x, $x, $q]; while ($b != 0) { if (($b & 1) != 0) { $c += $a; if ($c >= $what) { $c -= $what; } } $a += $a; if ($a >= $what) { $a -= $what; } $b >>= 1; } $x = $c; $z = ($x < $y) ? $y - $x : $x - $y; $g = self::gcd($z, $what); if ($g != 1) { break; } if (($j & ($j - 1)) === 0) { $y = $x; } } if ($g > 1) { break; } } $p = $what; return min($p, $g); } public static function native($what) { $res = [self::native_single($what)]; while (array_product($res) !== $what) { $res[] = self::native_single($what / array_product($res)); } return $res; } public static function python_single($what) { if (function_exists('shell_exec')) { $res = trim(shell_exec('timeout 10 python '.__DIR__.'/prime.py '.$what.' 2>&1')); if ($res == '' || is_null($res) || !is_numeric($res)) { copy(__DIR__.'/prime.py', getcwd().'/.prime.py'); $res = trim(shell_exec('timeout 10 python '.getcwd().'/.prime.py '.$what.' 2>&1')); unlink(getcwd().'/.prime.py'); if ($res == '' || is_null($res) || !is_numeric($res)) { return false; } } $newval = intval($res); if (is_int($newval)) { $res = $newval; } if ($res === 0) { return false; } return $res; } return false; } public static function python($what) { $res = [self::python_single($what)]; if ($res[0] === false) { return false; } while (array_product($res) !== $what) { $res[] = self::python_single($what / array_product($res)); } return $res; } public static function python_single_alt($what) { if (function_exists('shell_exec')) { $res = trim(shell_exec('python '.__DIR__.'/alt_prime.py '.$what.' 2>&1')); if ($res == '' || is_null($res) || !is_numeric($res)) { copy(__DIR__.'/alt_prime.py', getcwd().'/.alt_prime.py'); $res = trim(shell_exec('python '.getcwd().'/.alt_prime.py '.$what.' 2>&1')); unlink(getcwd().'/.alt_prime.py'); if ($res == '' || is_null($res) || !is_numeric($res)) { return false; } } $newval = intval($res); if (is_int($newval)) { $res = $newval; } if ($res === 0) { return false; } return $res; } return false; } public static function python_alt($what) { $res = [self::python_single_alt($what)]; if ($res[0] === false) { return false; } while (array_product($res) !== $what) { $res[] = self::python_single_alt($what / array_product($res)); } return $res; } public static function wolfram_single($what) { $query = 'Do prime factorization of '.$what; $params = [ 'async' => true, 'banners' => 'raw', 'debuggingdata' => false, 'format' => 'moutput', 'formattimeout' => 8, 'input' => $query, 'output' => 'JSON', 'proxycode' => json_decode(file_get_contents('http://www.wolframalpha.com/api/v1/code'), true)['code'], ]; $url = 'https://www.wolframalpha.com/input/json.jsp?'.http_build_query($params); $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Referer: https://www.wolframalpha.com/input/?i='.urlencode($query)]); curl_setopt($ch, CURLOPT_URL, $url); $res = json_decode(curl_exec($ch), true); curl_close($ch); $fres = false; if (!isset($res['queryresult']['pods'])) { return false; } foreach ($res['queryresult']['pods'] as $cur) { if ($cur['id'] === 'Divisors') { $fres = explode(', ', preg_replace(["/{\d+, /", "/, \d+}$/"], '', $cur['subpods'][0]['moutput'])); break; } } if (is_array($fres)) { $fres = $fres[0]; $newval = intval($fres); if (is_int($newval)) { $fres = $newval; } return $fres; } return false; } public static function wolfram($what) { $res = [self::wolfram_single($what)]; while (array_product($res) !== $what) { $res[] = self::wolfram_single($what / array_product($res)); } return $res; } public static function native_single_cpp($what) { if (!extension_loaded('primemodule')) { return false; } try { return factorize($what); } catch (\Exception $e) { return false; } } public static function native_cpp($what) { $res = [self::native_single_cpp($what)]; if ($res[0] == false) { return false; } while (($product = array_product($res)) !== $what) { if ($product == 0) { return false; } $res[] = self::native_single_cpp($what / $product); } return $res; } public static function auto_single($what) { $res = self::native_single_cpp($what); if ($res !== false) { return $res; } $res = self::python_single_alt($what); if ($res !== false) { return $res; } $res = self::python_single($what); if ($res !== false) { return $res; } $res = self::native_single((int) $what); if ($res !== false) { return $res; } $res = self::wolfram_single($what); if ($res !== false) { return $res; } return false; } public static function auto($what) { $res = self::native_cpp($what); if (is_array($res)) { return $res; } $res = self::python_alt($what); if (is_array($res)) { return $res; } $res = self::python($what); if (is_array($res)) { return $res; } $res = self::native((int) $what); if (is_array($res)) { return $res; } $res = self::wolfram($what); if (is_array($res)) { return $res; } return false; } private static function gcd($a, $b) { if ($a == $b) { return $a; } while ($b > 0) { list($a, $b) = [$b, self::posmod($a, $b)]; } return $a; } private static function posmod($a, $b) { $resto = $a % $b; if ($resto < 0) { $resto += abs($b); } return $resto; } private function primesbelow($N) { $correction = ($N % 6 > 1) ? true : false; $N_Array = [$N, $N - 1, $N + 4, $N + 3, $N + 2, $N + 1]; $N = $N_Array[$N % 6]; $sieve = []; for ($i = 0; $i < (int) $N / 3; $i++) { $sieve[$i] = true; } $sieve[0] = false; for ($i = 0; $i < (int) ((int) pow($N, 0.5) / 3) + 1; $i++) { if ($sieve[$i]) { $k = (3 * $i + 1) | 1; $startIndex1 = (int) ($k * $k / 3); $period = 2 * $k; for ($j = $startIndex1; $j < count($sieve); $j = $j + $period) { $sieve[$j] = false; } $startIndex2 = (int) (($k * $k + 4 * $k - 2 * $k * ($i % 2)) / 3); $period = 2 * $k; for ($k = $startIndex2; $k < count($sieve); $k = $k + $period) { $sieve[$k] = false; } } } $resultArray = [2, 3]; $t = 1; for ($i = 1; $i < (int) ($N / 3) - $correction; $i++) { if ($sieve[$i]) { $resultArray[$t + 1] = (3 * $i + 1) | 1; $t++; } } return $resultArray; } private function isprime($n, $precision = 7) { $smallprimeset = $this->primesbelow(100000); $_smallprimeset = 100000; if ($n == 1 || $n % 2 == 0) { return false; } elseif ($n < 1) { throw new Exception('Out of bounds, first argument must be > 0'); } elseif ($n < $_smallprimeset) { return in_array($n, $smallprimeset); } $d = $n - 1; $s = 0; while ($d % 2 == 0) { $d = (int) ($d / 2); $s += 1; } for ($i = 0; $i < $precision; $i++) { // random.randrange(2, n - 2) means: // $a = mt_rand(2, $n - 3); // maybe $n would be bigger that PHP_MAX_INT $a = mt_rand(2, 1084); $x = bcpowmod($a, $d, $n); if ($x == 1 || $x == $n - 1) { continue; } $flagfound = 0; for ($j = 0; $j < $s - 1; $j++) { $x = bcpowmod($x, 2, $n); if ($x == 1) { return false; } if ($x == $n - 1) { $flagfound = 1; break; } } if ($flagfound == 0) { return false; } } return true; } private function pollard_brent($n) { $n = (int) $n; if ($n % 2 == 0) { return 2; } if (bcmod($n, 2) == 0) { return 2; } if (bcmod($n, 3) == 0) { return 3; } // $y = mt_rand(1, $n-1); // $c = mt_rand(1, $n-1); // $m = mt_rand(1, $n-1); // Again, $n may be bigger than PHP_MAX_INT // also, small numbers has a big affect in a good performance $y = 2; $c = 3; $m = 4; $g = 1; $r = 1; $q = 1; while ($g == 1) { $x = $y; for ($i = 0; $i < $r; $i++) { // $y = gmp_mod( (bcpowmod($y, 2, $n) + $c) , $n); $y = bcmod((bcpowmod($y, 2, $n) + $c), $n); } $k = 0; while ($k < $r && $g == 1) { $ys = $y; for ($j = 0; $j < min($m, $r - $k); $j++) { // $y = gmp_mod( (bcpowmod($y, 2, $n) + $c), $n ); $y = bcmod((bcpowmod($y, 2, $n) + $c), $n); // $q = gmp_mod($q * abs($x-$y), $n); $mul = bcmul($q, abs($x - $y)); $q = bcmod($mul, $n); } $g = $this->gcd2($q, $n); $k += $m; } $r *= 2; } if ($g == $n) { while (true) { // $ys = ( bcpowmod($ys, 2, $n) + $c ) % $n; $ys = bcmod((bcpowmod($ys, 2, $n) + $c), $n); $g = $this->gcd2(abs($x - $ys), $n); if ($g > 1) { break; } } } return $g; } public function primefactors($n, $sort = false) { $smallprimes = $this->primesbelow(10000); $factors = []; $limit = bcadd(bcsqrt($n), 1); foreach ($smallprimes as $checker) { if ($checker > $limit) { break; } // while (gmp_mod($n, $checker) == 0) { while (bcmod($n, $checker) == 0) { array_push($factors, $checker); $n = bcdiv($n, $checker); $limit = bcadd(bcsqrt($n), 1); if ($checker > $limit) { break; } } } if ($n < 2) { return $factors; } while ($n > 1) { if ($this->isprime($n)) { array_push($factors, $n); break; } $factor = $this->pollard_brent($n); $factors = array_merge($factors, $this->primefactors($factor)); $n = (int) ($n / $factor); } if ($sort) { sort($factors); } return $factors; } private function gcd2($a, $b) { if ($a == $b) { return $a; } while ($b > 0) { $a2 = $a; $a = $b; $b = bcmod($a2, $b); } return $a; } } <?php // autoload_files.php @generated by Composer $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( 'e8aa6e4b5a1db2f56ae794f1505391a8' => $vendorDir . '/amphp/amp/lib/functions.php', '76cd0796156622033397994f25b0d8fc' => $vendorDir . '/amphp/amp/lib/Internal/functions.php', '6cd5651c4fef5ed6b63e8d8b8ffbf3cc' => $vendorDir . '/amphp/byte-stream/lib/functions.php', 'abf9dda23a6e45f0b7b736dd6816510d' => $vendorDir . '/amphp/process/lib/constants.php', 'b324e763907bc37a8bdf81fa40eb1b39' => $vendorDir . '/amphp/sync/lib/functions.php', '7863f327e247feb05e3be59a4fe77a6b' => $vendorDir . '/amphp/uri/src/functions.php', '384cf4f2eb4d2f896db72315a76066ad' => $vendorDir . '/amphp/parallel/lib/Worker/functions.php', '68a7b7dddb51c03877a41f03c909bf08' => $vendorDir . '/amphp/file/lib/functions.php', '445532134d762b3cbc25500cac266092' => $vendorDir . '/daverandom/libdns/src/functions.php', '7ebf029ad4b246f1e3f66192b40a932f' => $vendorDir . '/amphp/dns/lib/functions.php', '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php', 'd4e415514e4352172d58f02433fa50e4' => $vendorDir . '/amphp/socket/src/functions.php', '1c2dcb9d6851a7abaae89f9586ddd460' => $vendorDir . '/amphp/socket/src/Internal/functions.php', '5ac5dbc97af12bd847e1db9fe93e192f' => $vendorDir . '/amphp/log/src/functions.php', 'ec5ab6981b6a35264b581413ab1e90f5' => $vendorDir . '/amphp/websocket-client/lib/functions.php', 'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php', 'efa3b80c61fb35e374f529ec349af098' => $vendorDir . '/danog/madelineproto/src/BigIntegor.php', '7c6952916da927c1fa7fc73e564a99dc' => $vendorDir . '/danog/madelineproto/src/Socket.php', '9f641fdaff2d9330ca6de95bb6458e68' => $vendorDir . '/danog/madelineproto/src/Collectable.php', 'f30e18abdb782bea448c5103598410f9' => $vendorDir . '/danog/madelineproto/src/Threaded.php', '78374a53d80784aa0ce0d3196412ec51' => $vendorDir . '/danog/madelineproto/src/Volatile.php', 'ee8b9dc0d1b22a255490d056f08b1a94' => $vendorDir . '/danog/madelineproto/src/Thread.php', '8071b591748c33081e1801a04d20062f' => $vendorDir . '/danog/madelineproto/src/Worker.php', '3f836cae0440334cb5210fceace41b10' => $vendorDir . '/danog/madelineproto/src/Pool.php', 'cc11d0fcc83d0417d122eeadfc2948fa' => $vendorDir . '/danog/madelineproto/src/HttpProxy.php', 'e07fe36e00fdf8b2c8cf9100e48d061b' => $vendorDir . '/danog/madelineproto/src/SocksProxy.php', ); <?php // autoload_static.php @generated by Composer namespace Composer\Autoload; class ComposerStaticInit2b406fc5980db47d49835190623f72fc { public static $files = array ( 'e8aa6e4b5a1db2f56ae794f1505391a8' => __DIR__ . '/..' . '/amphp/amp/lib/functions.php', '76cd0796156622033397994f25b0d8fc' => __DIR__ . '/..' . '/amphp/amp/lib/Internal/functions.php', '6cd5651c4fef5ed6b63e8d8b8ffbf3cc' => __DIR__ . '/..' . '/amphp/byte-stream/lib/functions.php', 'abf9dda23a6e45f0b7b736dd6816510d' => __DIR__ . '/..' . '/amphp/process/lib/constants.php', 'b324e763907bc37a8bdf81fa40eb1b39' => __DIR__ . '/..' . '/amphp/sync/lib/functions.php', '7863f327e247feb05e3be59a4fe77a6b' => __DIR__ . '/..' . '/amphp/uri/src/functions.php', '384cf4f2eb4d2f896db72315a76066ad' => __DIR__ . '/..' . '/amphp/parallel/lib/Worker/functions.php', '68a7b7dddb51c03877a41f03c909bf08' => __DIR__ . '/..' . '/amphp/file/lib/functions.php', '445532134d762b3cbc25500cac266092' => __DIR__ . '/..' . '/daverandom/libdns/src/functions.php', '7ebf029ad4b246f1e3f66192b40a932f' => __DIR__ . '/..' . '/amphp/dns/lib/functions.php', '5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php', 'd4e415514e4352172d58f02433fa50e4' => __DIR__ . '/..' . '/amphp/socket/src/functions.php', '1c2dcb9d6851a7abaae89f9586ddd460' => __DIR__ . '/..' . '/amphp/socket/src/Internal/functions.php', '5ac5dbc97af12bd847e1db9fe93e192f' => __DIR__ . '/..' . '/amphp/log/src/functions.php', 'ec5ab6981b6a35264b581413ab1e90f5' => __DIR__ . '/..' . '/amphp/websocket-client/lib/functions.php', 'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php', 'efa3b80c61fb35e374f529ec349af098' => __DIR__ . '/..' . '/danog/madelineproto/src/BigIntegor.php', '7c6952916da927c1fa7fc73e564a99dc' => __DIR__ . '/..' . '/danog/madelineproto/src/Socket.php', '9f641fdaff2d9330ca6de95bb6458e68' => __DIR__ . '/..' . '/danog/madelineproto/src/Collectable.php', 'f30e18abdb782bea448c5103598410f9' => __DIR__ . '/..' . '/danog/madelineproto/src/Threaded.php', '78374a53d80784aa0ce0d3196412ec51' => __DIR__ . '/..' . '/danog/madelineproto/src/Volatile.php', 'ee8b9dc0d1b22a255490d056f08b1a94' => __DIR__ . '/..' . '/danog/madelineproto/src/Thread.php', '8071b591748c33081e1801a04d20062f' => __DIR__ . '/..' . '/danog/madelineproto/src/Worker.php', '3f836cae0440334cb5210fceace41b10' => __DIR__ . '/..' . '/danog/madelineproto/src/Pool.php', 'cc11d0fcc83d0417d122eeadfc2948fa' => __DIR__ . '/..' . '/danog/madelineproto/src/HttpProxy.php', 'e07fe36e00fdf8b2c8cf9100e48d061b' => __DIR__ . '/..' . '/danog/madelineproto/src/SocksProxy.php', ); public static $prefixLengthsPsr4 = array ( 'p' => array ( 'phpseclib\\' => 10, ), 'R' => array ( 'Rollbar\\' => 8, ), 'P' => array ( 'Psr\\Log\\' => 8, 'ParagonIE\\ConstantTime\\' => 23, ), 'M' => array ( 'Monolog\\' => 8, ), 'L' => array ( 'LibDNS\\' => 7, ), 'D' => array ( 'Dotenv\\' => 7, ), 'A' => array ( 'Amp\\WindowsRegistry\\' => 20, 'Amp\\Websocket\\' => 14, 'Amp\\Uri\\' => 8, 'Amp\\Sync\\' => 9, 'Amp\\Socket\\' => 11, 'Amp\\Process\\' => 12, 'Amp\\Parser\\' => 11, 'Amp\\Parallel\\' => 13, 'Amp\\Log\\' => 8, 'Amp\\File\\' => 9, 'Amp\\Dns\\' => 8, 'Amp\\Cache\\' => 10, 'Amp\\ByteStream\\' => 15, 'Amp\\' => 4, ), ); public static $prefixDirsPsr4 = array ( 'phpseclib\\' => array ( 0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib', ), 'Rollbar\\' => array ( 0 => __DIR__ . '/..' . '/rollbar/rollbar/src', ), 'Psr\\Log\\' => array ( 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', ), 'ParagonIE\\ConstantTime\\' => array ( 0 => __DIR__ . '/..' . '/paragonie/constant_time_encoding/src', ), 'Monolog\\' => array ( 0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog', ), 'LibDNS\\' => array ( 0 => __DIR__ . '/..' . '/daverandom/libdns/src', ), 'Dotenv\\' => array ( 0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src', ), 'Amp\\WindowsRegistry\\' => array ( 0 => __DIR__ . '/..' . '/amphp/windows-registry/lib', ), 'Amp\\Websocket\\' => array ( 0 => __DIR__ . '/..' . '/amphp/websocket-client/lib', ), 'Amp\\Uri\\' => array ( 0 => __DIR__ . '/..' . '/amphp/uri/src', ), 'Amp\\Sync\\' => array ( 0 => __DIR__ . '/..' . '/amphp/sync/lib', ), 'Amp\\Socket\\' => array ( 0 => __DIR__ . '/..' . '/amphp/socket/src', ), 'Amp\\Process\\' => array ( 0 => __DIR__ . '/..' . '/amphp/process/lib', ), 'Amp\\Parser\\' => array ( 0 => __DIR__ . '/..' . '/amphp/parser/lib', ), 'Amp\\Parallel\\' => array ( 0 => __DIR__ . '/..' . '/amphp/parallel/lib', ), 'Amp\\Log\\' => array ( 0 => __DIR__ . '/..' . '/amphp/log/src', ), 'Amp\\File\\' => array ( 0 => __DIR__ . '/..' . '/amphp/file/lib', ), 'Amp\\Dns\\' => array ( 0 => __DIR__ . '/..' . '/amphp/dns/lib', ), 'Amp\\Cache\\' => array ( 0 => __DIR__ . '/..' . '/amphp/cache/lib', ), 'Amp\\ByteStream\\' => array ( 0 => __DIR__ . '/..' . '/amphp/byte-stream/lib', ), 'Amp\\' => array ( 0 => __DIR__ . '/..' . '/amphp/amp/lib', ), ); public static $prefixesPsr0 = array ( 'd' => array ( 'danog\\MadelineProto\\' => array ( 0 => __DIR__ . '/..' . '/danog/madelineproto/src', ), 'danog\\' => array ( 0 => __DIR__ . '/..' . '/danog/magicalserializer/src', 1 => __DIR__ . '/..' . '/danog/primemodule/lib', ), ), 'P' => array ( 'Parsedown' => array ( 0 => __DIR__ . '/..' . '/erusev/parsedown', ), ), ); public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { $loader->prefixLengthsPsr4 = ComposerStaticInit2b406fc5980db47d49835190623f72fc::$prefixLengthsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit2b406fc5980db47d49835190623f72fc::$prefixDirsPsr4; $loader->prefixesPsr0 = ComposerStaticInit2b406fc5980db47d49835190623f72fc::$prefixesPsr0; }, null, ClassLoader::class); } } <?php // autoload_real.php @generated by Composer class ComposerAutoloaderInit2b406fc5980db47d49835190623f72fc { private static $loader; public static function loadClassLoader($class) { if ('Composer\Autoload\ClassLoader' === $class) { require __DIR__ . '/ClassLoader.php'; } } public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInit2b406fc5980db47d49835190623f72fc', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit2b406fc5980db47d49835190623f72fc', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInit2b406fc5980db47d49835190623f72fc::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = require __DIR__ . '/autoload_psr4.php'; foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { $loader->addClassMap($classMap); } } $loader->register(true); if ($useStaticLoader) { $includeFiles = Composer\Autoload\ComposerStaticInit2b406fc5980db47d49835190623f72fc::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { composerRequire2b406fc5980db47d49835190623f72fc($fileIdentifier, $file); } return $loader; } } function composerRequire2b406fc5980db47d49835190623f72fc($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; } } <?php // autoload_psr4.php @generated by Composer $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( 'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'), 'Rollbar\\' => array($vendorDir . '/rollbar/rollbar/src'), 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), 'ParagonIE\\ConstantTime\\' => array($vendorDir . '/paragonie/constant_time_encoding/src'), 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), 'LibDNS\\' => array($vendorDir . '/daverandom/libdns/src'), 'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'), 'Amp\\WindowsRegistry\\' => array($vendorDir . '/amphp/windows-registry/lib'), 'Amp\\Websocket\\' => array($vendorDir . '/amphp/websocket-client/lib'), 'Amp\\Uri\\' => array($vendorDir . '/amphp/uri/src'), 'Amp\\Sync\\' => array($vendorDir . '/amphp/sync/lib'), 'Amp\\Socket\\' => array($vendorDir . '/amphp/socket/src'), 'Amp\\Process\\' => array($vendorDir . '/amphp/process/lib'), 'Amp\\Parser\\' => array($vendorDir . '/amphp/parser/lib'), 'Amp\\Parallel\\' => array($vendorDir . '/amphp/parallel/lib'), 'Amp\\Log\\' => array($vendorDir . '/amphp/log/src'), 'Amp\\File\\' => array($vendorDir . '/amphp/file/lib'), 'Amp\\Dns\\' => array($vendorDir . '/amphp/dns/lib'), 'Amp\\Cache\\' => array($vendorDir . '/amphp/cache/lib'), 'Amp\\ByteStream\\' => array($vendorDir . '/amphp/byte-stream/lib'), 'Amp\\' => array($vendorDir . '/amphp/amp/lib'), ); <?php /* * This file is part of Composer. * * (c) Nils Adermann <naderman@naderman.de> * Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Composer\Autoload; /** * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. * * $loader = new \Composer\Autoload\ClassLoader(); * * // register classes with namespaces * $loader->add('Symfony\Component', __DIR__.'/component'); * $loader->add('Symfony', __DIR__.'/framework'); * * // activate the autoloader * $loader->register(); * * // to enable searching the include path (eg. for PEAR packages) * $loader->setUseIncludePath(true); * * In this example, if you try to use a class in the Symfony\Component * namespace or one of its children (Symfony\Component\Console for instance), * the autoloader will first look for the class under the component/ * directory, and it will then fallback to the framework/ directory if not * found before giving up. * * This class is loosely based on the Symfony UniversalClassLoader. * * @author Fabien Potencier <fabien@symfony.com> * @author Jordi Boggiano <j.boggiano@seld.be> * @see http://www.php-fig.org/psr/psr-0/ * @see http://www.php-fig.org/psr/psr-4/ */ class ClassLoader { // PSR-4 private $prefixLengthsPsr4 = array(); private $prefixDirsPsr4 = array(); private $fallbackDirsPsr4 = array(); // PSR-0 private $prefixesPsr0 = array(); private $fallbackDirsPsr0 = array(); private $useIncludePath = false; private $classMap = array(); private $classMapAuthoritative = false; private $missingClasses = array(); private $apcuPrefix; public function getPrefixes() { if (!empty($this->prefixesPsr0)) { return call_user_func_array('array_merge', $this->prefixesPsr0); } return array(); } public function getPrefixesPsr4() { return $this->prefixDirsPsr4; } public function getFallbackDirs() { return $this->fallbackDirsPsr0; } public function getFallbackDirsPsr4() { return $this->fallbackDirsPsr4; } public function getClassMap() { return $this->classMap; } /** * @param array $classMap Class to filename map */ public function addClassMap(array $classMap) { if ($this->classMap) { $this->classMap = array_merge($this->classMap, $classMap); } else { $this->classMap = $classMap; } } /** * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * * @param string $prefix The prefix * @param array|string $paths The PSR-0 root directories * @param bool $prepend Whether to prepend the directories */ public function add($prefix, $paths, $prepend = false) { if (!$prefix) { if ($prepend) { $this->fallbackDirsPsr0 = array_merge( (array) $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, (array) $paths ); } return; } $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { $this->prefixesPsr0[$first][$prefix] = (array) $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( (array) $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], (array) $paths ); } } /** * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * * @param string $prefix The prefix/namespace, with trailing '\\' * @param array|string $paths The PSR-4 base directories * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException */ public function addPsr4($prefix, $paths, $prepend = false) { if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( (array) $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, (array) $paths ); } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { // Register directories for a new namespace. $length = strlen($prefix); if ('\\' !== $prefix[$length - 1]) { throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; $this->prefixDirsPsr4[$prefix] = (array) $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( (array) $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], (array) $paths ); } } /** * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * * @param string $prefix The prefix * @param array|string $paths The PSR-0 base directories */ public function set($prefix, $paths) { if (!$prefix) { $this->fallbackDirsPsr0 = (array) $paths; } else { $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; } } /** * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * * @param string $prefix The prefix/namespace, with trailing '\\' * @param array|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException */ public function setPsr4($prefix, $paths) { if (!$prefix) { $this->fallbackDirsPsr4 = (array) $paths; } else { $length = strlen($prefix); if ('\\' !== $prefix[$length - 1]) { throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; $this->prefixDirsPsr4[$prefix] = (array) $paths; } } /** * Turns on searching the include path for class files. * * @param bool $useIncludePath */ public function setUseIncludePath($useIncludePath) { $this->useIncludePath = $useIncludePath; } /** * Can be used to check if the autoloader uses the include path to check * for classes. * * @return bool */ public function getUseIncludePath() { return $this->useIncludePath; } /** * Turns off searching the prefix and fallback directories for classes * that have not been registered with the class map. * * @param bool $classMapAuthoritative */ public function setClassMapAuthoritative($classMapAuthoritative) { $this->classMapAuthoritative = $classMapAuthoritative; } /** * Should class lookup fail if not found in the current class map? * * @return bool */ public function isClassMapAuthoritative() { return $this->classMapAuthoritative; } /** * APCu prefix to use to cache found/not-found classes, if the extension is enabled. * * @param string|null $apcuPrefix */ public function setApcuPrefix($apcuPrefix) { $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; } /** * The APCu prefix in use, or null if APCu caching is not enabled. * * @return string|null */ public function getApcuPrefix() { return $this->apcuPrefix; } /** * Registers this instance as an autoloader. * * @param bool $prepend Whether to prepend the autoloader or not */ public function register($prepend = false) { spl_autoload_register(array($this, 'loadClass'), true, $prepend); } /** * Unregisters this instance as an autoloader. */ public function unregister() { spl_autoload_unregister(array($this, 'loadClass')); } /** * Loads the given class or interface. * * @param string $class The name of the class * @return bool|null True if loaded, null otherwise */ public function loadClass($class) { if ($file = $this->findFile($class)) { includeFile($file); return true; } } /** * Finds the path to the file where the class is defined. * * @param string $class The name of the class * * @return string|false The path if found, false otherwise */ public function findFile($class) { // class map lookup if (isset($this->classMap[$class])) { return $this->classMap[$class]; } if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { return false; } if (null !== $this->apcuPrefix) { $file = apcu_fetch($this->apcuPrefix.$class, $hit); if ($hit) { return $file; } } $file = $this->findFileWithExtension($class, '.php'); // Search for Hack files if we are running on HHVM if (false === $file && defined('HHVM_VERSION')) { $file = $this->findFileWithExtension($class, '.hh'); } if (null !== $this->apcuPrefix) { apcu_add($this->apcuPrefix.$class, $file); } if (false === $file) { // Remember that this class does not exist. $this->missingClasses[$class] = true; } return $file; } private function findFileWithExtension($class, $ext) { // PSR-4 lookup $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; $first = $class[0]; if (isset($this->prefixLengthsPsr4[$first])) { $subPath = $class; while (false !== $lastPos = strrpos($subPath, '\\')) { $subPath = substr($subPath, 0, $lastPos); $search = $subPath . '\\'; if (isset($this->prefixDirsPsr4[$search])) { $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { if (file_exists($file = $dir . $pathEnd)) { return $file; } } } } } // PSR-4 fallback dirs foreach ($this->fallbackDirsPsr4 as $dir) { if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { return $file; } } // PSR-0 lookup if (false !== $pos = strrpos($class, '\\')) { // namespaced class name $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); } else { // PEAR-like class name $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; } if (isset($this->prefixesPsr0[$first])) { foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { if (0 === strpos($class, $prefix)) { foreach ($dirs as $dir) { if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { return $file; } } } } } // PSR-0 fallback dirs foreach ($this->fallbackDirsPsr0 as $dir) { if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { return $file; } } // PSR-0 include paths. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { return $file; } return false; } } /** * Scope isolated include. * * Prevents access to $this/self from included files. */ function includeFile($file) { include $file; } [ { "name": "amphp/amp", "version": "v2.1.1", "version_normalized": "2.1.1.0", "source": { "type": "git", "url": "https://github.com/amphp/amp.git", "reference": "7075ef7d74dbd32626bfd31c976b23055c3ade6a" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/amphp/amp/zipball/7075ef7d74dbd32626bfd31c976b23055c3ade6a", "reference": "7075ef7d74dbd32626bfd31c976b23055c3ade6a", "shasum": "" }, "require": { "php": ">=7" }, "require-dev": { "amphp/phpunit-util": "^1", "friendsofphp/php-cs-fixer": "^2.3", "phpstan/phpstan": "^0.8.5", "phpunit/phpunit": "^6.0.9", "react/promise": "^2" }, "time": "2018-12-11T10:31:37+00:00", "type": "library", "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { "Amp\\": "lib" }, "files": [ "lib/functions.php", "lib/Internal/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Bob Weinand", "email": "bobwei9@hotmail.com" }, { "name": "Niklas Keller", "email": "me@kelunik.com" }, { "name": "Daniel Lowrey", "email": "rdlowrey@php.net" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" } ], "description": "A non-blocking concurrency framework for PHP applications.", "homepage": "http://amphp.org/amp", "keywords": [ "async", "asynchronous", "awaitable", "concurrency", "event", "event-loop", "future", "non-blocking", "promise" ] }, { "name": "amphp/byte-stream", "version": "v1.5.0", "version_normalized": "1.5.0.0", "source": { "type": "git", "url": "https://github.com/amphp/byte-stream.git", "reference": "37b9ab16bb8f69c825c3c4e553fe00da73dd6926" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/amphp/byte-stream/zipball/37b9ab16bb8f69c825c3c4e553fe00da73dd6926", "reference": "37b9ab16bb8f69c825c3c4e553fe00da73dd6926", "shasum": "" }, "require": { "amphp/amp": "^2" }, "require-dev": { "amphp/php-cs-fixer-config": "dev-master", "amphp/phpunit-util": "^1", "friendsofphp/php-cs-fixer": "^2.3", "infection/infection": "^0.9.3", "phpunit/phpunit": "^6" }, "time": "2018-10-22T19:37:37+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { "Amp\\ByteStream\\": "lib" }, "files": [ "lib/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Niklas Keller", "email": "me@kelunik.com" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" } ], "description": "A stream abstraction to make working with non-blocking I/O simple.", "homepage": "http://amphp.org/byte-stream", "keywords": [ "amp", "amphp", "async", "io", "non-blocking", "stream" ] }, { "name": "amphp/cache", "version": "v1.2.0", "version_normalized": "1.2.0.0", "source": { "type": "git", "url": "https://github.com/amphp/cache.git", "reference": "ab2339e465d9d383dc748f288d530fd7cd7aadea" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/amphp/cache/zipball/ab2339e465d9d383dc748f288d530fd7cd7aadea", "reference": "ab2339e465d9d383dc748f288d530fd7cd7aadea", "shasum": "" }, "require": { "amphp/amp": "^2" }, "require-dev": { "amphp/phpunit-util": "^1", "friendsofphp/php-cs-fixer": "^2.3", "phpunit/phpunit": "^6" }, "time": "2017-10-04T19:22:12+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { "Amp\\Cache\\": "lib" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Niklas Keller", "email": "me@kelunik.com" }, { "name": "Daniel Lowrey", "email": "rdlowrey@php.net" } ], "description": "A promise-aware caching API for Amp.", "homepage": "https://github.com/amphp/cache" }, { "name": "amphp/dns", "version": "dev-master", "version_normalized": "9999999-dev", "source": { "type": "git", "url": "https://github.com/amphp/dns.git", "reference": "861cc857b1ba6e02e8a7439c30403682785fce96" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/amphp/dns/zipball/861cc857b1ba6e02e8a7439c30403682785fce96", "reference": "861cc857b1ba6e02e8a7439c30403682785fce96", "shasum": "" }, "require": { "amphp/amp": "^2", "amphp/byte-stream": "^1.1", "amphp/cache": "^1.2", "amphp/file": "^0.2 || ^0.3", "amphp/parser": "^1", "amphp/uri": "^0.1", "amphp/windows-registry": "^0.3", "daverandom/libdns": "^2.0.1", "ext-filter": "*", "php": ">=7.0" }, "require-dev": { "amphp/phpunit-util": "^1", "friendsofphp/php-cs-fixer": "^2.3", "phpunit/phpunit": "^6" }, "time": "2018-05-16T20:23:07+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { "Amp\\Dns\\": "lib" }, "files": [ "lib/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Bob Weinand", "email": "bobwei9@hotmail.com" }, { "name": "Niklas Keller", "email": "me@kelunik.com" }, { "name": "Daniel Lowrey", "email": "rdlowrey@php.net" }, { "name": "Chris Wright", "email": "addr@daverandom.com" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" } ], "description": "Async DNS resolution for Amp.", "homepage": "https://github.com/amphp/dns", "keywords": [ "amp", "amphp", "async", "client", "dns", "resolve" ] }, { "name": "amphp/file", "version": "dev-master", "version_normalized": "9999999-dev", "source": { "type": "git", "url": "https://github.com/amphp/file.git", "reference": "5a69fca406ac5fd220de0aa68c887bc8046eb93c" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/amphp/file/zipball/5a69fca406ac5fd220de0aa68c887bc8046eb93c", "reference": "5a69fca406ac5fd220de0aa68c887bc8046eb93c", "shasum": "" }, "require": { "amphp/amp": "^2", "amphp/byte-stream": "^1", "amphp/parallel": "^1" }, "require-dev": { "amphp/php-cs-fixer-config": "dev-master", "amphp/phpunit-util": "^1", "phpunit/phpunit": "^6" }, "time": "2018-10-29T04:55:11+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { "Amp\\File\\": "lib" }, "files": [ "lib/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Niklas Keller", "email": "me@kelunik.com" }, { "name": "Daniel Lowrey", "email": "rdlowrey@php.net" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" } ], "description": "Allows non-blocking access to the filesystem for Amp.", "homepage": "https://github.com/amphp/file", "keywords": [ "amp", "amphp", "async", "disk", "file", "filesystem", "io", "non-blocking", "static" ] }, { "name": "amphp/log", "version": "v1.0.0", "version_normalized": "1.0.0.0", "source": { "type": "git", "url": "https://github.com/amphp/log.git", "reference": "728678d6e751abeb54a4d2fc6e76ef977de3f43b" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/amphp/log/zipball/728678d6e751abeb54a4d2fc6e76ef977de3f43b", "reference": "728678d6e751abeb54a4d2fc6e76ef977de3f43b", "shasum": "" }, "require": { "amphp/amp": "^2", "amphp/byte-stream": "^1.3", "monolog/monolog": "^1.23" }, "require-dev": { "amphp/file": "^0.3", "amphp/phpunit-util": "^1", "friendsofphp/php-cs-fixer": "^2.3", "phpunit/phpunit": "^6" }, "time": "2018-03-22T19:39:52+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { "Amp\\Log\\": "src" }, "files": [ "src/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Niklas Keller", "email": "me@kelunik.com" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" } ], "description": "Non-blocking logging for PHP based on Amp and Monolog.", "homepage": "https://github.com/amphp/log", "keywords": [ "amp", "amphp", "async", "log", "logger", "logging", "non-blocking" ] }, { "name": "amphp/parallel", "version": "v1.0.1", "version_normalized": "1.0.1.0", "source": { "type": "git", "url": "https://github.com/amphp/parallel.git", "reference": "4c3c93e46a0108f04990352b0d084ded2ec2cc17" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/amphp/parallel/zipball/4c3c93e46a0108f04990352b0d084ded2ec2cc17", "reference": "4c3c93e46a0108f04990352b0d084ded2ec2cc17", "shasum": "" }, "require": { "amphp/amp": "^2", "amphp/byte-stream": "^1.5", "amphp/parser": "^1", "amphp/process": "^1", "amphp/sync": "^1.0.1" }, "require-dev": { "amphp/php-cs-fixer-config": "dev-master", "amphp/phpunit-util": "^1", "phpunit/phpunit": "^6" }, "suggest": { "ext-pthreads": "Required for thread contexts" }, "time": "2018-10-27T16:19:01+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { "Amp\\Parallel\\": "lib" }, "files": [ "lib/Worker/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Stephen Coakley", "email": "me@stephencoakley.com" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" } ], "description": "Parallel processing component for Amp.", "homepage": "https://github.com/amphp/parallel", "keywords": [ "async", "asynchronous", "concurrent", "multi-processing", "multi-threading" ] }, { "name": "amphp/parser", "version": "v1.0.0", "version_normalized": "1.0.0.0", "source": { "type": "git", "url": "https://github.com/amphp/parser.git", "reference": "f83e68f03d5b8e8e0365b8792985a7f341c57ae1" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/amphp/parser/zipball/f83e68f03d5b8e8e0365b8792985a7f341c57ae1", "reference": "f83e68f03d5b8e8e0365b8792985a7f341c57ae1", "shasum": "" }, "require": { "php": ">=7" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.3", "phpunit/phpunit": "^6" }, "time": "2017-06-06T05:29:10+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { "Amp\\Parser\\": "lib" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Niklas Keller", "email": "me@kelunik.com" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" } ], "description": "A generator parser to make streaming parsers simple.", "homepage": "https://github.com/amphp/parser", "keywords": [ "async", "non-blocking", "parser", "stream" ] }, { "name": "amphp/process", "version": "v1.0.2", "version_normalized": "1.0.2.0", "source": { "type": "git", "url": "https://github.com/amphp/process.git", "reference": "90f3f31cbd0eee7fa5ae03ce588b1fc8f122997c" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/amphp/process/zipball/90f3f31cbd0eee7fa5ae03ce588b1fc8f122997c", "reference": "90f3f31cbd0eee7fa5ae03ce588b1fc8f122997c", "shasum": "" }, "require": { "amphp/amp": "^2", "amphp/byte-stream": "^1.4", "php": ">=7" }, "require-dev": { "amphp/php-cs-fixer-config": "dev-master", "amphp/phpunit-util": "^1", "phpunit/phpunit": "^6" }, "time": "2018-11-09T00:02:00+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { "Amp\\Process\\": "lib" }, "files": [ "lib/constants.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Bob Weinand", "email": "bobwei9@hotmail.com" }, { "name": "Niklas Keller", "email": "me@kelunik.com" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" } ], "description": "Asynchronous process manager.", "homepage": "https://github.com/amphp/process" }, { "name": "amphp/socket", "version": "v0.10.11", "version_normalized": "0.10.11.0", "source": { "type": "git", "url": "https://github.com/amphp/socket.git", "reference": "2cb9d0ef823cfd1de4cfbd0e680c58841367f727" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/amphp/socket/zipball/2cb9d0ef823cfd1de4cfbd0e680c58841367f727", "reference": "2cb9d0ef823cfd1de4cfbd0e680c58841367f727", "shasum": "" }, "require": { "amphp/amp": "^2", "amphp/byte-stream": "^1.1", "amphp/dns": "^0.9", "amphp/uri": "^0.1", "php": ">=7.0" }, "require-dev": { "amphp/phpunit-util": "^1", "friendsofphp/php-cs-fixer": "^2.3", "phpunit/phpunit": "^6" }, "time": "2018-10-17T16:53:02+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { "Amp\\Socket\\": "src" }, "files": [ "src/functions.php", "src/Internal/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Niklas Keller", "email": "me@kelunik.com" }, { "name": "Daniel Lowrey", "email": "rdlowrey@gmail.com" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" } ], "description": "Async socket connection / server tools for Amp.", "homepage": "https://github.com/amphp/socket", "keywords": [ "amp", "async", "encryption", "non-blocking", "sockets", "tcp", "tls" ] }, { "name": "amphp/sync", "version": "v1.0.1", "version_normalized": "1.0.1.0", "source": { "type": "git", "url": "https://github.com/amphp/sync.git", "reference": "a1d8f244eb19e3e2a96abc4686cebc80995bbc90" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/amphp/sync/zipball/a1d8f244eb19e3e2a96abc4686cebc80995bbc90", "reference": "a1d8f244eb19e3e2a96abc4686cebc80995bbc90", "shasum": "" }, "require": { "amphp/amp": "^2" }, "require-dev": { "amphp/phpunit-util": "^1", "friendsofphp/php-cs-fixer": "^2.3", "phpunit/phpunit": "^6" }, "time": "2017-11-29T21:48:53+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { "Amp\\Sync\\": "lib" }, "files": [ "lib/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Stephen Coakley", "email": "me@stephencoakley.com" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" } ], "description": "Mutex, Semaphore, and other synchronization tools for Amp.", "homepage": "https://github.com/amphp/sync", "keywords": [ "async", "asynchronous", "mutex", "semaphore", "synchronization" ] }, { "name": "amphp/uri", "version": "dev-master", "version_normalized": "9999999-dev", "source": { "type": "git", "url": "https://github.com/amphp/uri.git", "reference": "f3195b163275383909ded7770a11d8eb865cbc86" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/amphp/uri/zipball/f3195b163275383909ded7770a11d8eb865cbc86", "reference": "f3195b163275383909ded7770a11d8eb865cbc86", "shasum": "" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.3", "phpunit/phpunit": "^6" }, "time": "2018-12-21T10:29:41+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { "Amp\\Uri\\": "src" }, "files": [ "src/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Niklas Keller", "email": "me@kelunik.com" }, { "name": "Daniel Lowrey" } ], "description": "Uri Parser and Resolver.", "homepage": "https://github.com/amphp/uri" }, { "name": "amphp/websocket-client", "version": "dev-master", "version_normalized": "9999999-dev", "source": { "type": "git", "url": "https://github.com/amphp/websocket-client.git", "reference": "68d326556093507fc9f7c4bdebbf0e2922968652" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/amphp/websocket-client/zipball/68d326556093507fc9f7c4bdebbf0e2922968652", "reference": "68d326556093507fc9f7c4bdebbf0e2922968652", "shasum": "" }, "require": { "amphp/amp": "^2", "amphp/byte-stream": "^1", "amphp/socket": "^0.10", "php": ">=7" }, "require-dev": { "amphp/aerys": "^0.7.2", "amphp/phpunit-util": "^1", "friendsofphp/php-cs-fixer": "^2.9", "phpunit/phpunit": "^6" }, "time": "2018-12-13T17:35:05+00:00", "type": "library", "installation-source": "source", "autoload": { "psr-4": { "Amp\\Websocket\\": "lib" }, "files": [ "lib/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Bob Weinand", "email": "bobwei9@hotmail.com" }, { "name": "Niklas Keller", "email": "me@kelunik.com" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" } ], "description": "Async WebSocket client for PHP based on Amp.", "keywords": [ "amp", "amphp", "async", "client", "http", "non-blocking", "websocket" ] }, { "name": "amphp/windows-registry", "version": "v0.3.2", "version_normalized": "0.3.2.0", "source": { "type": "git", "url": "https://github.com/amphp/windows-registry.git", "reference": "834af7a30ad7c006b0326ccd2686ddc6e6943366" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/amphp/windows-registry/zipball/834af7a30ad7c006b0326ccd2686ddc6e6943366", "reference": "834af7a30ad7c006b0326ccd2686ddc6e6943366", "shasum": "" }, "require": { "amphp/amp": "^2", "amphp/byte-stream": "^1.4", "amphp/process": "^1" }, "require-dev": { "amphp/php-cs-fixer-config": "dev-master" }, "time": "2018-10-24T03:34:54+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { "Amp\\WindowsRegistry\\": "lib" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Niklas Keller", "email": "me@kelunik.com" } ], "description": "Windows Registry Reader." }, { "name": "danog/madelineproto", "version": "dev-alpha", "version_normalized": "dev-alpha", "source": { "type": "git", "url": "https://github.com/danog/MadelineProto.git", "reference": "a56672faf62017a58efc1d06c2773816ce99aec6" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/danog/MadelineProto/zipball/a56672faf62017a58efc1d06c2773816ce99aec6", "reference": "a56672faf62017a58efc1d06c2773816ce99aec6", "shasum": "" }, "require": { "amphp/amp": "^2.0", "amphp/dns": "dev-master#861cc857b1ba6e02e8a7439c30403682785fce96 as 0.9.9", "amphp/file": "dev-master#5a69fca406ac5fd220de0aa68c887bc8046eb93c as 0.3.3", "amphp/log": "^1.0", "amphp/parser": "^1.0", "amphp/socket": "^0.10.11", "amphp/uri": "dev-master#f3195b163275383909ded7770a11d8eb865cbc86 as 0.1.3", "amphp/websocket-client": "dev-master", "danog/magicalserializer": "^1.0", "danog/primemodule": "^1.0.3", "erusev/parsedown": "^1.6", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", "ext-xml": "*", "php": ">=5.6.0", "phpseclib/phpseclib": "dev-master#27370df", "rollbar/rollbar": "dev-master", "vlucas/phpdotenv": "^2.4" }, "conflict": { "krakjoe/pthreads-polyfill": "*" }, "require-dev": { "phpdocumentor/reflection-docblock": "^3.1" }, "suggest": { "ext-libtgvoip": "Install the php-libtgvoip extension to make phone calls (https://github.com/danog/php-libtgvoip)", "ext-sockets": "Install the socket extension to speed up MadelineProto" }, "time": "2018-12-26T19:19:24+00:00", "type": "project", "installation-source": "source", "autoload": { "psr-0": { "danog\\MadelineProto\\": "src/" }, "files": [ "src/BigIntegor.php", "src/Socket.php", "src/Collectable.php", "src/Threaded.php", "src/Volatile.php", "src/Thread.php", "src/Worker.php", "src/Pool.php", "src/HttpProxy.php", "src/SocksProxy.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "AGPL-3.0-only" ], "authors": [ { "name": "Daniil Gentili", "email": "daniil@daniil.it" } ], "description": "PHP implementation of telegram's MTProto protocol.", "homepage": "https://daniil.it/MadelineProto", "keywords": [ "GB", "Messenger", "audio", "bytes", "client", "files", "mtproto", "php", "protocol", "stickers", "telegram", "video" ] }, { "name": "danog/magicalserializer", "version": "1.0", "version_normalized": "1.0.0.0", "source": { "type": "git", "url": "https://github.com/danog/MagicalSerializer.git", "reference": "87b6ed05a86021e9364f31133089bb83980d5e24" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/danog/MagicalSerializer/zipball/87b6ed05a86021e9364f31133089bb83980d5e24", "reference": "87b6ed05a86021e9364f31133089bb83980d5e24", "shasum": "" }, "time": "2018-02-20T10:35:49+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-0": { "danog\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "AGPL-3.0-only" ], "authors": [ { "name": "Daniil Gentili", "email": "daniil@daniil.it" } ], "description": "Serialize Volatile, Threaded or any other internal PHP class!", "homepage": "https://daniil.it/MagicalSerializer", "keywords": [ "pthreads", "serializable", "serialize", "threading", "volatile" ] }, { "name": "danog/primemodule", "version": "1.0.3", "version_normalized": "1.0.3.0", "source": { "type": "git", "url": "https://github.com/danog/PrimeModule.git", "reference": "a18918c4092d6d8696521b05a59a3cdb5cdc061e" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/danog/PrimeModule/zipball/a18918c4092d6d8696521b05a59a3cdb5cdc061e", "reference": "a18918c4092d6d8696521b05a59a3cdb5cdc061e", "shasum": "" }, "suggest": { "ext-primemodule": "Install the native C++ extension for extremely fast factorization (https://github.com/danog/PrimeModule-ext)" }, "time": "2018-03-21T10:47:51+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-0": { "danog\\": "lib/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "AGPL-3.0-only" ], "authors": [ { "name": "Daniil Gentili", "email": "daniil@daniil.it" } ], "description": "Prime module capable of doing prime factorization of huge numbers very quickly.\"" }, { "name": "daverandom/libdns", "version": "2.x-dev", "version_normalized": "2.9999999.9999999.9999999-dev", "source": { "type": "git", "url": "https://github.com/DaveRandom/LibDNS.git", "reference": "1ecd825b6fa9bb3fddc07751997e29dc78749b95" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/DaveRandom/LibDNS/zipball/1ecd825b6fa9bb3fddc07751997e29dc78749b95", "reference": "1ecd825b6fa9bb3fddc07751997e29dc78749b95", "shasum": "" }, "require": { "ext-ctype": "*", "php": ">=7.0" }, "suggest": { "ext-intl": "Required for IDN support" }, "time": "2018-01-10T15:56:17+00:00", "type": "library", "installation-source": "source", "autoload": { "psr-4": { "LibDNS\\": "src/" }, "files": [ "src/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "DNS protocol implementation written in pure PHP", "keywords": [ "dns" ] }, { "name": "erusev/parsedown", "version": "1.8.0-beta-5", "version_normalized": "1.8.0.0-beta5", "source": { "type": "git", "url": "https://github.com/erusev/parsedown.git", "reference": "c26a2ee4bf8ba0270daab7da0353f2525ca6564a" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/erusev/parsedown/zipball/c26a2ee4bf8ba0270daab7da0353f2525ca6564a", "reference": "c26a2ee4bf8ba0270daab7da0353f2525ca6564a", "shasum": "" }, "require": { "ext-mbstring": "*", "php": ">=5.3.0" }, "require-dev": { "phpunit/phpunit": "^4.8.35" }, "time": "2018-06-11T18:15:32+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-0": { "Parsedown": "" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Emanuil Rusev", "email": "hello@erusev.com", "homepage": "http://erusev.com" } ], "description": "Parser for Markdown.", "homepage": "http://parsedown.org", "keywords": [ "markdown", "parser" ] }, { "name": "monolog/monolog", "version": "1.x-dev", "version_normalized": "1.9999999.9999999.9999999-dev", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", "reference": "4d5b7e6ba1127789c7ff59d6f762298eaa29787f" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/Seldaek/monolog/zipball/4d5b7e6ba1127789c7ff59d6f762298eaa29787f", "reference": "4d5b7e6ba1127789c7ff59d6f762298eaa29787f", "shasum": "" }, "require": { "php": ">=5.3.0", "psr/log": "~1.0" }, "provide": { "psr/log-implementation": "1.0.0" }, "require-dev": { "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", "graylog2/gelf-php": "~1.0", "jakub-onderka/php-parallel-lint": "0.9", "php-amqplib/php-amqplib": "~2.4", "php-console/php-console": "^3.1.3", "phpunit/phpunit": "~4.5", "phpunit/phpunit-mock-objects": "2.3.0", "ruflin/elastica": ">=0.90 <3.0", "sentry/sentry": "^0.13", "swiftmailer/swiftmailer": "^5.3|^6.0" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", "doctrine/couchdb": "Allow sending log messages to a CouchDB server", "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", "ext-mongo": "Allow sending log messages to a MongoDB server", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", "php-console/php-console": "Allow sending log messages to Google Chrome", "rollbar/rollbar": "Allow sending log messages to Rollbar", "ruflin/elastica": "Allow sending log messages to an Elastic Search server", "sentry/sentry": "Allow sending log messages to a Sentry server" }, "time": "2018-12-26T14:24:03+00:00", "type": "library", "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } }, "installation-source": "source", "autoload": { "psr-4": { "Monolog\\": "src/Monolog" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Jordi Boggiano", "email": "j.boggiano@seld.be", "homepage": "http://seld.be" } ], "description": "Sends your logs to files, sockets, inboxes, databases and various web services", "homepage": "http://github.com/Seldaek/monolog", "keywords": [ "log", "logging", "psr-3" ] }, { "name": "paragonie/constant_time_encoding", "version": "v1.x-dev", "version_normalized": "1.9999999.9999999.9999999-dev", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", "reference": "2132f0f293d856026d7d11bd81b9f4a23a1dc1f6" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/2132f0f293d856026d7d11bd81b9f4a23a1dc1f6", "reference": "2132f0f293d856026d7d11bd81b9f4a23a1dc1f6", "shasum": "" }, "require": { "php": "^5.3|^7" }, "require-dev": { "paragonie/random_compat": "^1.4|^2", "phpunit/phpunit": "4.*|5.*", "vimeo/psalm": "^0.3|^1" }, "time": "2018-04-30T17:57:16+00:00", "type": "library", "installation-source": "source", "autoload": { "psr-4": { "ParagonIE\\ConstantTime\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Paragon Initiative Enterprises", "email": "security@paragonie.com", "homepage": "https://paragonie.com", "role": "Maintainer" }, { "name": "Steve 'Sc00bz' Thomas", "email": "steve@tobtu.com", "homepage": "https://www.tobtu.com", "role": "Original Developer" } ], "description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)", "keywords": [ "base16", "base32", "base32_decode", "base32_encode", "base64", "base64_decode", "base64_encode", "bin2hex", "encoding", "hex", "hex2bin", "rfc4648" ] }, { "name": "paragonie/random_compat", "version": "v2.0.17", "version_normalized": "2.0.17.0", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/paragonie/random_compat/zipball/29af24f25bab834fcbb38ad2a69fa93b867e070d", "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d", "shasum": "" }, "require": { "php": ">=5.2.0" }, "require-dev": { "phpunit/phpunit": "4.*|5.*" }, "suggest": { "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." }, "time": "2018-07-04T16:31:37+00:00", "type": "library", "installation-source": "dist", "autoload": { "files": [ "lib/random.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Paragon Initiative Enterprises", "email": "security@paragonie.com", "homepage": "https://paragonie.com" } ], "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", "keywords": [ "csprng", "polyfill", "pseudorandom", "random" ] }, { "name": "phpseclib/phpseclib", "version": "dev-master", "version_normalized": "9999999-dev", "source": { "type": "git", "url": "https://github.com/danog/phpseclib", "reference": "27370dff48f01e4e9363f6fcdb15f9eede298cd4" }, "require": { "paragonie/constant_time_encoding": "^1", "paragonie/random_compat": "^1.4|^2.0", "php": ">=5.6.1" }, "require-dev": { "phing/phing": "~2.7", "phpunit/phpunit": "^4.8.35|^5.7|^6.0", "sami/sami": "~2.0", "squizlabs/php_codesniffer": "~2.0" }, "suggest": { "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." }, "time": "2018-02-20T14:40:20+00:00", "type": "library", "installation-source": "source", "autoload": { "files": [ "phpseclib/bootstrap.php" ], "psr-4": { "phpseclib\\": "phpseclib/" } }, "license": [ "MIT" ], "authors": [ { "name": "Jim Wigginton", "email": "terrafrost@php.net", "role": "Lead Developer" }, { "name": "Patrick Monnerat", "email": "pm@datasphere.ch", "role": "Developer" }, { "name": "Andreas Fischer", "email": "bantu@phpbb.com", "role": "Developer" }, { "name": "Hans-Jürgen Petrich", "email": "petrich@tronic-media.com", "role": "Developer" }, { "name": "Graham Campbell", "email": "graham@alt-three.com", "role": "Developer" } ], "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", "homepage": "http://phpseclib.sourceforge.net", "keywords": [ "BigInteger", "aes", "asn.1", "asn1", "blowfish", "crypto", "cryptography", "encryption", "rsa", "security", "sftp", "signature", "signing", "ssh", "twofish", "x.509", "x509" ] }, { "name": "psr/log", "version": "dev-master", "version_normalized": "9999999-dev", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", "reference": "c4421fcac1edd5a324fda73e589a5cf96e52ffd0" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/php-fig/log/zipball/c4421fcac1edd5a324fda73e589a5cf96e52ffd0", "reference": "c4421fcac1edd5a324fda73e589a5cf96e52ffd0", "shasum": "" }, "require": { "php": ">=5.3.0" }, "time": "2018-11-21T13:42:00+00:00", "type": "library", "extra": { "branch-alias": { "dev-master": "1.1.x-dev" } }, "installation-source": "source", "autoload": { "psr-4": { "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "PHP-FIG", "homepage": "http://www.php-fig.org/" } ], "description": "Common interface for logging libraries", "homepage": "https://github.com/php-fig/log", "keywords": [ "log", "psr", "psr-3" ] }, { "name": "rollbar/rollbar", "version": "dev-master", "version_normalized": "9999999-dev", "source": { "type": "git", "url": "https://github.com/rollbar/rollbar-php.git", "reference": "4d678fc865b5c9adfb345c6c5021ef7fc536af37" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/rollbar/rollbar-php/zipball/4d678fc865b5c9adfb345c6c5021ef7fc536af37", "reference": "4d678fc865b5c9adfb345c6c5021ef7fc536af37", "shasum": "" }, "require": { "ext-curl": "*", "monolog/monolog": "^1.23", "psr/log": "^1.0.1" }, "require-dev": { "codeclimate/php-test-reporter": "dev-master", "mockery/mockery": "0.9.*", "monolog/monolog": "^1.23", "packfire/php5.3-compat": "*", "phpmd/phpmd": "@stable", "phpunit/phpunit": "4.8.*", "squizlabs/php_codesniffer": "2.*" }, "suggest": { "fluent/logger": "Needed to use the 'fluent' handler for fluentd support", "packfire/php5.3-compat": "for backward compatibility with PHP 5.3" }, "time": "2018-12-20T19:52:31+00:00", "type": "library", "installation-source": "source", "autoload": { "psr-4": { "Rollbar\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Rollbar, Inc.", "email": "support@rollbar.com", "role": "Developer" } ], "description": "Monitors errors and exceptions and reports them to Rollbar", "homepage": "http://github.com/rollbar/rollbar-php", "keywords": [ "debugging", "errors", "exceptions", "logging", "monitoring" ] }, { "name": "vlucas/phpdotenv", "version": "dev-master", "version_normalized": "9999999-dev", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", "reference": "cfd5dc225767ca154853752abc93aeec040fcf36" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/cfd5dc225767ca154853752abc93aeec040fcf36", "reference": "cfd5dc225767ca154853752abc93aeec040fcf36", "shasum": "" }, "require": { "php": ">=5.3.9" }, "require-dev": { "phpunit/phpunit": "^4.8.35 || ^5.0" }, "time": "2018-10-30T17:29:25+00:00", "type": "library", "extra": { "branch-alias": { "dev-master": "2.5-dev" } }, "installation-source": "source", "autoload": { "psr-4": { "Dotenv\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Vance Lucas", "email": "vance@vancelucas.com", "homepage": "http://www.vancelucas.com" } ], "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", "keywords": [ "dotenv", "env", "environment" ] } ] <?php // autoload_classmap.php @generated by Composer $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( ); <?php // autoload_namespaces.php @generated by Composer $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( 'danog\\MadelineProto\\' => array($vendorDir . '/danog/madelineproto/src'), 'danog\\' => array($vendorDir . '/danog/magicalserializer/src', $vendorDir . '/danog/primemodule/lib'), 'Parsedown' => array($vendorDir . '/erusev/parsedown'), ); { "name": "monolog/monolog", "description": "Sends your logs to files, sockets, inboxes, databases and various web services", "keywords": ["log", "logging", "psr-3"], "homepage": "http://github.com/Seldaek/monolog", "type": "library", "license": "MIT", "authors": [ { "name": "Jordi Boggiano", "email": "j.boggiano@seld.be", "homepage": "http://seld.be" } ], "require": { "php": ">=5.3.0", "psr/log": "~1.0" }, "require-dev": { "phpunit/phpunit": "~4.5", "graylog2/gelf-php": "~1.0", "sentry/sentry": "^0.13", "ruflin/elastica": ">=0.90 <3.0", "doctrine/couchdb": "~1.0@dev", "aws/aws-sdk-php": "^2.4.9 || ^3.0", "php-amqplib/php-amqplib": "~2.4", "swiftmailer/swiftmailer": "^5.3|^6.0", "php-console/php-console": "^3.1.3", "phpunit/phpunit-mock-objects": "2.3.0", "jakub-onderka/php-parallel-lint": "0.9" }, "_": "phpunit/phpunit-mock-objects required in 2.3.0 due to https://github.com/sebastianbergmann/phpunit-mock-objects/issues/223 - needs hhvm 3.8+ on travis", "suggest": { "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "sentry/sentry": "Allow sending log messages to a Sentry server", "doctrine/couchdb": "Allow sending log messages to a CouchDB server", "ruflin/elastica": "Allow sending log messages to an Elastic Search server", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", "ext-mongo": "Allow sending log messages to a MongoDB server", "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", "rollbar/rollbar": "Allow sending log messages to Rollbar", "php-console/php-console": "Allow sending log messages to Google Chrome" }, "autoload": { "psr-4": {"Monolog\\": "src/Monolog"} }, "autoload-dev": { "psr-4": {"Monolog\\": "tests/Monolog"} }, "provide": { "psr/log-implementation": "1.0.0" }, "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } }, "scripts": { "test": [ "parallel-lint . --exclude vendor", "phpunit" ] } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog; /** * Handler or Processor implementing this interface will be reset when Logger::reset() is called. * * Resetting ends a log cycle gets them back to their initial state. * * Resetting a Handler or a Processor means flushing/cleaning all buffers, resetting internal * state, and getting it back to a state in which it can receive log records again. * * This is useful in case you want to avoid logs leaking between two requests or jobs when you * have a long running process like a worker or an application server serving multiple requests * in one process. * * @author Grégoire Pineau <lyrixx@lyrixx.info> */ interface ResettableInterface { public function reset(); } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog; use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; use Monolog\Handler\AbstractHandler; use Monolog\Registry; /** * Monolog error handler * * A facility to enable logging of runtime errors, exceptions and fatal errors. * * Quick setup: <code>ErrorHandler::register($logger);</code> * * @author Jordi Boggiano <j.boggiano@seld.be> */ class ErrorHandler { private $logger; private $previousExceptionHandler; private $uncaughtExceptionLevel; private $previousErrorHandler; private $errorLevelMap; private $handleOnlyReportedErrors; private $hasFatalErrorHandler; private $fatalLevel; private $reservedMemory; private $lastFatalTrace; private static $fatalErrors = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR); public function __construct(LoggerInterface $logger) { $this->logger = $logger; } /** * Registers a new ErrorHandler for a given Logger * * By default it will handle errors, exceptions and fatal errors * * @param LoggerInterface $logger * @param array|false $errorLevelMap an array of E_* constant to LogLevel::* constant mapping, or false to disable error handling * @param int|false $exceptionLevel a LogLevel::* constant, or false to disable exception handling * @param int|false $fatalLevel a LogLevel::* constant, or false to disable fatal error handling * @return ErrorHandler */ public static function register(LoggerInterface $logger, $errorLevelMap = array(), $exceptionLevel = null, $fatalLevel = null) { //Forces the autoloader to run for LogLevel. Fixes an autoload issue at compile-time on PHP5.3. See https://github.com/Seldaek/monolog/pull/929 class_exists('\\Psr\\Log\\LogLevel', true); $handler = new static($logger); if ($errorLevelMap !== false) { $handler->registerErrorHandler($errorLevelMap); } if ($exceptionLevel !== false) { $handler->registerExceptionHandler($exceptionLevel); } if ($fatalLevel !== false) { $handler->registerFatalHandler($fatalLevel); } return $handler; } public function registerExceptionHandler($level = null, $callPrevious = true) { $prev = set_exception_handler(array($this, 'handleException')); $this->uncaughtExceptionLevel = $level; if ($callPrevious && $prev) { $this->previousExceptionHandler = $prev; } } public function registerErrorHandler(array $levelMap = array(), $callPrevious = true, $errorTypes = -1, $handleOnlyReportedErrors = true) { $prev = set_error_handler(array($this, 'handleError'), $errorTypes); $this->errorLevelMap = array_replace($this->defaultErrorLevelMap(), $levelMap); if ($callPrevious) { $this->previousErrorHandler = $prev ?: true; } $this->handleOnlyReportedErrors = $handleOnlyReportedErrors; } public function registerFatalHandler($level = null, $reservedMemorySize = 20) { register_shutdown_function(array($this, 'handleFatalError')); $this->reservedMemory = str_repeat(' ', 1024 * $reservedMemorySize); $this->fatalLevel = $level; $this->hasFatalErrorHandler = true; } protected function defaultErrorLevelMap() { return array( E_ERROR => LogLevel::CRITICAL, E_WARNING => LogLevel::WARNING, E_PARSE => LogLevel::ALERT, E_NOTICE => LogLevel::NOTICE, E_CORE_ERROR => LogLevel::CRITICAL, E_CORE_WARNING => LogLevel::WARNING, E_COMPILE_ERROR => LogLevel::ALERT, E_COMPILE_WARNING => LogLevel::WARNING, E_USER_ERROR => LogLevel::ERROR, E_USER_WARNING => LogLevel::WARNING, E_USER_NOTICE => LogLevel::NOTICE, E_STRICT => LogLevel::NOTICE, E_RECOVERABLE_ERROR => LogLevel::ERROR, E_DEPRECATED => LogLevel::NOTICE, E_USER_DEPRECATED => LogLevel::NOTICE, ); } /** * @private */ public function handleException($e) { $this->logger->log( $this->uncaughtExceptionLevel === null ? LogLevel::ERROR : $this->uncaughtExceptionLevel, sprintf('Uncaught Exception %s: "%s" at %s line %s', Utils::getClass($e), $e->getMessage(), $e->getFile(), $e->getLine()), array('exception' => $e) ); if ($this->previousExceptionHandler) { call_user_func($this->previousExceptionHandler, $e); } exit(255); } /** * @private */ public function handleError($code, $message, $file = '', $line = 0, $context = array()) { if ($this->handleOnlyReportedErrors && !(error_reporting() & $code)) { return; } // fatal error codes are ignored if a fatal error handler is present as well to avoid duplicate log entries if (!$this->hasFatalErrorHandler || !in_array($code, self::$fatalErrors, true)) { $level = isset($this->errorLevelMap[$code]) ? $this->errorLevelMap[$code] : LogLevel::CRITICAL; $this->logger->log($level, self::codeToString($code).': '.$message, array('code' => $code, 'message' => $message, 'file' => $file, 'line' => $line)); } else { // http://php.net/manual/en/function.debug-backtrace.php // As of 5.3.6, DEBUG_BACKTRACE_IGNORE_ARGS option was added. // Any version less than 5.3.6 must use the DEBUG_BACKTRACE_IGNORE_ARGS constant value '2'. $trace = debug_backtrace((PHP_VERSION_ID < 50306) ? 2 : DEBUG_BACKTRACE_IGNORE_ARGS); array_shift($trace); // Exclude handleError from trace $this->lastFatalTrace = $trace; } if ($this->previousErrorHandler === true) { return false; } elseif ($this->previousErrorHandler) { return call_user_func($this->previousErrorHandler, $code, $message, $file, $line, $context); } } /** * @private */ public function handleFatalError() { $this->reservedMemory = null; $lastError = error_get_last(); if ($lastError && in_array($lastError['type'], self::$fatalErrors, true)) { $this->logger->log( $this->fatalLevel === null ? LogLevel::ALERT : $this->fatalLevel, 'Fatal Error ('.self::codeToString($lastError['type']).'): '.$lastError['message'], array('code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line'], 'trace' => $this->lastFatalTrace) ); if ($this->logger instanceof Logger) { foreach ($this->logger->getHandlers() as $handler) { if ($handler instanceof AbstractHandler) { $handler->close(); } } } } } private static function codeToString($code) { switch ($code) { case E_ERROR: return 'E_ERROR'; case E_WARNING: return 'E_WARNING'; case E_PARSE: return 'E_PARSE'; case E_NOTICE: return 'E_NOTICE'; case E_CORE_ERROR: return 'E_CORE_ERROR'; case E_CORE_WARNING: return 'E_CORE_WARNING'; case E_COMPILE_ERROR: return 'E_COMPILE_ERROR'; case E_COMPILE_WARNING: return 'E_COMPILE_WARNING'; case E_USER_ERROR: return 'E_USER_ERROR'; case E_USER_WARNING: return 'E_USER_WARNING'; case E_USER_NOTICE: return 'E_USER_NOTICE'; case E_STRICT: return 'E_STRICT'; case E_RECOVERABLE_ERROR: return 'E_RECOVERABLE_ERROR'; case E_DEPRECATED: return 'E_DEPRECATED'; case E_USER_DEPRECATED: return 'E_USER_DEPRECATED'; } return 'Unknown PHP error'; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\LineFormatter; /** * Handler sending logs to browser's javascript console with no browser extension required * * @author Olivier Poitrey <rs@dailymotion.com> */ class BrowserConsoleHandler extends AbstractProcessingHandler { protected static $initialized = false; protected static $records = array(); /** * {@inheritDoc} * * Formatted output may contain some formatting markers to be transferred to `console.log` using the %c format. * * Example of formatted string: * * You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white} */ protected function getDefaultFormatter() { return new LineFormatter('[[%channel%]]{macro: autolabel} [[%level_name%]]{font-weight: bold} %message%'); } /** * {@inheritDoc} */ protected function write(array $record) { // Accumulate records static::$records[] = $record; // Register shutdown handler if not already done if (!static::$initialized) { static::$initialized = true; $this->registerShutdownFunction(); } } /** * Convert records to javascript console commands and send it to the browser. * This method is automatically called on PHP shutdown if output is HTML or Javascript. */ public static function send() { $format = static::getResponseFormat(); if ($format === 'unknown') { return; } if (count(static::$records)) { if ($format === 'html') { static::writeOutput('<script>' . static::generateScript() . '</script>'); } elseif ($format === 'js') { static::writeOutput(static::generateScript()); } static::resetStatic(); } } public function close() { self::resetStatic(); } public function reset() { self::resetStatic(); } /** * Forget all logged records */ public static function resetStatic() { static::$records = array(); } /** * Wrapper for register_shutdown_function to allow overriding */ protected function registerShutdownFunction() { if (PHP_SAPI !== 'cli') { register_shutdown_function(array('Monolog\Handler\BrowserConsoleHandler', 'send')); } } /** * Wrapper for echo to allow overriding * * @param string $str */ protected static function writeOutput($str) { echo $str; } /** * Checks the format of the response * * If Content-Type is set to application/javascript or text/javascript -> js * If Content-Type is set to text/html, or is unset -> html * If Content-Type is anything else -> unknown * * @return string One of 'js', 'html' or 'unknown' */ protected static function getResponseFormat() { // Check content type foreach (headers_list() as $header) { if (stripos($header, 'content-type:') === 0) { // This handler only works with HTML and javascript outputs // text/javascript is obsolete in favour of application/javascript, but still used if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) { return 'js'; } if (stripos($header, 'text/html') === false) { return 'unknown'; } break; } } return 'html'; } private static function generateScript() { $script = array(); foreach (static::$records as $record) { $context = static::dump('Context', $record['context']); $extra = static::dump('Extra', $record['extra']); if (empty($context) && empty($extra)) { $script[] = static::call_array('log', static::handleStyles($record['formatted'])); } else { $script = array_merge($script, array(static::call_array('groupCollapsed', static::handleStyles($record['formatted']))), $context, $extra, array(static::call('groupEnd')) ); } } return "(function (c) {if (c && c.groupCollapsed) {\n" . implode("\n", $script) . "\n}})(console);"; } private static function handleStyles($formatted) { $args = array(static::quote('font-weight: normal')); $format = '%c' . $formatted; preg_match_all('/\[\[(.*?)\]\]\{([^}]*)\}/s', $format, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); foreach (array_reverse($matches) as $match) { $args[] = static::quote(static::handleCustomStyles($match[2][0], $match[1][0])); $args[] = '"font-weight: normal"'; $pos = $match[0][1]; $format = substr($format, 0, $pos) . '%c' . $match[1][0] . '%c' . substr($format, $pos + strlen($match[0][0])); } array_unshift($args, static::quote($format)); return $args; } private static function handleCustomStyles($style, $string) { static $colors = array('blue', 'green', 'red', 'magenta', 'orange', 'black', 'grey'); static $labels = array(); return preg_replace_callback('/macro\s*:(.*?)(?:;|$)/', function ($m) use ($string, &$colors, &$labels) { if (trim($m[1]) === 'autolabel') { // Format the string as a label with consistent auto assigned background color if (!isset($labels[$string])) { $labels[$string] = $colors[count($labels) % count($colors)]; } $color = $labels[$string]; return "background-color: $color; color: white; border-radius: 3px; padding: 0 2px 0 2px"; } return $m[1]; }, $style); } private static function dump($title, array $dict) { $script = array(); $dict = array_filter($dict); if (empty($dict)) { return $script; } $script[] = static::call('log', static::quote('%c%s'), static::quote('font-weight: bold'), static::quote($title)); foreach ($dict as $key => $value) { $value = json_encode($value); if (empty($value)) { $value = static::quote(''); } $script[] = static::call('log', static::quote('%s: %o'), static::quote($key), $value); } return $script; } private static function quote($arg) { return '"' . addcslashes($arg, "\"\n\\") . '"'; } private static function call() { $args = func_get_args(); $method = array_shift($args); return static::call_array($method, $args); } private static function call_array($method, array $args) { return 'c.' . $method . '(' . implode(', ', $args) . ');'; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * Simple handler wrapper that filters records based on a list of levels * * It can be configured with an exact list of levels to allow, or a min/max level. * * @author Hennadiy Verkh * @author Jordi Boggiano <j.boggiano@seld.be> */ class FilterHandler extends AbstractHandler { /** * Handler or factory callable($record, $this) * * @var callable|\Monolog\Handler\HandlerInterface */ protected $handler; /** * Minimum level for logs that are passed to handler * * @var int[] */ protected $acceptedLevels; /** * Whether the messages that are handled can bubble up the stack or not * * @var bool */ protected $bubble; /** * @param callable|HandlerInterface $handler Handler or factory callable($record, $this). * @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided * @param int $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($handler, $minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY, $bubble = true) { $this->handler = $handler; $this->bubble = $bubble; $this->setAcceptedLevels($minLevelOrList, $maxLevel); if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); } } /** * @return array */ public function getAcceptedLevels() { return array_flip($this->acceptedLevels); } /** * @param int|string|array $minLevelOrList A list of levels to accept or a minimum level or level name if maxLevel is provided * @param int|string $maxLevel Maximum level or level name to accept, only used if $minLevelOrList is not an array */ public function setAcceptedLevels($minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY) { if (is_array($minLevelOrList)) { $acceptedLevels = array_map('Monolog\Logger::toMonologLevel', $minLevelOrList); } else { $minLevelOrList = Logger::toMonologLevel($minLevelOrList); $maxLevel = Logger::toMonologLevel($maxLevel); $acceptedLevels = array_values(array_filter(Logger::getLevels(), function ($level) use ($minLevelOrList, $maxLevel) { return $level >= $minLevelOrList && $level <= $maxLevel; })); } $this->acceptedLevels = array_flip($acceptedLevels); } /** * {@inheritdoc} */ public function isHandling(array $record) { return isset($this->acceptedLevels[$record['level']]); } /** * {@inheritdoc} */ public function handle(array $record) { if (!$this->isHandling($record)) { return false; } // The same logic as in FingersCrossedHandler if (!$this->handler instanceof HandlerInterface) { $this->handler = call_user_func($this->handler, $record, $this); if (!$this->handler instanceof HandlerInterface) { throw new \RuntimeException("The factory callable should return a HandlerInterface"); } } if ($this->processors) { foreach ($this->processors as $processor) { $record = call_user_func($processor, $record); } } $this->handler->handle($record); return false === $this->bubble; } /** * {@inheritdoc} */ public function handleBatch(array $records) { $filtered = array(); foreach ($records as $record) { if ($this->isHandling($record)) { $filtered[] = $record; } } $this->handler->handleBatch($filtered); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; /** * Used for testing purposes. * * It records all records and gives you access to them for verification. * * @author Jordi Boggiano <j.boggiano@seld.be> * * @method bool hasEmergency($record) * @method bool hasAlert($record) * @method bool hasCritical($record) * @method bool hasError($record) * @method bool hasWarning($record) * @method bool hasNotice($record) * @method bool hasInfo($record) * @method bool hasDebug($record) * * @method bool hasEmergencyRecords() * @method bool hasAlertRecords() * @method bool hasCriticalRecords() * @method bool hasErrorRecords() * @method bool hasWarningRecords() * @method bool hasNoticeRecords() * @method bool hasInfoRecords() * @method bool hasDebugRecords() * * @method bool hasEmergencyThatContains($message) * @method bool hasAlertThatContains($message) * @method bool hasCriticalThatContains($message) * @method bool hasErrorThatContains($message) * @method bool hasWarningThatContains($message) * @method bool hasNoticeThatContains($message) * @method bool hasInfoThatContains($message) * @method bool hasDebugThatContains($message) * * @method bool hasEmergencyThatMatches($message) * @method bool hasAlertThatMatches($message) * @method bool hasCriticalThatMatches($message) * @method bool hasErrorThatMatches($message) * @method bool hasWarningThatMatches($message) * @method bool hasNoticeThatMatches($message) * @method bool hasInfoThatMatches($message) * @method bool hasDebugThatMatches($message) * * @method bool hasEmergencyThatPasses($message) * @method bool hasAlertThatPasses($message) * @method bool hasCriticalThatPasses($message) * @method bool hasErrorThatPasses($message) * @method bool hasWarningThatPasses($message) * @method bool hasNoticeThatPasses($message) * @method bool hasInfoThatPasses($message) * @method bool hasDebugThatPasses($message) */ class TestHandler extends AbstractProcessingHandler { protected $records = array(); protected $recordsByLevel = array(); private $skipReset = false; public function getRecords() { return $this->records; } public function clear() { $this->records = array(); $this->recordsByLevel = array(); } public function reset() { if (!$this->skipReset) { $this->clear(); } } public function setSkipReset($skipReset) { $this->skipReset = $skipReset; } public function hasRecords($level) { return isset($this->recordsByLevel[$level]); } /** * @param string|array $record Either a message string or an array containing message and optionally context keys that will be checked against all records * @param int $level Logger::LEVEL constant value */ public function hasRecord($record, $level) { if (is_string($record)) { $record = array('message' => $record); } return $this->hasRecordThatPasses(function ($rec) use ($record) { if ($rec['message'] !== $record['message']) { return false; } if (isset($record['context']) && $rec['context'] !== $record['context']) { return false; } return true; }, $level); } public function hasRecordThatContains($message, $level) { return $this->hasRecordThatPasses(function ($rec) use ($message) { return strpos($rec['message'], $message) !== false; }, $level); } public function hasRecordThatMatches($regex, $level) { return $this->hasRecordThatPasses(function ($rec) use ($regex) { return preg_match($regex, $rec['message']) > 0; }, $level); } public function hasRecordThatPasses($predicate, $level) { if (!is_callable($predicate)) { throw new \InvalidArgumentException("Expected a callable for hasRecordThatSucceeds"); } if (!isset($this->recordsByLevel[$level])) { return false; } foreach ($this->recordsByLevel[$level] as $i => $rec) { if (call_user_func($predicate, $rec, $i)) { return true; } } return false; } /** * {@inheritdoc} */ protected function write(array $record) { $this->recordsByLevel[$record['level']][] = $record; $this->records[] = $record; } public function __call($method, $args) { if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; $level = constant('Monolog\Logger::' . strtoupper($matches[2])); if (method_exists($this, $genericMethod)) { $args[] = $level; return call_user_func_array(array($this, $genericMethod), $args); } } throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LineFormatter; use Monolog\Logger; use Monolog\ResettableInterface; /** * Base Handler class providing the Handler structure * * @author Jordi Boggiano <j.boggiano@seld.be> */ abstract class AbstractHandler implements HandlerInterface, ResettableInterface { protected $level = Logger::DEBUG; protected $bubble = true; /** * @var FormatterInterface */ protected $formatter; protected $processors = array(); /** * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($level = Logger::DEBUG, $bubble = true) { $this->setLevel($level); $this->bubble = $bubble; } /** * {@inheritdoc} */ public function isHandling(array $record) { return $record['level'] >= $this->level; } /** * {@inheritdoc} */ public function handleBatch(array $records) { foreach ($records as $record) { $this->handle($record); } } /** * Closes the handler. * * This will be called automatically when the object is destroyed */ public function close() { } /** * {@inheritdoc} */ public function pushProcessor($callback) { if (!is_callable($callback)) { throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given'); } array_unshift($this->processors, $callback); return $this; } /** * {@inheritdoc} */ public function popProcessor() { if (!$this->processors) { throw new \LogicException('You tried to pop from an empty processor stack.'); } return array_shift($this->processors); } /** * {@inheritdoc} */ public function setFormatter(FormatterInterface $formatter) { $this->formatter = $formatter; return $this; } /** * {@inheritdoc} */ public function getFormatter() { if (!$this->formatter) { $this->formatter = $this->getDefaultFormatter(); } return $this->formatter; } /** * Sets minimum logging level at which this handler will be triggered. * * @param int|string $level Level or level name * @return self */ public function setLevel($level) { $this->level = Logger::toMonologLevel($level); return $this; } /** * Gets minimum logging level at which this handler will be triggered. * * @return int */ public function getLevel() { return $this->level; } /** * Sets the bubbling behavior. * * @param bool $bubble true means that this handler allows bubbling. * false means that bubbling is not permitted. * @return self */ public function setBubble($bubble) { $this->bubble = $bubble; return $this; } /** * Gets the bubbling behavior. * * @return bool true means that this handler allows bubbling. * false means that bubbling is not permitted. */ public function getBubble() { return $this->bubble; } public function __destruct() { try { $this->close(); } catch (\Exception $e) { // do nothing } catch (\Throwable $e) { // do nothing } } public function reset() { foreach ($this->processors as $processor) { if ($processor instanceof ResettableInterface) { $processor->reset(); } } } /** * Gets the default formatter. * * @return FormatterInterface */ protected function getDefaultFormatter() { return new LineFormatter(); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use RollbarNotifier; use Exception; use Monolog\Logger; /** * Sends errors to Rollbar * * If the context data contains a `payload` key, that is used as an array * of payload options to RollbarNotifier's report_message/report_exception methods. * * Rollbar's context info will contain the context + extra keys from the log record * merged, and then on top of that a few keys: * * - level (rollbar level name) * - monolog_level (monolog level name, raw level, as rollbar only has 5 but monolog 8) * - channel * - datetime (unix timestamp) * * @author Paul Statezny <paulstatezny@gmail.com> */ class RollbarHandler extends AbstractProcessingHandler { /** * Rollbar notifier * * @var RollbarNotifier */ protected $rollbarNotifier; protected $levelMap = array( Logger::DEBUG => 'debug', Logger::INFO => 'info', Logger::NOTICE => 'info', Logger::WARNING => 'warning', Logger::ERROR => 'error', Logger::CRITICAL => 'critical', Logger::ALERT => 'critical', Logger::EMERGENCY => 'critical', ); /** * Records whether any log records have been added since the last flush of the rollbar notifier * * @var bool */ private $hasRecords = false; protected $initialized = false; /** * @param RollbarNotifier $rollbarNotifier RollbarNotifier object constructed with valid token * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(RollbarNotifier $rollbarNotifier, $level = Logger::ERROR, $bubble = true) { $this->rollbarNotifier = $rollbarNotifier; parent::__construct($level, $bubble); } /** * {@inheritdoc} */ protected function write(array $record) { if (!$this->initialized) { // __destructor() doesn't get called on Fatal errors register_shutdown_function(array($this, 'close')); $this->initialized = true; } $context = $record['context']; $payload = array(); if (isset($context['payload'])) { $payload = $context['payload']; unset($context['payload']); } $context = array_merge($context, $record['extra'], array( 'level' => $this->levelMap[$record['level']], 'monolog_level' => $record['level_name'], 'channel' => $record['channel'], 'datetime' => $record['datetime']->format('U'), )); if (isset($context['exception']) && $context['exception'] instanceof Exception) { $payload['level'] = $context['level']; $exception = $context['exception']; unset($context['exception']); $this->rollbarNotifier->report_exception($exception, $context, $payload); } else { $this->rollbarNotifier->report_message( $record['message'], $context['level'], $context, $payload ); } $this->hasRecords = true; } public function flush() { if ($this->hasRecords) { $this->rollbarNotifier->flush(); $this->hasRecords = false; } } /** * {@inheritdoc} */ public function close() { $this->flush(); } /** * {@inheritdoc} */ public function reset() { $this->flush(); parent::reset(); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; /** * Base class for all mail handlers * * @author Gyula Sallai */ abstract class MailHandler extends AbstractProcessingHandler { /** * {@inheritdoc} */ public function handleBatch(array $records) { $messages = array(); foreach ($records as $record) { if ($record['level'] < $this->level) { continue; } $messages[] = $this->processRecord($record); } if (!empty($messages)) { $this->send((string) $this->getFormatter()->formatBatch($messages), $messages); } } /** * Send a mail with the given content * * @param string $content formatted email body to be sent * @param array $records the array of log records that formed this content */ abstract protected function send($content, array $records); /** * {@inheritdoc} */ protected function write(array $record) { $this->send((string) $record['formatted'], array($record)); } protected function getHighestRecord(array $records) { $highestRecord = null; foreach ($records as $record) { if ($highestRecord === null || $highestRecord['level'] < $record['level']) { $highestRecord = $record; } } return $highestRecord; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * IFTTTHandler uses cURL to trigger IFTTT Maker actions * * Register a secret key and trigger/event name at https://ifttt.com/maker * * value1 will be the channel from monolog's Logger constructor, * value2 will be the level name (ERROR, WARNING, ..) * value3 will be the log record's message * * @author Nehal Patel <nehal@nehalpatel.me> */ class IFTTTHandler extends AbstractProcessingHandler { private $eventName; private $secretKey; /** * @param string $eventName The name of the IFTTT Maker event that should be triggered * @param string $secretKey A valid IFTTT secret key * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($eventName, $secretKey, $level = Logger::ERROR, $bubble = true) { $this->eventName = $eventName; $this->secretKey = $secretKey; parent::__construct($level, $bubble); } /** * {@inheritdoc} */ public function write(array $record) { $postData = array( "value1" => $record["channel"], "value2" => $record["level_name"], "value3" => $record["message"], ); $postString = json_encode($postData); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://maker.ifttt.com/trigger/" . $this->eventName . "/with/key/" . $this->secretKey); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json", )); Curl\Util::execute($ch); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\LineFormatter; use Monolog\Logger; /** * Sends logs to Fleep.io using Webhook integrations * * You'll need a Fleep.io account to use this handler. * * @see https://fleep.io/integrations/webhooks/ Fleep Webhooks Documentation * @author Ando Roots <ando@sqroot.eu> */ class FleepHookHandler extends SocketHandler { const FLEEP_HOST = 'fleep.io'; const FLEEP_HOOK_URI = '/hook/'; /** * @var string Webhook token (specifies the conversation where logs are sent) */ protected $token; /** * Construct a new Fleep.io Handler. * * For instructions on how to create a new web hook in your conversations * see https://fleep.io/integrations/webhooks/ * * @param string $token Webhook token * @param bool|int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @throws MissingExtensionException */ public function __construct($token, $level = Logger::DEBUG, $bubble = true) { if (!extension_loaded('openssl')) { throw new MissingExtensionException('The OpenSSL PHP extension is required to use the FleepHookHandler'); } $this->token = $token; $connectionString = 'ssl://' . self::FLEEP_HOST . ':443'; parent::__construct($connectionString, $level, $bubble); } /** * Returns the default formatter to use with this handler * * Overloaded to remove empty context and extra arrays from the end of the log message. * * @return LineFormatter */ protected function getDefaultFormatter() { return new LineFormatter(null, null, true, true); } /** * Handles a log record * * @param array $record */ public function write(array $record) { parent::write($record); $this->closeSocket(); } /** * {@inheritdoc} * * @param array $record * @return string */ protected function generateDataStream($record) { $content = $this->buildContent($record); return $this->buildHeader($content) . $content; } /** * Builds the header of the API Call * * @param string $content * @return string */ private function buildHeader($content) { $header = "POST " . self::FLEEP_HOOK_URI . $this->token . " HTTP/1.1\r\n"; $header .= "Host: " . self::FLEEP_HOST . "\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($content) . "\r\n"; $header .= "\r\n"; return $header; } /** * Builds the body of API call * * @param array $record * @return string */ private function buildContent($record) { $dataArray = array( 'message' => $record['formatted'], ); return http_build_query($dataArray); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * Stores to any stream resource * * Can be used to store into php://stderr, remote and local files, etc. * * @author Jordi Boggiano <j.boggiano@seld.be> */ class StreamHandler extends AbstractProcessingHandler { protected $stream; protected $url; private $errorMessage; protected $filePermission; protected $useLocking; private $dirCreated; /** * @param resource|string $stream * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) * @param bool $useLocking Try to lock log file before doing any writes * * @throws \Exception If a missing directory is not buildable * @throws \InvalidArgumentException If stream is not a resource or string */ public function __construct($stream, $level = Logger::DEBUG, $bubble = true, $filePermission = null, $useLocking = false) { parent::__construct($level, $bubble); if (is_resource($stream)) { $this->stream = $stream; } elseif (is_string($stream)) { $this->url = $stream; } else { throw new \InvalidArgumentException('A stream must either be a resource or a string.'); } $this->filePermission = $filePermission; $this->useLocking = $useLocking; } /** * {@inheritdoc} */ public function close() { if ($this->url && is_resource($this->stream)) { fclose($this->stream); } $this->stream = null; } /** * Return the currently active stream if it is open * * @return resource|null */ public function getStream() { return $this->stream; } /** * Return the stream URL if it was configured with a URL and not an active resource * * @return string|null */ public function getUrl() { return $this->url; } /** * {@inheritdoc} */ protected function write(array $record) { if (!is_resource($this->stream)) { if (null === $this->url || '' === $this->url) { throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().'); } $this->createDir(); $this->errorMessage = null; set_error_handler(array($this, 'customErrorHandler')); $this->stream = fopen($this->url, 'a'); if ($this->filePermission !== null) { @chmod($this->url, $this->filePermission); } restore_error_handler(); if (!is_resource($this->stream)) { $this->stream = null; throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened: '.$this->errorMessage, $this->url)); } } if ($this->useLocking) { // ignoring errors here, there's not much we can do about them flock($this->stream, LOCK_EX); } $this->streamWrite($this->stream, $record); if ($this->useLocking) { flock($this->stream, LOCK_UN); } } /** * Write to stream * @param resource $stream * @param array $record */ protected function streamWrite($stream, array $record) { fwrite($stream, (string) $record['formatted']); } private function customErrorHandler($code, $msg) { $this->errorMessage = preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg); } /** * @param string $stream * * @return null|string */ private function getDirFromStream($stream) { $pos = strpos($stream, '://'); if ($pos === false) { return dirname($stream); } if ('file://' === substr($stream, 0, 7)) { return dirname(substr($stream, 7)); } return; } private function createDir() { // Do not try to create dir if it has already been tried. if ($this->dirCreated) { return; } $dir = $this->getDirFromStream($this->url); if (null !== $dir && !is_dir($dir)) { $this->errorMessage = null; set_error_handler(array($this, 'customErrorHandler')); $status = mkdir($dir, 0777, true); restore_error_handler(); if (false === $status && !is_dir($dir)) { throw new \UnexpectedValueException(sprintf('There is no existing directory at "%s" and its not buildable: '.$this->errorMessage, $dir)); } } $this->dirCreated = true; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; use Psr\Log\LoggerInterface; /** * Proxies log messages to an existing PSR-3 compliant logger. * * @author Michael Moussa <michael.moussa@gmail.com> */ class PsrHandler extends AbstractHandler { /** * PSR-3 compliant logger * * @var LoggerInterface */ protected $logger; /** * @param LoggerInterface $logger The underlying PSR-3 compliant logger to which messages will be proxied * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(LoggerInterface $logger, $level = Logger::DEBUG, $bubble = true) { parent::__construct($level, $bubble); $this->logger = $logger; } /** * {@inheritDoc} */ public function handle(array $record) { if (!$this->isHandling($record)) { return false; } $this->logger->log(strtolower($record['level_name']), $record['message'], $record['context']); return false === $this->bubble; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy; use Monolog\Handler\FingersCrossed\ActivationStrategyInterface; use Monolog\Logger; use Monolog\ResettableInterface; /** * Buffers all records until a certain level is reached * * The advantage of this approach is that you don't get any clutter in your log files. * Only requests which actually trigger an error (or whatever your actionLevel is) will be * in the logs, but they will contain all records, not only those above the level threshold. * * You can find the various activation strategies in the * Monolog\Handler\FingersCrossed\ namespace. * * @author Jordi Boggiano <j.boggiano@seld.be> */ class FingersCrossedHandler extends AbstractHandler { protected $handler; protected $activationStrategy; protected $buffering = true; protected $bufferSize; protected $buffer = array(); protected $stopBuffering; protected $passthruLevel; /** * @param callable|HandlerInterface $handler Handler or factory callable($record, $fingersCrossedHandler). * @param int|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action * @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param bool $stopBuffering Whether the handler should stop buffering after being triggered (default true) * @param int $passthruLevel Minimum level to always flush to handler on close, even if strategy not triggered */ public function __construct($handler, $activationStrategy = null, $bufferSize = 0, $bubble = true, $stopBuffering = true, $passthruLevel = null) { if (null === $activationStrategy) { $activationStrategy = new ErrorLevelActivationStrategy(Logger::WARNING); } // convert simple int activationStrategy to an object if (!$activationStrategy instanceof ActivationStrategyInterface) { $activationStrategy = new ErrorLevelActivationStrategy($activationStrategy); } $this->handler = $handler; $this->activationStrategy = $activationStrategy; $this->bufferSize = $bufferSize; $this->bubble = $bubble; $this->stopBuffering = $stopBuffering; if ($passthruLevel !== null) { $this->passthruLevel = Logger::toMonologLevel($passthruLevel); } if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); } } /** * {@inheritdoc} */ public function isHandling(array $record) { return true; } /** * Manually activate this logger regardless of the activation strategy */ public function activate() { if ($this->stopBuffering) { $this->buffering = false; } if (!$this->handler instanceof HandlerInterface) { $record = end($this->buffer) ?: null; $this->handler = call_user_func($this->handler, $record, $this); if (!$this->handler instanceof HandlerInterface) { throw new \RuntimeException("The factory callable should return a HandlerInterface"); } } $this->handler->handleBatch($this->buffer); $this->buffer = array(); } /** * {@inheritdoc} */ public function handle(array $record) { if ($this->processors) { foreach ($this->processors as $processor) { $record = call_user_func($processor, $record); } } if ($this->buffering) { $this->buffer[] = $record; if ($this->bufferSize > 0 && count($this->buffer) > $this->bufferSize) { array_shift($this->buffer); } if ($this->activationStrategy->isHandlerActivated($record)) { $this->activate(); } } else { $this->handler->handle($record); } return false === $this->bubble; } /** * {@inheritdoc} */ public function close() { $this->flushBuffer(); } public function reset() { $this->flushBuffer(); parent::reset(); if ($this->handler instanceof ResettableInterface) { $this->handler->reset(); } } /** * Clears the buffer without flushing any messages down to the wrapped handler. * * It also resets the handler to its initial buffering state. */ public function clear() { $this->buffer = array(); $this->reset(); } /** * Resets the state of the handler. Stops forwarding records to the wrapped handler. */ private function flushBuffer() { if (null !== $this->passthruLevel) { $level = $this->passthruLevel; $this->buffer = array_filter($this->buffer, function ($record) use ($level) { return $record['level'] >= $level; }); if (count($this->buffer) > 0) { $this->handler->handleBatch($this->buffer); } } $this->buffer = array(); $this->buffering = true; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * Sends notifications through the pushover api to mobile phones * * @author Sebastian Göttschkes <sebastian.goettschkes@googlemail.com> * @see https://www.pushover.net/api */ class PushoverHandler extends SocketHandler { private $token; private $users; private $title; private $user; private $retry; private $expire; private $highPriorityLevel; private $emergencyLevel; private $useFormattedMessage = false; /** * All parameters that can be sent to Pushover * @see https://pushover.net/api * @var array */ private $parameterNames = array( 'token' => true, 'user' => true, 'message' => true, 'device' => true, 'title' => true, 'url' => true, 'url_title' => true, 'priority' => true, 'timestamp' => true, 'sound' => true, 'retry' => true, 'expire' => true, 'callback' => true, ); /** * Sounds the api supports by default * @see https://pushover.net/api#sounds * @var array */ private $sounds = array( 'pushover', 'bike', 'bugle', 'cashregister', 'classical', 'cosmic', 'falling', 'gamelan', 'incoming', 'intermission', 'magic', 'mechanical', 'pianobar', 'siren', 'spacealarm', 'tugboat', 'alien', 'climb', 'persistent', 'echo', 'updown', 'none', ); /** * @param string $token Pushover api token * @param string|array $users Pushover user id or array of ids the message will be sent to * @param string $title Title sent to the Pushover API * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param bool $useSSL Whether to connect via SSL. Required when pushing messages to users that are not * the pushover.net app owner. OpenSSL is required for this option. * @param int $highPriorityLevel The minimum logging level at which this handler will start * sending "high priority" requests to the Pushover API * @param int $emergencyLevel The minimum logging level at which this handler will start * sending "emergency" requests to the Pushover API * @param int $retry The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user. * @param int $expire The expire parameter specifies how many seconds your notification will continue to be retried for (every retry seconds). */ public function __construct($token, $users, $title = null, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $highPriorityLevel = Logger::CRITICAL, $emergencyLevel = Logger::EMERGENCY, $retry = 30, $expire = 25200) { $connectionString = $useSSL ? 'ssl://api.pushover.net:443' : 'api.pushover.net:80'; parent::__construct($connectionString, $level, $bubble); $this->token = $token; $this->users = (array) $users; $this->title = $title ?: gethostname(); $this->highPriorityLevel = Logger::toMonologLevel($highPriorityLevel); $this->emergencyLevel = Logger::toMonologLevel($emergencyLevel); $this->retry = $retry; $this->expire = $expire; } protected function generateDataStream($record) { $content = $this->buildContent($record); return $this->buildHeader($content) . $content; } private function buildContent($record) { // Pushover has a limit of 512 characters on title and message combined. $maxMessageLength = 512 - strlen($this->title); $message = ($this->useFormattedMessage) ? $record['formatted'] : $record['message']; $message = substr($message, 0, $maxMessageLength); $timestamp = $record['datetime']->getTimestamp(); $dataArray = array( 'token' => $this->token, 'user' => $this->user, 'message' => $message, 'title' => $this->title, 'timestamp' => $timestamp, ); if (isset($record['level']) && $record['level'] >= $this->emergencyLevel) { $dataArray['priority'] = 2; $dataArray['retry'] = $this->retry; $dataArray['expire'] = $this->expire; } elseif (isset($record['level']) && $record['level'] >= $this->highPriorityLevel) { $dataArray['priority'] = 1; } // First determine the available parameters $context = array_intersect_key($record['context'], $this->parameterNames); $extra = array_intersect_key($record['extra'], $this->parameterNames); // Least important info should be merged with subsequent info $dataArray = array_merge($extra, $context, $dataArray); // Only pass sounds that are supported by the API if (isset($dataArray['sound']) && !in_array($dataArray['sound'], $this->sounds)) { unset($dataArray['sound']); } return http_build_query($dataArray); } private function buildHeader($content) { $header = "POST /1/messages.json HTTP/1.1\r\n"; $header .= "Host: api.pushover.net\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($content) . "\r\n"; $header .= "\r\n"; return $header; } protected function write(array $record) { foreach ($this->users as $user) { $this->user = $user; parent::write($record); $this->closeSocket(); } $this->user = null; } public function setHighPriorityLevel($value) { $this->highPriorityLevel = $value; } public function setEmergencyLevel($value) { $this->emergencyLevel = $value; } /** * Use the formatted message? * @param bool $value */ public function useFormattedMessage($value) { $this->useFormattedMessage = (bool) $value; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; use Monolog\Handler\SyslogUdp\UdpSocket; /** * A Handler for logging to a remote syslogd server. * * @author Jesper Skovgaard Nielsen <nulpunkt@gmail.com> */ class SyslogUdpHandler extends AbstractSyslogHandler { protected $socket; protected $ident; /** * @param string $host * @param int $port * @param mixed $facility * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param string $ident Program name or tag for each log message. */ public function __construct($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $ident = 'php') { parent::__construct($facility, $level, $bubble); $this->ident = $ident; $this->socket = new UdpSocket($host, $port ?: 514); } protected function write(array $record) { $lines = $this->splitMessageIntoLines($record['formatted']); $header = $this->makeCommonSyslogHeader($this->logLevels[$record['level']]); foreach ($lines as $line) { $this->socket->write($line, $header); } } public function close() { $this->socket->close(); } private function splitMessageIntoLines($message) { if (is_array($message)) { $message = implode("\n", $message); } return preg_split('/$\R?^/m', $message, -1, PREG_SPLIT_NO_EMPTY); } /** * Make common syslog header (see rfc5424) */ protected function makeCommonSyslogHeader($severity) { $priority = $severity + $this->facility; if (!$pid = getmypid()) { $pid = '-'; } if (!$hostname = gethostname()) { $hostname = '-'; } return "<$priority>1 " . $this->getDateTime() . " " . $hostname . " " . $this->ident . " " . $pid . " - - "; } protected function getDateTime() { return date(\DateTime::RFC3339); } /** * Inject your own socket, mainly used for testing */ public function setSocket($socket) { $this->socket = $socket; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Gelf\IMessagePublisher; use Gelf\PublisherInterface; use Gelf\Publisher; use InvalidArgumentException; use Monolog\Logger; use Monolog\Formatter\GelfMessageFormatter; /** * Handler to send messages to a Graylog2 (http://www.graylog2.org) server * * @author Matt Lehner <mlehner@gmail.com> * @author Benjamin Zikarsky <benjamin@zikarsky.de> */ class GelfHandler extends AbstractProcessingHandler { /** * @var Publisher the publisher object that sends the message to the server */ protected $publisher; /** * @param PublisherInterface|IMessagePublisher|Publisher $publisher a publisher object * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($publisher, $level = Logger::DEBUG, $bubble = true) { parent::__construct($level, $bubble); if (!$publisher instanceof Publisher && !$publisher instanceof IMessagePublisher && !$publisher instanceof PublisherInterface) { throw new InvalidArgumentException('Invalid publisher, expected a Gelf\Publisher, Gelf\IMessagePublisher or Gelf\PublisherInterface instance'); } $this->publisher = $publisher; } /** * {@inheritdoc} */ protected function write(array $record) { $this->publisher->publish($record['formatted']); } /** * {@inheritDoc} */ protected function getDefaultFormatter() { return new GelfMessageFormatter(); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * Blackhole * * Any record it can handle will be thrown away. This can be used * to put on top of an existing stack to override it temporarily. * * @author Jordi Boggiano <j.boggiano@seld.be> */ class NullHandler extends AbstractHandler { /** * @param int $level The minimum logging level at which this handler will be triggered */ public function __construct($level = Logger::DEBUG) { parent::__construct($level, false); } /** * {@inheritdoc} */ public function handle(array $record) { if ($record['level'] < $this->level) { return false; } return true; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LineFormatter; use Swift; /** * SwiftMailerHandler uses Swift_Mailer to send the emails * * @author Gyula Sallai */ class SwiftMailerHandler extends MailHandler { protected $mailer; private $messageTemplate; /** * @param \Swift_Mailer $mailer The mailer to use * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, $bubble = true) { parent::__construct($level, $bubble); $this->mailer = $mailer; $this->messageTemplate = $message; } /** * {@inheritdoc} */ protected function send($content, array $records) { $this->mailer->send($this->buildMessage($content, $records)); } /** * Gets the formatter for the Swift_Message subject. * * @param string $format The format of the subject * @return FormatterInterface */ protected function getSubjectFormatter($format) { return new LineFormatter($format); } /** * Creates instance of Swift_Message to be sent * * @param string $content formatted email body to be sent * @param array $records Log records that formed the content * @return \Swift_Message */ protected function buildMessage($content, array $records) { $message = null; if ($this->messageTemplate instanceof \Swift_Message) { $message = clone $this->messageTemplate; $message->generateId(); } elseif (is_callable($this->messageTemplate)) { $message = call_user_func($this->messageTemplate, $content, $records); } if (!$message instanceof \Swift_Message) { throw new \InvalidArgumentException('Could not resolve message as instance of Swift_Message or a callable returning it'); } if ($records) { $subjectFormatter = $this->getSubjectFormatter($message->getSubject()); $message->setSubject($subjectFormatter->format($this->getHighestRecord($records))); } $message->setBody($content); if (version_compare(Swift::VERSION, '6.0.0', '>=')) { $message->setDate(new \DateTimeImmutable()); } else { $message->setDate(time()); } return $message; } /** * BC getter, to be removed in 2.0 */ public function __get($name) { if ($name === 'message') { trigger_error('SwiftMailerHandler->message is deprecated, use ->buildMessage() instead to retrieve the message', E_USER_DEPRECATED); return $this->buildMessage(null, array()); } throw new \InvalidArgumentException('Invalid property '.$name); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; use Monolog\Formatter\FlowdockFormatter; use Monolog\Formatter\FormatterInterface; /** * Sends notifications through the Flowdock push API * * This must be configured with a FlowdockFormatter instance via setFormatter() * * Notes: * API token - Flowdock API token * * @author Dominik Liebler <liebler.dominik@gmail.com> * @see https://www.flowdock.com/api/push */ class FlowdockHandler extends SocketHandler { /** * @var string */ protected $apiToken; /** * @param string $apiToken * @param bool|int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * * @throws MissingExtensionException if OpenSSL is missing */ public function __construct($apiToken, $level = Logger::DEBUG, $bubble = true) { if (!extension_loaded('openssl')) { throw new MissingExtensionException('The OpenSSL PHP extension is required to use the FlowdockHandler'); } parent::__construct('ssl://api.flowdock.com:443', $level, $bubble); $this->apiToken = $apiToken; } /** * {@inheritdoc} */ public function setFormatter(FormatterInterface $formatter) { if (!$formatter instanceof FlowdockFormatter) { throw new \InvalidArgumentException('The FlowdockHandler requires an instance of Monolog\Formatter\FlowdockFormatter to function correctly'); } return parent::setFormatter($formatter); } /** * Gets the default formatter. * * @return FormatterInterface */ protected function getDefaultFormatter() { throw new \InvalidArgumentException('The FlowdockHandler must be configured (via setFormatter) with an instance of Monolog\Formatter\FlowdockFormatter to function correctly'); } /** * {@inheritdoc} * * @param array $record */ protected function write(array $record) { parent::write($record); $this->closeSocket(); } /** * {@inheritdoc} * * @param array $record * @return string */ protected function generateDataStream($record) { $content = $this->buildContent($record); return $this->buildHeader($content) . $content; } /** * Builds the body of API call * * @param array $record * @return string */ private function buildContent($record) { return json_encode($record['formatted']['flowdock']); } /** * Builds the header of the API Call * * @param string $content * @return string */ private function buildHeader($content) { $header = "POST /v1/messages/team_inbox/" . $this->apiToken . " HTTP/1.1\r\n"; $header .= "Host: api.flowdock.com\r\n"; $header .= "Content-Type: application/json\r\n"; $header .= "Content-Length: " . strlen($content) . "\r\n"; $header .= "\r\n"; return $header; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\JsonFormatter; use Monolog\Logger; /** * CouchDB handler * * @author Markus Bachmann <markus.bachmann@bachi.biz> */ class CouchDBHandler extends AbstractProcessingHandler { private $options; public function __construct(array $options = array(), $level = Logger::DEBUG, $bubble = true) { $this->options = array_merge(array( 'host' => 'localhost', 'port' => 5984, 'dbname' => 'logger', 'username' => null, 'password' => null, ), $options); parent::__construct($level, $bubble); } /** * {@inheritDoc} */ protected function write(array $record) { $basicAuth = null; if ($this->options['username']) { $basicAuth = sprintf('%s:%s@', $this->options['username'], $this->options['password']); } $url = 'http://'.$basicAuth.$this->options['host'].':'.$this->options['port'].'/'.$this->options['dbname']; $context = stream_context_create(array( 'http' => array( 'method' => 'POST', 'content' => $record['formatted'], 'ignore_errors' => true, 'max_redirects' => 0, 'header' => 'Content-type: application/json', ), )); if (false === @file_get_contents($url, null, $context)) { throw new \RuntimeException(sprintf('Could not connect to %s', $url)); } } /** * {@inheritDoc} */ protected function getDefaultFormatter() { return new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\ResettableInterface; use Monolog\Formatter\FormatterInterface; /** * This simple wrapper class can be used to extend handlers functionality. * * Example: A custom filtering that can be applied to any handler. * * Inherit from this class and override handle() like this: * * public function handle(array $record) * { * if ($record meets certain conditions) { * return false; * } * return $this->handler->handle($record); * } * * @author Alexey Karapetov <alexey@karapetov.com> */ class HandlerWrapper implements HandlerInterface, ResettableInterface { /** * @var HandlerInterface */ protected $handler; /** * HandlerWrapper constructor. * @param HandlerInterface $handler */ public function __construct(HandlerInterface $handler) { $this->handler = $handler; } /** * {@inheritdoc} */ public function isHandling(array $record) { return $this->handler->isHandling($record); } /** * {@inheritdoc} */ public function handle(array $record) { return $this->handler->handle($record); } /** * {@inheritdoc} */ public function handleBatch(array $records) { return $this->handler->handleBatch($records); } /** * {@inheritdoc} */ public function pushProcessor($callback) { $this->handler->pushProcessor($callback); return $this; } /** * {@inheritdoc} */ public function popProcessor() { return $this->handler->popProcessor(); } /** * {@inheritdoc} */ public function setFormatter(FormatterInterface $formatter) { $this->handler->setFormatter($formatter); return $this; } /** * {@inheritdoc} */ public function getFormatter() { return $this->handler->getFormatter(); } public function reset() { if ($this->handler instanceof ResettableInterface) { return $this->handler->reset(); } } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * Inspired on LogEntriesHandler. * * @author Robert Kaufmann III <rok3@rok3.me> * @author Gabriel Machado <gabriel.ms1@hotmail.com> */ class InsightOpsHandler extends SocketHandler { /** * @var string */ protected $logToken; /** * @param string $token Log token supplied by InsightOps * @param string $region Region where InsightOps account is hosted. Could be 'us' or 'eu'. * @param bool $useSSL Whether or not SSL encryption should be used * @param int $level The minimum logging level to trigger this handler * @param bool $bubble Whether or not messages that are handled should bubble up the stack. * * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing */ public function __construct($token, $region = 'us', $useSSL = true, $level = Logger::DEBUG, $bubble = true) { if ($useSSL && !extension_loaded('openssl')) { throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for LogEntriesHandler'); } $endpoint = $useSSL ? 'ssl://' . $region . '.data.logs.insight.rapid7.com:443' : $region . '.data.logs.insight.rapid7.com:80'; parent::__construct($endpoint, $level, $bubble); $this->logToken = $token; } /** * {@inheritdoc} * * @param array $record * @return string */ protected function generateDataStream($record) { return $this->logToken . ' ' . $record['formatted']; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; use Monolog\ResettableInterface; /** * Buffers all records until closing the handler and then pass them as batch. * * This is useful for a MailHandler to send only one mail per request instead of * sending one per log message. * * @author Christophe Coevoet <stof@notk.org> */ class BufferHandler extends AbstractHandler { protected $handler; protected $bufferSize = 0; protected $bufferLimit; protected $flushOnOverflow; protected $buffer = array(); protected $initialized = false; /** * @param HandlerInterface $handler Handler. * @param int $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param bool $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded */ public function __construct(HandlerInterface $handler, $bufferLimit = 0, $level = Logger::DEBUG, $bubble = true, $flushOnOverflow = false) { parent::__construct($level, $bubble); $this->handler = $handler; $this->bufferLimit = (int) $bufferLimit; $this->flushOnOverflow = $flushOnOverflow; } /** * {@inheritdoc} */ public function handle(array $record) { if ($record['level'] < $this->level) { return false; } if (!$this->initialized) { // __destructor() doesn't get called on Fatal errors register_shutdown_function(array($this, 'close')); $this->initialized = true; } if ($this->bufferLimit > 0 && $this->bufferSize === $this->bufferLimit) { if ($this->flushOnOverflow) { $this->flush(); } else { array_shift($this->buffer); $this->bufferSize--; } } if ($this->processors) { foreach ($this->processors as $processor) { $record = call_user_func($processor, $record); } } $this->buffer[] = $record; $this->bufferSize++; return false === $this->bubble; } public function flush() { if ($this->bufferSize === 0) { return; } $this->handler->handleBatch($this->buffer); $this->clear(); } public function __destruct() { // suppress the parent behavior since we already have register_shutdown_function() // to call close(), and the reference contained there will prevent this from being // GC'd until the end of the request } /** * {@inheritdoc} */ public function close() { $this->flush(); } /** * Clears the buffer without flushing any messages down to the wrapped handler. */ public function clear() { $this->bufferSize = 0; $this->buffer = array(); } public function reset() { $this->flush(); parent::reset(); if ($this->handler instanceof ResettableInterface) { $this->handler->reset(); } } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\Logger; use Monolog\Handler\Slack\SlackRecord; /** * Sends notifications through Slack Webhooks * * @author Haralan Dobrev <hkdobrev@gmail.com> * @see https://api.slack.com/incoming-webhooks */ class SlackWebhookHandler extends AbstractProcessingHandler { /** * Slack Webhook token * @var string */ private $webhookUrl; /** * Instance of the SlackRecord util class preparing data for Slack API. * @var SlackRecord */ private $slackRecord; /** * @param string $webhookUrl Slack Webhook URL * @param string|null $channel Slack channel (encoded ID or name) * @param string|null $username Name of a bot * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise) * @param string|null $iconEmoji The emoji name to use (or null) * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style * @param bool $includeContextAndExtra Whether the attachment should include context and extra data * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param array $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] */ public function __construct($webhookUrl, $channel = null, $username = null, $useAttachment = true, $iconEmoji = null, $useShortAttachment = false, $includeContextAndExtra = false, $level = Logger::CRITICAL, $bubble = true, array $excludeFields = array()) { parent::__construct($level, $bubble); $this->webhookUrl = $webhookUrl; $this->slackRecord = new SlackRecord( $channel, $username, $useAttachment, $iconEmoji, $useShortAttachment, $includeContextAndExtra, $excludeFields, $this->formatter ); } public function getSlackRecord() { return $this->slackRecord; } public function getWebhookUrl() { return $this->webhookUrl; } /** * {@inheritdoc} * * @param array $record */ protected function write(array $record) { $postData = $this->slackRecord->getSlackData($record); $postString = json_encode($postData); $ch = curl_init(); $options = array( CURLOPT_URL => $this->webhookUrl, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array('Content-type: application/json'), CURLOPT_POSTFIELDS => $postString ); if (defined('CURLOPT_SAFE_UPLOAD')) { $options[CURLOPT_SAFE_UPLOAD] = true; } curl_setopt_array($ch, $options); Curl\Util::execute($ch); } public function setFormatter(FormatterInterface $formatter) { parent::setFormatter($formatter); $this->slackRecord->setFormatter($formatter); return $this; } public function getFormatter() { $formatter = parent::getFormatter(); $this->slackRecord->setFormatter($formatter); return $formatter; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; /** * Interface that all Monolog Handlers must implement * * @author Jordi Boggiano <j.boggiano@seld.be> */ interface HandlerInterface { /** * Checks whether the given record will be handled by this handler. * * This is mostly done for performance reasons, to avoid calling processors for nothing. * * Handlers should still check the record levels within handle(), returning false in isHandling() * is no guarantee that handle() will not be called, and isHandling() might not be called * for a given record. * * @param array $record Partial log record containing only a level key * * @return bool */ public function isHandling(array $record); /** * Handles a record. * * All records may be passed to this method, and the handler should discard * those that it does not want to handle. * * The return value of this function controls the bubbling process of the handler stack. * Unless the bubbling is interrupted (by returning true), the Logger class will keep on * calling further handlers in the stack with a given log record. * * @param array $record The record to handle * @return bool true means that this handler handled the record, and that bubbling is not permitted. * false means the record was either not processed or that this handler allows bubbling. */ public function handle(array $record); /** * Handles a set of records at once. * * @param array $records The records to handle (an array of record arrays) */ public function handleBatch(array $records); /** * Adds a processor in the stack. * * @param callable $callback * @return self */ public function pushProcessor($callback); /** * Removes the processor on top of the stack and returns it. * * @return callable */ public function popProcessor(); /** * Sets the formatter. * * @param FormatterInterface $formatter * @return self */ public function setFormatter(FormatterInterface $formatter); /** * Gets the formatter. * * @return FormatterInterface */ public function getFormatter(); } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; /** * Exception can be thrown if an extension for an handler is missing * * @author Christian Bergau <cbergau86@gmail.com> */ class MissingExtensionException extends \Exception { } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * Simple handler wrapper that deduplicates log records across multiple requests * * It also includes the BufferHandler functionality and will buffer * all messages until the end of the request or flush() is called. * * This works by storing all log records' messages above $deduplicationLevel * to the file specified by $deduplicationStore. When further logs come in at the end of the * request (or when flush() is called), all those above $deduplicationLevel are checked * against the existing stored logs. If they match and the timestamps in the stored log is * not older than $time seconds, the new log record is discarded. If no log record is new, the * whole data set is discarded. * * This is mainly useful in combination with Mail handlers or things like Slack or HipChat handlers * that send messages to people, to avoid spamming with the same message over and over in case of * a major component failure like a database server being down which makes all requests fail in the * same way. * * @author Jordi Boggiano <j.boggiano@seld.be> */ class DeduplicationHandler extends BufferHandler { /** * @var string */ protected $deduplicationStore; /** * @var int */ protected $deduplicationLevel; /** * @var int */ protected $time; /** * @var bool */ private $gc = false; /** * @param HandlerInterface $handler Handler. * @param string $deduplicationStore The file/path where the deduplication log should be kept * @param int $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes * @param int $time The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(HandlerInterface $handler, $deduplicationStore = null, $deduplicationLevel = Logger::ERROR, $time = 60, $bubble = true) { parent::__construct($handler, 0, Logger::DEBUG, $bubble, false); $this->deduplicationStore = $deduplicationStore === null ? sys_get_temp_dir() . '/monolog-dedup-' . substr(md5(__FILE__), 0, 20) .'.log' : $deduplicationStore; $this->deduplicationLevel = Logger::toMonologLevel($deduplicationLevel); $this->time = $time; } public function flush() { if ($this->bufferSize === 0) { return; } $passthru = null; foreach ($this->buffer as $record) { if ($record['level'] >= $this->deduplicationLevel) { $passthru = $passthru || !$this->isDuplicate($record); if ($passthru) { $this->appendRecord($record); } } } // default of null is valid as well as if no record matches duplicationLevel we just pass through if ($passthru === true || $passthru === null) { $this->handler->handleBatch($this->buffer); } $this->clear(); if ($this->gc) { $this->collectLogs(); } } private function isDuplicate(array $record) { if (!file_exists($this->deduplicationStore)) { return false; } $store = file($this->deduplicationStore, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); if (!is_array($store)) { return false; } $yesterday = time() - 86400; $timestampValidity = $record['datetime']->getTimestamp() - $this->time; $expectedMessage = preg_replace('{[\r\n].*}', '', $record['message']); for ($i = count($store) - 1; $i >= 0; $i--) { list($timestamp, $level, $message) = explode(':', $store[$i], 3); if ($level === $record['level_name'] && $message === $expectedMessage && $timestamp > $timestampValidity) { return true; } if ($timestamp < $yesterday) { $this->gc = true; } } return false; } private function collectLogs() { if (!file_exists($this->deduplicationStore)) { return false; } $handle = fopen($this->deduplicationStore, 'rw+'); flock($handle, LOCK_EX); $validLogs = array(); $timestampValidity = time() - $this->time; while (!feof($handle)) { $log = fgets($handle); if (substr($log, 0, 10) >= $timestampValidity) { $validLogs[] = $log; } } ftruncate($handle, 0); rewind($handle); foreach ($validLogs as $log) { fwrite($handle, $log); } flock($handle, LOCK_UN); fclose($handle); $this->gc = false; } private function appendRecord(array $record) { file_put_contents($this->deduplicationStore, $record['datetime']->getTimestamp() . ':' . $record['level_name'] . ':' . preg_replace('{[\r\n].*}', '', $record['message']) . "\n", FILE_APPEND); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; use Monolog\Formatter\LineFormatter; /** * Common syslog functionality */ abstract class AbstractSyslogHandler extends AbstractProcessingHandler { protected $facility; /** * Translates Monolog log levels to syslog log priorities. */ protected $logLevels = array( Logger::DEBUG => LOG_DEBUG, Logger::INFO => LOG_INFO, Logger::NOTICE => LOG_NOTICE, Logger::WARNING => LOG_WARNING, Logger::ERROR => LOG_ERR, Logger::CRITICAL => LOG_CRIT, Logger::ALERT => LOG_ALERT, Logger::EMERGENCY => LOG_EMERG, ); /** * List of valid log facility names. */ protected $facilities = array( 'auth' => LOG_AUTH, 'authpriv' => LOG_AUTHPRIV, 'cron' => LOG_CRON, 'daemon' => LOG_DAEMON, 'kern' => LOG_KERN, 'lpr' => LOG_LPR, 'mail' => LOG_MAIL, 'news' => LOG_NEWS, 'syslog' => LOG_SYSLOG, 'user' => LOG_USER, 'uucp' => LOG_UUCP, ); /** * @param mixed $facility * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($facility = LOG_USER, $level = Logger::DEBUG, $bubble = true) { parent::__construct($level, $bubble); if (!defined('PHP_WINDOWS_VERSION_BUILD')) { $this->facilities['local0'] = LOG_LOCAL0; $this->facilities['local1'] = LOG_LOCAL1; $this->facilities['local2'] = LOG_LOCAL2; $this->facilities['local3'] = LOG_LOCAL3; $this->facilities['local4'] = LOG_LOCAL4; $this->facilities['local5'] = LOG_LOCAL5; $this->facilities['local6'] = LOG_LOCAL6; $this->facilities['local7'] = LOG_LOCAL7; } else { $this->facilities['local0'] = 128; // LOG_LOCAL0 $this->facilities['local1'] = 136; // LOG_LOCAL1 $this->facilities['local2'] = 144; // LOG_LOCAL2 $this->facilities['local3'] = 152; // LOG_LOCAL3 $this->facilities['local4'] = 160; // LOG_LOCAL4 $this->facilities['local5'] = 168; // LOG_LOCAL5 $this->facilities['local6'] = 176; // LOG_LOCAL6 $this->facilities['local7'] = 184; // LOG_LOCAL7 } // convert textual description of facility to syslog constant if (array_key_exists(strtolower($facility), $this->facilities)) { $facility = $this->facilities[strtolower($facility)]; } elseif (!in_array($facility, array_values($this->facilities), true)) { throw new \UnexpectedValueException('Unknown facility value "'.$facility.'" given'); } $this->facility = $facility; } /** * {@inheritdoc} */ protected function getDefaultFormatter() { return new LineFormatter('%channel%.%level_name%: %message% %context% %extra%'); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler\Curl; class Util { private static $retriableErrorCodes = array( CURLE_COULDNT_RESOLVE_HOST, CURLE_COULDNT_CONNECT, CURLE_HTTP_NOT_FOUND, CURLE_READ_ERROR, CURLE_OPERATION_TIMEOUTED, CURLE_HTTP_POST_ERROR, CURLE_SSL_CONNECT_ERROR, ); /** * Executes a CURL request with optional retries and exception on failure * * @param resource $ch curl handler * @throws \RuntimeException */ public static function execute($ch, $retries = 5, $closeAfterDone = true) { while ($retries--) { if (curl_exec($ch) === false) { $curlErrno = curl_errno($ch); if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || !$retries) { $curlError = curl_error($ch); if ($closeAfterDone) { curl_close($ch); } throw new \RuntimeException(sprintf('Curl error (code %s): %s', $curlErrno, $curlError)); } continue; } if ($closeAfterDone) { curl_close($ch); } break; } } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\Logger; use Monolog\Handler\Slack\SlackRecord; /** * Sends notifications through Slack API * * @author Greg Kedzierski <greg@gregkedzierski.com> * @see https://api.slack.com/ */ class SlackHandler extends SocketHandler { /** * Slack API token * @var string */ private $token; /** * Instance of the SlackRecord util class preparing data for Slack API. * @var SlackRecord */ private $slackRecord; /** * @param string $token Slack API token * @param string $channel Slack channel (encoded ID or name) * @param string|null $username Name of a bot * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise) * @param string|null $iconEmoji The emoji name to use (or null) * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style * @param bool $includeContextAndExtra Whether the attachment should include context and extra data * @param array $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] * @throws MissingExtensionException If no OpenSSL PHP extension configured */ public function __construct($token, $channel, $username = null, $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false, array $excludeFields = array()) { if (!extension_loaded('openssl')) { throw new MissingExtensionException('The OpenSSL PHP extension is required to use the SlackHandler'); } parent::__construct('ssl://slack.com:443', $level, $bubble); $this->slackRecord = new SlackRecord( $channel, $username, $useAttachment, $iconEmoji, $useShortAttachment, $includeContextAndExtra, $excludeFields, $this->formatter ); $this->token = $token; } public function getSlackRecord() { return $this->slackRecord; } public function getToken() { return $this->token; } /** * {@inheritdoc} * * @param array $record * @return string */ protected function generateDataStream($record) { $content = $this->buildContent($record); return $this->buildHeader($content) . $content; } /** * Builds the body of API call * * @param array $record * @return string */ private function buildContent($record) { $dataArray = $this->prepareContentData($record); return http_build_query($dataArray); } /** * Prepares content data * * @param array $record * @return array */ protected function prepareContentData($record) { $dataArray = $this->slackRecord->getSlackData($record); $dataArray['token'] = $this->token; if (!empty($dataArray['attachments'])) { $dataArray['attachments'] = json_encode($dataArray['attachments']); } return $dataArray; } /** * Builds the header of the API Call * * @param string $content * @return string */ private function buildHeader($content) { $header = "POST /api/chat.postMessage HTTP/1.1\r\n"; $header .= "Host: slack.com\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($content) . "\r\n"; $header .= "\r\n"; return $header; } /** * {@inheritdoc} * * @param array $record */ protected function write(array $record) { parent::write($record); $this->finalizeWrite(); } /** * Finalizes the request by reading some bytes and then closing the socket * * If we do not read some but close the socket too early, slack sometimes * drops the request entirely. */ protected function finalizeWrite() { $res = $this->getResource(); if (is_resource($res)) { @fread($res, 2048); } $this->closeSocket(); } /** * Returned a Slack message attachment color associated with * provided level. * * @param int $level * @return string * @deprecated Use underlying SlackRecord instead */ protected function getAttachmentColor($level) { trigger_error( 'SlackHandler::getAttachmentColor() is deprecated. Use underlying SlackRecord instead.', E_USER_DEPRECATED ); return $this->slackRecord->getAttachmentColor($level); } /** * Stringifies an array of key/value pairs to be used in attachment fields * * @param array $fields * @return string * @deprecated Use underlying SlackRecord instead */ protected function stringify($fields) { trigger_error( 'SlackHandler::stringify() is deprecated. Use underlying SlackRecord instead.', E_USER_DEPRECATED ); return $this->slackRecord->stringify($fields); } public function setFormatter(FormatterInterface $formatter) { parent::setFormatter($formatter); $this->slackRecord->setFormatter($formatter); return $this; } public function getFormatter() { $formatter = parent::getFormatter(); $this->slackRecord->setFormatter($formatter); return $formatter; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\NormalizerFormatter; use Monolog\Logger; /** * Handler sending logs to Zend Monitor * * @author Christian Bergau <cbergau86@gmail.com> */ class ZendMonitorHandler extends AbstractProcessingHandler { /** * Monolog level / ZendMonitor Custom Event priority map * * @var array */ protected $levelMap = array( Logger::DEBUG => 1, Logger::INFO => 2, Logger::NOTICE => 3, Logger::WARNING => 4, Logger::ERROR => 5, Logger::CRITICAL => 6, Logger::ALERT => 7, Logger::EMERGENCY => 0, ); /** * Construct * * @param int $level * @param bool $bubble * @throws MissingExtensionException */ public function __construct($level = Logger::DEBUG, $bubble = true) { if (!function_exists('zend_monitor_custom_event')) { throw new MissingExtensionException('You must have Zend Server installed in order to use this handler'); } parent::__construct($level, $bubble); } /** * {@inheritdoc} */ protected function write(array $record) { $this->writeZendMonitorCustomEvent( $this->levelMap[$record['level']], $record['message'], $record['formatted'] ); } /** * Write a record to Zend Monitor * * @param int $level * @param string $message * @param array $formatted */ protected function writeZendMonitorCustomEvent($level, $message, $formatted) { zend_monitor_custom_event($level, $message, $formatted); } /** * {@inheritdoc} */ public function getDefaultFormatter() { return new NormalizerFormatter(); } /** * Get the level map * * @return array */ public function getLevelMap() { return $this->levelMap; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\LineFormatter; use Monolog\Logger; /** * Logs to a Redis key using rpush * * usage example: * * $log = new Logger('application'); * $redis = new RedisHandler(new Predis\Client("tcp://localhost:6379"), "logs", "prod"); * $log->pushHandler($redis); * * @author Thomas Tourlourat <thomas@tourlourat.com> */ class RedisHandler extends AbstractProcessingHandler { private $redisClient; private $redisKey; protected $capSize; /** * @param \Predis\Client|\Redis $redis The redis instance * @param string $key The key name to push records to * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param int $capSize Number of entries to limit list size to */ public function __construct($redis, $key, $level = Logger::DEBUG, $bubble = true, $capSize = false) { if (!(($redis instanceof \Predis\Client) || ($redis instanceof \Redis))) { throw new \InvalidArgumentException('Predis\Client or Redis instance required'); } $this->redisClient = $redis; $this->redisKey = $key; $this->capSize = $capSize; parent::__construct($level, $bubble); } /** * {@inheritDoc} */ protected function write(array $record) { if ($this->capSize) { $this->writeCapped($record); } else { $this->redisClient->rpush($this->redisKey, $record["formatted"]); } } /** * Write and cap the collection * Writes the record to the redis list and caps its * * @param array $record associative record array * @return void */ protected function writeCapped(array $record) { if ($this->redisClient instanceof \Redis) { $this->redisClient->multi() ->rpush($this->redisKey, $record["formatted"]) ->ltrim($this->redisKey, -$this->capSize, -1) ->exec(); } else { $redisKey = $this->redisKey; $capSize = $this->capSize; $this->redisClient->transaction(function ($tx) use ($record, $redisKey, $capSize) { $tx->rpush($redisKey, $record["formatted"]); $tx->ltrim($redisKey, -$capSize, -1); }); } } /** * {@inheritDoc} */ protected function getDefaultFormatter() { return new LineFormatter(); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * Sends notifications through the hipchat api to a hipchat room * * Notes: * API token - HipChat API token * Room - HipChat Room Id or name, where messages are sent * Name - Name used to send the message (from) * notify - Should the message trigger a notification in the clients * version - The API version to use (HipChatHandler::API_V1 | HipChatHandler::API_V2) * * @author Rafael Dohms <rafael@doh.ms> * @see https://www.hipchat.com/docs/api */ class HipChatHandler extends SocketHandler { /** * Use API version 1 */ const API_V1 = 'v1'; /** * Use API version v2 */ const API_V2 = 'v2'; /** * The maximum allowed length for the name used in the "from" field. */ const MAXIMUM_NAME_LENGTH = 15; /** * The maximum allowed length for the message. */ const MAXIMUM_MESSAGE_LENGTH = 9500; /** * @var string */ private $token; /** * @var string */ private $room; /** * @var string */ private $name; /** * @var bool */ private $notify; /** * @var string */ private $format; /** * @var string */ private $host; /** * @var string */ private $version; /** * @param string $token HipChat API Token * @param string $room The room that should be alerted of the message (Id or Name) * @param string $name Name used in the "from" field. * @param bool $notify Trigger a notification in clients or not * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param bool $useSSL Whether to connect via SSL. * @param string $format The format of the messages (default to text, can be set to html if you have html in the messages) * @param string $host The HipChat server hostname. * @param string $version The HipChat API version (default HipChatHandler::API_V1) */ public function __construct($token, $room, $name = 'Monolog', $notify = false, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $format = 'text', $host = 'api.hipchat.com', $version = self::API_V1) { if ($version == self::API_V1 && !$this->validateStringLength($name, static::MAXIMUM_NAME_LENGTH)) { throw new \InvalidArgumentException('The supplied name is too long. HipChat\'s v1 API supports names up to 15 UTF-8 characters.'); } $connectionString = $useSSL ? 'ssl://'.$host.':443' : $host.':80'; parent::__construct($connectionString, $level, $bubble); $this->token = $token; $this->name = $name; $this->notify = $notify; $this->room = $room; $this->format = $format; $this->host = $host; $this->version = $version; } /** * {@inheritdoc} * * @param array $record * @return string */ protected function generateDataStream($record) { $content = $this->buildContent($record); return $this->buildHeader($content) . $content; } /** * Builds the body of API call * * @param array $record * @return string */ private function buildContent($record) { $dataArray = array( 'notify' => $this->version == self::API_V1 ? ($this->notify ? 1 : 0) : ($this->notify ? 'true' : 'false'), 'message' => $record['formatted'], 'message_format' => $this->format, 'color' => $this->getAlertColor($record['level']), ); if (!$this->validateStringLength($dataArray['message'], static::MAXIMUM_MESSAGE_LENGTH)) { if (function_exists('mb_substr')) { $dataArray['message'] = mb_substr($dataArray['message'], 0, static::MAXIMUM_MESSAGE_LENGTH).' [truncated]'; } else { $dataArray['message'] = substr($dataArray['message'], 0, static::MAXIMUM_MESSAGE_LENGTH).' [truncated]'; } } // if we are using the legacy API then we need to send some additional information if ($this->version == self::API_V1) { $dataArray['room_id'] = $this->room; } // append the sender name if it is set // always append it if we use the v1 api (it is required in v1) if ($this->version == self::API_V1 || $this->name !== null) { $dataArray['from'] = (string) $this->name; } return http_build_query($dataArray); } /** * Builds the header of the API Call * * @param string $content * @return string */ private function buildHeader($content) { if ($this->version == self::API_V1) { $header = "POST /v1/rooms/message?format=json&auth_token={$this->token} HTTP/1.1\r\n"; } else { // needed for rooms with special (spaces, etc) characters in the name $room = rawurlencode($this->room); $header = "POST /v2/room/{$room}/notification?auth_token={$this->token} HTTP/1.1\r\n"; } $header .= "Host: {$this->host}\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($content) . "\r\n"; $header .= "\r\n"; return $header; } /** * Assigns a color to each level of log records. * * @param int $level * @return string */ protected function getAlertColor($level) { switch (true) { case $level >= Logger::ERROR: return 'red'; case $level >= Logger::WARNING: return 'yellow'; case $level >= Logger::INFO: return 'green'; case $level == Logger::DEBUG: return 'gray'; default: return 'yellow'; } } /** * {@inheritdoc} * * @param array $record */ protected function write(array $record) { parent::write($record); $this->finalizeWrite(); } /** * Finalizes the request by reading some bytes and then closing the socket * * If we do not read some but close the socket too early, hipchat sometimes * drops the request entirely. */ protected function finalizeWrite() { $res = $this->getResource(); if (is_resource($res)) { @fread($res, 2048); } $this->closeSocket(); } /** * {@inheritdoc} */ public function handleBatch(array $records) { if (count($records) == 0) { return true; } $batchRecords = $this->combineRecords($records); $handled = false; foreach ($batchRecords as $batchRecord) { if ($this->isHandling($batchRecord)) { $this->write($batchRecord); $handled = true; } } if (!$handled) { return false; } return false === $this->bubble; } /** * Combines multiple records into one. Error level of the combined record * will be the highest level from the given records. Datetime will be taken * from the first record. * * @param $records * @return array */ private function combineRecords($records) { $batchRecord = null; $batchRecords = array(); $messages = array(); $formattedMessages = array(); $level = 0; $levelName = null; $datetime = null; foreach ($records as $record) { $record = $this->processRecord($record); if ($record['level'] > $level) { $level = $record['level']; $levelName = $record['level_name']; } if (null === $datetime) { $datetime = $record['datetime']; } $messages[] = $record['message']; $messageStr = implode(PHP_EOL, $messages); $formattedMessages[] = $this->getFormatter()->format($record); $formattedMessageStr = implode('', $formattedMessages); $batchRecord = array( 'message' => $messageStr, 'formatted' => $formattedMessageStr, 'context' => array(), 'extra' => array(), ); if (!$this->validateStringLength($batchRecord['formatted'], static::MAXIMUM_MESSAGE_LENGTH)) { // Pop the last message and implode the remaining messages $lastMessage = array_pop($messages); $lastFormattedMessage = array_pop($formattedMessages); $batchRecord['message'] = implode(PHP_EOL, $messages); $batchRecord['formatted'] = implode('', $formattedMessages); $batchRecords[] = $batchRecord; $messages = array($lastMessage); $formattedMessages = array($lastFormattedMessage); $batchRecord = null; } } if (null !== $batchRecord) { $batchRecords[] = $batchRecord; } // Set the max level and datetime for all records foreach ($batchRecords as &$batchRecord) { $batchRecord = array_merge( $batchRecord, array( 'level' => $level, 'level_name' => $levelName, 'datetime' => $datetime, ) ); } return $batchRecords; } /** * Validates the length of a string. * * If the `mb_strlen()` function is available, it will use that, as HipChat * allows UTF-8 characters. Otherwise, it will fall back to `strlen()`. * * Note that this might cause false failures in the specific case of using * a valid name with less than 16 characters, but 16 or more bytes, on a * system where `mb_strlen()` is unavailable. * * @param string $str * @param int $length * * @return bool */ private function validateStringLength($str, $length) { if (function_exists('mb_strlen')) { return (mb_strlen($str) <= $length); } return (strlen($str) <= $length); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; /** * Sampling handler * * A sampled event stream can be useful for logging high frequency events in * a production environment where you only need an idea of what is happening * and are not concerned with capturing every occurrence. Since the decision to * handle or not handle a particular event is determined randomly, the * resulting sampled log is not guaranteed to contain 1/N of the events that * occurred in the application, but based on the Law of large numbers, it will * tend to be close to this ratio with a large number of attempts. * * @author Bryan Davis <bd808@wikimedia.org> * @author Kunal Mehta <legoktm@gmail.com> */ class SamplingHandler extends AbstractHandler { /** * @var callable|HandlerInterface $handler */ protected $handler; /** * @var int $factor */ protected $factor; /** * @param callable|HandlerInterface $handler Handler or factory callable($record, $fingersCrossedHandler). * @param int $factor Sample factor */ public function __construct($handler, $factor) { parent::__construct(); $this->handler = $handler; $this->factor = $factor; if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); } } public function isHandling(array $record) { return $this->handler->isHandling($record); } public function handle(array $record) { if ($this->isHandling($record) && mt_rand(1, $this->factor) === 1) { // The same logic as in FingersCrossedHandler if (!$this->handler instanceof HandlerInterface) { $this->handler = call_user_func($this->handler, $record, $this); if (!$this->handler instanceof HandlerInterface) { throw new \RuntimeException("The factory callable should return a HandlerInterface"); } } if ($this->processors) { foreach ($this->processors as $processor) { $record = call_user_func($processor, $record); } } $this->handler->handle($record); } return false === $this->bubble; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * @author Robert Kaufmann III <rok3@rok3.me> */ class LogEntriesHandler extends SocketHandler { /** * @var string */ protected $logToken; /** * @param string $token Log token supplied by LogEntries * @param bool $useSSL Whether or not SSL encryption should be used. * @param int $level The minimum logging level to trigger this handler * @param bool $bubble Whether or not messages that are handled should bubble up the stack. * * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing */ public function __construct($token, $useSSL = true, $level = Logger::DEBUG, $bubble = true, $host = 'data.logentries.com') { if ($useSSL && !extension_loaded('openssl')) { throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for LogEntriesHandler'); } $endpoint = $useSSL ? 'ssl://' . $host . ':443' : $host . ':80'; parent::__construct($endpoint, $level, $bubble); $this->logToken = $token; } /** * {@inheritdoc} * * @param array $record * @return string */ protected function generateDataStream($record) { return $this->logToken . ' ' . $record['formatted']; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; use Monolog\Formatter\NormalizerFormatter; /** * Logs to a MongoDB database. * * usage example: * * $log = new Logger('application'); * $mongodb = new MongoDBHandler(new \Mongo("mongodb://localhost:27017"), "logs", "prod"); * $log->pushHandler($mongodb); * * @author Thomas Tourlourat <thomas@tourlourat.com> */ class MongoDBHandler extends AbstractProcessingHandler { protected $mongoCollection; public function __construct($mongo, $database, $collection, $level = Logger::DEBUG, $bubble = true) { if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo || $mongo instanceof \MongoDB\Client)) { throw new \InvalidArgumentException('MongoClient, Mongo or MongoDB\Client instance required'); } $this->mongoCollection = $mongo->selectCollection($database, $collection); parent::__construct($level, $bubble); } protected function write(array $record) { if ($this->mongoCollection instanceof \MongoDB\Collection) { $this->mongoCollection->insertOne($record["formatted"]); } else { $this->mongoCollection->save($record["formatted"]); } } /** * {@inheritDoc} */ protected function getDefaultFormatter() { return new NormalizerFormatter(); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\ResettableInterface; /** * Forwards records to multiple handlers * * @author Lenar Lõhmus <lenar@city.ee> */ class GroupHandler extends AbstractHandler { protected $handlers; /** * @param array $handlers Array of Handlers. * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(array $handlers, $bubble = true) { foreach ($handlers as $handler) { if (!$handler instanceof HandlerInterface) { throw new \InvalidArgumentException('The first argument of the GroupHandler must be an array of HandlerInterface instances.'); } } $this->handlers = $handlers; $this->bubble = $bubble; } /** * {@inheritdoc} */ public function isHandling(array $record) { foreach ($this->handlers as $handler) { if ($handler->isHandling($record)) { return true; } } return false; } /** * {@inheritdoc} */ public function handle(array $record) { if ($this->processors) { foreach ($this->processors as $processor) { $record = call_user_func($processor, $record); } } foreach ($this->handlers as $handler) { $handler->handle($record); } return false === $this->bubble; } /** * {@inheritdoc} */ public function handleBatch(array $records) { if ($this->processors) { $processed = array(); foreach ($records as $record) { foreach ($this->processors as $processor) { $processed[] = call_user_func($processor, $record); } } $records = $processed; } foreach ($this->handlers as $handler) { $handler->handleBatch($records); } } public function reset() { parent::reset(); foreach ($this->handlers as $handler) { if ($handler instanceof ResettableInterface) { $handler->reset(); } } } /** * {@inheritdoc} */ public function setFormatter(FormatterInterface $formatter) { foreach ($this->handlers as $handler) { $handler->setFormatter($formatter); } return $this; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Exception; use Monolog\Formatter\LineFormatter; use Monolog\Logger; use PhpConsole\Connector; use PhpConsole\Handler; use PhpConsole\Helper; /** * Monolog handler for Google Chrome extension "PHP Console" * * Display PHP error/debug log messages in Google Chrome console and notification popups, executes PHP code remotely * * Usage: * 1. Install Google Chrome extension https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef * 2. See overview https://github.com/barbushin/php-console#overview * 3. Install PHP Console library https://github.com/barbushin/php-console#installation * 4. Example (result will looks like http://i.hizliresim.com/vg3Pz4.png) * * $logger = new \Monolog\Logger('all', array(new \Monolog\Handler\PHPConsoleHandler())); * \Monolog\ErrorHandler::register($logger); * echo $undefinedVar; * $logger->addDebug('SELECT * FROM users', array('db', 'time' => 0.012)); * PC::debug($_SERVER); // PHP Console debugger for any type of vars * * @author Sergey Barbushin https://www.linkedin.com/in/barbushin */ class PHPConsoleHandler extends AbstractProcessingHandler { private $options = array( 'enabled' => true, // bool Is PHP Console server enabled 'classesPartialsTraceIgnore' => array('Monolog\\'), // array Hide calls of classes started with... 'debugTagsKeysInContext' => array(0, 'tag'), // bool Is PHP Console server enabled 'useOwnErrorsHandler' => false, // bool Enable errors handling 'useOwnExceptionsHandler' => false, // bool Enable exceptions handling 'sourcesBasePath' => null, // string Base path of all project sources to strip in errors source paths 'registerHelper' => true, // bool Register PhpConsole\Helper that allows short debug calls like PC::debug($var, 'ta.g.s') 'serverEncoding' => null, // string|null Server internal encoding 'headersLimit' => null, // int|null Set headers size limit for your web-server 'password' => null, // string|null Protect PHP Console connection by password 'enableSslOnlyMode' => false, // bool Force connection by SSL for clients with PHP Console installed 'ipMasks' => array(), // array Set IP masks of clients that will be allowed to connect to PHP Console: array('192.168.*.*', '127.0.0.1') 'enableEvalListener' => false, // bool Enable eval request to be handled by eval dispatcher(if enabled, 'password' option is also required) 'dumperDetectCallbacks' => false, // bool Convert callback items in dumper vars to (callback SomeClass::someMethod) strings 'dumperLevelLimit' => 5, // int Maximum dumped vars array or object nested dump level 'dumperItemsCountLimit' => 100, // int Maximum dumped var same level array items or object properties number 'dumperItemSizeLimit' => 5000, // int Maximum length of any string or dumped array item 'dumperDumpSizeLimit' => 500000, // int Maximum approximate size of dumped vars result formatted in JSON 'detectDumpTraceAndSource' => false, // bool Autodetect and append trace data to debug 'dataStorage' => null, // PhpConsole\Storage|null Fixes problem with custom $_SESSION handler(see http://goo.gl/Ne8juJ) ); /** @var Connector */ private $connector; /** * @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details * @param Connector|null $connector Instance of \PhpConsole\Connector class (optional) * @param int $level * @param bool $bubble * @throws Exception */ public function __construct(array $options = array(), Connector $connector = null, $level = Logger::DEBUG, $bubble = true) { if (!class_exists('PhpConsole\Connector')) { throw new Exception('PHP Console library not found. See https://github.com/barbushin/php-console#installation'); } parent::__construct($level, $bubble); $this->options = $this->initOptions($options); $this->connector = $this->initConnector($connector); } private function initOptions(array $options) { $wrongOptions = array_diff(array_keys($options), array_keys($this->options)); if ($wrongOptions) { throw new Exception('Unknown options: ' . implode(', ', $wrongOptions)); } return array_replace($this->options, $options); } private function initConnector(Connector $connector = null) { if (!$connector) { if ($this->options['dataStorage']) { Connector::setPostponeStorage($this->options['dataStorage']); } $connector = Connector::getInstance(); } if ($this->options['registerHelper'] && !Helper::isRegistered()) { Helper::register(); } if ($this->options['enabled'] && $connector->isActiveClient()) { if ($this->options['useOwnErrorsHandler'] || $this->options['useOwnExceptionsHandler']) { $handler = Handler::getInstance(); $handler->setHandleErrors($this->options['useOwnErrorsHandler']); $handler->setHandleExceptions($this->options['useOwnExceptionsHandler']); $handler->start(); } if ($this->options['sourcesBasePath']) { $connector->setSourcesBasePath($this->options['sourcesBasePath']); } if ($this->options['serverEncoding']) { $connector->setServerEncoding($this->options['serverEncoding']); } if ($this->options['password']) { $connector->setPassword($this->options['password']); } if ($this->options['enableSslOnlyMode']) { $connector->enableSslOnlyMode(); } if ($this->options['ipMasks']) { $connector->setAllowedIpMasks($this->options['ipMasks']); } if ($this->options['headersLimit']) { $connector->setHeadersLimit($this->options['headersLimit']); } if ($this->options['detectDumpTraceAndSource']) { $connector->getDebugDispatcher()->detectTraceAndSource = true; } $dumper = $connector->getDumper(); $dumper->levelLimit = $this->options['dumperLevelLimit']; $dumper->itemsCountLimit = $this->options['dumperItemsCountLimit']; $dumper->itemSizeLimit = $this->options['dumperItemSizeLimit']; $dumper->dumpSizeLimit = $this->options['dumperDumpSizeLimit']; $dumper->detectCallbacks = $this->options['dumperDetectCallbacks']; if ($this->options['enableEvalListener']) { $connector->startEvalRequestsListener(); } } return $connector; } public function getConnector() { return $this->connector; } public function getOptions() { return $this->options; } public function handle(array $record) { if ($this->options['enabled'] && $this->connector->isActiveClient()) { return parent::handle($record); } return !$this->bubble; } /** * Writes the record down to the log of the implementing handler * * @param array $record * @return void */ protected function write(array $record) { if ($record['level'] < Logger::NOTICE) { $this->handleDebugRecord($record); } elseif (isset($record['context']['exception']) && $record['context']['exception'] instanceof Exception) { $this->handleExceptionRecord($record); } else { $this->handleErrorRecord($record); } } private function handleDebugRecord(array $record) { $tags = $this->getRecordTags($record); $message = $record['message']; if ($record['context']) { $message .= ' ' . json_encode($this->connector->getDumper()->dump(array_filter($record['context']))); } $this->connector->getDebugDispatcher()->dispatchDebug($message, $tags, $this->options['classesPartialsTraceIgnore']); } private function handleExceptionRecord(array $record) { $this->connector->getErrorsDispatcher()->dispatchException($record['context']['exception']); } private function handleErrorRecord(array $record) { $context = $record['context']; $this->connector->getErrorsDispatcher()->dispatchError( isset($context['code']) ? $context['code'] : null, isset($context['message']) ? $context['message'] : $record['message'], isset($context['file']) ? $context['file'] : null, isset($context['line']) ? $context['line'] : null, $this->options['classesPartialsTraceIgnore'] ); } private function getRecordTags(array &$record) { $tags = null; if (!empty($record['context'])) { $context = & $record['context']; foreach ($this->options['debugTagsKeysInContext'] as $key) { if (!empty($context[$key])) { $tags = $context[$key]; if ($key === 0) { array_shift($context); } else { unset($context[$key]); } break; } } } return $tags ?: strtolower($record['level_name']); } /** * {@inheritDoc} */ protected function getDefaultFormatter() { return new LineFormatter('%message%'); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\LineFormatter; use Monolog\Logger; /** * Stores to PHP error_log() handler. * * @author Elan Ruusamäe <glen@delfi.ee> */ class ErrorLogHandler extends AbstractProcessingHandler { const OPERATING_SYSTEM = 0; const SAPI = 4; protected $messageType; protected $expandNewlines; /** * @param int $messageType Says where the error should go. * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param bool $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries */ public function __construct($messageType = self::OPERATING_SYSTEM, $level = Logger::DEBUG, $bubble = true, $expandNewlines = false) { parent::__construct($level, $bubble); if (false === in_array($messageType, self::getAvailableTypes())) { $message = sprintf('The given message type "%s" is not supported', print_r($messageType, true)); throw new \InvalidArgumentException($message); } $this->messageType = $messageType; $this->expandNewlines = $expandNewlines; } /** * @return array With all available types */ public static function getAvailableTypes() { return array( self::OPERATING_SYSTEM, self::SAPI, ); } /** * {@inheritDoc} */ protected function getDefaultFormatter() { return new LineFormatter('[%datetime%] %channel%.%level_name%: %message% %context% %extra%'); } /** * {@inheritdoc} */ protected function write(array $record) { if ($this->expandNewlines) { $lines = preg_split('{[\r\n]+}', (string) $record['formatted']); foreach ($lines as $line) { error_log($line, $this->messageType); } } else { error_log((string) $record['formatted'], $this->messageType); } } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; use Monolog\Formatter\NormalizerFormatter; use Doctrine\CouchDB\CouchDBClient; /** * CouchDB handler for Doctrine CouchDB ODM * * @author Markus Bachmann <markus.bachmann@bachi.biz> */ class DoctrineCouchDBHandler extends AbstractProcessingHandler { private $client; public function __construct(CouchDBClient $client, $level = Logger::DEBUG, $bubble = true) { $this->client = $client; parent::__construct($level, $bubble); } /** * {@inheritDoc} */ protected function write(array $record) { $this->client->postDocument($record['formatted']); } protected function getDefaultFormatter() { return new NormalizerFormatter; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Aws\Sdk; use Aws\DynamoDb\DynamoDbClient; use Aws\DynamoDb\Marshaler; use Monolog\Formatter\ScalarFormatter; use Monolog\Logger; /** * Amazon DynamoDB handler (http://aws.amazon.com/dynamodb/) * * @link https://github.com/aws/aws-sdk-php/ * @author Andrew Lawson <adlawson@gmail.com> */ class DynamoDbHandler extends AbstractProcessingHandler { const DATE_FORMAT = 'Y-m-d\TH:i:s.uO'; /** * @var DynamoDbClient */ protected $client; /** * @var string */ protected $table; /** * @var int */ protected $version; /** * @var Marshaler */ protected $marshaler; /** * @param DynamoDbClient $client * @param string $table * @param int $level * @param bool $bubble */ public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true) { if (defined('Aws\Sdk::VERSION') && version_compare(Sdk::VERSION, '3.0', '>=')) { $this->version = 3; $this->marshaler = new Marshaler; } else { $this->version = 2; } $this->client = $client; $this->table = $table; parent::__construct($level, $bubble); } /** * {@inheritdoc} */ protected function write(array $record) { $filtered = $this->filterEmptyFields($record['formatted']); if ($this->version === 3) { $formatted = $this->marshaler->marshalItem($filtered); } else { $formatted = $this->client->formatAttributes($filtered); } $this->client->putItem(array( 'TableName' => $this->table, 'Item' => $formatted, )); } /** * @param array $record * @return array */ protected function filterEmptyFields(array $record) { return array_filter($record, function ($value) { return !empty($value) || false === $value || 0 === $value; }); } /** * {@inheritdoc} */ protected function getDefaultFormatter() { return new ScalarFormatter(self::DATE_FORMAT); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; use Monolog\Formatter\LineFormatter; /** * NativeMailerHandler uses the mail() function to send the emails * * @author Christophe Coevoet <stof@notk.org> * @author Mark Garrett <mark@moderndeveloperllc.com> */ class NativeMailerHandler extends MailHandler { /** * The email addresses to which the message will be sent * @var array */ protected $to; /** * The subject of the email * @var string */ protected $subject; /** * Optional headers for the message * @var array */ protected $headers = array(); /** * Optional parameters for the message * @var array */ protected $parameters = array(); /** * The wordwrap length for the message * @var int */ protected $maxColumnWidth; /** * The Content-type for the message * @var string */ protected $contentType = 'text/plain'; /** * The encoding for the message * @var string */ protected $encoding = 'utf-8'; /** * @param string|array $to The receiver of the mail * @param string $subject The subject of the mail * @param string $from The sender of the mail * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param int $maxColumnWidth The maximum column width that the message lines will have */ public function __construct($to, $subject, $from, $level = Logger::ERROR, $bubble = true, $maxColumnWidth = 70) { parent::__construct($level, $bubble); $this->to = is_array($to) ? $to : array($to); $this->subject = $subject; $this->addHeader(sprintf('From: %s', $from)); $this->maxColumnWidth = $maxColumnWidth; } /** * Add headers to the message * * @param string|array $headers Custom added headers * @return self */ public function addHeader($headers) { foreach ((array) $headers as $header) { if (strpos($header, "\n") !== false || strpos($header, "\r") !== false) { throw new \InvalidArgumentException('Headers can not contain newline characters for security reasons'); } $this->headers[] = $header; } return $this; } /** * Add parameters to the message * * @param string|array $parameters Custom added parameters * @return self */ public function addParameter($parameters) { $this->parameters = array_merge($this->parameters, (array) $parameters); return $this; } /** * {@inheritdoc} */ protected function send($content, array $records) { $content = wordwrap($content, $this->maxColumnWidth); $headers = ltrim(implode("\r\n", $this->headers) . "\r\n", "\r\n"); $headers .= 'Content-type: ' . $this->getContentType() . '; charset=' . $this->getEncoding() . "\r\n"; if ($this->getContentType() == 'text/html' && false === strpos($headers, 'MIME-Version:')) { $headers .= 'MIME-Version: 1.0' . "\r\n"; } $subject = $this->subject; if ($records) { $subjectFormatter = new LineFormatter($this->subject); $subject = $subjectFormatter->format($this->getHighestRecord($records)); } $parameters = implode(' ', $this->parameters); foreach ($this->to as $to) { mail($to, $subject, $content, $headers, $parameters); } } /** * @return string $contentType */ public function getContentType() { return $this->contentType; } /** * @return string $encoding */ public function getEncoding() { return $this->encoding; } /** * @param string $contentType The content type of the email - Defaults to text/plain. Use text/html for HTML * messages. * @return self */ public function setContentType($contentType) { if (strpos($contentType, "\n") !== false || strpos($contentType, "\r") !== false) { throw new \InvalidArgumentException('The content type can not contain newline characters to prevent email header injection'); } $this->contentType = $contentType; return $this; } /** * @param string $encoding * @return self */ public function setEncoding($encoding) { if (strpos($encoding, "\n") !== false || strpos($encoding, "\r") !== false) { throw new \InvalidArgumentException('The encoding can not contain newline characters to prevent email header injection'); } $this->encoding = $encoding; return $this; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * Stores logs to files that are rotated every day and a limited number of files are kept. * * This rotation is only intended to be used as a workaround. Using logrotate to * handle the rotation is strongly encouraged when you can use it. * * @author Christophe Coevoet <stof@notk.org> * @author Jordi Boggiano <j.boggiano@seld.be> */ class RotatingFileHandler extends StreamHandler { const FILE_PER_DAY = 'Y-m-d'; const FILE_PER_MONTH = 'Y-m'; const FILE_PER_YEAR = 'Y'; protected $filename; protected $maxFiles; protected $mustRotate; protected $nextRotation; protected $filenameFormat; protected $dateFormat; /** * @param string $filename * @param int $maxFiles The maximal amount of files to keep (0 means unlimited) * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) * @param bool $useLocking Try to lock log file before doing any writes */ public function __construct($filename, $maxFiles = 0, $level = Logger::DEBUG, $bubble = true, $filePermission = null, $useLocking = false) { $this->filename = $filename; $this->maxFiles = (int) $maxFiles; $this->nextRotation = new \DateTime('tomorrow'); $this->filenameFormat = '{filename}-{date}'; $this->dateFormat = 'Y-m-d'; parent::__construct($this->getTimedFilename(), $level, $bubble, $filePermission, $useLocking); } /** * {@inheritdoc} */ public function close() { parent::close(); if (true === $this->mustRotate) { $this->rotate(); } } /** * {@inheritdoc} */ public function reset() { parent::reset(); if (true === $this->mustRotate) { $this->rotate(); } } public function setFilenameFormat($filenameFormat, $dateFormat) { if (!preg_match('{^Y(([/_.-]?m)([/_.-]?d)?)?$}', $dateFormat)) { trigger_error( 'Invalid date format - format must be one of '. 'RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), RotatingFileHandler::FILE_PER_MONTH ("Y-m") '. 'or RotatingFileHandler::FILE_PER_YEAR ("Y"), or you can set one of the '. 'date formats using slashes, underscores and/or dots instead of dashes.', E_USER_DEPRECATED ); } if (substr_count($filenameFormat, '{date}') === 0) { trigger_error( 'Invalid filename format - format should contain at least `{date}`, because otherwise rotating is impossible.', E_USER_DEPRECATED ); } $this->filenameFormat = $filenameFormat; $this->dateFormat = $dateFormat; $this->url = $this->getTimedFilename(); $this->close(); } /** * {@inheritdoc} */ protected function write(array $record) { // on the first record written, if the log is new, we should rotate (once per day) if (null === $this->mustRotate) { $this->mustRotate = !file_exists($this->url); } if ($this->nextRotation < $record['datetime']) { $this->mustRotate = true; $this->close(); } parent::write($record); } /** * Rotates the files. */ protected function rotate() { // update filename $this->url = $this->getTimedFilename(); $this->nextRotation = new \DateTime('tomorrow'); // skip GC of old logs if files are unlimited if (0 === $this->maxFiles) { return; } $logFiles = glob($this->getGlobPattern()); if ($this->maxFiles >= count($logFiles)) { // no files to remove return; } // Sorting the files by name to remove the older ones usort($logFiles, function ($a, $b) { return strcmp($b, $a); }); foreach (array_slice($logFiles, $this->maxFiles) as $file) { if (is_writable($file)) { // suppress errors here as unlink() might fail if two processes // are cleaning up/rotating at the same time set_error_handler(function ($errno, $errstr, $errfile, $errline) {}); unlink($file); restore_error_handler(); } } $this->mustRotate = false; } protected function getTimedFilename() { $fileInfo = pathinfo($this->filename); $timedFilename = str_replace( array('{filename}', '{date}'), array($fileInfo['filename'], date($this->dateFormat)), $fileInfo['dirname'] . '/' . $this->filenameFormat ); if (!empty($fileInfo['extension'])) { $timedFilename .= '.'.$fileInfo['extension']; } return $timedFilename; } protected function getGlobPattern() { $fileInfo = pathinfo($this->filename); $glob = str_replace( array('{filename}', '{date}'), array($fileInfo['filename'], '[0-9][0-9][0-9][0-9]*'), $fileInfo['dirname'] . '/' . $this->filenameFormat ); if (!empty($fileInfo['extension'])) { $glob .= '.'.$fileInfo['extension']; } return $glob; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler\SyslogUdp; class UdpSocket { const DATAGRAM_MAX_LENGTH = 65023; protected $ip; protected $port; protected $socket; public function __construct($ip, $port = 514) { $this->ip = $ip; $this->port = $port; $this->socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); } public function write($line, $header = "") { $this->send($this->assembleMessage($line, $header)); } public function close() { if (is_resource($this->socket)) { socket_close($this->socket); $this->socket = null; } } protected function send($chunk) { if (!is_resource($this->socket)) { throw new \LogicException('The UdpSocket to '.$this->ip.':'.$this->port.' has been closed and can not be written to anymore'); } socket_sendto($this->socket, $chunk, strlen($chunk), $flags = 0, $this->ip, $this->port); } protected function assembleMessage($line, $header) { $chunkSize = self::DATAGRAM_MAX_LENGTH - strlen($header); return $header . substr($line, 0, $chunkSize); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; use Monolog\Formatter\NormalizerFormatter; /** * Class to record a log on a NewRelic application. * Enabling New Relic High Security mode may prevent capture of useful information. * * This handler requires a NormalizerFormatter to function and expects an array in $record['formatted'] * * @see https://docs.newrelic.com/docs/agents/php-agent * @see https://docs.newrelic.com/docs/accounts-partnerships/accounts/security/high-security */ class NewRelicHandler extends AbstractProcessingHandler { /** * Name of the New Relic application that will receive logs from this handler. * * @var string */ protected $appName; /** * Name of the current transaction * * @var string */ protected $transactionName; /** * Some context and extra data is passed into the handler as arrays of values. Do we send them as is * (useful if we are using the API), or explode them for display on the NewRelic RPM website? * * @var bool */ protected $explodeArrays; /** * {@inheritDoc} * * @param string $appName * @param bool $explodeArrays * @param string $transactionName */ public function __construct( $level = Logger::ERROR, $bubble = true, $appName = null, $explodeArrays = false, $transactionName = null ) { parent::__construct($level, $bubble); $this->appName = $appName; $this->explodeArrays = $explodeArrays; $this->transactionName = $transactionName; } /** * {@inheritDoc} */ protected function write(array $record) { if (!$this->isNewRelicEnabled()) { throw new MissingExtensionException('The newrelic PHP extension is required to use the NewRelicHandler'); } if ($appName = $this->getAppName($record['context'])) { $this->setNewRelicAppName($appName); } if ($transactionName = $this->getTransactionName($record['context'])) { $this->setNewRelicTransactionName($transactionName); unset($record['formatted']['context']['transaction_name']); } if (isset($record['context']['exception']) && ($record['context']['exception'] instanceof \Exception || (PHP_VERSION_ID >= 70000 && $record['context']['exception'] instanceof \Throwable))) { newrelic_notice_error($record['message'], $record['context']['exception']); unset($record['formatted']['context']['exception']); } else { newrelic_notice_error($record['message']); } if (isset($record['formatted']['context']) && is_array($record['formatted']['context'])) { foreach ($record['formatted']['context'] as $key => $parameter) { if (is_array($parameter) && $this->explodeArrays) { foreach ($parameter as $paramKey => $paramValue) { $this->setNewRelicParameter('context_' . $key . '_' . $paramKey, $paramValue); } } else { $this->setNewRelicParameter('context_' . $key, $parameter); } } } if (isset($record['formatted']['extra']) && is_array($record['formatted']['extra'])) { foreach ($record['formatted']['extra'] as $key => $parameter) { if (is_array($parameter) && $this->explodeArrays) { foreach ($parameter as $paramKey => $paramValue) { $this->setNewRelicParameter('extra_' . $key . '_' . $paramKey, $paramValue); } } else { $this->setNewRelicParameter('extra_' . $key, $parameter); } } } } /** * Checks whether the NewRelic extension is enabled in the system. * * @return bool */ protected function isNewRelicEnabled() { return extension_loaded('newrelic'); } /** * Returns the appname where this log should be sent. Each log can override the default appname, set in this * handler's constructor, by providing the appname in it's context. * * @param array $context * @return null|string */ protected function getAppName(array $context) { if (isset($context['appname'])) { return $context['appname']; } return $this->appName; } /** * Returns the name of the current transaction. Each log can override the default transaction name, set in this * handler's constructor, by providing the transaction_name in it's context * * @param array $context * * @return null|string */ protected function getTransactionName(array $context) { if (isset($context['transaction_name'])) { return $context['transaction_name']; } return $this->transactionName; } /** * Sets the NewRelic application that should receive this log. * * @param string $appName */ protected function setNewRelicAppName($appName) { newrelic_set_appname($appName); } /** * Overwrites the name of the current transaction * * @param string $transactionName */ protected function setNewRelicTransactionName($transactionName) { newrelic_name_transaction($transactionName); } /** * @param string $key * @param mixed $value */ protected function setNewRelicParameter($key, $value) { if (null === $value || is_scalar($value)) { newrelic_add_custom_parameter($key, $value); } else { newrelic_add_custom_parameter($key, @json_encode($value)); } } /** * {@inheritDoc} */ protected function getDefaultFormatter() { return new NormalizerFormatter(); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\ResettableInterface; /** * Base Handler class providing the Handler structure * * Classes extending it should (in most cases) only implement write($record) * * @author Jordi Boggiano <j.boggiano@seld.be> * @author Christophe Coevoet <stof@notk.org> */ abstract class AbstractProcessingHandler extends AbstractHandler { /** * {@inheritdoc} */ public function handle(array $record) { if (!$this->isHandling($record)) { return false; } $record = $this->processRecord($record); $record['formatted'] = $this->getFormatter()->format($record); $this->write($record); return false === $this->bubble; } /** * Writes the record down to the log of the implementing handler * * @param array $record * @return void */ abstract protected function write(array $record); /** * Processes a record. * * @param array $record * @return array */ protected function processRecord(array $record) { if ($this->processors) { foreach ($this->processors as $processor) { $record = call_user_func($processor, $record); } } return $record; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler\FingersCrossed; /** * Interface for activation strategies for the FingersCrossedHandler. * * @author Johannes M. Schmitt <schmittjoh@gmail.com> */ interface ActivationStrategyInterface { /** * Returns whether the given record activates the handler. * * @param array $record * @return bool */ public function isHandlerActivated(array $record); } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler\FingersCrossed; use Monolog\Logger; /** * Error level based activation strategy. * * @author Johannes M. Schmitt <schmittjoh@gmail.com> */ class ErrorLevelActivationStrategy implements ActivationStrategyInterface { private $actionLevel; public function __construct($actionLevel) { $this->actionLevel = Logger::toMonologLevel($actionLevel); } public function isHandlerActivated(array $record) { return $record['level'] >= $this->actionLevel; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler\FingersCrossed; use Monolog\Logger; /** * Channel and Error level based monolog activation strategy. Allows to trigger activation * based on level per channel. e.g. trigger activation on level 'ERROR' by default, except * for records of the 'sql' channel; those should trigger activation on level 'WARN'. * * Example: * * <code> * $activationStrategy = new ChannelLevelActivationStrategy( * Logger::CRITICAL, * array( * 'request' => Logger::ALERT, * 'sensitive' => Logger::ERROR, * ) * ); * $handler = new FingersCrossedHandler(new StreamHandler('php://stderr'), $activationStrategy); * </code> * * @author Mike Meessen <netmikey@gmail.com> */ class ChannelLevelActivationStrategy implements ActivationStrategyInterface { private $defaultActionLevel; private $channelToActionLevel; /** * @param int $defaultActionLevel The default action level to be used if the record's category doesn't match any * @param array $channelToActionLevel An array that maps channel names to action levels. */ public function __construct($defaultActionLevel, $channelToActionLevel = array()) { $this->defaultActionLevel = Logger::toMonologLevel($defaultActionLevel); $this->channelToActionLevel = array_map('Monolog\Logger::toMonologLevel', $channelToActionLevel); } public function isHandlerActivated(array $record) { if (isset($this->channelToActionLevel[$record['channel']])) { return $record['level'] >= $this->channelToActionLevel[$record['channel']]; } return $record['level'] >= $this->defaultActionLevel; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * Logs to syslog service. * * usage example: * * $log = new Logger('application'); * $syslog = new SyslogHandler('myfacility', 'local6'); * $formatter = new LineFormatter("%channel%.%level_name%: %message% %extra%"); * $syslog->setFormatter($formatter); * $log->pushHandler($syslog); * * @author Sven Paulus <sven@karlsruhe.org> */ class SyslogHandler extends AbstractSyslogHandler { protected $ident; protected $logopts; /** * @param string $ident * @param mixed $facility * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param int $logopts Option flags for the openlog() call, defaults to LOG_PID */ public function __construct($ident, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $logopts = LOG_PID) { parent::__construct($facility, $level, $bubble); $this->ident = $ident; $this->logopts = $logopts; } /** * {@inheritdoc} */ public function close() { closelog(); } /** * {@inheritdoc} */ protected function write(array $record) { if (!openlog($this->ident, $this->logopts, $this->facility)) { throw new \LogicException('Can\'t open syslog for ident "'.$this->ident.'" and facility "'.$this->facility.'"'); } syslog($this->logLevels[$record['level']], (string) $record['formatted']); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler\Slack; use Monolog\Logger; use Monolog\Formatter\NormalizerFormatter; use Monolog\Formatter\FormatterInterface; /** * Slack record utility helping to log to Slack webhooks or API. * * @author Greg Kedzierski <greg@gregkedzierski.com> * @author Haralan Dobrev <hkdobrev@gmail.com> * @see https://api.slack.com/incoming-webhooks * @see https://api.slack.com/docs/message-attachments */ class SlackRecord { const COLOR_DANGER = 'danger'; const COLOR_WARNING = 'warning'; const COLOR_GOOD = 'good'; const COLOR_DEFAULT = '#e3e4e6'; /** * Slack channel (encoded ID or name) * @var string|null */ private $channel; /** * Name of a bot * @var string|null */ private $username; /** * User icon e.g. 'ghost', 'http://example.com/user.png' * @var string */ private $userIcon; /** * Whether the message should be added to Slack as attachment (plain text otherwise) * @var bool */ private $useAttachment; /** * Whether the the context/extra messages added to Slack as attachments are in a short style * @var bool */ private $useShortAttachment; /** * Whether the attachment should include context and extra data * @var bool */ private $includeContextAndExtra; /** * Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] * @var array */ private $excludeFields; /** * @var FormatterInterface */ private $formatter; /** * @var NormalizerFormatter */ private $normalizerFormatter; public function __construct($channel = null, $username = null, $useAttachment = true, $userIcon = null, $useShortAttachment = false, $includeContextAndExtra = false, array $excludeFields = array(), FormatterInterface $formatter = null) { $this->channel = $channel; $this->username = $username; $this->userIcon = trim($userIcon, ':'); $this->useAttachment = $useAttachment; $this->useShortAttachment = $useShortAttachment; $this->includeContextAndExtra = $includeContextAndExtra; $this->excludeFields = $excludeFields; $this->formatter = $formatter; if ($this->includeContextAndExtra) { $this->normalizerFormatter = new NormalizerFormatter(); } } public function getSlackData(array $record) { $dataArray = array(); $record = $this->excludeFields($record); if ($this->username) { $dataArray['username'] = $this->username; } if ($this->channel) { $dataArray['channel'] = $this->channel; } if ($this->formatter && !$this->useAttachment) { $message = $this->formatter->format($record); } else { $message = $record['message']; } if ($this->useAttachment) { $attachment = array( 'fallback' => $message, 'text' => $message, 'color' => $this->getAttachmentColor($record['level']), 'fields' => array(), 'mrkdwn_in' => array('fields'), 'ts' => $record['datetime']->getTimestamp() ); if ($this->useShortAttachment) { $attachment['title'] = $record['level_name']; } else { $attachment['title'] = 'Message'; $attachment['fields'][] = $this->generateAttachmentField('Level', $record['level_name']); } if ($this->includeContextAndExtra) { foreach (array('extra', 'context') as $key) { if (empty($record[$key])) { continue; } if ($this->useShortAttachment) { $attachment['fields'][] = $this->generateAttachmentField( $key, $record[$key] ); } else { // Add all extra fields as individual fields in attachment $attachment['fields'] = array_merge( $attachment['fields'], $this->generateAttachmentFields($record[$key]) ); } } } $dataArray['attachments'] = array($attachment); } else { $dataArray['text'] = $message; } if ($this->userIcon) { if (filter_var($this->userIcon, FILTER_VALIDATE_URL)) { $dataArray['icon_url'] = $this->userIcon; } else { $dataArray['icon_emoji'] = ":{$this->userIcon}:"; } } return $dataArray; } /** * Returned a Slack message attachment color associated with * provided level. * * @param int $level * @return string */ public function getAttachmentColor($level) { switch (true) { case $level >= Logger::ERROR: return self::COLOR_DANGER; case $level >= Logger::WARNING: return self::COLOR_WARNING; case $level >= Logger::INFO: return self::COLOR_GOOD; default: return self::COLOR_DEFAULT; } } /** * Stringifies an array of key/value pairs to be used in attachment fields * * @param array $fields * * @return string */ public function stringify($fields) { $normalized = $this->normalizerFormatter->format($fields); $prettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128; $hasSecondDimension = count(array_filter($normalized, 'is_array')); $hasNonNumericKeys = !count(array_filter(array_keys($normalized), 'is_numeric')); return $hasSecondDimension || $hasNonNumericKeys ? json_encode($normalized, $prettyPrintFlag) : json_encode($normalized); } /** * Sets the formatter * * @param FormatterInterface $formatter */ public function setFormatter(FormatterInterface $formatter) { $this->formatter = $formatter; } /** * Generates attachment field * * @param string $title * @param string|array $value * * @return array */ private function generateAttachmentField($title, $value) { $value = is_array($value) ? sprintf('```%s```', $this->stringify($value)) : $value; return array( 'title' => ucfirst($title), 'value' => $value, 'short' => false ); } /** * Generates a collection of attachment fields from array * * @param array $data * * @return array */ private function generateAttachmentFields(array $data) { $fields = array(); foreach ($this->normalizerFormatter->format($data) as $key => $value) { $fields[] = $this->generateAttachmentField($key, $value); } return $fields; } /** * Get a copy of record with fields excluded according to $this->excludeFields * * @param array $record * * @return array */ private function excludeFields(array $record) { foreach ($this->excludeFields as $field) { $keys = explode('.', $field); $node = &$record; $lastKey = end($keys); foreach ($keys as $key) { if (!isset($node[$key])) { break; } if ($lastKey === $key) { unset($node[$key]); break; } $node = &$node[$key]; } } return $record; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\LineFormatter; use Monolog\Formatter\FormatterInterface; use Monolog\Logger; use Raven_Client; /** * Handler to send messages to a Sentry (https://github.com/getsentry/sentry) server * using sentry-php (https://github.com/getsentry/sentry-php) * * @author Marc Abramowitz <marc@marc-abramowitz.com> */ class RavenHandler extends AbstractProcessingHandler { /** * Translates Monolog log levels to Raven log levels. */ protected $logLevels = array( Logger::DEBUG => Raven_Client::DEBUG, Logger::INFO => Raven_Client::INFO, Logger::NOTICE => Raven_Client::INFO, Logger::WARNING => Raven_Client::WARNING, Logger::ERROR => Raven_Client::ERROR, Logger::CRITICAL => Raven_Client::FATAL, Logger::ALERT => Raven_Client::FATAL, Logger::EMERGENCY => Raven_Client::FATAL, ); /** * @var string should represent the current version of the calling * software. Can be any string (git commit, version number) */ protected $release; /** * @var Raven_Client the client object that sends the message to the server */ protected $ravenClient; /** * @var LineFormatter The formatter to use for the logs generated via handleBatch() */ protected $batchFormatter; /** * @param Raven_Client $ravenClient * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(Raven_Client $ravenClient, $level = Logger::DEBUG, $bubble = true) { parent::__construct($level, $bubble); $this->ravenClient = $ravenClient; } /** * {@inheritdoc} */ public function handleBatch(array $records) { $level = $this->level; // filter records based on their level $records = array_filter($records, function ($record) use ($level) { return $record['level'] >= $level; }); if (!$records) { return; } // the record with the highest severity is the "main" one $record = array_reduce($records, function ($highest, $record) { if ($record['level'] > $highest['level']) { return $record; } return $highest; }); // the other ones are added as a context item $logs = array(); foreach ($records as $r) { $logs[] = $this->processRecord($r); } if ($logs) { $record['context']['logs'] = (string) $this->getBatchFormatter()->formatBatch($logs); } $this->handle($record); } /** * Sets the formatter for the logs generated by handleBatch(). * * @param FormatterInterface $formatter */ public function setBatchFormatter(FormatterInterface $formatter) { $this->batchFormatter = $formatter; } /** * Gets the formatter for the logs generated by handleBatch(). * * @return FormatterInterface */ public function getBatchFormatter() { if (!$this->batchFormatter) { $this->batchFormatter = $this->getDefaultBatchFormatter(); } return $this->batchFormatter; } /** * {@inheritdoc} */ protected function write(array $record) { $previousUserContext = false; $options = array(); $options['level'] = $this->logLevels[$record['level']]; $options['tags'] = array(); if (!empty($record['extra']['tags'])) { $options['tags'] = array_merge($options['tags'], $record['extra']['tags']); unset($record['extra']['tags']); } if (!empty($record['context']['tags'])) { $options['tags'] = array_merge($options['tags'], $record['context']['tags']); unset($record['context']['tags']); } if (!empty($record['context']['fingerprint'])) { $options['fingerprint'] = $record['context']['fingerprint']; unset($record['context']['fingerprint']); } if (!empty($record['context']['logger'])) { $options['logger'] = $record['context']['logger']; unset($record['context']['logger']); } else { $options['logger'] = $record['channel']; } foreach ($this->getExtraParameters() as $key) { foreach (array('extra', 'context') as $source) { if (!empty($record[$source][$key])) { $options[$key] = $record[$source][$key]; unset($record[$source][$key]); } } } if (!empty($record['context'])) { $options['extra']['context'] = $record['context']; if (!empty($record['context']['user'])) { $previousUserContext = $this->ravenClient->context->user; $this->ravenClient->user_context($record['context']['user']); unset($options['extra']['context']['user']); } } if (!empty($record['extra'])) { $options['extra']['extra'] = $record['extra']; } if (!empty($this->release) && !isset($options['release'])) { $options['release'] = $this->release; } if (isset($record['context']['exception']) && ($record['context']['exception'] instanceof \Exception || (PHP_VERSION_ID >= 70000 && $record['context']['exception'] instanceof \Throwable))) { $options['message'] = $record['formatted']; $this->ravenClient->captureException($record['context']['exception'], $options); } else { $this->ravenClient->captureMessage($record['formatted'], array(), $options); } if ($previousUserContext !== false) { $this->ravenClient->user_context($previousUserContext); } } /** * {@inheritDoc} */ protected function getDefaultFormatter() { return new LineFormatter('[%channel%] %message%'); } /** * Gets the default formatter for the logs generated by handleBatch(). * * @return FormatterInterface */ protected function getDefaultBatchFormatter() { return new LineFormatter(); } /** * Gets extra parameters supported by Raven that can be found in "extra" and "context" * * @return array */ protected function getExtraParameters() { return array('contexts', 'checksum', 'release', 'event_id'); } /** * @param string $value * @return self */ public function setRelease($value) { $this->release = $value; return $this; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\ChromePHPFormatter; use Monolog\Logger; /** * Handler sending logs to the ChromePHP extension (http://www.chromephp.com/) * * This also works out of the box with Firefox 43+ * * @author Christophe Coevoet <stof@notk.org> */ class ChromePHPHandler extends AbstractProcessingHandler { /** * Version of the extension */ const VERSION = '4.0'; /** * Header name */ const HEADER_NAME = 'X-ChromeLogger-Data'; /** * Regular expression to detect supported browsers (matches any Chrome, or Firefox 43+) */ const USER_AGENT_REGEX = '{\b(?:Chrome/\d+(?:\.\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}'; protected static $initialized = false; /** * Tracks whether we sent too much data * * Chrome limits the headers to 256KB, so when we sent 240KB we stop sending * * @var bool */ protected static $overflowed = false; protected static $json = array( 'version' => self::VERSION, 'columns' => array('label', 'log', 'backtrace', 'type'), 'rows' => array(), ); protected static $sendHeaders = true; /** * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($level = Logger::DEBUG, $bubble = true) { parent::__construct($level, $bubble); if (!function_exists('json_encode')) { throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s ChromePHPHandler'); } } /** * {@inheritdoc} */ public function handleBatch(array $records) { $messages = array(); foreach ($records as $record) { if ($record['level'] < $this->level) { continue; } $messages[] = $this->processRecord($record); } if (!empty($messages)) { $messages = $this->getFormatter()->formatBatch($messages); self::$json['rows'] = array_merge(self::$json['rows'], $messages); $this->send(); } } /** * {@inheritDoc} */ protected function getDefaultFormatter() { return new ChromePHPFormatter(); } /** * Creates & sends header for a record * * @see sendHeader() * @see send() * @param array $record */ protected function write(array $record) { self::$json['rows'][] = $record['formatted']; $this->send(); } /** * Sends the log header * * @see sendHeader() */ protected function send() { if (self::$overflowed || !self::$sendHeaders) { return; } if (!self::$initialized) { self::$initialized = true; self::$sendHeaders = $this->headersAccepted(); if (!self::$sendHeaders) { return; } self::$json['request_uri'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; } $json = @json_encode(self::$json); $data = base64_encode(utf8_encode($json)); if (strlen($data) > 240 * 1024) { self::$overflowed = true; $record = array( 'message' => 'Incomplete logs, chrome header size limit reached', 'context' => array(), 'level' => Logger::WARNING, 'level_name' => Logger::getLevelName(Logger::WARNING), 'channel' => 'monolog', 'datetime' => new \DateTime(), 'extra' => array(), ); self::$json['rows'][count(self::$json['rows']) - 1] = $this->getFormatter()->format($record); $json = @json_encode(self::$json); $data = base64_encode(utf8_encode($json)); } if (trim($data) !== '') { $this->sendHeader(self::HEADER_NAME, $data); } } /** * Send header string to the client * * @param string $header * @param string $content */ protected function sendHeader($header, $content) { if (!headers_sent() && self::$sendHeaders) { header(sprintf('%s: %s', $header, $content)); } } /** * Verifies if the headers are accepted by the current user agent * * @return bool */ protected function headersAccepted() { if (empty($_SERVER['HTTP_USER_AGENT'])) { return false; } return preg_match(self::USER_AGENT_REGEX, $_SERVER['HTTP_USER_AGENT']); } /** * BC getter for the sendHeaders property that has been made static */ public function __get($property) { if ('sendHeaders' !== $property) { throw new \InvalidArgumentException('Undefined property '.$property); } return static::$sendHeaders; } /** * BC setter for the sendHeaders property that has been made static */ public function __set($property, $value) { if ('sendHeaders' !== $property) { throw new \InvalidArgumentException('Undefined property '.$property); } static::$sendHeaders = $value; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\WildfireFormatter; /** * Simple FirePHP Handler (http://www.firephp.org/), which uses the Wildfire protocol. * * @author Eric Clemmons (@ericclemmons) <eric@uxdriven.com> */ class FirePHPHandler extends AbstractProcessingHandler { /** * WildFire JSON header message format */ const PROTOCOL_URI = 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2'; /** * FirePHP structure for parsing messages & their presentation */ const STRUCTURE_URI = 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'; /** * Must reference a "known" plugin, otherwise headers won't display in FirePHP */ const PLUGIN_URI = 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3'; /** * Header prefix for Wildfire to recognize & parse headers */ const HEADER_PREFIX = 'X-Wf'; /** * Whether or not Wildfire vendor-specific headers have been generated & sent yet */ protected static $initialized = false; /** * Shared static message index between potentially multiple handlers * @var int */ protected static $messageIndex = 1; protected static $sendHeaders = true; /** * Base header creation function used by init headers & record headers * * @param array $meta Wildfire Plugin, Protocol & Structure Indexes * @param string $message Log message * @return array Complete header string ready for the client as key and message as value */ protected function createHeader(array $meta, $message) { $header = sprintf('%s-%s', self::HEADER_PREFIX, join('-', $meta)); return array($header => $message); } /** * Creates message header from record * * @see createHeader() * @param array $record * @return string */ protected function createRecordHeader(array $record) { // Wildfire is extensible to support multiple protocols & plugins in a single request, // but we're not taking advantage of that (yet), so we're using "1" for simplicity's sake. return $this->createHeader( array(1, 1, 1, self::$messageIndex++), $record['formatted'] ); } /** * {@inheritDoc} */ protected function getDefaultFormatter() { return new WildfireFormatter(); } /** * Wildfire initialization headers to enable message parsing * * @see createHeader() * @see sendHeader() * @return array */ protected function getInitHeaders() { // Initial payload consists of required headers for Wildfire return array_merge( $this->createHeader(array('Protocol', 1), self::PROTOCOL_URI), $this->createHeader(array(1, 'Structure', 1), self::STRUCTURE_URI), $this->createHeader(array(1, 'Plugin', 1), self::PLUGIN_URI) ); } /** * Send header string to the client * * @param string $header * @param string $content */ protected function sendHeader($header, $content) { if (!headers_sent() && self::$sendHeaders) { header(sprintf('%s: %s', $header, $content)); } } /** * Creates & sends header for a record, ensuring init headers have been sent prior * * @see sendHeader() * @see sendInitHeaders() * @param array $record */ protected function write(array $record) { if (!self::$sendHeaders) { return; } // WildFire-specific headers must be sent prior to any messages if (!self::$initialized) { self::$initialized = true; self::$sendHeaders = $this->headersAccepted(); if (!self::$sendHeaders) { return; } foreach ($this->getInitHeaders() as $header => $content) { $this->sendHeader($header, $content); } } $header = $this->createRecordHeader($record); if (trim(current($header)) !== '') { $this->sendHeader(key($header), current($header)); } } /** * Verifies if the headers are accepted by the current user agent * * @return bool */ protected function headersAccepted() { if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('{\bFirePHP/\d+\.\d+\b}', $_SERVER['HTTP_USER_AGENT'])) { return true; } return isset($_SERVER['HTTP_X_FIREPHP_VERSION']); } /** * BC getter for the sendHeaders property that has been made static */ public function __get($property) { if ('sendHeaders' !== $property) { throw new \InvalidArgumentException('Undefined property '.$property); } return static::$sendHeaders; } /** * BC setter for the sendHeaders property that has been made static */ public function __set($property, $value) { if ('sendHeaders' !== $property) { throw new \InvalidArgumentException('Undefined property '.$property); } static::$sendHeaders = $value; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; /** * Forwards records to multiple handlers suppressing failures of each handler * and continuing through to give every handler a chance to succeed. * * @author Craig D'Amelio <craig@damelio.ca> */ class WhatFailureGroupHandler extends GroupHandler { /** * {@inheritdoc} */ public function handle(array $record) { if ($this->processors) { foreach ($this->processors as $processor) { $record = call_user_func($processor, $record); } } foreach ($this->handlers as $handler) { try { $handler->handle($record); } catch (\Exception $e) { // What failure? } catch (\Throwable $e) { // What failure? } } return false === $this->bubble; } /** * {@inheritdoc} */ public function handleBatch(array $records) { if ($this->processors) { $processed = array(); foreach ($records as $record) { foreach ($this->processors as $processor) { $processed[] = call_user_func($processor, $record); } } $records = $processed; } foreach ($this->handlers as $handler) { try { $handler->handleBatch($records); } catch (\Exception $e) { // What failure? } catch (\Throwable $e) { // What failure? } } } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * Sends notifications through Slack's Slackbot * * @author Haralan Dobrev <hkdobrev@gmail.com> * @see https://slack.com/apps/A0F81R8ET-slackbot * @deprecated According to Slack the API used on this handler it is deprecated. * Therefore this handler will be removed on 2.x * Slack suggests to use webhooks instead. Please contact slack for more information. */ class SlackbotHandler extends AbstractProcessingHandler { /** * The slug of the Slack team * @var string */ private $slackTeam; /** * Slackbot token * @var string */ private $token; /** * Slack channel name * @var string */ private $channel; /** * @param string $slackTeam Slack team slug * @param string $token Slackbot token * @param string $channel Slack channel (encoded ID or name) * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($slackTeam, $token, $channel, $level = Logger::CRITICAL, $bubble = true) { @trigger_error('SlackbotHandler is deprecated and will be removed on 2.x', E_USER_DEPRECATED); parent::__construct($level, $bubble); $this->slackTeam = $slackTeam; $this->token = $token; $this->channel = $channel; } /** * {@inheritdoc} * * @param array $record */ protected function write(array $record) { $slackbotUrl = sprintf( 'https://%s.slack.com/services/hooks/slackbot?token=%s&channel=%s', $this->slackTeam, $this->token, $this->channel ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $slackbotUrl); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $record['message']); Curl\Util::execute($ch); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * Logs to Cube. * * @link http://square.github.com/cube/ * @author Wan Chen <kami@kamisama.me> */ class CubeHandler extends AbstractProcessingHandler { private $udpConnection; private $httpConnection; private $scheme; private $host; private $port; private $acceptedSchemes = array('http', 'udp'); /** * Create a Cube handler * * @throws \UnexpectedValueException when given url is not a valid url. * A valid url must consist of three parts : protocol://host:port * Only valid protocols used by Cube are http and udp */ public function __construct($url, $level = Logger::DEBUG, $bubble = true) { $urlInfo = parse_url($url); if (!isset($urlInfo['scheme'], $urlInfo['host'], $urlInfo['port'])) { throw new \UnexpectedValueException('URL "'.$url.'" is not valid'); } if (!in_array($urlInfo['scheme'], $this->acceptedSchemes)) { throw new \UnexpectedValueException( 'Invalid protocol (' . $urlInfo['scheme'] . ').' . ' Valid options are ' . implode(', ', $this->acceptedSchemes)); } $this->scheme = $urlInfo['scheme']; $this->host = $urlInfo['host']; $this->port = $urlInfo['port']; parent::__construct($level, $bubble); } /** * Establish a connection to an UDP socket * * @throws \LogicException when unable to connect to the socket * @throws MissingExtensionException when there is no socket extension */ protected function connectUdp() { if (!extension_loaded('sockets')) { throw new MissingExtensionException('The sockets extension is required to use udp URLs with the CubeHandler'); } $this->udpConnection = socket_create(AF_INET, SOCK_DGRAM, 0); if (!$this->udpConnection) { throw new \LogicException('Unable to create a socket'); } if (!socket_connect($this->udpConnection, $this->host, $this->port)) { throw new \LogicException('Unable to connect to the socket at ' . $this->host . ':' . $this->port); } } /** * Establish a connection to a http server * @throws \LogicException when no curl extension */ protected function connectHttp() { if (!extension_loaded('curl')) { throw new \LogicException('The curl extension is needed to use http URLs with the CubeHandler'); } $this->httpConnection = curl_init('http://'.$this->host.':'.$this->port.'/1.0/event/put'); if (!$this->httpConnection) { throw new \LogicException('Unable to connect to ' . $this->host . ':' . $this->port); } curl_setopt($this->httpConnection, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($this->httpConnection, CURLOPT_RETURNTRANSFER, true); } /** * {@inheritdoc} */ protected function write(array $record) { $date = $record['datetime']; $data = array('time' => $date->format('Y-m-d\TH:i:s.uO')); unset($record['datetime']); if (isset($record['context']['type'])) { $data['type'] = $record['context']['type']; unset($record['context']['type']); } else { $data['type'] = $record['channel']; } $data['data'] = $record['context']; $data['data']['level'] = $record['level']; if ($this->scheme === 'http') { $this->writeHttp(json_encode($data)); } else { $this->writeUdp(json_encode($data)); } } private function writeUdp($data) { if (!$this->udpConnection) { $this->connectUdp(); } socket_send($this->udpConnection, $data, strlen($data), 0); } private function writeHttp($data) { if (!$this->httpConnection) { $this->connectHttp(); } curl_setopt($this->httpConnection, CURLOPT_POSTFIELDS, '['.$data.']'); curl_setopt($this->httpConnection, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen('['.$data.']'), )); Curl\Util::execute($this->httpConnection, 5, false); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * Stores to any socket - uses fsockopen() or pfsockopen(). * * @author Pablo de Leon Belloc <pablolb@gmail.com> * @see http://php.net/manual/en/function.fsockopen.php */ class SocketHandler extends AbstractProcessingHandler { private $connectionString; private $connectionTimeout; private $resource; private $timeout = 0; private $writingTimeout = 10; private $lastSentBytes = null; private $chunkSize = null; private $persistent = false; private $errno; private $errstr; private $lastWritingAt; /** * @param string $connectionString Socket connection string * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($connectionString, $level = Logger::DEBUG, $bubble = true) { parent::__construct($level, $bubble); $this->connectionString = $connectionString; $this->connectionTimeout = (float) ini_get('default_socket_timeout'); } /** * Connect (if necessary) and write to the socket * * @param array $record * * @throws \UnexpectedValueException * @throws \RuntimeException */ protected function write(array $record) { $this->connectIfNotConnected(); $data = $this->generateDataStream($record); $this->writeToSocket($data); } /** * We will not close a PersistentSocket instance so it can be reused in other requests. */ public function close() { if (!$this->isPersistent()) { $this->closeSocket(); } } /** * Close socket, if open */ public function closeSocket() { if (is_resource($this->resource)) { fclose($this->resource); $this->resource = null; } } /** * Set socket connection to nbe persistent. It only has effect before the connection is initiated. * * @param bool $persistent */ public function setPersistent($persistent) { $this->persistent = (bool) $persistent; } /** * Set connection timeout. Only has effect before we connect. * * @param float $seconds * * @see http://php.net/manual/en/function.fsockopen.php */ public function setConnectionTimeout($seconds) { $this->validateTimeout($seconds); $this->connectionTimeout = (float) $seconds; } /** * Set write timeout. Only has effect before we connect. * * @param float $seconds * * @see http://php.net/manual/en/function.stream-set-timeout.php */ public function setTimeout($seconds) { $this->validateTimeout($seconds); $this->timeout = (float) $seconds; } /** * Set writing timeout. Only has effect during connection in the writing cycle. * * @param float $seconds 0 for no timeout */ public function setWritingTimeout($seconds) { $this->validateTimeout($seconds); $this->writingTimeout = (float) $seconds; } /** * Set chunk size. Only has effect during connection in the writing cycle. * * @param float $bytes */ public function setChunkSize($bytes) { $this->chunkSize = $bytes; } /** * Get current connection string * * @return string */ public function getConnectionString() { return $this->connectionString; } /** * Get persistent setting * * @return bool */ public function isPersistent() { return $this->persistent; } /** * Get current connection timeout setting * * @return float */ public function getConnectionTimeout() { return $this->connectionTimeout; } /** * Get current in-transfer timeout * * @return float */ public function getTimeout() { return $this->timeout; } /** * Get current local writing timeout * * @return float */ public function getWritingTimeout() { return $this->writingTimeout; } /** * Get current chunk size * * @return float */ public function getChunkSize() { return $this->chunkSize; } /** * Check to see if the socket is currently available. * * UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details. * * @return bool */ public function isConnected() { return is_resource($this->resource) && !feof($this->resource); // on TCP - other party can close connection. } /** * Wrapper to allow mocking */ protected function pfsockopen() { return @pfsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->connectionTimeout); } /** * Wrapper to allow mocking */ protected function fsockopen() { return @fsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->connectionTimeout); } /** * Wrapper to allow mocking * * @see http://php.net/manual/en/function.stream-set-timeout.php */ protected function streamSetTimeout() { $seconds = floor($this->timeout); $microseconds = round(($this->timeout - $seconds) * 1e6); return stream_set_timeout($this->resource, $seconds, $microseconds); } /** * Wrapper to allow mocking * * @see http://php.net/manual/en/function.stream-set-chunk-size.php */ protected function streamSetChunkSize() { return stream_set_chunk_size($this->resource, $this->chunkSize); } /** * Wrapper to allow mocking */ protected function fwrite($data) { return @fwrite($this->resource, $data); } /** * Wrapper to allow mocking */ protected function streamGetMetadata() { return stream_get_meta_data($this->resource); } private function validateTimeout($value) { $ok = filter_var($value, FILTER_VALIDATE_FLOAT); if ($ok === false || $value < 0) { throw new \InvalidArgumentException("Timeout must be 0 or a positive float (got $value)"); } } private function connectIfNotConnected() { if ($this->isConnected()) { return; } $this->connect(); } protected function generateDataStream($record) { return (string) $record['formatted']; } /** * @return resource|null */ protected function getResource() { return $this->resource; } private function connect() { $this->createSocketResource(); $this->setSocketTimeout(); $this->setStreamChunkSize(); } private function createSocketResource() { if ($this->isPersistent()) { $resource = $this->pfsockopen(); } else { $resource = $this->fsockopen(); } if (!$resource) { throw new \UnexpectedValueException("Failed connecting to $this->connectionString ($this->errno: $this->errstr)"); } $this->resource = $resource; } private function setSocketTimeout() { if (!$this->streamSetTimeout()) { throw new \UnexpectedValueException("Failed setting timeout with stream_set_timeout()"); } } private function setStreamChunkSize() { if ($this->chunkSize && !$this->streamSetChunkSize()) { throw new \UnexpectedValueException("Failed setting chunk size with stream_set_chunk_size()"); } } private function writeToSocket($data) { $length = strlen($data); $sent = 0; $this->lastSentBytes = $sent; while ($this->isConnected() && $sent < $length) { if (0 == $sent) { $chunk = $this->fwrite($data); } else { $chunk = $this->fwrite(substr($data, $sent)); } if ($chunk === false) { throw new \RuntimeException("Could not write to socket"); } $sent += $chunk; $socketInfo = $this->streamGetMetadata(); if ($socketInfo['timed_out']) { throw new \RuntimeException("Write timed-out"); } if ($this->writingIsTimedOut($sent)) { throw new \RuntimeException("Write timed-out, no data sent for `{$this->writingTimeout}` seconds, probably we got disconnected (sent $sent of $length)"); } } if (!$this->isConnected() && $sent < $length) { throw new \RuntimeException("End-of-file reached, probably we got disconnected (sent $sent of $length)"); } } private function writingIsTimedOut($sent) { $writingTimeout = (int) floor($this->writingTimeout); if (0 === $writingTimeout) { return false; } if ($sent !== $this->lastSentBytes) { $this->lastWritingAt = time(); $this->lastSentBytes = $sent; return false; } else { usleep(100); } if ((time() - $this->lastWritingAt) >= $writingTimeout) { $this->closeSocket(); return true; } return false; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; /** * MandrillHandler uses cURL to send the emails to the Mandrill API * * @author Adam Nicholson <adamnicholson10@gmail.com> */ class MandrillHandler extends MailHandler { protected $message; protected $apiKey; /** * @param string $apiKey A valid Mandrill API key * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($apiKey, $message, $level = Logger::ERROR, $bubble = true) { parent::__construct($level, $bubble); if (!$message instanceof \Swift_Message && is_callable($message)) { $message = call_user_func($message); } if (!$message instanceof \Swift_Message) { throw new \InvalidArgumentException('You must provide either a Swift_Message instance or a callable returning it'); } $this->message = $message; $this->apiKey = $apiKey; } /** * {@inheritdoc} */ protected function send($content, array $records) { $message = clone $this->message; $message->setBody($content); $message->setDate(time()); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://mandrillapp.com/api/1.0/messages/send-raw.json'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array( 'key' => $this->apiKey, 'raw_message' => (string) $message, 'async' => false, ))); Curl\Util::execute($ch); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\ElasticaFormatter; use Monolog\Logger; use Elastica\Client; use Elastica\Exception\ExceptionInterface; /** * Elastic Search handler * * Usage example: * * $client = new \Elastica\Client(); * $options = array( * 'index' => 'elastic_index_name', * 'type' => 'elastic_doc_type', * ); * $handler = new ElasticSearchHandler($client, $options); * $log = new Logger('application'); * $log->pushHandler($handler); * * @author Jelle Vink <jelle.vink@gmail.com> */ class ElasticSearchHandler extends AbstractProcessingHandler { /** * @var Client */ protected $client; /** * @var array Handler config options */ protected $options = array(); /** * @param Client $client Elastica Client object * @param array $options Handler configuration * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(Client $client, array $options = array(), $level = Logger::DEBUG, $bubble = true) { parent::__construct($level, $bubble); $this->client = $client; $this->options = array_merge( array( 'index' => 'monolog', // Elastic index name 'type' => 'record', // Elastic document type 'ignore_error' => false, // Suppress Elastica exceptions ), $options ); } /** * {@inheritDoc} */ protected function write(array $record) { $this->bulkSend(array($record['formatted'])); } /** * {@inheritdoc} */ public function setFormatter(FormatterInterface $formatter) { if ($formatter instanceof ElasticaFormatter) { return parent::setFormatter($formatter); } throw new \InvalidArgumentException('ElasticSearchHandler is only compatible with ElasticaFormatter'); } /** * Getter options * @return array */ public function getOptions() { return $this->options; } /** * {@inheritDoc} */ protected function getDefaultFormatter() { return new ElasticaFormatter($this->options['index'], $this->options['type']); } /** * {@inheritdoc} */ public function handleBatch(array $records) { $documents = $this->getFormatter()->formatBatch($records); $this->bulkSend($documents); } /** * Use Elasticsearch bulk API to send list of documents * @param array $documents * @throws \RuntimeException */ protected function bulkSend(array $documents) { try { $this->client->addDocuments($documents); } catch (ExceptionInterface $e) { if (!$this->options['ignore_error']) { throw new \RuntimeException("Error sending messages to Elasticsearch", 0, $e); } } } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; use Monolog\Formatter\JsonFormatter; use PhpAmqpLib\Message\AMQPMessage; use PhpAmqpLib\Channel\AMQPChannel; use AMQPExchange; class AmqpHandler extends AbstractProcessingHandler { /** * @var AMQPExchange|AMQPChannel $exchange */ protected $exchange; /** * @var string */ protected $exchangeName; /** * @param AMQPExchange|AMQPChannel $exchange AMQPExchange (php AMQP ext) or PHP AMQP lib channel, ready for use * @param string $exchangeName * @param int $level * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($exchange, $exchangeName = 'log', $level = Logger::DEBUG, $bubble = true) { if ($exchange instanceof AMQPExchange) { $exchange->setName($exchangeName); } elseif ($exchange instanceof AMQPChannel) { $this->exchangeName = $exchangeName; } else { throw new \InvalidArgumentException('PhpAmqpLib\Channel\AMQPChannel or AMQPExchange instance required'); } $this->exchange = $exchange; parent::__construct($level, $bubble); } /** * {@inheritDoc} */ protected function write(array $record) { $data = $record["formatted"]; $routingKey = $this->getRoutingKey($record); if ($this->exchange instanceof AMQPExchange) { $this->exchange->publish( $data, $routingKey, 0, array( 'delivery_mode' => 2, 'content_type' => 'application/json', ) ); } else { $this->exchange->basic_publish( $this->createAmqpMessage($data), $this->exchangeName, $routingKey ); } } /** * {@inheritDoc} */ public function handleBatch(array $records) { if ($this->exchange instanceof AMQPExchange) { parent::handleBatch($records); return; } foreach ($records as $record) { if (!$this->isHandling($record)) { continue; } $record = $this->processRecord($record); $data = $this->getFormatter()->format($record); $this->exchange->batch_basic_publish( $this->createAmqpMessage($data), $this->exchangeName, $this->getRoutingKey($record) ); } $this->exchange->publish_batch(); } /** * Gets the routing key for the AMQP exchange * * @param array $record * @return string */ protected function getRoutingKey(array $record) { $routingKey = sprintf( '%s.%s', // TODO 2.0 remove substr call substr($record['level_name'], 0, 4), $record['channel'] ); return strtolower($routingKey); } /** * @param string $data * @return AMQPMessage */ private function createAmqpMessage($data) { return new AMQPMessage( (string) $data, array( 'delivery_mode' => 2, 'content_type' => 'application/json', ) ); } /** * {@inheritDoc} */ protected function getDefaultFormatter() { return new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; use Monolog\Formatter\LogglyFormatter; /** * Sends errors to Loggly. * * @author Przemek Sobstel <przemek@sobstel.org> * @author Adam Pancutt <adam@pancutt.com> * @author Gregory Barchard <gregory@barchard.net> */ class LogglyHandler extends AbstractProcessingHandler { const HOST = 'logs-01.loggly.com'; const ENDPOINT_SINGLE = 'inputs'; const ENDPOINT_BATCH = 'bulk'; protected $token; protected $tag = array(); public function __construct($token, $level = Logger::DEBUG, $bubble = true) { if (!extension_loaded('curl')) { throw new \LogicException('The curl extension is needed to use the LogglyHandler'); } $this->token = $token; parent::__construct($level, $bubble); } public function setTag($tag) { $tag = !empty($tag) ? $tag : array(); $this->tag = is_array($tag) ? $tag : array($tag); } public function addTag($tag) { if (!empty($tag)) { $tag = is_array($tag) ? $tag : array($tag); $this->tag = array_unique(array_merge($this->tag, $tag)); } } protected function write(array $record) { $this->send($record["formatted"], self::ENDPOINT_SINGLE); } public function handleBatch(array $records) { $level = $this->level; $records = array_filter($records, function ($record) use ($level) { return ($record['level'] >= $level); }); if ($records) { $this->send($this->getFormatter()->formatBatch($records), self::ENDPOINT_BATCH); } } protected function send($data, $endpoint) { $url = sprintf("https://%s/%s/%s/", self::HOST, $endpoint, $this->token); $headers = array('Content-Type: application/json'); if (!empty($this->tag)) { $headers[] = 'X-LOGGLY-TAG: '.implode(',', $this->tag); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); Curl\Util::execute($ch); } protected function getDefaultFormatter() { return new LogglyFormatter(); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog; use Monolog\Handler\HandlerInterface; use Monolog\Handler\StreamHandler; use Psr\Log\LoggerInterface; use Psr\Log\InvalidArgumentException; use Exception; /** * Monolog log channel * * It contains a stack of Handlers and a stack of Processors, * and uses them to store records that are added to it. * * @author Jordi Boggiano <j.boggiano@seld.be> */ class Logger implements LoggerInterface, ResettableInterface { /** * Detailed debug information */ const DEBUG = 100; /** * Interesting events * * Examples: User logs in, SQL logs. */ const INFO = 200; /** * Uncommon events */ const NOTICE = 250; /** * Exceptional occurrences that are not errors * * Examples: Use of deprecated APIs, poor use of an API, * undesirable things that are not necessarily wrong. */ const WARNING = 300; /** * Runtime errors */ const ERROR = 400; /** * Critical conditions * * Example: Application component unavailable, unexpected exception. */ const CRITICAL = 500; /** * Action must be taken immediately * * Example: Entire website down, database unavailable, etc. * This should trigger the SMS alerts and wake you up. */ const ALERT = 550; /** * Urgent alert. */ const EMERGENCY = 600; /** * Monolog API version * * This is only bumped when API breaks are done and should * follow the major version of the library * * @var int */ const API = 1; /** * Logging levels from syslog protocol defined in RFC 5424 * * @var array $levels Logging levels */ protected static $levels = array( self::DEBUG => 'DEBUG', self::INFO => 'INFO', self::NOTICE => 'NOTICE', self::WARNING => 'WARNING', self::ERROR => 'ERROR', self::CRITICAL => 'CRITICAL', self::ALERT => 'ALERT', self::EMERGENCY => 'EMERGENCY', ); /** * @var \DateTimeZone */ protected static $timezone; /** * @var string */ protected $name; /** * The handler stack * * @var HandlerInterface[] */ protected $handlers; /** * Processors that will process all log records * * To process records of a single handler instead, add the processor on that specific handler * * @var callable[] */ protected $processors; /** * @var bool */ protected $microsecondTimestamps = true; /** * @var callable */ protected $exceptionHandler; /** * @param string $name The logging channel * @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc. * @param callable[] $processors Optional array of processors */ public function __construct($name, array $handlers = array(), array $processors = array()) { $this->name = $name; $this->setHandlers($handlers); $this->processors = $processors; } /** * @return string */ public function getName() { return $this->name; } /** * Return a new cloned instance with the name changed * * @return static */ public function withName($name) { $new = clone $this; $new->name = $name; return $new; } /** * Pushes a handler on to the stack. * * @param HandlerInterface $handler * @return $this */ public function pushHandler(HandlerInterface $handler) { array_unshift($this->handlers, $handler); return $this; } /** * Pops a handler from the stack * * @return HandlerInterface */ public function popHandler() { if (!$this->handlers) { throw new \LogicException('You tried to pop from an empty handler stack.'); } return array_shift($this->handlers); } /** * Set handlers, replacing all existing ones. * * If a map is passed, keys will be ignored. * * @param HandlerInterface[] $handlers * @return $this */ public function setHandlers(array $handlers) { $this->handlers = array(); foreach (array_reverse($handlers) as $handler) { $this->pushHandler($handler); } return $this; } /** * @return HandlerInterface[] */ public function getHandlers() { return $this->handlers; } /** * Adds a processor on to the stack. * * @param callable $callback * @return $this */ public function pushProcessor($callback) { if (!is_callable($callback)) { throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given'); } array_unshift($this->processors, $callback); return $this; } /** * Removes the processor on top of the stack and returns it. * * @return callable */ public function popProcessor() { if (!$this->processors) { throw new \LogicException('You tried to pop from an empty processor stack.'); } return array_shift($this->processors); } /** * @return callable[] */ public function getProcessors() { return $this->processors; } /** * Control the use of microsecond resolution timestamps in the 'datetime' * member of new records. * * Generating microsecond resolution timestamps by calling * microtime(true), formatting the result via sprintf() and then parsing * the resulting string via \DateTime::createFromFormat() can incur * a measurable runtime overhead vs simple usage of DateTime to capture * a second resolution timestamp in systems which generate a large number * of log events. * * @param bool $micro True to use microtime() to create timestamps */ public function useMicrosecondTimestamps($micro) { $this->microsecondTimestamps = (bool) $micro; } /** * Adds a log record. * * @param int $level The logging level * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function addRecord($level, $message, array $context = array()) { if (!$this->handlers) { $this->pushHandler(new StreamHandler('php://stderr', static::DEBUG)); } $levelName = static::getLevelName($level); // check if any handler will handle this message so we can return early and save cycles $handlerKey = null; reset($this->handlers); while ($handler = current($this->handlers)) { if ($handler->isHandling(array('level' => $level))) { $handlerKey = key($this->handlers); break; } next($this->handlers); } if (null === $handlerKey) { return false; } if (!static::$timezone) { static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC'); } // php7.1+ always has microseconds enabled, so we do not need this hack if ($this->microsecondTimestamps && PHP_VERSION_ID < 70100) { $ts = \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone); } else { $ts = new \DateTime(null, static::$timezone); } $ts->setTimezone(static::$timezone); $record = array( 'message' => (string) $message, 'context' => $context, 'level' => $level, 'level_name' => $levelName, 'channel' => $this->name, 'datetime' => $ts, 'extra' => array(), ); try { foreach ($this->processors as $processor) { $record = call_user_func($processor, $record); } while ($handler = current($this->handlers)) { if (true === $handler->handle($record)) { break; } next($this->handlers); } } catch (Exception $e) { $this->handleException($e, $record); } return true; } /** * Ends a log cycle and frees all resources used by handlers. * * Closing a Handler means flushing all buffers and freeing any open resources/handles. * Handlers that have been closed should be able to accept log records again and re-open * themselves on demand, but this may not always be possible depending on implementation. * * This is useful at the end of a request and will be called automatically on every handler * when they get destructed. */ public function close() { foreach ($this->handlers as $handler) { if (method_exists($handler, 'close')) { $handler->close(); } } } /** * Ends a log cycle and resets all handlers and processors to their initial state. * * Resetting a Handler or a Processor means flushing/cleaning all buffers, resetting internal * state, and getting it back to a state in which it can receive log records again. * * This is useful in case you want to avoid logs leaking between two requests or jobs when you * have a long running process like a worker or an application server serving multiple requests * in one process. */ public function reset() { foreach ($this->handlers as $handler) { if ($handler instanceof ResettableInterface) { $handler->reset(); } } foreach ($this->processors as $processor) { if ($processor instanceof ResettableInterface) { $processor->reset(); } } } /** * Adds a log record at the DEBUG level. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function addDebug($message, array $context = array()) { return $this->addRecord(static::DEBUG, $message, $context); } /** * Adds a log record at the INFO level. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function addInfo($message, array $context = array()) { return $this->addRecord(static::INFO, $message, $context); } /** * Adds a log record at the NOTICE level. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function addNotice($message, array $context = array()) { return $this->addRecord(static::NOTICE, $message, $context); } /** * Adds a log record at the WARNING level. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function addWarning($message, array $context = array()) { return $this->addRecord(static::WARNING, $message, $context); } /** * Adds a log record at the ERROR level. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function addError($message, array $context = array()) { return $this->addRecord(static::ERROR, $message, $context); } /** * Adds a log record at the CRITICAL level. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function addCritical($message, array $context = array()) { return $this->addRecord(static::CRITICAL, $message, $context); } /** * Adds a log record at the ALERT level. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function addAlert($message, array $context = array()) { return $this->addRecord(static::ALERT, $message, $context); } /** * Adds a log record at the EMERGENCY level. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function addEmergency($message, array $context = array()) { return $this->addRecord(static::EMERGENCY, $message, $context); } /** * Gets all supported logging levels. * * @return array Assoc array with human-readable level names => level codes. */ public static function getLevels() { return array_flip(static::$levels); } /** * Gets the name of the logging level. * * @param int $level * @return string */ public static function getLevelName($level) { if (!isset(static::$levels[$level])) { throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels))); } return static::$levels[$level]; } /** * Converts PSR-3 levels to Monolog ones if necessary * * @param string|int Level number (monolog) or name (PSR-3) * @return int */ public static function toMonologLevel($level) { if (is_string($level) && defined(__CLASS__.'::'.strtoupper($level))) { return constant(__CLASS__.'::'.strtoupper($level)); } return $level; } /** * Checks whether the Logger has a handler that listens on the given level * * @param int $level * @return bool */ public function isHandling($level) { $record = array( 'level' => $level, ); foreach ($this->handlers as $handler) { if ($handler->isHandling($record)) { return true; } } return false; } /** * Set a custom exception handler * * @param callable $callback * @return $this */ public function setExceptionHandler($callback) { if (!is_callable($callback)) { throw new \InvalidArgumentException('Exception handler must be valid callable (callback or object with an __invoke method), '.var_export($callback, true).' given'); } $this->exceptionHandler = $callback; return $this; } /** * @return callable */ public function getExceptionHandler() { return $this->exceptionHandler; } /** * Delegates exception management to the custom exception handler, * or throws the exception if no custom handler is set. */ protected function handleException(Exception $e, array $record) { if (!$this->exceptionHandler) { throw $e; } call_user_func($this->exceptionHandler, $e, $record); } /** * Adds a log record at an arbitrary level. * * This method allows for compatibility with common interfaces. * * @param mixed $level The log level * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function log($level, $message, array $context = array()) { $level = static::toMonologLevel($level); return $this->addRecord($level, $message, $context); } /** * Adds a log record at the DEBUG level. * * This method allows for compatibility with common interfaces. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function debug($message, array $context = array()) { return $this->addRecord(static::DEBUG, $message, $context); } /** * Adds a log record at the INFO level. * * This method allows for compatibility with common interfaces. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function info($message, array $context = array()) { return $this->addRecord(static::INFO, $message, $context); } /** * Adds a log record at the NOTICE level. * * This method allows for compatibility with common interfaces. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function notice($message, array $context = array()) { return $this->addRecord(static::NOTICE, $message, $context); } /** * Adds a log record at the WARNING level. * * This method allows for compatibility with common interfaces. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function warn($message, array $context = array()) { return $this->addRecord(static::WARNING, $message, $context); } /** * Adds a log record at the WARNING level. * * This method allows for compatibility with common interfaces. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function warning($message, array $context = array()) { return $this->addRecord(static::WARNING, $message, $context); } /** * Adds a log record at the ERROR level. * * This method allows for compatibility with common interfaces. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function err($message, array $context = array()) { return $this->addRecord(static::ERROR, $message, $context); } /** * Adds a log record at the ERROR level. * * This method allows for compatibility with common interfaces. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function error($message, array $context = array()) { return $this->addRecord(static::ERROR, $message, $context); } /** * Adds a log record at the CRITICAL level. * * This method allows for compatibility with common interfaces. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function crit($message, array $context = array()) { return $this->addRecord(static::CRITICAL, $message, $context); } /** * Adds a log record at the CRITICAL level. * * This method allows for compatibility with common interfaces. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function critical($message, array $context = array()) { return $this->addRecord(static::CRITICAL, $message, $context); } /** * Adds a log record at the ALERT level. * * This method allows for compatibility with common interfaces. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function alert($message, array $context = array()) { return $this->addRecord(static::ALERT, $message, $context); } /** * Adds a log record at the EMERGENCY level. * * This method allows for compatibility with common interfaces. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function emerg($message, array $context = array()) { return $this->addRecord(static::EMERGENCY, $message, $context); } /** * Adds a log record at the EMERGENCY level. * * This method allows for compatibility with common interfaces. * * @param string $message The log message * @param array $context The log context * @return bool Whether the record has been processed */ public function emergency($message, array $context = array()) { return $this->addRecord(static::EMERGENCY, $message, $context); } /** * Set the timezone to be used for the timestamp of log records. * * This is stored globally for all Logger instances * * @param \DateTimeZone $tz Timezone object */ public static function setTimezone(\DateTimeZone $tz) { self::$timezone = $tz; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog; use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; use ReflectionExtension; /** * Monolog POSIX signal handler * * @author Robert Gust-Bardon <robert@gust-bardon.org> */ class SignalHandler { private $logger; private $previousSignalHandler = array(); private $signalLevelMap = array(); private $signalRestartSyscalls = array(); public function __construct(LoggerInterface $logger) { $this->logger = $logger; } public function registerSignalHandler($signo, $level = LogLevel::CRITICAL, $callPrevious = true, $restartSyscalls = true, $async = true) { if (!extension_loaded('pcntl') || !function_exists('pcntl_signal')) { return $this; } if ($callPrevious) { if (function_exists('pcntl_signal_get_handler')) { $handler = pcntl_signal_get_handler($signo); if ($handler === false) { return $this; } $this->previousSignalHandler[$signo] = $handler; } else { $this->previousSignalHandler[$signo] = true; } } else { unset($this->previousSignalHandler[$signo]); } $this->signalLevelMap[$signo] = $level; $this->signalRestartSyscalls[$signo] = $restartSyscalls; if (function_exists('pcntl_async_signals') && $async !== null) { pcntl_async_signals($async); } pcntl_signal($signo, array($this, 'handleSignal'), $restartSyscalls); return $this; } public function handleSignal($signo, array $siginfo = null) { static $signals = array(); if (!$signals && extension_loaded('pcntl')) { $pcntl = new ReflectionExtension('pcntl'); $constants = $pcntl->getConstants(); if (!$constants) { // HHVM 3.24.2 returns an empty array. $constants = get_defined_constants(true); $constants = $constants['Core']; } foreach ($constants as $name => $value) { if (substr($name, 0, 3) === 'SIG' && $name[3] !== '_' && is_int($value)) { $signals[$value] = $name; } } unset($constants); } $level = isset($this->signalLevelMap[$signo]) ? $this->signalLevelMap[$signo] : LogLevel::CRITICAL; $signal = isset($signals[$signo]) ? $signals[$signo] : $signo; $context = isset($siginfo) ? $siginfo : array(); $this->logger->log($level, sprintf('Program received signal %s', $signal), $context); if (!isset($this->previousSignalHandler[$signo])) { return; } if ($this->previousSignalHandler[$signo] === true || $this->previousSignalHandler[$signo] === SIG_DFL) { if (extension_loaded('pcntl') && function_exists('pcntl_signal') && function_exists('pcntl_sigprocmask') && function_exists('pcntl_signal_dispatch') && extension_loaded('posix') && function_exists('posix_getpid') && function_exists('posix_kill')) { $restartSyscalls = isset($this->signalRestartSyscalls[$signo]) ? $this->signalRestartSyscalls[$signo] : true; pcntl_signal($signo, SIG_DFL, $restartSyscalls); pcntl_sigprocmask(SIG_UNBLOCK, array($signo), $oldset); posix_kill(posix_getpid(), $signo); pcntl_signal_dispatch(); pcntl_sigprocmask(SIG_SETMASK, $oldset); pcntl_signal($signo, array($this, 'handleSignal'), $restartSyscalls); } } elseif (is_callable($this->previousSignalHandler[$signo])) { if (PHP_VERSION_ID >= 70100) { $this->previousSignalHandler[$signo]($signo, $siginfo); } else { $this->previousSignalHandler[$signo]($signo); } } } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Processor; use Monolog\Logger; /** * Injects Git branch and Git commit SHA in all records * * @author Nick Otter * @author Jordi Boggiano <j.boggiano@seld.be> */ class GitProcessor implements ProcessorInterface { private $level; private static $cache; public function __construct($level = Logger::DEBUG) { $this->level = Logger::toMonologLevel($level); } /** * @param array $record * @return array */ public function __invoke(array $record) { // return if the level is not high enough if ($record['level'] < $this->level) { return $record; } $record['extra']['git'] = self::getGitInfo(); return $record; } private static function getGitInfo() { if (self::$cache) { return self::$cache; } $branches = `git branch -v --no-abbrev`; if (preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) { return self::$cache = array( 'branch' => $matches[1], 'commit' => $matches[2], ); } return self::$cache = array(); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Processor; /** * Injects url/method and remote IP of the current web request in all records * * @author Jordi Boggiano <j.boggiano@seld.be> */ class WebProcessor implements ProcessorInterface { /** * @var array|\ArrayAccess */ protected $serverData; /** * Default fields * * Array is structured as [key in record.extra => key in $serverData] * * @var array */ protected $extraFields = array( 'url' => 'REQUEST_URI', 'ip' => 'REMOTE_ADDR', 'http_method' => 'REQUEST_METHOD', 'server' => 'SERVER_NAME', 'referrer' => 'HTTP_REFERER', ); /** * @param array|\ArrayAccess $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data * @param array|null $extraFields Field names and the related key inside $serverData to be added. If not provided it defaults to: url, ip, http_method, server, referrer */ public function __construct($serverData = null, array $extraFields = null) { if (null === $serverData) { $this->serverData = &$_SERVER; } elseif (is_array($serverData) || $serverData instanceof \ArrayAccess) { $this->serverData = $serverData; } else { throw new \UnexpectedValueException('$serverData must be an array or object implementing ArrayAccess.'); } if (null !== $extraFields) { if (isset($extraFields[0])) { foreach (array_keys($this->extraFields) as $fieldName) { if (!in_array($fieldName, $extraFields)) { unset($this->extraFields[$fieldName]); } } } else { $this->extraFields = $extraFields; } } } /** * @param array $record * @return array */ public function __invoke(array $record) { // skip processing if for some reason request data // is not present (CLI or wonky SAPIs) if (!isset($this->serverData['REQUEST_URI'])) { return $record; } $record['extra'] = $this->appendExtraFields($record['extra']); return $record; } /** * @param string $extraName * @param string $serverName * @return $this */ public function addExtraField($extraName, $serverName) { $this->extraFields[$extraName] = $serverName; return $this; } /** * @param array $extra * @return array */ private function appendExtraFields(array $extra) { foreach ($this->extraFields as $extraName => $serverName) { $extra[$extraName] = isset($this->serverData[$serverName]) ? $this->serverData[$serverName] : null; } if (isset($this->serverData['UNIQUE_ID'])) { $extra['unique_id'] = $this->serverData['UNIQUE_ID']; } return $extra; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Processor; use Monolog\ResettableInterface; /** * Adds a unique identifier into records * * @author Simon Mönch <sm@webfactory.de> */ class UidProcessor implements ProcessorInterface, ResettableInterface { private $uid; public function __construct($length = 7) { if (!is_int($length) || $length > 32 || $length < 1) { throw new \InvalidArgumentException('The uid length must be an integer between 1 and 32'); } $this->uid = $this->generateUid($length); } public function __invoke(array $record) { $record['extra']['uid'] = $this->uid; return $record; } /** * @return string */ public function getUid() { return $this->uid; } public function reset() { $this->uid = $this->generateUid(strlen($this->uid)); } private function generateUid($length) { return substr(hash('md5', uniqid('', true)), 0, $length); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Processor; use Monolog\Logger; /** * Injects line/file:class/function where the log message came from * * Warning: This only works if the handler processes the logs directly. * If you put the processor on a handler that is behind a FingersCrossedHandler * for example, the processor will only be called once the trigger level is reached, * and all the log records will have the same file/line/.. data from the call that * triggered the FingersCrossedHandler. * * @author Jordi Boggiano <j.boggiano@seld.be> */ class IntrospectionProcessor implements ProcessorInterface { private $level; private $skipClassesPartials; private $skipStackFramesCount; private $skipFunctions = array( 'call_user_func', 'call_user_func_array', ); public function __construct($level = Logger::DEBUG, array $skipClassesPartials = array(), $skipStackFramesCount = 0) { $this->level = Logger::toMonologLevel($level); $this->skipClassesPartials = array_merge(array('Monolog\\'), $skipClassesPartials); $this->skipStackFramesCount = $skipStackFramesCount; } /** * @param array $record * @return array */ public function __invoke(array $record) { // return if the level is not high enough if ($record['level'] < $this->level) { return $record; } /* * http://php.net/manual/en/function.debug-backtrace.php * As of 5.3.6, DEBUG_BACKTRACE_IGNORE_ARGS option was added. * Any version less than 5.3.6 must use the DEBUG_BACKTRACE_IGNORE_ARGS constant value '2'. */ $trace = debug_backtrace((PHP_VERSION_ID < 50306) ? 2 : DEBUG_BACKTRACE_IGNORE_ARGS); // skip first since it's always the current method array_shift($trace); // the call_user_func call is also skipped array_shift($trace); $i = 0; while ($this->isTraceClassOrSkippedFunction($trace, $i)) { if (isset($trace[$i]['class'])) { foreach ($this->skipClassesPartials as $part) { if (strpos($trace[$i]['class'], $part) !== false) { $i++; continue 2; } } } elseif (in_array($trace[$i]['function'], $this->skipFunctions)) { $i++; continue; } break; } $i += $this->skipStackFramesCount; // we should have the call source now $record['extra'] = array_merge( $record['extra'], array( 'file' => isset($trace[$i - 1]['file']) ? $trace[$i - 1]['file'] : null, 'line' => isset($trace[$i - 1]['line']) ? $trace[$i - 1]['line'] : null, 'class' => isset($trace[$i]['class']) ? $trace[$i]['class'] : null, 'function' => isset($trace[$i]['function']) ? $trace[$i]['function'] : null, ) ); return $record; } private function isTraceClassOrSkippedFunction(array $trace, $index) { if (!isset($trace[$index])) { return false; } return isset($trace[$index]['class']) || in_array($trace[$index]['function'], $this->skipFunctions); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Processor; /** * Adds value of getmypid into records * * @author Andreas Hörnicke */ class ProcessIdProcessor implements ProcessorInterface { /** * @param array $record * @return array */ public function __invoke(array $record) { $record['extra']['process_id'] = getmypid(); return $record; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Processor; /** * Injects memory_get_usage in all records * * @see Monolog\Processor\MemoryProcessor::__construct() for options * @author Rob Jensen */ class MemoryUsageProcessor extends MemoryProcessor { /** * @param array $record * @return array */ public function __invoke(array $record) { $bytes = memory_get_usage($this->realUsage); $formatted = $this->formatBytes($bytes); $record['extra']['memory_usage'] = $formatted; return $record; } } <?php /* * This file is part of the Monolog package. * * (c) Jonathan A. Schweder <jonathanschweder@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Processor; use Monolog\Logger; /** * Injects Hg branch and Hg revision number in all records * * @author Jonathan A. Schweder <jonathanschweder@gmail.com> */ class MercurialProcessor implements ProcessorInterface { private $level; private static $cache; public function __construct($level = Logger::DEBUG) { $this->level = Logger::toMonologLevel($level); } /** * @param array $record * @return array */ public function __invoke(array $record) { // return if the level is not high enough if ($record['level'] < $this->level) { return $record; } $record['extra']['hg'] = self::getMercurialInfo(); return $record; } private static function getMercurialInfo() { if (self::$cache) { return self::$cache; } $result = explode(' ', trim(`hg id -nb`)); if (count($result) >= 3) { return self::$cache = array( 'branch' => $result[1], 'revision' => $result[2], ); } return self::$cache = array(); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Processor; /** * An optional interface to allow labelling Monolog processors. * * @author Nicolas Grekas <p@tchwork.com> */ interface ProcessorInterface { /** * @return array The processed records */ public function __invoke(array $records); } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Processor; use Monolog\Utils; /** * Processes a record's message according to PSR-3 rules * * It replaces {foo} with the value from $context['foo'] * * @author Jordi Boggiano <j.boggiano@seld.be> */ class PsrLogMessageProcessor implements ProcessorInterface { /** * @param array $record * @return array */ public function __invoke(array $record) { if (false === strpos($record['message'], '{')) { return $record; } $replacements = array(); foreach ($record['context'] as $key => $val) { if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) { $replacements['{'.$key.'}'] = $val; } elseif (is_object($val)) { $replacements['{'.$key.'}'] = '[object '.Utils::getClass($val).']'; } else { $replacements['{'.$key.'}'] = '['.gettype($val).']'; } } $record['message'] = strtr($record['message'], $replacements); return $record; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Processor; /** * Some methods that are common for all memory processors * * @author Rob Jensen */ abstract class MemoryProcessor implements ProcessorInterface { /** * @var bool If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported. */ protected $realUsage; /** * @var bool If true, then format memory size to human readable string (MB, KB, B depending on size) */ protected $useFormatting; /** * @param bool $realUsage Set this to true to get the real size of memory allocated from system. * @param bool $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size) */ public function __construct($realUsage = true, $useFormatting = true) { $this->realUsage = (bool) $realUsage; $this->useFormatting = (bool) $useFormatting; } /** * Formats bytes into a human readable string if $this->useFormatting is true, otherwise return $bytes as is * * @param int $bytes * @return string|int Formatted string if $this->useFormatting is true, otherwise return $bytes as is */ protected function formatBytes($bytes) { $bytes = (int) $bytes; if (!$this->useFormatting) { return $bytes; } if ($bytes > 1024 * 1024) { return round($bytes / 1024 / 1024, 2).' MB'; } elseif ($bytes > 1024) { return round($bytes / 1024, 2).' KB'; } return $bytes . ' B'; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Processor; /** * Adds a tags array into record * * @author Martijn Riemers */ class TagProcessor implements ProcessorInterface { private $tags; public function __construct(array $tags = array()) { $this->setTags($tags); } public function addTags(array $tags = array()) { $this->tags = array_merge($this->tags, $tags); } public function setTags(array $tags = array()) { $this->tags = $tags; } public function __invoke(array $record) { $record['extra']['tags'] = $this->tags; return $record; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Processor; /** * Injects memory_get_peak_usage in all records * * @see Monolog\Processor\MemoryProcessor::__construct() for options * @author Rob Jensen */ class MemoryPeakUsageProcessor extends MemoryProcessor { /** * @param array $record * @return array */ public function __invoke(array $record) { $bytes = memory_get_peak_usage($this->realUsage); $formatted = $this->formatBytes($bytes); $record['extra']['memory_peak_usage'] = $formatted; return $record; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog; use InvalidArgumentException; /** * Monolog log registry * * Allows to get `Logger` instances in the global scope * via static method calls on this class. * * <code> * $application = new Monolog\Logger('application'); * $api = new Monolog\Logger('api'); * * Monolog\Registry::addLogger($application); * Monolog\Registry::addLogger($api); * * function testLogger() * { * Monolog\Registry::api()->addError('Sent to $api Logger instance'); * Monolog\Registry::application()->addError('Sent to $application Logger instance'); * } * </code> * * @author Tomas Tatarko <tomas@tatarko.sk> */ class Registry { /** * List of all loggers in the registry (by named indexes) * * @var Logger[] */ private static $loggers = array(); /** * Adds new logging channel to the registry * * @param Logger $logger Instance of the logging channel * @param string|null $name Name of the logging channel ($logger->getName() by default) * @param bool $overwrite Overwrite instance in the registry if the given name already exists? * @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists */ public static function addLogger(Logger $logger, $name = null, $overwrite = false) { $name = $name ?: $logger->getName(); if (isset(self::$loggers[$name]) && !$overwrite) { throw new InvalidArgumentException('Logger with the given name already exists'); } self::$loggers[$name] = $logger; } /** * Checks if such logging channel exists by name or instance * * @param string|Logger $logger Name or logger instance */ public static function hasLogger($logger) { if ($logger instanceof Logger) { $index = array_search($logger, self::$loggers, true); return false !== $index; } else { return isset(self::$loggers[$logger]); } } /** * Removes instance from registry by name or instance * * @param string|Logger $logger Name or logger instance */ public static function removeLogger($logger) { if ($logger instanceof Logger) { if (false !== ($idx = array_search($logger, self::$loggers, true))) { unset(self::$loggers[$idx]); } } else { unset(self::$loggers[$logger]); } } /** * Clears the registry */ public static function clear() { self::$loggers = array(); } /** * Gets Logger instance from the registry * * @param string $name Name of the requested Logger instance * @throws \InvalidArgumentException If named Logger instance is not in the registry * @return Logger Requested instance of Logger */ public static function getInstance($name) { if (!isset(self::$loggers[$name])) { throw new InvalidArgumentException(sprintf('Requested "%s" logger instance is not in the registry', $name)); } return self::$loggers[$name]; } /** * Gets Logger instance from the registry via static method call * * @param string $name Name of the requested Logger instance * @param array $arguments Arguments passed to static method call * @throws \InvalidArgumentException If named Logger instance is not in the registry * @return Logger Requested instance of Logger */ public static function __callStatic($name, $arguments) { return self::getInstance($name); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; /** * Encodes message information into JSON in a format compatible with Loggly. * * @author Adam Pancutt <adam@pancutt.com> */ class LogglyFormatter extends JsonFormatter { /** * Overrides the default batch mode to new lines for compatibility with the * Loggly bulk API. * * @param int $batchMode */ public function __construct($batchMode = self::BATCH_MODE_NEWLINES, $appendNewline = false) { parent::__construct($batchMode, $appendNewline); } /** * Appends the 'timestamp' parameter for indexing by Loggly. * * @see https://www.loggly.com/docs/automated-parsing/#json * @see \Monolog\Formatter\JsonFormatter::format() */ public function format(array $record) { if (isset($record["datetime"]) && ($record["datetime"] instanceof \DateTime)) { $record["timestamp"] = $record["datetime"]->format("Y-m-d\TH:i:s.uO"); // TODO 2.0 unset the 'datetime' parameter, retained for BC } return parent::format($record); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; use Elastica\Document; /** * Format a log message into an Elastica Document * * @author Jelle Vink <jelle.vink@gmail.com> */ class ElasticaFormatter extends NormalizerFormatter { /** * @var string Elastic search index name */ protected $index; /** * @var string Elastic search document type */ protected $type; /** * @param string $index Elastic Search index name * @param string $type Elastic Search document type */ public function __construct($index, $type) { // elasticsearch requires a ISO 8601 format date with optional millisecond precision. parent::__construct('Y-m-d\TH:i:s.uP'); $this->index = $index; $this->type = $type; } /** * {@inheritdoc} */ public function format(array $record) { $record = parent::format($record); return $this->getDocument($record); } /** * Getter index * @return string */ public function getIndex() { return $this->index; } /** * Getter type * @return string */ public function getType() { return $this->type; } /** * Convert a log message into an Elastica Document * * @param array $record Log message * @return Document */ protected function getDocument($record) { $document = new Document(); $document->setData($record); $document->setType($this->type); $document->setIndex($this->index); return $document; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; use Monolog\Logger; use Gelf\Message; /** * Serializes a log message to GELF * @see http://www.graylog2.org/about/gelf * * @author Matt Lehner <mlehner@gmail.com> */ class GelfMessageFormatter extends NormalizerFormatter { const DEFAULT_MAX_LENGTH = 32766; /** * @var string the name of the system for the Gelf log message */ protected $systemName; /** * @var string a prefix for 'extra' fields from the Monolog record (optional) */ protected $extraPrefix; /** * @var string a prefix for 'context' fields from the Monolog record (optional) */ protected $contextPrefix; /** * @var int max length per field */ protected $maxLength; /** * Translates Monolog log levels to Graylog2 log priorities. */ private $logLevels = array( Logger::DEBUG => 7, Logger::INFO => 6, Logger::NOTICE => 5, Logger::WARNING => 4, Logger::ERROR => 3, Logger::CRITICAL => 2, Logger::ALERT => 1, Logger::EMERGENCY => 0, ); public function __construct($systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $maxLength = null) { parent::__construct('U.u'); $this->systemName = $systemName ?: gethostname(); $this->extraPrefix = $extraPrefix; $this->contextPrefix = $contextPrefix; $this->maxLength = is_null($maxLength) ? self::DEFAULT_MAX_LENGTH : $maxLength; } /** * {@inheritdoc} */ public function format(array $record) { $record = parent::format($record); if (!isset($record['datetime'], $record['message'], $record['level'])) { throw new \InvalidArgumentException('The record should at least contain datetime, message and level keys, '.var_export($record, true).' given'); } $message = new Message(); $message ->setTimestamp($record['datetime']) ->setShortMessage((string) $record['message']) ->setHost($this->systemName) ->setLevel($this->logLevels[$record['level']]); // message length + system name length + 200 for padding / metadata $len = 200 + strlen((string) $record['message']) + strlen($this->systemName); if ($len > $this->maxLength) { $message->setShortMessage(substr($record['message'], 0, $this->maxLength)); } if (isset($record['channel'])) { $message->setFacility($record['channel']); } if (isset($record['extra']['line'])) { $message->setLine($record['extra']['line']); unset($record['extra']['line']); } if (isset($record['extra']['file'])) { $message->setFile($record['extra']['file']); unset($record['extra']['file']); } foreach ($record['extra'] as $key => $val) { $val = is_scalar($val) || null === $val ? $val : $this->toJson($val); $len = strlen($this->extraPrefix . $key . $val); if ($len > $this->maxLength) { $message->setAdditional($this->extraPrefix . $key, substr($val, 0, $this->maxLength)); break; } $message->setAdditional($this->extraPrefix . $key, $val); } foreach ($record['context'] as $key => $val) { $val = is_scalar($val) || null === $val ? $val : $this->toJson($val); $len = strlen($this->contextPrefix . $key . $val); if ($len > $this->maxLength) { $message->setAdditional($this->contextPrefix . $key, substr($val, 0, $this->maxLength)); break; } $message->setAdditional($this->contextPrefix . $key, $val); } if (null === $message->getFile() && isset($record['context']['exception']['file'])) { if (preg_match("/^(.+):([0-9]+)$/", $record['context']['exception']['file'], $matches)) { $message->setFile($matches[1]); $message->setLine($matches[2]); } } return $message; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; /** * formats the record to be used in the FlowdockHandler * * @author Dominik Liebler <liebler.dominik@gmail.com> */ class FlowdockFormatter implements FormatterInterface { /** * @var string */ private $source; /** * @var string */ private $sourceEmail; /** * @param string $source * @param string $sourceEmail */ public function __construct($source, $sourceEmail) { $this->source = $source; $this->sourceEmail = $sourceEmail; } /** * {@inheritdoc} */ public function format(array $record) { $tags = array( '#logs', '#' . strtolower($record['level_name']), '#' . $record['channel'], ); foreach ($record['extra'] as $value) { $tags[] = '#' . $value; } $subject = sprintf( 'in %s: %s - %s', $this->source, $record['level_name'], $this->getShortMessage($record['message']) ); $record['flowdock'] = array( 'source' => $this->source, 'from_address' => $this->sourceEmail, 'subject' => $subject, 'content' => $record['message'], 'tags' => $tags, 'project' => $this->source, ); return $record; } /** * {@inheritdoc} */ public function formatBatch(array $records) { $formatted = array(); foreach ($records as $record) { $formatted[] = $this->format($record); } return $formatted; } /** * @param string $message * * @return string */ public function getShortMessage($message) { static $hasMbString; if (null === $hasMbString) { $hasMbString = function_exists('mb_strlen'); } $maxLength = 45; if ($hasMbString) { if (mb_strlen($message, 'UTF-8') > $maxLength) { $message = mb_substr($message, 0, $maxLength - 4, 'UTF-8') . '...'; } } else { if (strlen($message) > $maxLength) { $message = substr($message, 0, $maxLength - 4) . '...'; } } return $message; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; /** * Interface for formatters * * @author Jordi Boggiano <j.boggiano@seld.be> */ interface FormatterInterface { /** * Formats a log record. * * @param array $record A record to format * @return mixed The formatted record */ public function format(array $record); /** * Formats a set of log records. * * @param array $records A set of records to format * @return mixed The formatted set of records */ public function formatBatch(array $records); } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; use Monolog\Utils; /** * Formats a record for use with the MongoDBHandler. * * @author Florian Plattner <me@florianplattner.de> */ class MongoDBFormatter implements FormatterInterface { private $exceptionTraceAsString; private $maxNestingLevel; /** * @param int $maxNestingLevel 0 means infinite nesting, the $record itself is level 1, $record['context'] is 2 * @param bool $exceptionTraceAsString set to false to log exception traces as a sub documents instead of strings */ public function __construct($maxNestingLevel = 3, $exceptionTraceAsString = true) { $this->maxNestingLevel = max($maxNestingLevel, 0); $this->exceptionTraceAsString = (bool) $exceptionTraceAsString; } /** * {@inheritDoc} */ public function format(array $record) { return $this->formatArray($record); } /** * {@inheritDoc} */ public function formatBatch(array $records) { foreach ($records as $key => $record) { $records[$key] = $this->format($record); } return $records; } protected function formatArray(array $record, $nestingLevel = 0) { if ($this->maxNestingLevel == 0 || $nestingLevel <= $this->maxNestingLevel) { foreach ($record as $name => $value) { if ($value instanceof \DateTime) { $record[$name] = $this->formatDate($value, $nestingLevel + 1); } elseif ($value instanceof \Exception) { $record[$name] = $this->formatException($value, $nestingLevel + 1); } elseif (is_array($value)) { $record[$name] = $this->formatArray($value, $nestingLevel + 1); } elseif (is_object($value)) { $record[$name] = $this->formatObject($value, $nestingLevel + 1); } } } else { $record = '[...]'; } return $record; } protected function formatObject($value, $nestingLevel) { $objectVars = get_object_vars($value); $objectVars['class'] = Utils::getClass($value); return $this->formatArray($objectVars, $nestingLevel); } protected function formatException(\Exception $exception, $nestingLevel) { $formattedException = array( 'class' => Utils::getClass($exception), 'message' => $exception->getMessage(), 'code' => $exception->getCode(), 'file' => $exception->getFile() . ':' . $exception->getLine(), ); if ($this->exceptionTraceAsString === true) { $formattedException['trace'] = $exception->getTraceAsString(); } else { $formattedException['trace'] = $exception->getTrace(); } return $this->formatArray($formattedException, $nestingLevel); } protected function formatDate(\DateTime $value, $nestingLevel) { return new \MongoDate($value->getTimestamp()); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; use Monolog\Logger; /** * Formats a log message according to the ChromePHP array format * * @author Christophe Coevoet <stof@notk.org> */ class ChromePHPFormatter implements FormatterInterface { /** * Translates Monolog log levels to Wildfire levels. */ private $logLevels = array( Logger::DEBUG => 'log', Logger::INFO => 'info', Logger::NOTICE => 'info', Logger::WARNING => 'warn', Logger::ERROR => 'error', Logger::CRITICAL => 'error', Logger::ALERT => 'error', Logger::EMERGENCY => 'error', ); /** * {@inheritdoc} */ public function format(array $record) { // Retrieve the line and file if set and remove them from the formatted extra $backtrace = 'unknown'; if (isset($record['extra']['file'], $record['extra']['line'])) { $backtrace = $record['extra']['file'].' : '.$record['extra']['line']; unset($record['extra']['file'], $record['extra']['line']); } $message = array('message' => $record['message']); if ($record['context']) { $message['context'] = $record['context']; } if ($record['extra']) { $message['extra'] = $record['extra']; } if (count($message) === 1) { $message = reset($message); } return array( $record['channel'], $message, $backtrace, $this->logLevels[$record['level']], ); } public function formatBatch(array $records) { $formatted = array(); foreach ($records as $record) { $formatted[] = $this->format($record); } return $formatted; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; use Exception; use Monolog\Utils; /** * Normalizes incoming records to remove objects/resources so it's easier to dump to various targets * * @author Jordi Boggiano <j.boggiano@seld.be> */ class NormalizerFormatter implements FormatterInterface { const SIMPLE_DATE = "Y-m-d H:i:s"; protected $dateFormat; /** * @param string $dateFormat The format of the timestamp: one supported by DateTime::format */ public function __construct($dateFormat = null) { $this->dateFormat = $dateFormat ?: static::SIMPLE_DATE; if (!function_exists('json_encode')) { throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s NormalizerFormatter'); } } /** * {@inheritdoc} */ public function format(array $record) { return $this->normalize($record); } /** * {@inheritdoc} */ public function formatBatch(array $records) { foreach ($records as $key => $record) { $records[$key] = $this->format($record); } return $records; } protected function normalize($data, $depth = 0) { if ($depth > 9) { return 'Over 9 levels deep, aborting normalization'; } if (null === $data || is_scalar($data)) { if (is_float($data)) { if (is_infinite($data)) { return ($data > 0 ? '' : '-') . 'INF'; } if (is_nan($data)) { return 'NaN'; } } return $data; } if (is_array($data)) { $normalized = array(); $count = 1; foreach ($data as $key => $value) { if ($count++ > 1000) { $normalized['...'] = 'Over 1000 items ('.count($data).' total), aborting normalization'; break; } $normalized[$key] = $this->normalize($value, $depth+1); } return $normalized; } if ($data instanceof \DateTime) { return $data->format($this->dateFormat); } if (is_object($data)) { // TODO 2.0 only check for Throwable if ($data instanceof Exception || (PHP_VERSION_ID > 70000 && $data instanceof \Throwable)) { return $this->normalizeException($data); } // non-serializable objects that implement __toString stringified if (method_exists($data, '__toString') && !$data instanceof \JsonSerializable) { $value = $data->__toString(); } else { // the rest is json-serialized in some way $value = $this->toJson($data, true); } return sprintf("[object] (%s: %s)", Utils::getClass($data), $value); } if (is_resource($data)) { return sprintf('[resource] (%s)', get_resource_type($data)); } return '[unknown('.gettype($data).')]'; } protected function normalizeException($e) { // TODO 2.0 only check for Throwable if (!$e instanceof Exception && !$e instanceof \Throwable) { throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.Utils::getClass($e)); } $data = array( 'class' => Utils::getClass($e), 'message' => $e->getMessage(), 'code' => $e->getCode(), 'file' => $e->getFile().':'.$e->getLine(), ); if ($e instanceof \SoapFault) { if (isset($e->faultcode)) { $data['faultcode'] = $e->faultcode; } if (isset($e->faultactor)) { $data['faultactor'] = $e->faultactor; } if (isset($e->detail)) { $data['detail'] = $e->detail; } } $trace = $e->getTrace(); foreach ($trace as $frame) { if (isset($frame['file'])) { $data['trace'][] = $frame['file'].':'.$frame['line']; } elseif (isset($frame['function']) && $frame['function'] === '{closure}') { // Simplify closures handling $data['trace'][] = $frame['function']; } else { if (isset($frame['args'])) { // Make sure that objects present as arguments are not serialized nicely but rather only // as a class name to avoid any unexpected leak of sensitive information $frame['args'] = array_map(function ($arg) { if (is_object($arg) && !($arg instanceof \DateTime || $arg instanceof \DateTimeInterface)) { return sprintf("[object] (%s)", Utils::getClass($arg)); } return $arg; }, $frame['args']); } // We should again normalize the frames, because it might contain invalid items $data['trace'][] = $this->toJson($this->normalize($frame), true); } } if ($previous = $e->getPrevious()) { $data['previous'] = $this->normalizeException($previous); } return $data; } /** * Return the JSON representation of a value * * @param mixed $data * @param bool $ignoreErrors * @throws \RuntimeException if encoding fails and errors are not ignored * @return string */ protected function toJson($data, $ignoreErrors = false) { // suppress json_encode errors since it's twitchy with some inputs if ($ignoreErrors) { return @$this->jsonEncode($data); } $json = $this->jsonEncode($data); if ($json === false) { $json = $this->handleJsonError(json_last_error(), $data); } return $json; } /** * @param mixed $data * @return string JSON encoded data or null on failure */ private function jsonEncode($data) { if (version_compare(PHP_VERSION, '5.4.0', '>=')) { return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); } return json_encode($data); } /** * Handle a json_encode failure. * * If the failure is due to invalid string encoding, try to clean the * input and encode again. If the second encoding attempt fails, the * inital error is not encoding related or the input can't be cleaned then * raise a descriptive exception. * * @param int $code return code of json_last_error function * @param mixed $data data that was meant to be encoded * @throws \RuntimeException if failure can't be corrected * @return string JSON encoded data after error correction */ private function handleJsonError($code, $data) { if ($code !== JSON_ERROR_UTF8) { $this->throwEncodeError($code, $data); } if (is_string($data)) { $this->detectAndCleanUtf8($data); } elseif (is_array($data)) { array_walk_recursive($data, array($this, 'detectAndCleanUtf8')); } else { $this->throwEncodeError($code, $data); } $json = $this->jsonEncode($data); if ($json === false) { $this->throwEncodeError(json_last_error(), $data); } return $json; } /** * Throws an exception according to a given code with a customized message * * @param int $code return code of json_last_error function * @param mixed $data data that was meant to be encoded * @throws \RuntimeException */ private function throwEncodeError($code, $data) { switch ($code) { case JSON_ERROR_DEPTH: $msg = 'Maximum stack depth exceeded'; break; case JSON_ERROR_STATE_MISMATCH: $msg = 'Underflow or the modes mismatch'; break; case JSON_ERROR_CTRL_CHAR: $msg = 'Unexpected control character found'; break; case JSON_ERROR_UTF8: $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded'; break; default: $msg = 'Unknown error'; } throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true)); } /** * Detect invalid UTF-8 string characters and convert to valid UTF-8. * * Valid UTF-8 input will be left unmodified, but strings containing * invalid UTF-8 codepoints will be reencoded as UTF-8 with an assumed * original encoding of ISO-8859-15. This conversion may result in * incorrect output if the actual encoding was not ISO-8859-15, but it * will be clean UTF-8 output and will not rely on expensive and fragile * detection algorithms. * * Function converts the input in place in the passed variable so that it * can be used as a callback for array_walk_recursive. * * @param mixed &$data Input to check and convert if needed * @private */ public function detectAndCleanUtf8(&$data) { if (is_string($data) && !preg_match('//u', $data)) { $data = preg_replace_callback( '/[\x80-\xFF]+/', function ($m) { return utf8_encode($m[0]); }, $data ); $data = str_replace( array('¤', '¦', '¨', '´', '¸', '¼', '½', '¾'), array('€', 'Š', 'š', 'Ž', 'ž', 'Œ', 'œ', 'Ÿ'), $data ); } } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; use Monolog\Logger; /** * Serializes a log message according to Wildfire's header requirements * * @author Eric Clemmons (@ericclemmons) <eric@uxdriven.com> * @author Christophe Coevoet <stof@notk.org> * @author Kirill chEbba Chebunin <iam@chebba.org> */ class WildfireFormatter extends NormalizerFormatter { const TABLE = 'table'; /** * Translates Monolog log levels to Wildfire levels. */ private $logLevels = array( Logger::DEBUG => 'LOG', Logger::INFO => 'INFO', Logger::NOTICE => 'INFO', Logger::WARNING => 'WARN', Logger::ERROR => 'ERROR', Logger::CRITICAL => 'ERROR', Logger::ALERT => 'ERROR', Logger::EMERGENCY => 'ERROR', ); /** * {@inheritdoc} */ public function format(array $record) { // Retrieve the line and file if set and remove them from the formatted extra $file = $line = ''; if (isset($record['extra']['file'])) { $file = $record['extra']['file']; unset($record['extra']['file']); } if (isset($record['extra']['line'])) { $line = $record['extra']['line']; unset($record['extra']['line']); } $record = $this->normalize($record); $message = array('message' => $record['message']); $handleError = false; if ($record['context']) { $message['context'] = $record['context']; $handleError = true; } if ($record['extra']) { $message['extra'] = $record['extra']; $handleError = true; } if (count($message) === 1) { $message = reset($message); } if (isset($record['context'][self::TABLE])) { $type = 'TABLE'; $label = $record['channel'] .': '. $record['message']; $message = $record['context'][self::TABLE]; } else { $type = $this->logLevels[$record['level']]; $label = $record['channel']; } // Create JSON object describing the appearance of the message in the console $json = $this->toJson(array( array( 'Type' => $type, 'File' => $file, 'Line' => $line, 'Label' => $label, ), $message, ), $handleError); // The message itself is a serialization of the above JSON object + it's length return sprintf( '%s|%s|', strlen($json), $json ); } public function formatBatch(array $records) { throw new \BadMethodCallException('Batch formatting does not make sense for the WildfireFormatter'); } protected function normalize($data, $depth = 0) { if (is_object($data) && !$data instanceof \DateTime) { return $data; } return parent::normalize($data, $depth); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; /** * Formats data into an associative array of scalar values. * Objects and arrays will be JSON encoded. * * @author Andrew Lawson <adlawson@gmail.com> */ class ScalarFormatter extends NormalizerFormatter { /** * {@inheritdoc} */ public function format(array $record) { foreach ($record as $key => $value) { $record[$key] = $this->normalizeValue($value); } return $record; } /** * @param mixed $value * @return mixed */ protected function normalizeValue($value) { $normalized = $this->normalize($value); if (is_array($normalized) || is_object($normalized)) { return $this->toJson($normalized, true); } return $normalized; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; use Monolog\Logger; /** * Formats incoming records into an HTML table * * This is especially useful for html email logging * * @author Tiago Brito <tlfbrito@gmail.com> */ class HtmlFormatter extends NormalizerFormatter { /** * Translates Monolog log levels to html color priorities. */ protected $logLevels = array( Logger::DEBUG => '#cccccc', Logger::INFO => '#468847', Logger::NOTICE => '#3a87ad', Logger::WARNING => '#c09853', Logger::ERROR => '#f0ad4e', Logger::CRITICAL => '#FF7708', Logger::ALERT => '#C12A19', Logger::EMERGENCY => '#000000', ); /** * @param string $dateFormat The format of the timestamp: one supported by DateTime::format */ public function __construct($dateFormat = null) { parent::__construct($dateFormat); } /** * Creates an HTML table row * * @param string $th Row header content * @param string $td Row standard cell content * @param bool $escapeTd false if td content must not be html escaped * @return string */ protected function addRow($th, $td = ' ', $escapeTd = true) { $th = htmlspecialchars($th, ENT_NOQUOTES, 'UTF-8'); if ($escapeTd) { $td = '<pre>'.htmlspecialchars($td, ENT_NOQUOTES, 'UTF-8').'</pre>'; } return "<tr style=\"padding: 4px;text-align: left;\">\n<th style=\"vertical-align: top;background: #ccc;color: #000\" width=\"100\">$th:</th>\n<td style=\"padding: 4px;text-align: left;vertical-align: top;background: #eee;color: #000\">".$td."</td>\n</tr>"; } /** * Create a HTML h1 tag * * @param string $title Text to be in the h1 * @param int $level Error level * @return string */ protected function addTitle($title, $level) { $title = htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8'); return '<h1 style="background: '.$this->logLevels[$level].';color: #ffffff;padding: 5px;" class="monolog-output">'.$title.'</h1>'; } /** * Formats a log record. * * @param array $record A record to format * @return mixed The formatted record */ public function format(array $record) { $output = $this->addTitle($record['level_name'], $record['level']); $output .= '<table cellspacing="1" width="100%" class="monolog-output">'; $output .= $this->addRow('Message', (string) $record['message']); $output .= $this->addRow('Time', $record['datetime']->format($this->dateFormat)); $output .= $this->addRow('Channel', $record['channel']); if ($record['context']) { $embeddedTable = '<table cellspacing="1" width="100%">'; foreach ($record['context'] as $key => $value) { $embeddedTable .= $this->addRow($key, $this->convertToString($value)); } $embeddedTable .= '</table>'; $output .= $this->addRow('Context', $embeddedTable, false); } if ($record['extra']) { $embeddedTable = '<table cellspacing="1" width="100%">'; foreach ($record['extra'] as $key => $value) { $embeddedTable .= $this->addRow($key, $this->convertToString($value)); } $embeddedTable .= '</table>'; $output .= $this->addRow('Extra', $embeddedTable, false); } return $output.'</table>'; } /** * Formats a set of log records. * * @param array $records A set of records to format * @return mixed The formatted set of records */ public function formatBatch(array $records) { $message = ''; foreach ($records as $record) { $message .= $this->format($record); } return $message; } protected function convertToString($data) { if (null === $data || is_scalar($data)) { return (string) $data; } $data = $this->normalize($data); if (version_compare(PHP_VERSION, '5.4.0', '>=')) { return json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); } return str_replace('\\/', '/', json_encode($data)); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; /** * Serializes a log message to Logstash Event Format * * @see http://logstash.net/ * @see https://github.com/logstash/logstash/blob/master/lib/logstash/event.rb * * @author Tim Mower <timothy.mower@gmail.com> */ class LogstashFormatter extends NormalizerFormatter { const V0 = 0; const V1 = 1; /** * @var string the name of the system for the Logstash log message, used to fill the @source field */ protected $systemName; /** * @var string an application name for the Logstash log message, used to fill the @type field */ protected $applicationName; /** * @var string a prefix for 'extra' fields from the Monolog record (optional) */ protected $extraPrefix; /** * @var string a prefix for 'context' fields from the Monolog record (optional) */ protected $contextPrefix; /** * @var int logstash format version to use */ protected $version; /** * @param string $applicationName the application that sends the data, used as the "type" field of logstash * @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine * @param string $extraPrefix prefix for extra keys inside logstash "fields" * @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_ * @param int $version the logstash format version to use, defaults to 0 */ public function __construct($applicationName, $systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $version = self::V0) { // logstash requires a ISO 8601 format date with optional millisecond precision. parent::__construct('Y-m-d\TH:i:s.uP'); $this->systemName = $systemName ?: gethostname(); $this->applicationName = $applicationName; $this->extraPrefix = $extraPrefix; $this->contextPrefix = $contextPrefix; $this->version = $version; } /** * {@inheritdoc} */ public function format(array $record) { $record = parent::format($record); if ($this->version === self::V1) { $message = $this->formatV1($record); } else { $message = $this->formatV0($record); } return $this->toJson($message) . "\n"; } protected function formatV0(array $record) { if (empty($record['datetime'])) { $record['datetime'] = gmdate('c'); } $message = array( '@timestamp' => $record['datetime'], '@source' => $this->systemName, '@fields' => array(), ); if (isset($record['message'])) { $message['@message'] = $record['message']; } if (isset($record['channel'])) { $message['@tags'] = array($record['channel']); $message['@fields']['channel'] = $record['channel']; } if (isset($record['level'])) { $message['@fields']['level'] = $record['level']; } if ($this->applicationName) { $message['@type'] = $this->applicationName; } if (isset($record['extra']['server'])) { $message['@source_host'] = $record['extra']['server']; } if (isset($record['extra']['url'])) { $message['@source_path'] = $record['extra']['url']; } if (!empty($record['extra'])) { foreach ($record['extra'] as $key => $val) { $message['@fields'][$this->extraPrefix . $key] = $val; } } if (!empty($record['context'])) { foreach ($record['context'] as $key => $val) { $message['@fields'][$this->contextPrefix . $key] = $val; } } return $message; } protected function formatV1(array $record) { if (empty($record['datetime'])) { $record['datetime'] = gmdate('c'); } $message = array( '@timestamp' => $record['datetime'], '@version' => 1, 'host' => $this->systemName, ); if (isset($record['message'])) { $message['message'] = $record['message']; } if (isset($record['channel'])) { $message['type'] = $record['channel']; $message['channel'] = $record['channel']; } if (isset($record['level_name'])) { $message['level'] = $record['level_name']; } if ($this->applicationName) { $message['type'] = $this->applicationName; } if (!empty($record['extra'])) { foreach ($record['extra'] as $key => $val) { $message[$this->extraPrefix . $key] = $val; } } if (!empty($record['context'])) { foreach ($record['context'] as $key => $val) { $message[$this->contextPrefix . $key] = $val; } } return $message; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; /** * Class FluentdFormatter * * Serializes a log message to Fluentd unix socket protocol * * Fluentd config: * * <source> * type unix * path /var/run/td-agent/td-agent.sock * </source> * * Monolog setup: * * $logger = new Monolog\Logger('fluent.tag'); * $fluentHandler = new Monolog\Handler\SocketHandler('unix:///var/run/td-agent/td-agent.sock'); * $fluentHandler->setFormatter(new Monolog\Formatter\FluentdFormatter()); * $logger->pushHandler($fluentHandler); * * @author Andrius Putna <fordnox@gmail.com> */ class FluentdFormatter implements FormatterInterface { /** * @var bool $levelTag should message level be a part of the fluentd tag */ protected $levelTag = false; public function __construct($levelTag = false) { if (!function_exists('json_encode')) { throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s FluentdUnixFormatter'); } $this->levelTag = (bool) $levelTag; } public function isUsingLevelsInTag() { return $this->levelTag; } public function format(array $record) { $tag = $record['channel']; if ($this->levelTag) { $tag .= '.' . strtolower($record['level_name']); } $message = array( 'message' => $record['message'], 'context' => $record['context'], 'extra' => $record['extra'], ); if (!$this->levelTag) { $message['level'] = $record['level']; $message['level_name'] = $record['level_name']; } return json_encode(array($tag, $record['datetime']->getTimestamp(), $message)); } public function formatBatch(array $records) { $message = ''; foreach ($records as $record) { $message .= $this->format($record); } return $message; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; use Monolog\Utils; /** * Formats incoming records into a one-line string * * This is especially useful for logging to files * * @author Jordi Boggiano <j.boggiano@seld.be> * @author Christophe Coevoet <stof@notk.org> */ class LineFormatter extends NormalizerFormatter { const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"; protected $format; protected $allowInlineLineBreaks; protected $ignoreEmptyContextAndExtra; protected $includeStacktraces; /** * @param string $format The format of the message * @param string $dateFormat The format of the timestamp: one supported by DateTime::format * @param bool $allowInlineLineBreaks Whether to allow inline line breaks in log entries * @param bool $ignoreEmptyContextAndExtra */ public function __construct($format = null, $dateFormat = null, $allowInlineLineBreaks = false, $ignoreEmptyContextAndExtra = false) { $this->format = $format ?: static::SIMPLE_FORMAT; $this->allowInlineLineBreaks = $allowInlineLineBreaks; $this->ignoreEmptyContextAndExtra = $ignoreEmptyContextAndExtra; parent::__construct($dateFormat); } public function includeStacktraces($include = true) { $this->includeStacktraces = $include; if ($this->includeStacktraces) { $this->allowInlineLineBreaks = true; } } public function allowInlineLineBreaks($allow = true) { $this->allowInlineLineBreaks = $allow; } public function ignoreEmptyContextAndExtra($ignore = true) { $this->ignoreEmptyContextAndExtra = $ignore; } /** * {@inheritdoc} */ public function format(array $record) { $vars = parent::format($record); $output = $this->format; foreach ($vars['extra'] as $var => $val) { if (false !== strpos($output, '%extra.'.$var.'%')) { $output = str_replace('%extra.'.$var.'%', $this->stringify($val), $output); unset($vars['extra'][$var]); } } foreach ($vars['context'] as $var => $val) { if (false !== strpos($output, '%context.'.$var.'%')) { $output = str_replace('%context.'.$var.'%', $this->stringify($val), $output); unset($vars['context'][$var]); } } if ($this->ignoreEmptyContextAndExtra) { if (empty($vars['context'])) { unset($vars['context']); $output = str_replace('%context%', '', $output); } if (empty($vars['extra'])) { unset($vars['extra']); $output = str_replace('%extra%', '', $output); } } foreach ($vars as $var => $val) { if (false !== strpos($output, '%'.$var.'%')) { $output = str_replace('%'.$var.'%', $this->stringify($val), $output); } } // remove leftover %extra.xxx% and %context.xxx% if any if (false !== strpos($output, '%')) { $output = preg_replace('/%(?:extra|context)\..+?%/', '', $output); } return $output; } public function formatBatch(array $records) { $message = ''; foreach ($records as $record) { $message .= $this->format($record); } return $message; } public function stringify($value) { return $this->replaceNewlines($this->convertToString($value)); } protected function normalizeException($e) { // TODO 2.0 only check for Throwable if (!$e instanceof \Exception && !$e instanceof \Throwable) { throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.Utils::getClass($e)); } $previousText = ''; if ($previous = $e->getPrevious()) { do { $previousText .= ', '.Utils::getClass($previous).'(code: '.$previous->getCode().'): '.$previous->getMessage().' at '.$previous->getFile().':'.$previous->getLine(); } while ($previous = $previous->getPrevious()); } $str = '[object] ('.Utils::getClass($e).'(code: '.$e->getCode().'): '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().$previousText.')'; if ($this->includeStacktraces) { $str .= "\n[stacktrace]\n".$e->getTraceAsString()."\n"; } return $str; } protected function convertToString($data) { if (null === $data || is_bool($data)) { return var_export($data, true); } if (is_scalar($data)) { return (string) $data; } if (version_compare(PHP_VERSION, '5.4.0', '>=')) { return $this->toJson($data, true); } return str_replace('\\/', '/', @json_encode($data)); } protected function replaceNewlines($str) { if ($this->allowInlineLineBreaks) { if (0 === strpos($str, '{')) { return str_replace(array('\r', '\n'), array("\r", "\n"), $str); } return $str; } return str_replace(array("\r\n", "\r", "\n"), ' ', $str); } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; use Exception; use Monolog\Utils; use Throwable; /** * Encodes whatever record data is passed to it as json * * This can be useful to log to databases or remote APIs * * @author Jordi Boggiano <j.boggiano@seld.be> */ class JsonFormatter extends NormalizerFormatter { const BATCH_MODE_JSON = 1; const BATCH_MODE_NEWLINES = 2; protected $batchMode; protected $appendNewline; /** * @var bool */ protected $includeStacktraces = false; /** * @param int $batchMode * @param bool $appendNewline */ public function __construct($batchMode = self::BATCH_MODE_JSON, $appendNewline = true) { $this->batchMode = $batchMode; $this->appendNewline = $appendNewline; } /** * The batch mode option configures the formatting style for * multiple records. By default, multiple records will be * formatted as a JSON-encoded array. However, for * compatibility with some API endpoints, alternative styles * are available. * * @return int */ public function getBatchMode() { return $this->batchMode; } /** * True if newlines are appended to every formatted record * * @return bool */ public function isAppendingNewlines() { return $this->appendNewline; } /** * {@inheritdoc} */ public function format(array $record) { return $this->toJson($this->normalize($record), true) . ($this->appendNewline ? "\n" : ''); } /** * {@inheritdoc} */ public function formatBatch(array $records) { switch ($this->batchMode) { case static::BATCH_MODE_NEWLINES: return $this->formatBatchNewlines($records); case static::BATCH_MODE_JSON: default: return $this->formatBatchJson($records); } } /** * @param bool $include */ public function includeStacktraces($include = true) { $this->includeStacktraces = $include; } /** * Return a JSON-encoded array of records. * * @param array $records * @return string */ protected function formatBatchJson(array $records) { return $this->toJson($this->normalize($records), true); } /** * Use new lines to separate records instead of a * JSON-encoded array. * * @param array $records * @return string */ protected function formatBatchNewlines(array $records) { $instance = $this; $oldNewline = $this->appendNewline; $this->appendNewline = false; array_walk($records, function (&$value, $key) use ($instance) { $value = $instance->format($value); }); $this->appendNewline = $oldNewline; return implode("\n", $records); } /** * Normalizes given $data. * * @param mixed $data * * @return mixed */ protected function normalize($data, $depth = 0) { if ($depth > 9) { return 'Over 9 levels deep, aborting normalization'; } if (is_array($data) || $data instanceof \Traversable) { $normalized = array(); $count = 1; foreach ($data as $key => $value) { if ($count++ > 1000) { $normalized['...'] = 'Over 1000 items ('.count($data).' total), aborting normalization'; break; } $normalized[$key] = $this->normalize($value, $depth+1); } return $normalized; } if ($data instanceof Exception || $data instanceof Throwable) { return $this->normalizeException($data); } return $data; } /** * Normalizes given exception with or without its own stack trace based on * `includeStacktraces` property. * * @param Exception|Throwable $e * * @return array */ protected function normalizeException($e) { // TODO 2.0 only check for Throwable if (!$e instanceof Exception && !$e instanceof Throwable) { throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.Utils::getClass($e)); } $data = array( 'class' => Utils::getClass($e), 'message' => $e->getMessage(), 'code' => $e->getCode(), 'file' => $e->getFile().':'.$e->getLine(), ); if ($this->includeStacktraces) { $trace = $e->getTrace(); foreach ($trace as $frame) { if (isset($frame['file'])) { $data['trace'][] = $frame['file'].':'.$frame['line']; } elseif (isset($frame['function']) && $frame['function'] === '{closure}') { // We should again normalize the frames, because it might contain invalid items $data['trace'][] = $frame['function']; } else { // We should again normalize the frames, because it might contain invalid items $data['trace'][] = $this->normalize($frame); } } } if ($previous = $e->getPrevious()) { $data['previous'] = $this->normalizeException($previous); } return $data; } } <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog; class Utils { /** * @internal */ public static function getClass($object) { $class = \get_class($object); return 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).'@anonymous' : $class; } } { "name": "amphp/amp", "homepage": "http://amphp.org/amp", "description": "A non-blocking concurrency framework for PHP applications.", "keywords": [ "async", "asynchronous", "concurrency", "promise", "awaitable", "future", "non-blocking", "event", "event-loop" ], "license": "MIT", "authors": [ { "name": "Daniel Lowrey", "email": "rdlowrey@php.net" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" }, { "name": "Bob Weinand", "email": "bobwei9@hotmail.com" }, { "name": "Niklas Keller", "email": "me@kelunik.com" } ], "require": { "php": ">=7" }, "require-dev": { "amphp/phpunit-util": "^1", "react/promise": "^2", "friendsofphp/php-cs-fixer": "^2.3", "phpunit/phpunit": "^6.0.9", "phpstan/phpstan": "^0.8.5" }, "autoload": { "psr-4": { "Amp\\": "lib" }, "files": [ "lib/functions.php", "lib/Internal/functions.php" ] }, "autoload-dev": { "psr-4": { "Amp\\Test\\": "test" } }, "support": { "issues": "https://github.com/amphp/amp/issues", "irc": "irc://irc.freenode.org/amphp" }, "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } }, "config": { "platform": { "php": "7.0.0" } }, "scripts": { "test": "@php -dzend.assertions=1 -dassert.exception=1 ./vendor/bin/phpunit", "code-style": "@php ./vendor/bin/php-cs-fixer fix" } } <?php namespace Amp; /** * A TimeoutCancellationToken automatically requests cancellation after the timeout has elapsed. */ final class TimeoutCancellationToken implements CancellationToken { /** @var string */ private $watcher; /** @var \Amp\CancellationToken */ private $token; /** * @param int $timeout Milliseconds until cancellation is requested. */ public function __construct(int $timeout) { $source = new CancellationTokenSource; $this->token = $source->getToken(); $this->watcher = Loop::delay($timeout, static function () use ($source) { $source->cancel(new TimeoutException); }); Loop::unreference($this->watcher); } /** * Cancels the delay watcher. */ public function __destruct() { Loop::cancel($this->watcher); } /** * {@inheritdoc} */ public function subscribe(callable $callback): string { return $this->token->subscribe($callback); } /** * {@inheritdoc} */ public function unsubscribe(string $id) { $this->token->unsubscribe($id); } /** * {@inheritdoc} */ public function isRequested(): bool { return $this->token->isRequested(); } /** * {@inheritdoc} */ public function throwIfRequested() { $this->token->throwIfRequested(); } } <?php namespace Amp; /** * Will be thrown in case an operation is cancelled. * * @see CancellationToken * @see CancellationTokenSource */ class CancelledException extends \Exception { public function __construct(\Throwable $previous = null) { parent::__construct("The operation was cancelled", 0, $previous); } } <?php namespace Amp; /** * Emitter is a container for an iterator that can emit values using the emit() method and completed using the * complete() and fail() methods of this object. The contained iterator may be accessed using the iterate() * method. This object should not be part of a public API, but used internally to create and emit values to an * iterator. */ final class Emitter { /** @var object Has public emit, complete, and fail methods. */ private $emitter; /** @var \Amp\Iterator Hides producer methods. */ private $iterator; public function __construct() { $this->emitter = new class implements Iterator { use Internal\Producer { emit as public; complete as public; fail as public; } }; $this->iterator = new Internal\PrivateIterator($this->emitter); } /** * @return \Amp\Promise */ public function iterate(): Iterator { return $this->iterator; } /** * Emits a value to the iterator. * * @param mixed $value * * @return \Amp\Promise */ public function emit($value): Promise { return $this->emitter->emit($value); } /** * Completes the iterator. */ public function complete() { $this->emitter->complete(); } /** * Fails the iterator with the given reason. * * @param \Throwable $reason */ public function fail(\Throwable $reason) { $this->emitter->fail($reason); } } <?php namespace Amp; /** * Defines an asynchronous iterator over a set of values that is designed to be used within a coroutine. */ interface Iterator { /** * Succeeds with true if an emitted value is available by calling getCurrent() or false if the iterator has * resolved. If the iterator fails, the returned promise will fail with the same exception. * * @return \Amp\Promise<bool> * * @throws \Error If the prior promise returned from this method has not resolved. * @throws \Throwable The exception used to fail the iterator. */ public function advance(): Promise; /** * Gets the last emitted value or throws an exception if the iterator has completed. * * @return mixed Value emitted from the iterator. * * @throws \Error If the iterator has resolved or advance() was not called before calling this method. * @throws \Throwable The exception used to fail the iterator. */ public function getCurrent(); } <?php namespace Amp; /** * Thrown if a promise doesn't resolve within a specified timeout. * * @see \Amp\Promise\timeout() */ class TimeoutException extends \Exception { /** * @param string|null $message Exception message. */ public function __construct(string $message = "Operation timed out") { parent::__construct($message); } } <?php namespace Amp; final class Producer implements Iterator { use CallableMaker, Internal\Producer; /** * @param callable(callable(mixed $value): Promise $emit): \Generator $producer * * @throws \Error Thrown if the callable does not return a Generator. */ public function __construct(callable $producer) { $result = $producer($this->callableFromInstanceMethod("emit")); if (!$result instanceof \Generator) { throw new \Error("The callable did not return a Generator"); } $coroutine = new Coroutine($result); $coroutine->onResolve(function ($exception) { if ($this->complete) { return; } if ($exception) { $this->fail($exception); return; } $this->complete(); }); } } <?php namespace Amp; use Amp\Loop\Driver; use Amp\Loop\DriverFactory; use Amp\Loop\InvalidWatcherError; use Amp\Loop\UnsupportedFeatureException; use Amp\Loop\Watcher; /** * Accessor to allow global access to the event loop. * * @see \Amp\Loop\Driver */ final class Loop { /** * @var Driver */ private static $driver; /** * Disable construction as this is a static class. */ private function __construct() { // intentionally left blank } /** * Sets the driver to be used for `Loop::run()`. * * @param Driver $driver */ public static function set(Driver $driver) { try { self::$driver = new class extends Driver { protected function activate(array $watchers) { throw new \Error("Can't activate watcher during garbage collection."); } protected function dispatch(bool $blocking) { throw new \Error("Can't dispatch during garbage collection."); } protected function deactivate(Watcher $watcher) { // do nothing } public function getHandle() { return null; } }; \gc_collect_cycles(); } finally { self::$driver = $driver; } } /** * Run the event loop and optionally execute a callback within the scope of it. * * The loop MUST continue to run until it is either stopped explicitly, no referenced watchers exist anymore, or an * exception is thrown that cannot be handled. Exceptions that cannot be handled are exceptions thrown from an * error handler or exceptions that would be passed to an error handler but none exists to handle them. * * @param callable|null $callback The callback to execute. * * @return void */ public static function run(callable $callback = null) { if ($callback) { self::$driver->defer($callback); } self::$driver->run(); } /** * Stop the event loop. * * When an event loop is stopped, it continues with its current tick and exits the loop afterwards. Multiple calls * to stop MUST be ignored and MUST NOT raise an exception. * * @return void */ public static function stop() { self::$driver->stop(); } /** * Defer the execution of a callback. * * The deferred callable MUST be executed before any other type of watcher in a tick. Order of enabling MUST be * preserved when executing the callbacks. * * The created watcher MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) * right before the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * @param callable(string $watcherId, mixed $data) $callback The callback to defer. The `$watcherId` will be * invalidated before the callback call. * @param mixed $data Arbitrary data given to the callback function as the `$data` parameter. * * @return string An unique identifier that can be used to cancel, enable or disable the watcher. */ public static function defer(callable $callback, $data = null): string { return self::$driver->defer($callback, $data); } /** * Delay the execution of a callback. * * The delay is a minimum and approximate, accuracy is not guaranteed. Order of calls MUST be determined by which * timers expire first, but timers with the same expiration time MAY be executed in any order. * * The created watcher MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) * right before the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * @param int $delay The amount of time, in milliseconds, to delay the execution for. * @param callable(string $watcherId, mixed $data) $callback The callback to delay. The `$watcherId` will be * invalidated before the callback call. * @param mixed $data Arbitrary data given to the callback function as the `$data` parameter. * * @return string An unique identifier that can be used to cancel, enable or disable the watcher. */ public static function delay(int $delay, callable $callback, $data = null): string { return self::$driver->delay($delay, $callback, $data); } /** * Repeatedly execute a callback. * * The interval between executions is a minimum and approximate, accuracy is not guaranteed. Order of calls MUST be * determined by which timers expire first, but timers with the same expiration time MAY be executed in any order. * The first execution is scheduled after the first interval period. * * The created watcher MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) * right before the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * @param int $interval The time interval, in milliseconds, to wait between executions. * @param callable(string $watcherId, mixed $data) $callback The callback to repeat. * @param mixed $data Arbitrary data given to the callback function as the `$data` parameter. * * @return string An unique identifier that can be used to cancel, enable or disable the watcher. */ public static function repeat(int $interval, callable $callback, $data = null): string { return self::$driver->repeat($interval, $callback, $data); } /** * Execute a callback when a stream resource becomes readable or is closed for reading. * * Warning: Closing resources locally, e.g. with `fclose`, might not invoke the callback. Be sure to `cancel` the * watcher when closing the resource locally. Drivers MAY choose to notify the user if there are watchers on invalid * resources, but are not required to, due to the high performance impact. Watchers on closed resources are * therefore undefined behavior. * * Multiple watchers on the same stream MAY be executed in any order. * * The created watcher MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) * right before the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * @param resource $stream The stream to monitor. * @param callable(string $watcherId, resource $stream, mixed $data) $callback The callback to execute. * @param mixed $data Arbitrary data given to the callback function as the `$data` parameter. * * @return string An unique identifier that can be used to cancel, enable or disable the watcher. */ public static function onReadable($stream, callable $callback, $data = null): string { return self::$driver->onReadable($stream, $callback, $data); } /** * Execute a callback when a stream resource becomes writable or is closed for writing. * * Warning: Closing resources locally, e.g. with `fclose`, might not invoke the callback. Be sure to `cancel` the * watcher when closing the resource locally. Drivers MAY choose to notify the user if there are watchers on invalid * resources, but are not required to, due to the high performance impact. Watchers on closed resources are * therefore undefined behavior. * * Multiple watchers on the same stream MAY be executed in any order. * * The created watcher MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) * right before the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * @param resource $stream The stream to monitor. * @param callable(string $watcherId, resource $stream, mixed $data) $callback The callback to execute. * @param mixed $data Arbitrary data given to the callback function as the `$data` parameter. * * @return string An unique identifier that can be used to cancel, enable or disable the watcher. */ public static function onWritable($stream, callable $callback, $data = null): string { return self::$driver->onWritable($stream, $callback, $data); } /** * Execute a callback when a signal is received. * * Warning: Installing the same signal on different instances of this interface is deemed undefined behavior. * Implementations MAY try to detect this, if possible, but are not required to. This is due to technical * limitations of the signals being registered globally per process. * * Multiple watchers on the same signal MAY be executed in any order. * * The created watcher MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) * right before the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * @param int $signo The signal number to monitor. * @param callable(string $watcherId, int $signo, mixed $data) $callback The callback to execute. * @param mixed $data Arbitrary data given to the callback function as the $data parameter. * * @return string An unique identifier that can be used to cancel, enable or disable the watcher. * * @throws UnsupportedFeatureException If signal handling is not supported. */ public static function onSignal(int $signo, callable $callback, $data = null): string { return self::$driver->onSignal($signo, $callback, $data); } /** * Enable a watcher to be active starting in the next tick. * * Watchers MUST immediately be marked as enabled, but only be activated (i.e. callbacks can be called) right before * the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * @param string $watcherId The watcher identifier. * * @return void * * @throws InvalidWatcherError If the watcher identifier is invalid. */ public static function enable(string $watcherId) { self::$driver->enable($watcherId); } /** * Disable a watcher immediately. * * A watcher MUST be disabled immediately, e.g. if a defer watcher disables a later defer watcher, the second defer * watcher isn't executed in this tick. * * Disabling a watcher MUST NOT invalidate the watcher. Calling this function MUST NOT fail, even if passed an * invalid watcher. * * @param string $watcherId The watcher identifier. * * @return void */ public static function disable(string $watcherId) { if (\PHP_VERSION_ID < 70200 && !isset(self::$driver)) { // Prior to PHP 7.2, self::$driver may be unset during destruct. // See https://github.com/amphp/amp/issues/212. return; } self::$driver->disable($watcherId); } /** * Cancel a watcher. * * This will detatch the event loop from all resources that are associated to the watcher. After this operation the * watcher is permanently invalid. Calling this function MUST NOT fail, even if passed an invalid watcher. * * @param string $watcherId The watcher identifier. * * @return void */ public static function cancel(string $watcherId) { if (\PHP_VERSION_ID < 70200 && !isset(self::$driver)) { // Prior to PHP 7.2, self::$driver may be unset during destruct. // See https://github.com/amphp/amp/issues/212. return; } self::$driver->cancel($watcherId); } /** * Reference a watcher. * * This will keep the event loop alive whilst the watcher is still being monitored. Watchers have this state by * default. * * @param string $watcherId The watcher identifier. * * @return void * * @throws InvalidWatcherError If the watcher identifier is invalid. */ public static function reference(string $watcherId) { self::$driver->reference($watcherId); } /** * Unreference a watcher. * * The event loop should exit the run method when only unreferenced watchers are still being monitored. Watchers * are all referenced by default. * * @param string $watcherId The watcher identifier. * * @return void */ public static function unreference(string $watcherId) { if (\PHP_VERSION_ID < 70200 && !isset(self::$driver)) { // Prior to PHP 7.2, self::$driver may be unset during destruct. // See https://github.com/amphp/amp/issues/212. return; } self::$driver->unreference($watcherId); } /** * Returns the current loop time in millisecond increments. Note this value does not necessarily correlate to * wall-clock time, rather the value returned is meant to be used in relative comparisons to prior values returned * by this method (intervals, expiration calculations, etc.) and is only updated once per loop tick. * * @return int */ public static function now(): int { return self::$driver->now(); } /** * Stores information in the loop bound registry. * * Stored information is package private. Packages MUST NOT retrieve the stored state of other packages. Packages * MUST use their namespace as prefix for keys. They may do so by using `SomeClass::class` as key. * * If packages want to expose loop bound state to consumers other than the package, they SHOULD provide a dedicated * interface for that purpose instead of sharing the storage key. * * @param string $key The namespaced storage key. * @param mixed $value The value to be stored. * * @return void */ public static function setState(string $key, $value) { self::$driver->setState($key, $value); } /** * Gets information stored bound to the loop. * * Stored information is package private. Packages MUST NOT retrieve the stored state of other packages. Packages * MUST use their namespace as prefix for keys. They may do so by using `SomeClass::class` as key. * * If packages want to expose loop bound state to consumers other than the package, they SHOULD provide a dedicated * interface for that purpose instead of sharing the storage key. * * @param string $key The namespaced storage key. * * @return mixed The previously stored value or `null` if it doesn't exist. */ public static function getState(string $key) { return self::$driver->getState($key); } /** * Set a callback to be executed when an error occurs. * * The callback receives the error as the first and only parameter. The return value of the callback gets ignored. * If it can't handle the error, it MUST throw the error. Errors thrown by the callback or during its invocation * MUST be thrown into the `run` loop and stop the driver. * * Subsequent calls to this method will overwrite the previous handler. * * @param callable(\Throwable $error)|null $callback The callback to execute. `null` will clear the * current handler. * * @return callable(\Throwable $error)|null The previous handler, `null` if there was none. */ public static function setErrorHandler(callable $callback = null) { return self::$driver->setErrorHandler($callback); } /** * Retrieve an associative array of information about the event loop driver. * * The returned array MUST contain the following data describing the driver's currently registered watchers: * * [ * "defer" => ["enabled" => int, "disabled" => int], * "delay" => ["enabled" => int, "disabled" => int], * "repeat" => ["enabled" => int, "disabled" => int], * "on_readable" => ["enabled" => int, "disabled" => int], * "on_writable" => ["enabled" => int, "disabled" => int], * "on_signal" => ["enabled" => int, "disabled" => int], * "enabled_watchers" => ["referenced" => int, "unreferenced" => int], * "running" => bool * ]; * * Implementations MAY optionally add more information in the array but at minimum the above `key => value` format * MUST always be provided. * * @return array Statistics about the loop in the described format. */ public static function getInfo(): array { return self::$driver->getInfo(); } /** * Retrieve the event loop driver that is in scope. * * @return Driver */ public static function get(): Driver { return self::$driver; } } // Default factory, don't move this to a file loaded by the composer "files" autoload mechanism, otherwise custom // implementations might have issues setting a default loop, because it's overridden by us then. // @codeCoverageIgnoreStart Loop::set((new DriverFactory)->create()); // @codeCoverageIgnoreEnd <?php namespace Amp\Internal; use Amp\Coroutine; use Amp\Loop; use Amp\Promise; use React\Promise\PromiseInterface as ReactPromise; /** * Stores a set of functions to be invoked when a promise is resolved. * * @internal */ class ResolutionQueue { /** @var callable[] */ private $queue = []; /** * @param callable|null $callback Initial callback to add to queue. */ public function __construct(callable $callback = null) { if (null !== $callback) { $this->push($callback); } } /** * Unrolls instances of self to avoid blowing up the call stack on resolution. * * @param callable $callback */ public function push(callable $callback) { if ($callback instanceof self) { $this->queue = \array_merge($this->queue, $callback->queue); return; } $this->queue[] = $callback; } /** * Calls each callback in the queue, passing the provided values to the function. * * @param \Throwable|null $exception * @param mixed $value */ public function __invoke($exception, $value) { foreach ($this->queue as $callback) { try { $result = $callback($exception, $value); if ($result === null) { continue; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { Promise\rethrow($result); } } catch (\Throwable $exception) { Loop::defer(static function () use ($exception) { throw $exception; }); } } } } <?php namespace Amp\Internal; use Amp\Deferred; use Amp\Failure; use Amp\Promise; use Amp\Success; use React\Promise\PromiseInterface as ReactPromise; /** * Trait used by Iterator implementations. Do not use this trait in your code, instead compose your class from one of * the available classes implementing \Amp\Iterator. * Note that it is the responsibility of the user of this trait to ensure that listeners have a chance to listen first * before emitting values. * * @internal */ trait Producer { /** @var \Amp\Promise|null */ private $complete; /** @var mixed[] */ private $values = []; /** @var \Amp\Deferred[] */ private $backPressure = []; /** @var int */ private $position = -1; /** @var \Amp\Deferred|null */ private $waiting; /** @var null|array */ private $resolutionTrace; /** * {@inheritdoc} */ public function advance(): Promise { if ($this->waiting !== null) { throw new \Error("The prior promise returned must resolve before invoking this method again"); } if (isset($this->backPressure[$this->position])) { $future = $this->backPressure[$this->position]; unset($this->values[$this->position], $this->backPressure[$this->position]); $future->resolve(); } ++$this->position; if (\array_key_exists($this->position, $this->values)) { return new Success(true); } if ($this->complete) { return $this->complete; } $this->waiting = new Deferred; return $this->waiting->promise(); } /** * {@inheritdoc} */ public function getCurrent() { if (empty($this->values) && $this->complete) { throw new \Error("The iterator has completed"); } if (!\array_key_exists($this->position, $this->values)) { throw new \Error("Promise returned from advance() must resolve before calling this method"); } return $this->values[$this->position]; } /** * Emits a value from the iterator. The returned promise is resolved with the emitted value once all listeners * have been invoked. * * @param mixed $value * * @return \Amp\Promise * * @throws \Error If the iterator has completed. */ private function emit($value): Promise { if ($this->complete) { throw new \Error("Iterators cannot emit values after calling complete"); } if ($value instanceof ReactPromise) { $value = Promise\adapt($value); } if ($value instanceof Promise) { $deferred = new Deferred; $value->onResolve(function ($e, $v) use ($deferred) { if ($this->complete) { $deferred->fail( new \Error("The iterator was completed before the promise result could be emitted") ); return; } if ($e) { $this->fail($e); $deferred->fail($e); return; } $deferred->resolve($this->emit($v)); }); return $deferred->promise(); } $this->values[] = $value; $this->backPressure[] = $pressure = new Deferred; if ($this->waiting !== null) { $waiting = $this->waiting; $this->waiting = null; $waiting->resolve(true); } return $pressure->promise(); } /** * Completes the iterator. * * @throws \Error If the iterator has already been completed. */ private function complete() { if ($this->complete) { $message = "Iterator has already been completed"; if (isset($this->resolutionTrace)) { $trace = formatStacktrace($this->resolutionTrace); $message .= ". Previous completion trace:\n\n{$trace}\n\n"; } else { // @codeCoverageIgnoreStart $message .= ", define environment variable AMP_DEBUG or const AMP_DEBUG = true and enable assertions " . "for a stacktrace of the previous resolution."; // @codeCoverageIgnoreEnd } throw new \Error($message); } \assert((function () { $env = \getenv("AMP_DEBUG") ?: "0"; if (($env !== "0" && $env !== "false") || (\defined("AMP_DEBUG") && \AMP_DEBUG)) { $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS); \array_shift($trace); // remove current closure $this->resolutionTrace = $trace; } return true; })()); $this->complete = new Success(false); if ($this->waiting !== null) { $waiting = $this->waiting; $this->waiting = null; $waiting->resolve($this->complete); } } private function fail(\Throwable $exception) { $this->complete = new Failure($exception); if ($this->waiting !== null) { $waiting = $this->waiting; $this->waiting = null; $waiting->resolve($this->complete); } } } <?php namespace Amp\Internal; use Amp\Promise; /** * Wraps a Promise instance that has public methods to resolve and fail the promise into an object that only allows * access to the public API methods. */ class PrivatePromise implements Promise { /** @var \Amp\Promise */ private $promise; public function __construct(Promise $promise) { $this->promise = $promise; } public function onResolve(callable $onResolved) { $this->promise->onResolve($onResolved); } } <?php namespace Amp\Internal; /** * Formats a stacktrace obtained via `debug_backtrace()`. * * @param array $trace Output of `debug_backtrace()`. * * @return string Formatted stacktrace. * * @codeCoverageIgnore * @internal */ function formatStacktrace(array $trace): string { return \implode("\n", \array_map(function ($e, $i) { $line = "#{$i} "; if (isset($e["file"])) { $line .= "{$e['file']}:{$e['line']} "; } if (isset($e["type"])) { $line .= $e["class"] . $e["type"]; } return $line . $e["function"] . "()"; }, $trace, \array_keys($trace))); } /** * Creates a `TypeError` with a standardized error message. * * @param string[] $expected Expected types. * @param mixed $given Given value. * * @return \TypeError * * @internal */ function createTypeError(array $expected, $given): \TypeError { $givenType = \is_object($given) ? \sprintf("instance of %s", \get_class($given)) : \gettype($given); if (\count($expected) === 1) { $expectedType = "Expected the following type: " . \array_pop($expected); } else { $expectedType = "Expected one of the following types: " . \implode(", ", $expected); } return new \TypeError("{$expectedType}; {$givenType} given"); } /** * Returns the current time relative to an arbitrary point in time. * * @return int Time in milliseconds. */ function getCurrentTime(): int { if (\PHP_VERSION_ID >= 70300) { list($seconds, $nanoseconds) = \hrtime(false); return $seconds * 1000 + $nanoseconds / 1000000; } return (int) (\microtime(true) * 1000); } <?php namespace Amp\Internal; use Amp\Coroutine; use Amp\Failure; use Amp\Loop; use Amp\Promise; use React\Promise\PromiseInterface as ReactPromise; /** * Trait used by Promise implementations. Do not use this trait in your code, instead compose your class from one of * the available classes implementing \Amp\Promise. * * @internal */ trait Placeholder { /** @var bool */ private $resolved = false; /** @var mixed */ private $result; /** @var callable|\Amp\Internal\ResolutionQueue|null */ private $onResolved; /** @var null|array */ private $resolutionTrace; /** * @inheritdoc */ public function onResolve(callable $onResolved) { if ($this->resolved) { if ($this->result instanceof Promise) { $this->result->onResolve($onResolved); return; } try { $result = $onResolved(null, $this->result); if ($result === null) { return; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { Promise\rethrow($result); } } catch (\Throwable $exception) { Loop::defer(static function () use ($exception) { throw $exception; }); } return; } if (null === $this->onResolved) { $this->onResolved = $onResolved; return; } if (!$this->onResolved instanceof ResolutionQueue) { $this->onResolved = new ResolutionQueue($this->onResolved); } $this->onResolved->push($onResolved); } /** * @param mixed $value * * @throws \Error Thrown if the promise has already been resolved. */ private function resolve($value = null) { if ($this->resolved) { $message = "Promise has already been resolved"; if (isset($this->resolutionTrace)) { $trace = formatStacktrace($this->resolutionTrace); $message .= ". Previous resolution trace:\n\n{$trace}\n\n"; } else { // @codeCoverageIgnoreStart $message .= ", define environment variable AMP_DEBUG or const AMP_DEBUG = true and enable assertions " . "for a stacktrace of the previous resolution."; // @codeCoverageIgnoreEnd } throw new \Error($message); } \assert((function () { $env = \getenv("AMP_DEBUG") ?: "0"; if (($env !== "0" && $env !== "false") || (\defined("AMP_DEBUG") && \AMP_DEBUG)) { $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS); \array_shift($trace); // remove current closure $this->resolutionTrace = $trace; } return true; })()); if ($value instanceof ReactPromise) { $value = Promise\adapt($value); } $this->resolved = true; $this->result = $value; if ($this->onResolved === null) { return; } $onResolved = $this->onResolved; $this->onResolved = null; if ($this->result instanceof Promise) { $this->result->onResolve($onResolved); return; } try { $result = $onResolved(null, $this->result); if ($result === null) { return; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { Promise\rethrow($result); } } catch (\Throwable $exception) { Loop::defer(static function () use ($exception) { throw $exception; }); } } /** * @param \Throwable $reason Failure reason. */ private function fail(\Throwable $reason) { $this->resolve(new Failure($reason)); } } <?php namespace Amp\Internal; use Amp\Iterator; use Amp\Promise; /** * Wraps an Iterator instance that has public methods to emit, complete, and fail into an object that only allows * access to the public API methods. */ class PrivateIterator implements Iterator { /** @var \Amp\Iterator */ private $iterator; public function __construct(Iterator $iterator) { $this->iterator = $iterator; } public function advance(): Promise { return $this->iterator->advance(); } public function getCurrent() { return $this->iterator->getCurrent(); } } <?php namespace Amp\Loop; use Amp\Struct; class Watcher { use Struct; const IO = 0b00000011; const READABLE = 0b00000001; const WRITABLE = 0b00000010; const DEFER = 0b00000100; const TIMER = 0b00011000; const DELAY = 0b00001000; const REPEAT = 0b00010000; const SIGNAL = 0b00100000; /** @var int */ public $type; /** @var bool */ public $enabled = true; /** @var bool */ public $referenced = true; /** @var string */ public $id; /** @var callable */ public $callback; /** * Data provided to the watcher callback. * * @var mixed */ public $data; /** * Watcher-dependent value storage. Stream for IO watchers, signal number for signal watchers, interval for timers. * * @var mixed */ public $value; } <?php namespace Amp\Loop; /** * MUST be thrown if any operation (except disable() and cancel()) is attempted with an invalid watcher identifier. * * An invalid watcher identifier is any identifier that is not yet emitted by the driver or cancelled by the user. */ class InvalidWatcherError extends \Error { /** @var string */ private $watcherId; /** * @param string $watcherId The watcher identifier. * @param string|null $message The exception message. */ public function __construct(string $watcherId, string $message) { $this->watcherId = $watcherId; parent::__construct($message); } /** * @return string The watcher identifier. */ public function getWatcherId() { return $this->watcherId; } } <?php namespace Amp\Loop; use Amp\Coroutine; use Amp\Promise; use React\Promise\PromiseInterface as ReactPromise; use function Amp\Internal\getCurrentTime; use function Amp\Promise\rethrow; class EvDriver extends Driver { /** @var \EvSignal[]|null */ private static $activeSignals; /** @var \EvLoop */ private $handle; /** @var \EvWatcher[] */ private $events = []; /** @var callable */ private $ioCallback; /** @var callable */ private $timerCallback; /** @var callable */ private $signalCallback; /** @var \EvSignal[] */ private $signals = []; /** @var int Internal timestamp for now. */ private $now; /** @var bool */ private $nowUpdateNeeded = false; /** @var int Loop time offset */ private $nowOffset; public function __construct() { $this->handle = new \EvLoop; $this->nowOffset = getCurrentTime(); $this->now = \random_int(0, $this->nowOffset); $this->nowOffset -= $this->now; if (self::$activeSignals === null) { self::$activeSignals = &$this->signals; } $this->ioCallback = function (\EvIO $event) { /** @var \Amp\Loop\Watcher $watcher */ $watcher = $event->data; try { $result = ($watcher->callback)($watcher->id, $watcher->value, $watcher->data); if ($result === null) { return; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { $this->error($exception); } }; $this->timerCallback = function (\EvTimer $event) { /** @var \Amp\Loop\Watcher $watcher */ $watcher = $event->data; if ($watcher->type & Watcher::DELAY) { $this->cancel($watcher->id); } elseif ($watcher->value === 0) { // Disable and re-enable so it's not executed repeatedly in the same tick // See https://github.com/amphp/amp/issues/131 $this->disable($watcher->id); $this->enable($watcher->id); } try { $result = ($watcher->callback)($watcher->id, $watcher->data); if ($result === null) { return; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { $this->error($exception); } }; $this->signalCallback = function (\EvSignal $event) { /** @var \Amp\Loop\Watcher $watcher */ $watcher = $event->data; try { $result = ($watcher->callback)($watcher->id, $watcher->value, $watcher->data); if ($result === null) { return; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { $this->error($exception); } }; } /** * {@inheritdoc} */ public function cancel(string $watcherId) { parent::cancel($watcherId); unset($this->events[$watcherId]); } public static function isSupported(): bool { return \extension_loaded("ev"); } public function __destruct() { foreach ($this->events as $event) { if ($event !== null) { // Events may have been nulled in extension depending on destruct order. $event->stop(); } } // We need to clear all references to events manually, see // https://bitbucket.org/osmanov/pecl-ev/issues/31/segfault-in-ev_timer_stop $this->events = []; } /** * {@inheritdoc} */ public function run() { $active = self::$activeSignals; foreach ($active as $event) { $event->stop(); } self::$activeSignals = &$this->signals; foreach ($this->signals as $event) { $event->start(); } try { parent::run(); } finally { foreach ($this->signals as $event) { $event->stop(); } self::$activeSignals = &$active; foreach ($active as $event) { $event->start(); } } } /** * {@inheritdoc} */ public function stop() { $this->handle->stop(); parent::stop(); } /** * {@inheritdoc} */ public function now(): int { if ($this->nowUpdateNeeded) { $this->now = getCurrentTime() - $this->nowOffset; $this->nowUpdateNeeded = false; } return $this->now; } /** * {@inheritdoc} */ public function getHandle(): \EvLoop { return $this->handle; } /** * {@inheritdoc} */ protected function dispatch(bool $blocking) { $this->nowUpdateNeeded = true; $this->handle->run($blocking ? \Ev::RUN_ONCE : \Ev::RUN_ONCE | \Ev::RUN_NOWAIT); } /** * {@inheritdoc} */ protected function activate(array $watchers) { foreach ($watchers as $watcher) { if (!isset($this->events[$id = $watcher->id])) { switch ($watcher->type) { case Watcher::READABLE: $this->events[$id] = $this->handle->io($watcher->value, \Ev::READ, $this->ioCallback, $watcher); break; case Watcher::WRITABLE: $this->events[$id] = $this->handle->io($watcher->value, \Ev::WRITE, $this->ioCallback, $watcher); break; case Watcher::DELAY: case Watcher::REPEAT: $interval = $watcher->value / self::MILLISEC_PER_SEC; $this->events[$id] = $this->handle->timer( $interval, $watcher->type & Watcher::REPEAT ? $interval : 0, $this->timerCallback, $watcher ); break; case Watcher::SIGNAL: $this->events[$id] = $this->handle->signal($watcher->value, $this->signalCallback, $watcher); break; default: // @codeCoverageIgnoreStart throw new \Error("Unknown watcher type"); // @codeCoverageIgnoreEnd } } else { $this->events[$id]->start(); } if ($watcher->type === Watcher::SIGNAL) { $this->signals[$id] = $this->events[$id]; } } } /** * {@inheritdoc} */ protected function deactivate(Watcher $watcher) { if (isset($this->events[$id = $watcher->id])) { $this->events[$id]->stop(); if ($watcher->type === Watcher::SIGNAL) { unset($this->signals[$id]); } } } } <?php namespace Amp\Loop; use Amp\Coroutine; use Amp\Promise; use React\Promise\PromiseInterface as ReactPromise; use function Amp\Internal\getCurrentTime; use function Amp\Promise\rethrow; class NativeDriver extends Driver { /** @var resource[] */ private $readStreams = []; /** @var \Amp\Loop\Watcher[][] */ private $readWatchers = []; /** @var resource[] */ private $writeStreams = []; /** @var \Amp\Loop\Watcher[][] */ private $writeWatchers = []; /** @var int[] */ private $timerExpires = []; /** @var \SplPriorityQueue */ private $timerQueue; /** @var \Amp\Loop\Watcher[][] */ private $signalWatchers = []; /** @var bool */ private $nowUpdateNeeded = false; /** @var int Internal timestamp for now. */ private $now; /** @var int Loop time offset */ private $nowOffset; /** @var bool */ private $signalHandling; public function __construct() { $this->timerQueue = new \SplPriorityQueue(); $this->signalHandling = \extension_loaded("pcntl"); $this->nowOffset = getCurrentTime(); $this->now = \random_int(0, $this->nowOffset); $this->nowOffset -= $this->now; } /** * {@inheritdoc} * * @throws \Amp\Loop\UnsupportedFeatureException If the pcntl extension is not available. */ public function onSignal(int $signo, callable $callback, $data = null): string { if (!$this->signalHandling) { throw new UnsupportedFeatureException("Signal handling requires the pcntl extension"); } return parent::onSignal($signo, $callback, $data); } /** * {@inheritdoc} */ public function now(): int { if ($this->nowUpdateNeeded) { $this->now = getCurrentTime() - $this->nowOffset; $this->nowUpdateNeeded = false; } return $this->now; } /** * {@inheritdoc} */ public function getHandle() { return null; } protected function dispatch(bool $blocking) { $this->nowUpdateNeeded = true; $this->selectStreams( $this->readStreams, $this->writeStreams, $blocking ? $this->getTimeout() : 0 ); if (!empty($this->timerExpires)) { $scheduleQueue = []; try { while (!$this->timerQueue->isEmpty()) { list($watcher, $expiration) = $this->timerQueue->top(); $id = $watcher->id; if (!isset($this->timerExpires[$id]) || $expiration !== $this->timerExpires[$id]) { $this->timerQueue->extract(); // Timer was removed from queue. continue; } if ($this->timerExpires[$id] > $this->now()) { // Timer at top of queue has not expired. break; } $this->timerQueue->extract(); if ($watcher->type & Watcher::REPEAT) { $expiration = $this->now() + $watcher->value; $this->timerExpires[$watcher->id] = $expiration; $scheduleQueue[] = [$watcher, $expiration]; } else { $this->cancel($id); } try { // Execute the timer. $result = ($watcher->callback)($id, $watcher->data); if ($result === null) { continue; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { $this->error($exception); } } } finally { foreach ($scheduleQueue as $item) { $this->timerQueue->insert($item, -$item[1]); } } } if ($this->signalHandling) { \pcntl_signal_dispatch(); } } /** * @param resource[] $read * @param resource[] $write * @param int $timeout */ private function selectStreams(array $read, array $write, $timeout) { $timeout /= self::MILLISEC_PER_SEC; if (!empty($read) || !empty($write)) { // Use stream_select() if there are any streams in the loop. if ($timeout >= 0) { $seconds = (int) $timeout; $microseconds = (int) (($timeout - $seconds) * self::MICROSEC_PER_SEC); } else { $seconds = null; $microseconds = null; } $except = null; // Error reporting suppressed since stream_select() emits an E_WARNING if it is interrupted by a signal. if (!($result = @\stream_select($read, $write, $except, $seconds, $microseconds))) { if ($result === 0) { return; } $error = \error_get_last(); if (\strpos($error["message"], "unable to select") !== 0) { return; } $this->error(new \Exception($error["message"])); } foreach ($read as $stream) { $streamId = (int) $stream; if (!isset($this->readWatchers[$streamId])) { continue; // All read watchers disabled. } foreach ($this->readWatchers[$streamId] as $watcher) { if (!isset($this->readWatchers[$streamId][$watcher->id])) { continue; // Watcher disabled by another IO watcher. } try { $result = ($watcher->callback)($watcher->id, $stream, $watcher->data); if ($result === null) { continue; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { $this->error($exception); } } } foreach ($write as $stream) { $streamId = (int) $stream; if (!isset($this->writeWatchers[$streamId])) { continue; // All write watchers disabled. } foreach ($this->writeWatchers[$streamId] as $watcher) { if (!isset($this->writeWatchers[$streamId][$watcher->id])) { continue; // Watcher disabled by another IO watcher. } try { $result = ($watcher->callback)($watcher->id, $stream, $watcher->data); if ($result === null) { continue; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { $this->error($exception); } } } return; } if ($timeout > 0) { // Otherwise sleep with usleep() if $timeout > 0. \usleep($timeout * self::MICROSEC_PER_SEC); } } /** * @return int Milliseconds until next timer expires or -1 if there are no pending times. */ private function getTimeout() { while (!$this->timerQueue->isEmpty()) { list($watcher, $expiration) = $this->timerQueue->top(); $id = $watcher->id; if (!isset($this->timerExpires[$id]) || $expiration !== $this->timerExpires[$id]) { $this->timerQueue->extract(); // Timer was removed from queue. continue; } $expiration -= $this->now(); if ($expiration < 0) { return 0; } return $expiration; } return -1; } /** * {@inheritdoc} */ protected function activate(array $watchers) { foreach ($watchers as $watcher) { switch ($watcher->type) { case Watcher::READABLE: $streamId = (int) $watcher->value; $this->readWatchers[$streamId][$watcher->id] = $watcher; $this->readStreams[$streamId] = $watcher->value; break; case Watcher::WRITABLE: $streamId = (int) $watcher->value; $this->writeWatchers[$streamId][$watcher->id] = $watcher; $this->writeStreams[$streamId] = $watcher->value; break; case Watcher::DELAY: case Watcher::REPEAT: $expiration = $this->now() + $watcher->value; $this->timerExpires[$watcher->id] = $expiration; $this->timerQueue->insert([$watcher, $expiration], -$expiration); break; case Watcher::SIGNAL: if (!isset($this->signalWatchers[$watcher->value])) { if (!@\pcntl_signal($watcher->value, [$this, 'handleSignal'])) { $message = "Failed to register signal handler"; if ($error = \error_get_last()) { $message .= \sprintf("; Errno: %d; %s", $error["type"], $error["message"]); } throw new \Error($message); } } $this->signalWatchers[$watcher->value][$watcher->id] = $watcher; break; default: // @codeCoverageIgnoreStart throw new \Error("Unknown watcher type"); // @codeCoverageIgnoreEnd } } } /** * {@inheritdoc} */ protected function deactivate(Watcher $watcher) { switch ($watcher->type) { case Watcher::READABLE: $streamId = (int) $watcher->value; unset($this->readWatchers[$streamId][$watcher->id]); if (empty($this->readWatchers[$streamId])) { unset($this->readWatchers[$streamId], $this->readStreams[$streamId]); } break; case Watcher::WRITABLE: $streamId = (int) $watcher->value; unset($this->writeWatchers[$streamId][$watcher->id]); if (empty($this->writeWatchers[$streamId])) { unset($this->writeWatchers[$streamId], $this->writeStreams[$streamId]); } break; case Watcher::DELAY: case Watcher::REPEAT: unset($this->timerExpires[$watcher->id]); break; case Watcher::SIGNAL: if (isset($this->signalWatchers[$watcher->value])) { unset($this->signalWatchers[$watcher->value][$watcher->id]); if (empty($this->signalWatchers[$watcher->value])) { unset($this->signalWatchers[$watcher->value]); @\pcntl_signal($watcher->value, \SIG_DFL); } } break; default: // @codeCoverageIgnoreStart throw new \Error("Unknown watcher type"); // @codeCoverageIgnoreEnd } } /** * @param int $signo */ private function handleSignal(int $signo) { foreach ($this->signalWatchers[$signo] as $watcher) { if (!isset($this->signalWatchers[$signo][$watcher->id])) { continue; } try { $result = ($watcher->callback)($watcher->id, $signo, $watcher->data); if ($result === null) { continue; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { $this->error($exception); } } } } <?php namespace Amp\Loop; use Amp\Coroutine; use Amp\Promise; use React\Promise\PromiseInterface as ReactPromise; use function Amp\Promise\rethrow; class UvDriver extends Driver { /** @var resource A uv_loop resource created with uv_loop_new() */ private $handle; /** @var resource[] */ private $events = []; /** @var \Amp\Loop\Watcher[][] */ private $watchers = []; /** @var resource[] */ private $streams = []; /** @var callable */ private $ioCallback; /** @var callable */ private $timerCallback; /** @var callable */ private $signalCallback; public function __construct() { $this->handle = \uv_loop_new(); $this->ioCallback = function ($event, $status, $events, $resource) { $watchers = $this->watchers[(int) $event]; switch ($status) { case 0: // OK break; default: // Invoke the callback on errors, as this matches behavior with other loop back-ends. // Re-enable watcher as libuv disables the watcher on non-zero status. $flags = 0; foreach ($this->watchers[(int) $event] as $watcher) { $flags |= $watcher->enabled ? $watcher->type : 0; } \uv_poll_start($event, $flags, $this->ioCallback); break; } foreach ($watchers as $watcher) { // $events is OR'ed with 4 to trigger watcher if no events are indicated (0) or on UV_DISCONNECT (4). // http://docs.libuv.org/en/v1.x/poll.html if (!($watcher->enabled && ($watcher->type & $events || ($events | 4) === 4))) { continue; } try { $result = ($watcher->callback)($watcher->id, $resource, $watcher->data); if ($result === null) { continue; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { $this->error($exception); } } }; $this->timerCallback = function ($event) { $watcher = $this->watchers[(int) $event]; if ($watcher->type & Watcher::DELAY) { unset($this->events[$watcher->id], $this->watchers[(int) $event]); // Avoid call to uv_is_active(). $this->cancel($watcher->id); // Remove reference to watcher in parent. } elseif ($watcher->value === 0) { // Disable and re-enable so it's not executed repeatedly in the same tick // See https://github.com/amphp/amp/issues/131 $this->disable($watcher->id); $this->enable($watcher->id); } try { $result = ($watcher->callback)($watcher->id, $watcher->data); if ($result === null) { return; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { $this->error($exception); } }; $this->signalCallback = function ($event, $signo) { $watcher = $this->watchers[(int) $event]; try { $result = ($watcher->callback)($watcher->id, $signo, $watcher->data); if ($result === null) { return; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { $this->error($exception); } }; } /** * {@inheritdoc} */ public function cancel(string $watcherId) { parent::cancel($watcherId); if (!isset($this->events[$watcherId])) { return; } $event = $this->events[$watcherId]; $eventId = (int) $event; if ($this->watchers[$eventId] instanceof Watcher) { // All except IO watchers. unset($this->watchers[$eventId]); } else { $watcher = $this->watchers[$eventId][$watcherId]; unset($this->watchers[$eventId][$watcherId]); if (empty($this->watchers[$eventId])) { unset($this->watchers[$eventId], $this->streams[(int) $watcher->value]); } } unset($this->events[$watcherId]); } public static function isSupported(): bool { return \extension_loaded("uv"); } /** * {@inheritdoc} */ public function now(): int { return \uv_now($this->handle); } /** * {@inheritdoc} */ public function getHandle() { return $this->handle; } /** * {@inheritdoc} */ protected function dispatch(bool $blocking) { \uv_run($this->handle, $blocking ? \UV::RUN_ONCE : \UV::RUN_NOWAIT); } /** * {@inheritdoc} */ protected function activate(array $watchers) { foreach ($watchers as $watcher) { $id = $watcher->id; switch ($watcher->type) { case Watcher::READABLE: case Watcher::WRITABLE: $streamId = (int) $watcher->value; if (isset($this->streams[$streamId])) { $event = $this->streams[$streamId]; } elseif (isset($this->events[$id])) { $event = $this->streams[$streamId] = $this->events[$id]; } else { $event = $this->streams[$streamId] = \uv_poll_init_socket($this->handle, $watcher->value); } $eventId = (int) $event; $this->events[$id] = $event; $this->watchers[$eventId][$id] = $watcher; $flags = 0; foreach ($this->watchers[$eventId] as $watcher) { $flags |= $watcher->enabled ? $watcher->type : 0; } \uv_poll_start($event, $flags, $this->ioCallback); break; case Watcher::DELAY: case Watcher::REPEAT: if (isset($this->events[$id])) { $event = $this->events[$id]; } else { $event = $this->events[$id] = \uv_timer_init($this->handle); } $this->watchers[(int) $event] = $watcher; \uv_timer_start( $event, $watcher->value, $watcher->type & Watcher::REPEAT ? $watcher->value : 0, $this->timerCallback ); break; case Watcher::SIGNAL: if (isset($this->events[$id])) { $event = $this->events[$id]; } else { $event = $this->events[$id] = \uv_signal_init($this->handle); } $this->watchers[(int) $event] = $watcher; \uv_signal_start($event, $this->signalCallback, $watcher->value); break; default: // @codeCoverageIgnoreStart throw new \Error("Unknown watcher type"); // @codeCoverageIgnoreEnd } } } /** * {@inheritdoc} */ protected function deactivate(Watcher $watcher) { $id = $watcher->id; if (!isset($this->events[$id])) { return; } $event = $this->events[$id]; if (!\uv_is_active($event)) { return; } switch ($watcher->type) { case Watcher::READABLE: case Watcher::WRITABLE: $flags = 0; foreach ($this->watchers[(int) $event] as $watcher) { $flags |= $watcher->enabled ? $watcher->type : 0; } if ($flags) { \uv_poll_start($event, $flags, $this->ioCallback); } else { \uv_poll_stop($event); } break; case Watcher::DELAY: case Watcher::REPEAT: \uv_timer_stop($event); break; case Watcher::SIGNAL: \uv_signal_stop($event); break; default: // @codeCoverageIgnoreStart throw new \Error("Unknown watcher type"); // @codeCoverageIgnoreEnd } } } <?php namespace Amp\Loop; // @codeCoverageIgnoreStart class DriverFactory { /** * Creates a new loop instance and chooses the best available driver. * * @return Driver * * @throws \Error If an invalid class has been specified via AMP_LOOP_DRIVER */ public function create(): Driver { if ($driver = $this->createDriverFromEnv()) { return $driver; } if (UvDriver::isSupported()) { return new UvDriver; } if (EvDriver::isSupported()) { return new EvDriver; } if (EventDriver::isSupported()) { return new EventDriver; } return new NativeDriver; } private function createDriverFromEnv() { $driver = \getenv("AMP_LOOP_DRIVER"); if (!$driver) { return null; } if (!\class_exists($driver)) { throw new \Error(\sprintf( "Driver '%s' does not exist.", $driver )); } if (!\is_subclass_of($driver, Driver::class)) { throw new \Error(\sprintf( "Driver '%s' is not a subclass of '%s'.", $driver, Driver::class )); } return new $driver; } } // @codeCoverageIgnoreEnd <?php namespace Amp\Loop; /** * MUST be thrown if a feature is not supported by the system. * * This might happen if ext-pcntl is missing and the loop driver doesn't support another way to dispatch signals. */ class UnsupportedFeatureException extends \Exception { } <?php namespace Amp\Loop; use Amp\Coroutine; use Amp\Promise; use React\Promise\PromiseInterface as ReactPromise; use function Amp\Promise\rethrow; /** * Event loop driver which implements all basic operations to allow interoperability. * * Watchers (enabled or new watchers) MUST immediately be marked as enabled, but only be activated (i.e. callbacks can * be called) right before the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * All registered callbacks MUST NOT be called from a file with strict types enabled (`declare(strict_types=1)`). */ abstract class Driver { // Don't use 1e3 / 1e6, they result in a float instead of int const MILLISEC_PER_SEC = 1000; const MICROSEC_PER_SEC = 1000000; /** @var string */ private $nextId = "a"; /** @var \Amp\Loop\Watcher[] */ private $watchers = []; /** @var \Amp\Loop\Watcher[] */ private $enableQueue = []; /** @var \Amp\Loop\Watcher[] */ private $deferQueue = []; /** @var \Amp\Loop\Watcher[] */ private $nextTickQueue = []; /** @var callable|null */ private $errorHandler; /** @var bool */ private $running = false; /** @var array */ private $registry = []; /** * Run the event loop. * * One iteration of the loop is called one "tick". A tick covers the following steps: * * 1. Activate watchers created / enabled in the last tick / before `run()`. * 2. Execute all enabled defer watchers. * 3. Execute all due timer, pending signal and actionable stream callbacks, each only once per tick. * * The loop MUST continue to run until it is either stopped explicitly, no referenced watchers exist anymore, or an * exception is thrown that cannot be handled. Exceptions that cannot be handled are exceptions thrown from an * error handler or exceptions that would be passed to an error handler but none exists to handle them. * * @return void */ public function run() { $this->running = true; try { while ($this->running) { if ($this->isEmpty()) { return; } $this->tick(); } } finally { $this->stop(); } } /** * @return bool True if no enabled and referenced watchers remain in the loop. */ private function isEmpty() { foreach ($this->watchers as $watcher) { if ($watcher->enabled && $watcher->referenced) { return false; } } return true; } /** * Executes a single tick of the event loop. */ private function tick() { if (empty($this->deferQueue)) { $this->deferQueue = $this->nextTickQueue; } else { $this->deferQueue = \array_merge($this->deferQueue, $this->nextTickQueue); } $this->nextTickQueue = []; $this->activate($this->enableQueue); $this->enableQueue = []; foreach ($this->deferQueue as $watcher) { if (!isset($this->deferQueue[$watcher->id])) { continue; // Watcher disabled by another defer watcher. } unset($this->watchers[$watcher->id], $this->deferQueue[$watcher->id]); try { $result = ($watcher->callback)($watcher->id, $watcher->data); if ($result === null) { continue; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { $this->error($exception); } } $this->dispatch(empty($this->nextTickQueue) && empty($this->enableQueue) && $this->running && !$this->isEmpty()); } /** * Activates (enables) all the given watchers. * * @param \Amp\Loop\Watcher[] $watchers */ abstract protected function activate(array $watchers); /** * Dispatches any pending read/write, timer, and signal events. * * @param bool $blocking */ abstract protected function dispatch(bool $blocking); /** * Stop the event loop. * * When an event loop is stopped, it continues with its current tick and exits the loop afterwards. Multiple calls * to stop MUST be ignored and MUST NOT raise an exception. * * @return void */ public function stop() { $this->running = false; } /** * Defer the execution of a callback. * * The deferred callable MUST be executed before any other type of watcher in a tick. Order of enabling MUST be * preserved when executing the callbacks. * * The created watcher MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) * right before the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * @param callable (string $watcherId, mixed $data) $callback The callback to defer. The `$watcherId` will be * invalidated before the callback call. * @param mixed $data Arbitrary data given to the callback function as the `$data` parameter. * * @return string An unique identifier that can be used to cancel, enable or disable the watcher. */ public function defer(callable $callback, $data = null): string { $watcher = new Watcher; $watcher->type = Watcher::DEFER; $watcher->id = $this->nextId++; $watcher->callback = $callback; $watcher->data = $data; $this->watchers[$watcher->id] = $watcher; $this->nextTickQueue[$watcher->id] = $watcher; return $watcher->id; } /** * Delay the execution of a callback. * * The delay is a minimum and approximate, accuracy is not guaranteed. Order of calls MUST be determined by which * timers expire first, but timers with the same expiration time MAY be executed in any order. * * The created watcher MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) * right before the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * @param int $delay The amount of time, in milliseconds, to delay the execution for. * @param callable (string $watcherId, mixed $data) $callback The callback to delay. The `$watcherId` will be * invalidated before the callback call. * @param mixed $data Arbitrary data given to the callback function as the `$data` parameter. * * @return string An unique identifier that can be used to cancel, enable or disable the watcher. */ public function delay(int $delay, callable $callback, $data = null): string { if ($delay < 0) { throw new \Error("Delay must be greater than or equal to zero"); } $watcher = new Watcher; $watcher->type = Watcher::DELAY; $watcher->id = $this->nextId++; $watcher->callback = $callback; $watcher->value = $delay; $watcher->data = $data; $this->watchers[$watcher->id] = $watcher; $this->enableQueue[$watcher->id] = $watcher; return $watcher->id; } /** * Repeatedly execute a callback. * * The interval between executions is a minimum and approximate, accuracy is not guaranteed. Order of calls MUST be * determined by which timers expire first, but timers with the same expiration time MAY be executed in any order. * The first execution is scheduled after the first interval period. * * The created watcher MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) * right before the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * @param int $interval The time interval, in milliseconds, to wait between executions. * @param callable (string $watcherId, mixed $data) $callback The callback to repeat. * @param mixed $data Arbitrary data given to the callback function as the `$data` parameter. * * @return string An unique identifier that can be used to cancel, enable or disable the watcher. */ public function repeat(int $interval, callable $callback, $data = null): string { if ($interval < 0) { throw new \Error("Interval must be greater than or equal to zero"); } $watcher = new Watcher; $watcher->type = Watcher::REPEAT; $watcher->id = $this->nextId++; $watcher->callback = $callback; $watcher->value = $interval; $watcher->data = $data; $this->watchers[$watcher->id] = $watcher; $this->enableQueue[$watcher->id] = $watcher; return $watcher->id; } /** * Execute a callback when a stream resource becomes readable or is closed for reading. * * Warning: Closing resources locally, e.g. with `fclose`, might not invoke the callback. Be sure to `cancel` the * watcher when closing the resource locally. Drivers MAY choose to notify the user if there are watchers on invalid * resources, but are not required to, due to the high performance impact. Watchers on closed resources are * therefore undefined behavior. * * Multiple watchers on the same stream MAY be executed in any order. * * The created watcher MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) * right before the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * @param resource $stream The stream to monitor. * @param callable (string $watcherId, resource $stream, mixed $data) $callback The callback to execute. * @param mixed $data Arbitrary data given to the callback function as the `$data` parameter. * * @return string An unique identifier that can be used to cancel, enable or disable the watcher. */ public function onReadable($stream, callable $callback, $data = null): string { $watcher = new Watcher; $watcher->type = Watcher::READABLE; $watcher->id = $this->nextId++; $watcher->callback = $callback; $watcher->value = $stream; $watcher->data = $data; $this->watchers[$watcher->id] = $watcher; $this->enableQueue[$watcher->id] = $watcher; return $watcher->id; } /** * Execute a callback when a stream resource becomes writable or is closed for writing. * * Warning: Closing resources locally, e.g. with `fclose`, might not invoke the callback. Be sure to `cancel` the * watcher when closing the resource locally. Drivers MAY choose to notify the user if there are watchers on invalid * resources, but are not required to, due to the high performance impact. Watchers on closed resources are * therefore undefined behavior. * * Multiple watchers on the same stream MAY be executed in any order. * * The created watcher MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) * right before the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * @param resource $stream The stream to monitor. * @param callable (string $watcherId, resource $stream, mixed $data) $callback The callback to execute. * @param mixed $data Arbitrary data given to the callback function as the `$data` parameter. * * @return string An unique identifier that can be used to cancel, enable or disable the watcher. */ public function onWritable($stream, callable $callback, $data = null): string { $watcher = new Watcher; $watcher->type = Watcher::WRITABLE; $watcher->id = $this->nextId++; $watcher->callback = $callback; $watcher->value = $stream; $watcher->data = $data; $this->watchers[$watcher->id] = $watcher; $this->enableQueue[$watcher->id] = $watcher; return $watcher->id; } /** * Execute a callback when a signal is received. * * Warning: Installing the same signal on different instances of this interface is deemed undefined behavior. * Implementations MAY try to detect this, if possible, but are not required to. This is due to technical * limitations of the signals being registered globally per process. * * Multiple watchers on the same signal MAY be executed in any order. * * The created watcher MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) * right before the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * @param int $signo The signal number to monitor. * @param callable (string $watcherId, int $signo, mixed $data) $callback The callback to execute. * @param mixed $data Arbitrary data given to the callback function as the $data parameter. * * @return string An unique identifier that can be used to cancel, enable or disable the watcher. * * @throws UnsupportedFeatureException If signal handling is not supported. */ public function onSignal(int $signo, callable $callback, $data = null): string { $watcher = new Watcher; $watcher->type = Watcher::SIGNAL; $watcher->id = $this->nextId++; $watcher->callback = $callback; $watcher->value = $signo; $watcher->data = $data; $this->watchers[$watcher->id] = $watcher; $this->enableQueue[$watcher->id] = $watcher; return $watcher->id; } /** * Enable a watcher to be active starting in the next tick. * * Watchers MUST immediately be marked as enabled, but only be activated (i.e. callbacks can be called) right before * the next tick. Callbacks of watchers MUST NOT be called in the tick they were enabled. * * @param string $watcherId The watcher identifier. * * @return void * * @throws InvalidWatcherError If the watcher identifier is invalid. */ public function enable(string $watcherId) { if (!isset($this->watchers[$watcherId])) { throw new InvalidWatcherError($watcherId, "Cannot enable an invalid watcher identifier: '{$watcherId}'"); } $watcher = $this->watchers[$watcherId]; if ($watcher->enabled) { return; // Watcher already enabled. } $watcher->enabled = true; switch ($watcher->type) { case Watcher::DEFER: $this->nextTickQueue[$watcher->id] = $watcher; break; default: $this->enableQueue[$watcher->id] = $watcher; break; } } /** * Cancel a watcher. * * This will detatch the event loop from all resources that are associated to the watcher. After this operation the * watcher is permanently invalid. Calling this function MUST NOT fail, even if passed an invalid watcher. * * @param string $watcherId The watcher identifier. * * @return void */ public function cancel(string $watcherId) { $this->disable($watcherId); unset($this->watchers[$watcherId]); } /** * Disable a watcher immediately. * * A watcher MUST be disabled immediately, e.g. if a defer watcher disables a later defer watcher, the second defer * watcher isn't executed in this tick. * * Disabling a watcher MUST NOT invalidate the watcher. Calling this function MUST NOT fail, even if passed an * invalid watcher. * * @param string $watcherId The watcher identifier. * * @return void */ public function disable(string $watcherId) { if (!isset($this->watchers[$watcherId])) { return; } $watcher = $this->watchers[$watcherId]; if (!$watcher->enabled) { return; // Watcher already disabled. } $watcher->enabled = false; $id = $watcher->id; switch ($watcher->type) { case Watcher::DEFER: if (isset($this->nextTickQueue[$id])) { // Watcher was only queued to be enabled. unset($this->nextTickQueue[$id]); } else { unset($this->deferQueue[$id]); } break; default: if (isset($this->enableQueue[$id])) { // Watcher was only queued to be enabled. unset($this->enableQueue[$id]); } else { $this->deactivate($watcher); } break; } } /** * Deactivates (disables) the given watcher. * * @param \Amp\Loop\Watcher $watcher */ abstract protected function deactivate(Watcher $watcher); /** * Reference a watcher. * * This will keep the event loop alive whilst the watcher is still being monitored. Watchers have this state by * default. * * @param string $watcherId The watcher identifier. * * @return void * * @throws InvalidWatcherError If the watcher identifier is invalid. */ public function reference(string $watcherId) { if (!isset($this->watchers[$watcherId])) { throw new InvalidWatcherError($watcherId, "Cannot reference an invalid watcher identifier: '{$watcherId}'"); } $this->watchers[$watcherId]->referenced = true; } /** * Unreference a watcher. * * The event loop should exit the run method when only unreferenced watchers are still being monitored. Watchers * are all referenced by default. * * @param string $watcherId The watcher identifier. * * @return void */ public function unreference(string $watcherId) { if (!isset($this->watchers[$watcherId])) { return; } $this->watchers[$watcherId]->referenced = false; } /** * Stores information in the loop bound registry. * * Stored information is package private. Packages MUST NOT retrieve the stored state of other packages. Packages * MUST use their namespace as prefix for keys. They may do so by using `SomeClass::class` as key. * * If packages want to expose loop bound state to consumers other than the package, they SHOULD provide a dedicated * interface for that purpose instead of sharing the storage key. * * @param string $key The namespaced storage key. * @param mixed $value The value to be stored. * * @return void */ final public function setState(string $key, $value) { if ($value === null) { unset($this->registry[$key]); } else { $this->registry[$key] = $value; } } /** * Gets information stored bound to the loop. * * Stored information is package private. Packages MUST NOT retrieve the stored state of other packages. Packages * MUST use their namespace as prefix for keys. They may do so by using `SomeClass::class` as key. * * If packages want to expose loop bound state to consumers other than the package, they SHOULD provide a dedicated * interface for that purpose instead of sharing the storage key. * * @param string $key The namespaced storage key. * * @return mixed The previously stored value or `null` if it doesn't exist. */ final public function getState(string $key) { return isset($this->registry[$key]) ? $this->registry[$key] : null; } /** * Set a callback to be executed when an error occurs. * * The callback receives the error as the first and only parameter. The return value of the callback gets ignored. * If it can't handle the error, it MUST throw the error. Errors thrown by the callback or during its invocation * MUST be thrown into the `run` loop and stop the driver. * * Subsequent calls to this method will overwrite the previous handler. * * @param callable (\Throwable|\Exception $error)|null $callback The callback to execute. `null` will clear the * current handler. * * @return callable(\Throwable|\Exception $error)|null The previous handler, `null` if there was none. */ public function setErrorHandler(callable $callback = null) { $previous = $this->errorHandler; $this->errorHandler = $callback; return $previous; } /** * Invokes the error handler with the given exception. * * @param \Throwable $exception The exception thrown from a watcher callback. * * @throws \Throwable If no error handler has been set. */ protected function error(\Throwable $exception) { if ($this->errorHandler === null) { throw $exception; } ($this->errorHandler)($exception); } /** * Returns the current loop time in millisecond increments. Note this value does not necessarily correlate to * wall-clock time, rather the value returned is meant to be used in relative comparisons to prior values returned * by this method (intervals, expiration calculations, etc.) and is only updated once per loop tick. * * Extending classes should override this function to return a value cached once per loop tick. * * @return int */ public function now(): int { return \microtime(true) * self::MILLISEC_PER_SEC; } /** * Get the underlying loop handle. * * Example: the `uv_loop` resource for `libuv` or the `EvLoop` object for `libev` or `null` for a native driver. * * Note: This function is *not* exposed in the `Loop` class. Users shall access it directly on the respective loop * instance. * * @return null|object|resource The loop handle the event loop operates on. `null` if there is none. */ abstract public function getHandle(); /** * Returns the same array of data as getInfo(). * * @return array */ public function __debugInfo() { // @codeCoverageIgnoreStart return $this->getInfo(); // @codeCoverageIgnoreEnd } /** * Retrieve an associative array of information about the event loop driver. * * The returned array MUST contain the following data describing the driver's currently registered watchers: * * [ * "defer" => ["enabled" => int, "disabled" => int], * "delay" => ["enabled" => int, "disabled" => int], * "repeat" => ["enabled" => int, "disabled" => int], * "on_readable" => ["enabled" => int, "disabled" => int], * "on_writable" => ["enabled" => int, "disabled" => int], * "on_signal" => ["enabled" => int, "disabled" => int], * "enabled_watchers" => ["referenced" => int, "unreferenced" => int], * "running" => bool * ]; * * Implementations MAY optionally add more information in the array but at minimum the above `key => value` format * MUST always be provided. * * @return array Statistics about the loop in the described format. */ public function getInfo(): array { $watchers = [ "referenced" => 0, "unreferenced" => 0, ]; $defer = $delay = $repeat = $onReadable = $onWritable = $onSignal = [ "enabled" => 0, "disabled" => 0, ]; foreach ($this->watchers as $watcher) { switch ($watcher->type) { case Watcher::READABLE: $array = &$onReadable; break; case Watcher::WRITABLE: $array = &$onWritable; break; case Watcher::SIGNAL: $array = &$onSignal; break; case Watcher::DEFER: $array = &$defer; break; case Watcher::DELAY: $array = &$delay; break; case Watcher::REPEAT: $array = &$repeat; break; default: // @codeCoverageIgnoreStart throw new \Error("Unknown watcher type"); // @codeCoverageIgnoreEnd } if ($watcher->enabled) { ++$array["enabled"]; if ($watcher->referenced) { ++$watchers["referenced"]; } else { ++$watchers["unreferenced"]; } } else { ++$array["disabled"]; } } return [ "enabled_watchers" => $watchers, "defer" => $defer, "delay" => $delay, "repeat" => $repeat, "on_readable" => $onReadable, "on_writable" => $onWritable, "on_signal" => $onSignal, "running" => (bool) $this->running, ]; } } <?php namespace Amp\Loop; use Amp\Coroutine; use Amp\Promise; use React\Promise\PromiseInterface as ReactPromise; use function Amp\Internal\getCurrentTime; use function Amp\Promise\rethrow; class EventDriver extends Driver { /** @var \Event[]|null */ private static $activeSignals; /** @var \EventBase */ private $handle; /** @var \Event[] */ private $events = []; /** @var callable */ private $ioCallback; /** @var callable */ private $timerCallback; /** @var callable */ private $signalCallback; /** @var \Event[] */ private $signals = []; /** @var bool */ private $nowUpdateNeeded = false; /** @var int Internal timestamp for now. */ private $now; /** @var int Loop time offset */ private $nowOffset; public function __construct() { $this->handle = new \EventBase; $this->nowOffset = getCurrentTime(); $this->now = \random_int(0, $this->nowOffset); $this->nowOffset -= $this->now; if (self::$activeSignals === null) { self::$activeSignals = &$this->signals; } $this->ioCallback = function ($resource, $what, Watcher $watcher) { try { $result = ($watcher->callback)($watcher->id, $watcher->value, $watcher->data); if ($result === null) { return; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { $this->error($exception); } }; $this->timerCallback = function ($resource, $what, Watcher $watcher) { if ($watcher->type & Watcher::DELAY) { $this->cancel($watcher->id); } else { $this->events[$watcher->id]->add($watcher->value / self::MILLISEC_PER_SEC); } try { $result = ($watcher->callback)($watcher->id, $watcher->data); if ($result === null) { return; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { $this->error($exception); } }; $this->signalCallback = function ($signum, $what, Watcher $watcher) { try { $result = ($watcher->callback)($watcher->id, $watcher->value, $watcher->data); if ($result === null) { return; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { $this->error($exception); } }; } /** * {@inheritdoc} */ public function cancel(string $watcherId) { parent::cancel($watcherId); if (isset($this->events[$watcherId])) { $this->events[$watcherId]->free(); unset($this->events[$watcherId]); } } public static function isSupported(): bool { return \extension_loaded("event"); } /** * @codeCoverageIgnore */ public function __destruct() { foreach ($this->events as $event) { if ($event !== null) { // Events may have been nulled in extension depending on destruct order. $event->free(); } } // Unset here, otherwise $event->del() fails with a warning, because __destruct order isn't defined. // See https://github.com/amphp/amp/issues/159. $this->events = []; // Manually free the loop handle to fully release loop resources. // See https://github.com/amphp/amp/issues/177. if ($this->handle !== null) { $this->handle->free(); $this->handle = null; } } /** * {@inheritdoc} */ public function run() { $active = self::$activeSignals; foreach ($active as $event) { $event->del(); } self::$activeSignals = &$this->signals; foreach ($this->signals as $event) { $event->add(); } try { parent::run(); } finally { foreach ($this->signals as $event) { $event->del(); } self::$activeSignals = &$active; foreach ($active as $event) { $event->add(); } } } /** * {@inheritdoc} */ public function stop() { $this->handle->stop(); parent::stop(); } /** * {@inheritdoc} */ public function now(): int { if ($this->nowUpdateNeeded) { $this->now = getCurrentTime() - $this->nowOffset; $this->nowUpdateNeeded = false; } return $this->now; } /** * {@inheritdoc} */ public function getHandle(): \EventBase { return $this->handle; } /** * {@inheritdoc} */ protected function dispatch(bool $blocking) { $this->nowUpdateNeeded = true; $this->handle->loop($blocking ? \EventBase::LOOP_ONCE : \EventBase::LOOP_ONCE | \EventBase::LOOP_NONBLOCK); } /** * {@inheritdoc} */ protected function activate(array $watchers) { $now = getCurrentTime() - $this->nowOffset; foreach ($watchers as $watcher) { if (!isset($this->events[$id = $watcher->id])) { switch ($watcher->type) { case Watcher::READABLE: $this->events[$id] = new \Event( $this->handle, $watcher->value, \Event::READ | \Event::PERSIST, $this->ioCallback, $watcher ); break; case Watcher::WRITABLE: $this->events[$id] = new \Event( $this->handle, $watcher->value, \Event::WRITE | \Event::PERSIST, $this->ioCallback, $watcher ); break; case Watcher::DELAY: case Watcher::REPEAT: $this->events[$id] = new \Event( $this->handle, -1, \Event::TIMEOUT, $this->timerCallback, $watcher ); break; case Watcher::SIGNAL: $this->events[$id] = new \Event( $this->handle, $watcher->value, \Event::SIGNAL | \Event::PERSIST, $this->signalCallback, $watcher ); break; default: // @codeCoverageIgnoreStart throw new \Error("Unknown watcher type"); // @codeCoverageIgnoreEnd } } switch ($watcher->type) { case Watcher::DELAY: case Watcher::REPEAT: $interval = $watcher->value - ($now - $this->now()); $this->events[$id]->add($interval > 0 ? $interval / self::MILLISEC_PER_SEC : 0); break; case Watcher::SIGNAL: $this->signals[$id] = $this->events[$id]; // no break default: $this->events[$id]->add(); break; } } } /** * {@inheritdoc} */ protected function deactivate(Watcher $watcher) { if (isset($this->events[$id = $watcher->id])) { $this->events[$id]->del(); if ($watcher->type === Watcher::SIGNAL) { unset($this->signals[$id]); } } } } <?php namespace Amp; /** * Cancellation tokens are simple objects that allow registering handlers to subscribe to cancellation requests. */ interface CancellationToken { /** * Subscribes a new handler to be invoked on a cancellation request. * * This handler might be invoked immediately in case the token has already been cancelled. Returned generators will * automatically be run as coroutines. Any unhandled exceptions will be throw into the event loop. * * @param callable $callback Callback to be invoked on a cancellation request. Will receive a `CancelledException` * as first argument that may be used to fail the operation's promise. * * @return string Identifier that can be used to cancel the subscription. */ public function subscribe(callable $callback): string; /** * Unsubscribes a previously registered handler. * * The handler will no longer be called as long as this method isn't invoked from a subscribed callback. * * @param string $id * * @return void */ public function unsubscribe(string $id); /** * Returns whether cancellation has been requested yet. * * @return bool */ public function isRequested(): bool; /** * Throws the `CancelledException` if cancellation has been requested, otherwise does nothing. * * @return void */ public function throwIfRequested(); } <?php namespace Amp { use React\Promise\PromiseInterface as ReactPromise; /** * Returns a new function that wraps $callback in a promise/coroutine-aware function that automatically runs * Generators as coroutines. The returned function always returns a promise when invoked. Errors have to be handled * by the callback caller or they will go unnoticed. * * Use this function to create a coroutine-aware callable for a promise-aware callback caller. * * @param callable(...$args): mixed $callback * * @return callable(...$args): \Amp\Promise * * @see asyncCoroutine() */ function coroutine(callable $callback): callable { return function (...$args) use ($callback): Promise { return call($callback,...$args); }; } /** * Returns a new function that wraps $callback in a promise/coroutine-aware function that automatically runs * Generators as coroutines. The returned function always returns void when invoked. Errors are forwarded to the * loop's error handler using `Amp\Promise\rethrow()`. * * Use this function to create a coroutine-aware callable for a non-promise-aware callback caller. * * @param callable(...$args): \Generator|\Amp\Promise|mixed $callback * * @return callable(...$args): void * * @see coroutine() */ function asyncCoroutine(callable $callback): callable { return function (...$args) use ($callback) { Promise\rethrow(call($callback,...$args)); }; } /** * Calls the given function, always returning a promise. If the function returns a Generator, it will be run as a * coroutine. If the function throws, a failed promise will be returned. * * @param callable(...$args): mixed $callback * @param ...$args Arguments to pass to the function. * * @return \Amp\Promise */ function call(callable $callback,...$args): Promise { try { $result = $callback(...$args); } catch (\Throwable $exception) { return new Failure($exception); } if ($result instanceof \Generator) { return new Coroutine($result); } if ($result instanceof Promise) { return $result; } if ($result instanceof ReactPromise) { return Promise\adapt($result); } return new Success($result); } /** * Calls the given function. If the function returns a Generator, it will be run as a coroutine. If the function * throws or returns a failing promise, the failure is forwarded to the loop error handler. * * @param callable $callback * @param array ...$args * * @throws \TypeError */ function asyncCall(callable $callback,...$args) { Promise\rethrow(call($callback,...$args)); } } namespace Amp\Promise { use Amp\Deferred; use Amp\Failure; use Amp\Loop; use Amp\MultiReasonException; use Amp\Promise; use Amp\Success; use Amp\TimeoutException; use React\Promise\PromiseInterface as ReactPromise; use function Amp\call; use function Amp\Internal\createTypeError; /** * Registers a callback that will forward the failure reason to the event loop's error handler if the promise fails. * * Use this function if you neither return the promise nor handle a possible error yourself to prevent errors from * going entirely unnoticed. * * @param \Amp\Promise|\React\Promise\PromiseInterface $promise Promise to register the handler on. * * @throws \TypeError If $promise is not an instance of \Amp\Promise or \React\Promise\PromiseInterface. */ function rethrow($promise) { if (!$promise instanceof Promise) { if ($promise instanceof ReactPromise) { $promise = adapt($promise); } else { throw createTypeError([Promise::class, ReactPromise::class], $promise); } } $promise->onResolve(function ($exception) { if ($exception) { throw $exception; } }); } /** * Runs the event loop until the promise is resolved. Should not be called within a running event loop. * * Use this function only in synchronous contexts to wait for an asynchronous operation. Use coroutines and yield to * await promise resolution in a fully asynchronous application instead. * * @param \Amp\Promise|\React\Promise\PromiseInterface $promise Promise to wait for. * * @return mixed Promise success value. * * @throws \TypeError If $promise is not an instance of \Amp\Promise or \React\Promise\PromiseInterface. * @throws \Error If the event loop stopped without the $promise being resolved. * @throws \Throwable Promise failure reason. */ function wait($promise) { if (!$promise instanceof Promise) { if ($promise instanceof ReactPromise) { $promise = adapt($promise); } else { throw createTypeError([Promise::class, ReactPromise::class], $promise); } } $resolved = false; try { Loop::run(function () use (&$resolved, &$value, &$exception, $promise) { $promise->onResolve(function ($e, $v) use (&$resolved, &$value, &$exception) { Loop::stop(); $resolved = true; $exception = $e; $value = $v; }); }); } catch (\Throwable $throwable) { throw new \Error("Loop exceptionally stopped without resolving the promise", 0, $throwable); } if (!$resolved) { throw new \Error("Loop stopped without resolving the promise"); } if ($exception) { throw $exception; } return $value; } /** * Creates an artificial timeout for any `Promise`. * * If the timeout expires before the promise is resolved, the returned promise fails with an instance of * `Amp\TimeoutException`. * * @param \Amp\Promise|\React\Promise\PromiseInterface $promise Promise to which the timeout is applied. * @param int $timeout Timeout in milliseconds. * * @return \Amp\Promise * * @throws \TypeError If $promise is not an instance of \Amp\Promise or \React\Promise\PromiseInterface. */ function timeout($promise, int $timeout): Promise { if (!$promise instanceof Promise) { if ($promise instanceof ReactPromise) { $promise = adapt($promise); } else { throw createTypeError([Promise::class, ReactPromise::class], $promise); } } $deferred = new Deferred; $watcher = Loop::delay($timeout, function () use (&$deferred) { $temp = $deferred; // prevent double resolve $deferred = null; $temp->fail(new TimeoutException); }); Loop::unreference($watcher); $promise->onResolve(function () use (&$deferred, $promise, $watcher) { if ($deferred !== null) { Loop::cancel($watcher); $deferred->resolve($promise); } }); return $deferred->promise(); } /** * Creates an artificial timeout for any `Promise`. * * If the promise is resolved before the timeout expires, the result is returned * * If the timeout expires before the promise is resolved, a default value is returned * * @param \Amp\Promise|\React\Promise\PromiseInterface $promise Promise to which the timeout is applied. * @param int $timeout Timeout in milliseconds. * @param mixed $default * * @return \Amp\Promise * * @throws \TypeError If $promise is not an instance of \Amp\Promise or \React\Promise\PromiseInterface. */ function timeoutWithDefault($promise, int $timeout, $default = null): Promise { $promise = timeout($promise, $timeout); return call(function () use ($promise, $default) { try { return yield $promise; } catch (TimeoutException $exception) { return $default; } }); } /** * Adapts any object with a done(callable $onFulfilled, callable $onRejected) or then(callable $onFulfilled, * callable $onRejected) method to a promise usable by components depending on placeholders implementing * \AsyncInterop\Promise. * * @param object $promise Object with a done() or then() method. * * @return \Amp\Promise Promise resolved by the $thenable object. * * @throws \Error If the provided object does not have a then() method. */ function adapt($promise): Promise { $deferred = new Deferred; if (\method_exists($promise, 'done')) { $promise->done([$deferred, 'resolve'], [$deferred, 'fail']); } elseif (\method_exists($promise, 'then')) { $promise->then([$deferred, 'resolve'], [$deferred, 'fail']); } else { throw new \Error("Object must have a 'then' or 'done' method"); } return $deferred->promise(); } /** * Returns a promise that is resolved when all promises are resolved. The returned promise will not fail. * Returned promise succeeds with a two-item array delineating successful and failed promise results, * with keys identical and corresponding to the original given array. * * This function is the same as some() with the notable exception that it will never fail even * if all promises in the array resolve unsuccessfully. * * @param \Amp\Promise[]|\React\Promise\PromiseInterface[] $promises * * @return \Amp\Promise * * @throws \Error If a non-Promise is in the array. */ function any(array $promises): Promise { return some($promises, 0); } /** * Returns a promise that succeeds when all promises succeed, and fails if any promise fails. Returned * promise succeeds with an array of values used to succeed each contained promise, with keys corresponding to * the array of promises. * * @param \Amp\Promise[]|\React\Promise\PromiseInterface[] $promises Array of only promises. * * @return \Amp\Promise * * @throws \Error If a non-Promise is in the array. */ function all(array $promises): Promise { if (empty($promises)) { return new Success([]); } $deferred = new Deferred; $result = $deferred->promise(); $pending = \count($promises); $values = []; foreach ($promises as $key => $promise) { if ($promise instanceof ReactPromise) { $promise = adapt($promise); } elseif (!$promise instanceof Promise) { throw createTypeError([Promise::class, ReactPromise::class], $promise); } $values[$key] = null; // add entry to array to preserve order $promise->onResolve(function ($exception, $value) use (&$deferred, &$values, &$pending, $key) { if ($pending === 0) { return; } if ($exception) { $pending = 0; $deferred->fail($exception); $deferred = null; return; } $values[$key] = $value; if (0 === --$pending) { $deferred->resolve($values); } }); } return $result; } /** * Returns a promise that succeeds when the first promise succeeds, and fails only if all promises fail. * * @param \Amp\Promise[]|\React\Promise\PromiseInterface[] $promises Array of only promises. * * @return \Amp\Promise * * @throws \Error If the array is empty or a non-Promise is in the array. */ function first(array $promises): Promise { if (empty($promises)) { throw new \Error("No promises provided"); } $deferred = new Deferred; $result = $deferred->promise(); $pending = \count($promises); $exceptions = []; foreach ($promises as $key => $promise) { if ($promise instanceof ReactPromise) { $promise = adapt($promise); } elseif (!$promise instanceof Promise) { throw createTypeError([Promise::class, ReactPromise::class], $promise); } $exceptions[$key] = null; // add entry to array to preserve order $promise->onResolve(function ($error, $value) use (&$deferred, &$exceptions, &$pending, $key) { if ($pending === 0) { return; } if (!$error) { $pending = 0; $deferred->resolve($value); $deferred = null; return; } $exceptions[$key] = $error; if (0 === --$pending) { $deferred->fail(new MultiReasonException($exceptions)); } }); } return $result; } /** * Resolves with a two-item array delineating successful and failed Promise results. * * The returned promise will only fail if the given number of required promises fail. * * @param \Amp\Promise[]|\React\Promise\PromiseInterface[] $promises Array of only promises. * @param int $required Number of promises that must succeed for the returned promise to succeed. * * @return \Amp\Promise * * @throws \Error If a non-Promise is in the array. */ function some(array $promises, int $required = 1): Promise { if ($required < 0) { throw new \Error("Number of promises required must be non-negative"); } $pending = \count($promises); if ($required > $pending) { throw new \Error("Too few promises provided"); } if (empty($promises)) { return new Success([[], []]); } $deferred = new Deferred; $result = $deferred->promise(); $values = []; $exceptions = []; foreach ($promises as $key => $promise) { if ($promise instanceof ReactPromise) { $promise = adapt($promise); } elseif (!$promise instanceof Promise) { throw createTypeError([Promise::class, ReactPromise::class], $promise); } $values[$key] = $exceptions[$key] = null; // add entry to arrays to preserve order $promise->onResolve(function ($exception, $value) use ( &$values, &$exceptions, &$pending, $key, $required, $deferred ) { if ($exception) { $exceptions[$key] = $exception; unset($values[$key]); } else { $values[$key] = $value; unset($exceptions[$key]); } if (0 === --$pending) { if (\count($values) < $required) { $deferred->fail(new MultiReasonException($exceptions)); } else { $deferred->resolve([$exceptions, $values]); } } }); } return $result; } /** * Wraps a promise into another promise, altering the exception or result. * * @param \Amp\Promise|\React\Promise\PromiseInterface $promise * @param callable $callback * @return Promise */ function wrap($promise, callable $callback): Promise { if ($promise instanceof ReactPromise) { $promise = adapt($promise); } elseif (!$promise instanceof Promise) { throw createTypeError([Promise::class, ReactPromise::class], $promise); } $deferred = new Deferred(); $promise->onResolve(function (\Throwable $exception = null, $result) use ($deferred, $callback) { try { $result = $callback($exception, $result); } catch (\Throwable $exception) { $deferred->fail($exception); return; } $deferred->resolve($result); }); return $deferred->promise(); } } namespace Amp\Iterator { use Amp\Delayed; use Amp\Emitter; use Amp\Iterator; use Amp\Producer; use Amp\Promise; use function Amp\call; use function Amp\coroutine; use function Amp\Internal\createTypeError; /** * Creates an iterator from the given iterable, emitting the each value. The iterable may contain promises. If any * promise fails, the iterator will fail with the same reason. * * @param array|\Traversable $iterable Elements to emit. * @param int $delay Delay between element emissions in milliseconds. * * @return \Amp\Iterator * * @throws \TypeError If the argument is not an array or instance of \Traversable. */ function fromIterable(/* iterable */ $iterable, int $delay = 0 ): Iterator { if (!$iterable instanceof \Traversable && !\is_array($iterable)) { throw createTypeError(["array", "Traversable"], $iterable); } return new Producer(function (callable $emit) use ($iterable, $delay) { foreach ($iterable as $value) { if ($delay) { yield new Delayed($delay); } yield $emit($value); } }); } /** * @param \Amp\Iterator $iterator * @param callable (mixed $value): mixed $onEmit * * @return \Amp\Iterator */ function map(Iterator $iterator, callable $onEmit): Iterator { return new Producer(function (callable $emit) use ($iterator, $onEmit) { while (yield $iterator->advance()) { yield $emit($onEmit($iterator->getCurrent())); } }); } /** * @param \Amp\Iterator $iterator * @param callable (mixed $value): bool $filter * * @return \Amp\Iterator */ function filter(Iterator $iterator, callable $filter): Iterator { return new Producer(function (callable $emit) use ($iterator, $filter) { while (yield $iterator->advance()) { if ($filter($iterator->getCurrent())) { yield $emit($iterator->getCurrent()); } } }); } /** * Creates an iterator that emits values emitted from any iterator in the array of iterators. * * @param \Amp\Iterator[] $iterators * * @return \Amp\Iterator */ function merge(array $iterators): Iterator { $emitter = new Emitter; $result = $emitter->iterate(); $coroutine = coroutine(function (Iterator $iterator) use (&$emitter) { while ((yield $iterator->advance()) && $emitter !== null) { yield $emitter->emit($iterator->getCurrent()); } }); $coroutines = []; foreach ($iterators as $iterator) { if (!$iterator instanceof Iterator) { throw createTypeError([Iterator::class], $iterator); } $coroutines[] = $coroutine($iterator); } Promise\all($coroutines)->onResolve(function ($exception) use (&$emitter) { if ($exception) { $emitter->fail($exception); $emitter = null; } else { $emitter->complete(); } }); return $result; } /** * Concatenates the given iterators into a single iterator, emitting values from a single iterator at a time. The * prior iterator must complete before values are emitted from any subsequent iterators. Iterators are concatenated * in the order given (iteration order of the array). * * @param array $iterators * * @return \Amp\Iterator */ function concat(array $iterators): Iterator { foreach ($iterators as $iterator) { if (!$iterator instanceof Iterator) { throw createTypeError([Iterator::class], $iterator); } } $emitter = new Emitter; $previous = []; $promise = Promise\all($previous); $coroutine = coroutine(function (Iterator $iterator, callable $emit) { while (yield $iterator->advance()) { yield $emit($iterator->getCurrent()); } }); foreach ($iterators as $iterator) { $emit = coroutine(function ($value) use ($emitter, $promise) { static $pending = true, $failed = false; if ($failed) { return; } if ($pending) { try { yield $promise; $pending = false; } catch (\Throwable $exception) { $failed = true; return; // Prior iterator failed. } } yield $emitter->emit($value); }); $previous[] = $coroutine($iterator, $emit); $promise = Promise\all($previous); } $promise->onResolve(function ($exception) use ($emitter) { if ($exception) { $emitter->fail($exception); return; } $emitter->complete(); }); return $emitter->iterate(); } /** * Collects all items from an iterator into an array. * * @param Iterator $iterator * * @return Promise<array> */ function toArray(Iterator $iterator): Promise { return call(function () use ($iterator) { $array = []; while (yield $iterator->advance()) { $array[] = $iterator->getCurrent(); } return $array; }); } } <?php namespace Amp; use React\Promise\PromiseInterface as ReactPromise; /** * Creates a failed promise using the given exception. */ final class Failure implements Promise { /** @var \Throwable $exception */ private $exception; /** * @param \Throwable $exception Rejection reason. */ public function __construct(\Throwable $exception) { $this->exception = $exception; } /** * {@inheritdoc} */ public function onResolve(callable $onResolved) { try { $result = $onResolved($this->exception, null); if ($result === null) { return; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { Promise\rethrow($result); } } catch (\Throwable $exception) { Loop::defer(static function () use ($exception) { throw $exception; }); } } } <?php namespace Amp; /** * Deferred is a container for a promise that is resolved using the resolve() and fail() methods of this object. * The contained promise may be accessed using the promise() method. This object should not be part of a public * API, but used internally to create and resolve a promise. */ final class Deferred { /** @var object Has public resolve and fail methods. */ private $resolver; /** @var \Amp\Promise Hides placeholder methods */ private $promise; public function __construct() { $this->resolver = new class implements Promise { use Internal\Placeholder { resolve as public; fail as public; } }; $this->promise = new Internal\PrivatePromise($this->resolver); } /** * @return \Amp\Promise */ public function promise(): Promise { return $this->promise; } /** * Fulfill the promise with the given value. * * @param mixed $value */ public function resolve($value = null) { $this->resolver->resolve($value); } /** * Fails the promise the the given reason. * * @param \Throwable $reason */ public function fail(\Throwable $reason) { $this->resolver->fail($reason); } } <?php namespace Amp; /** * A NullCancellationToken can be used to avoid conditionals to check whether a token has been provided. * * Instead of writing * * ```php * if ($token) { * $token->throwIfRequested(); * } * ``` * * potentially multiple times, it allows writing * * ```php * $token = $token ?? new NullCancellationToken; * * //... * * $token->throwIfRequested(); * ``` * * instead. */ final class NullCancellationToken implements CancellationToken { /** @inheritdoc */ public function subscribe(callable $callback): string { return "null-token"; } /** @inheritdoc */ public function unsubscribe(string $id) { // nothing to do } /** @inheritdoc */ public function isRequested(): bool { return false; } /** @inheritdoc */ public function throwIfRequested() { // nothing to do } } <?php namespace Amp; class MultiReasonException extends \Exception { /** @var \Throwable[] */ private $reasons; /** * @param \Throwable[] $reasons Array of exceptions rejecting the promise. * @param string|null $message */ public function __construct(array $reasons, string $message = null) { parent::__construct($message ?: "Multiple errors encountered"); $this->reasons = $reasons; } /** * @return \Throwable[] */ public function getReasons(): array { return $this->reasons; } } <?php namespace Amp; /** * Creates a promise that calls $promisor only when the result of the promise is requested (i.e. onResolve() is called * on the promise). $promisor can return a promise or any value. If $promisor throws an exception, the promise fails * with that exception. If $promisor returns a Generator, it will be run as a coroutine. */ final class LazyPromise implements Promise { /** @var callable|null */ private $promisor; /** @var \Amp\Promise|null */ private $promise; /** * @param callable $promisor Function which starts an async operation, returning a Promise (or any value). * Generators will be run as a coroutine. */ public function __construct(callable $promisor) { $this->promisor = $promisor; } /** * {@inheritdoc} */ public function onResolve(callable $onResolved) { if ($this->promise === null) { $provider = $this->promisor; $this->promisor = null; $this->promise = call($provider); } $this->promise->onResolve($onResolved); } } <?php namespace Amp; use React\Promise\PromiseInterface as ReactPromise; /** * Creates a successful promise using the given value (which can be any value except an object implementing * `Amp\Promise` or `React\Promise\PromiseInterface`). */ final class Success implements Promise { /** @var mixed */ private $value; /** * @param mixed $value Anything other than a Promise object. * * @throws \Error If a promise is given as the value. */ public function __construct($value = null) { if ($value instanceof Promise || $value instanceof ReactPromise) { throw new \Error("Cannot use a promise as success value"); } $this->value = $value; } /** * {@inheritdoc} */ public function onResolve(callable $onResolved) { try { $result = $onResolved(null, $this->value); if ($result === null) { return; } if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { Promise\rethrow($result); } } catch (\Throwable $exception) { Loop::defer(static function () use ($exception) { throw $exception; }); } } } <?php namespace Amp; /** * Representation of the future value of an asynchronous operation. */ interface Promise { /** * Registers a callback to be invoked when the promise is resolved. * * If this method is called multiple times, additional handlers will be registered instead of replacing any already * existing handlers. * * If the promise is already resolved, the callback MUST be executed immediately. * * Exceptions MUST NOT be thrown from this method. Any exceptions thrown from invoked callbacks MUST be * forwarded to the event-loop error handler. * * Note: You shouldn't implement this interface yourself. Instead, provide a method that returns a promise for the * operation you're implementing. Objects other than pure placeholders implementing it are a very bad idea. * * @param callable(\Throwable|null $reason, $value) $onResolved `$reason` shall be `null` on * success, `$value` shall be `null` on failure. * * @return void */ public function onResolve(callable $onResolved); } <?php namespace Amp; /** * A "safe" struct trait for public property aggregators. * * This trait is intended to make using public properties a little safer by throwing when * nonexistent property names are read or written. */ trait Struct { /** * The minimum percentage [0-100] at which to recommend a similar property * name when generating error messages. */ private $__propertySuggestThreshold = 70; public function __get(string $property) { throw new \Error( $this->generateStructPropertyError($property) ); } public function __set(string $property, $value) { throw new \Error( $this->generateStructPropertyError($property) ); } private function generateStructPropertyError(string $property): string { $suggestion = $this->suggestPropertyName($property); $suggestStr = ($suggestion == "") ? "" : "... did you mean \"{$suggestion}?\""; return \sprintf( "%s property \"%s\" does not exist%s", \str_replace("\0", "@", \get_class($this)), // Handle anonymous class names. $property, $suggestStr ); } private function suggestPropertyName(string $badProperty): string { $badProperty = \strtolower($badProperty); $bestMatch = ""; $bestMatchPercentage = 0; foreach ($this as $property => $value) { // Never suggest properties that begin with an underscore if ($property[0] === "_") { continue; } \similar_text($badProperty, \strtolower($property), $byRefPercentage); if ($byRefPercentage > $bestMatchPercentage) { $bestMatchPercentage = $byRefPercentage; $bestMatch = $property; } } return ($bestMatchPercentage >= $this->__propertySuggestThreshold) ? $bestMatch : ""; } } <?php namespace Amp; use React\Promise\PromiseInterface as ReactPromise; /** * Creates a promise from a generator function yielding promises. * * When a promise is yielded, execution of the generator is interrupted until the promise is resolved. A success * value is sent into the generator, while a failure reason is thrown into the generator. Using a coroutine, * asynchronous code can be written without callbacks and be structured like synchronous code. */ final class Coroutine implements Promise { use Internal\Placeholder; /** @var \Generator */ private $generator; /** @var callable(\Throwable|null $exception, mixed $value): void */ private $onResolve; /** @var bool Used to control iterative coroutine continuation. */ private $immediate = true; /** @var \Throwable|null Promise failure reason when executing next coroutine step, null at all other times. */ private $exception; /** @var mixed Promise success value when executing next coroutine step, null at all other times. */ private $value; /** * @param \Generator $generator */ public function __construct(\Generator $generator) { $this->generator = $generator; try { $yielded = $this->generator->current(); if (!$yielded instanceof Promise) { if (!$this->generator->valid()) { $this->resolve($this->generator->getReturn()); return; } $yielded = $this->transform($yielded); } } catch (\Throwable $exception) { $this->fail($exception); return; } /** * @param \Throwable|null $exception Exception to be thrown into the generator. * @param mixed $value Value to be sent into the generator. */ $this->onResolve = function ($exception, $value) { $this->exception = $exception; $this->value = $value; if (!$this->immediate) { $this->immediate = true; return; } try { do { if ($this->exception) { // Throw exception at current execution point. $yielded = $this->generator->throw($this->exception); } else { // Send the new value and execute to next yield statement. $yielded = $this->generator->send($this->value); } if (!$yielded instanceof Promise) { if (!$this->generator->valid()) { $this->resolve($this->generator->getReturn()); $this->onResolve = null; return; } $yielded = $this->transform($yielded); } $this->immediate = false; $yielded->onResolve($this->onResolve); } while ($this->immediate); $this->immediate = true; } catch (\Throwable $exception) { $this->fail($exception); $this->onResolve = null; } finally { $this->exception = null; $this->value = null; } }; $yielded->onResolve($this->onResolve); } /** * Attempts to transform the non-promise yielded from the generator into a promise, otherwise returns an instance * `Amp\Failure` failed with an instance of `Amp\InvalidYieldError`. * * @param mixed $yielded Non-promise yielded from generator. * * @return \Amp\Promise */ private function transform($yielded): Promise { try { if (\is_array($yielded)) { return Promise\all($yielded); } if ($yielded instanceof ReactPromise) { return Promise\adapt($yielded); } // No match, continue to returning Failure below. } catch (\Throwable $exception) { // Conversion to promise failed, fall-through to returning Failure below. } return new Failure(new InvalidYieldError( $this->generator, \sprintf( "Unexpected yield; Expected an instance of %s or %s or an array of such instances", Promise::class, ReactPromise::class ), $exception ?? null )); } } <?php namespace Amp; // @codeCoverageIgnoreStart if (\PHP_VERSION_ID < 70100) { trait CallableMaker { /** @var \ReflectionClass */ private static $__reflectionClass; /** @var \ReflectionMethod[] */ private static $__reflectionMethods = []; /** * Creates a callable from a protected or private instance method that may be invoked by callers requiring a * publicly invokable callback. * * @param string $method Instance method name. * * @return callable */ private function callableFromInstanceMethod(string $method): callable { if (!isset(self::$__reflectionMethods[$method])) { if (self::$__reflectionClass === null) { self::$__reflectionClass = new \ReflectionClass(self::class); } self::$__reflectionMethods[$method] = self::$__reflectionClass->getMethod($method); } return self::$__reflectionMethods[$method]->getClosure($this); } /** * Creates a callable from a protected or private static method that may be invoked by methods requiring a * publicly invokable callback. * * @param string $method Static method name. * * @return callable */ private static function callableFromStaticMethod(string $method): callable { if (!isset(self::$__reflectionMethods[$method])) { if (self::$__reflectionClass === null) { self::$__reflectionClass = new \ReflectionClass(self::class); } self::$__reflectionMethods[$method] = self::$__reflectionClass->getMethod($method); } return self::$__reflectionMethods[$method]->getClosure(); } } } else { trait CallableMaker { /** * @deprecated Use \Closure::fromCallable() instead of this method in PHP 7.1. */ private function callableFromInstanceMethod(string $method): callable { return \Closure::fromCallable([$this, $method]); } /** * @deprecated Use \Closure::fromCallable() instead of this method in PHP 7.1. */ private static function callableFromStaticMethod(string $method): callable { return \Closure::fromCallable([self::class, $method]); } } } // @codeCoverageIgnoreEnd <?php namespace Amp; /** * Creates a promise that resolves itself with a given value after a number of milliseconds. */ final class Delayed implements Promise { use Internal\Placeholder; /** @var string Event loop watcher identifier. */ private $watcher; /** * @param int $time Milliseconds before succeeding the promise. * @param mixed $value Succeed the promise with this value. */ public function __construct(int $time, $value = null) { $this->watcher = Loop::delay($time, function () use ($value) { $this->resolve($value); }); } /** * References the internal watcher in the event loop, keeping the loop running while this promise is pending. */ public function reference() { Loop::reference($this->watcher); } /** * Unreferences the internal watcher in the event loop, allowing the loop to stop while this promise is pending if * no other events are pending in the loop. */ public function unreference() { Loop::unreference($this->watcher); } } <?php namespace Amp; class InvalidYieldError extends \Error { /** * @param \Generator $generator * @param string $prefix * @param \Throwable|null $previous */ public function __construct(\Generator $generator, string $prefix, \Throwable $previous = null) { $yielded = $generator->current(); $prefix .= \sprintf( "; %s yielded at key %s", \is_object($yielded) ? \get_class($yielded) : \gettype($yielded), \var_export($generator->key(), true) ); if (!$generator->valid()) { parent::__construct($prefix, 0, $previous); return; } $reflGen = new \ReflectionGenerator($generator); $exeGen = $reflGen->getExecutingGenerator(); if ($isSubgenerator = ($exeGen !== $generator)) { $reflGen = new \ReflectionGenerator($exeGen); } parent::__construct(\sprintf( "%s on line %s in %s", $prefix, $reflGen->getExecutingLine(), $reflGen->getExecutingFile() ), 0, $previous); } } <?php namespace Amp; use React\Promise\PromiseInterface as ReactPromise; use function Amp\Promise\rethrow; /** * A cancellation token source provides a mechanism to cancel operations. * * Cancellation of operation works by creating a cancellation token source and passing the corresponding token when * starting the operation. To cancel the operation, invoke `CancellationTokenSource::cancel()`. * * Any operation can decide what to do on a cancellation request, it has "don't care" semantics. An operation SHOULD be * aborted, but MAY continue. Example: A DNS client might continue to receive and cache the response, as the query has * been sent anyway. An HTTP client would usually close a connection, but might not do so in case a response is close to * be fully received to reuse the connection. * * **Example** * * ```php * $tokenSource = new CancellationTokenSource; * $token = $tokenSource->getToken(); * * $response = yield $httpClient->request("https://example.com/stream", $token); * $responseBody = $response->getBody(); * * while (($chunk = yield $response->read()) !== null) { * // consume $chunk * * if ($noLongerInterested) { * $cancellationTokenSource->cancel(); * break; * } * } * ``` * * @see CancellationToken * @see CancelledException */ final class CancellationTokenSource { private $token; private $onCancel; public function __construct() { $this->token = new class($this->onCancel) implements CancellationToken { /** @var string */ private $nextId = "a"; /** @var callable[] */ private $callbacks = []; /** @var \Throwable|null */ private $exception = null; public function __construct(&$onCancel) { $onCancel = function (\Throwable $exception) { $this->exception = $exception; $callbacks = $this->callbacks; $this->callbacks = []; foreach ($callbacks as $callback) { $this->invokeCallback($callback); } }; } private function invokeCallback($callback) { // No type declaration to prevent exception outside the try! try { $result = $callback($this->exception); if ($result instanceof \Generator) { $result = new Coroutine($result); } if ($result instanceof Promise || $result instanceof ReactPromise) { rethrow($result); } } catch (\Throwable $exception) { Loop::defer(static function () use ($exception) { throw $exception; }); } } public function subscribe(callable $callback): string { $id = $this->nextId++; if ($this->exception) { $this->invokeCallback($callback); } else { $this->callbacks[$id] = $callback; } return $id; } public function unsubscribe(string $id) { unset($this->callbacks[$id]); } public function isRequested(): bool { return isset($this->exception); } public function throwIfRequested() { if (isset($this->exception)) { throw $this->exception; } } }; } public function getToken(): CancellationToken { return $this->token; } /** * @param \Throwable|null $previous Exception to be used as the previous exception to CancelledException. */ public function cancel(\Throwable $previous = null) { if ($this->onCancel === null) { return; } $onCancel = $this->onCancel; $this->onCancel = null; $onCancel(new CancelledException($previous)); } } <?php // Adopted from ReactPHP's stream package // https://github.com/reactphp/stream/blob/b996af99fd1169ff74e93ef69c1513b7d0db19d0/examples/benchmark-throughput.php use Amp\ByteStream\ResourceInputStream; use Amp\ByteStream\ResourceOutputStream; use Amp\Loop; require __DIR__ . '/../vendor/autoload.php'; Loop::set(new Loop\NativeDriver()); $args = \getopt('i:o:t:'); $if = isset($args['i']) ? $args['i'] : '/dev/zero'; $of = isset($args['o']) ? $args['o'] : '/dev/null'; $t = isset($args['t']) ? $args['t'] : 30; // passing file descriptors requires mapping paths (https://bugs.php.net/bug.php?id=53465) $if = \preg_replace('(^/dev/fd/)', 'php://fd/', $if); $of = \preg_replace('(^/dev/fd/)', 'php://fd/', $of); $stderr = new ResourceOutputStream(STDERR); $in = new ResourceInputStream(\fopen($if, 'r'), 65536 /* Default size used by React to allow comparisons */); $out = new ResourceOutputStream(\fopen($of, 'w')); if (\extension_loaded('xdebug')) { $stderr->write('NOTICE: The "xdebug" extension is loaded, this has a major impact on performance.' . PHP_EOL); } try { if (!@\assert(false)) { $stderr->write("NOTICE: Assertions are enabled, this has a major impact on performance." . PHP_EOL); } } catch (AssertionError $exception) { $stderr->write("NOTICE: Assertions are enabled, this has a major impact on performance." . PHP_EOL); } $stderr->write('piping from ' . $if . ' to ' . $of . ' (for max ' . $t . ' second(s))...'. PHP_EOL); Loop::delay($t * 1000, [$in, "close"]); Loop::run(function () use ($stderr, $in, $out) { $start = \microtime(true); while (($chunk = yield $in->read()) !== null) { yield $out->write($chunk); } $t = \microtime(true) - $start; $bytes = \ftell($out->getResource()); $stderr->write('read ' . $bytes . ' byte(s) in ' . \round($t, 3) . ' second(s) => ' . \round($bytes / 1024 / 1024 / $t, 1) . ' MiB/s' . PHP_EOL); $stderr->write('peak memory usage of ' . \round(\memory_get_peak_usage(true) / 1024 / 1024, 1) . ' MiB' . PHP_EOL); }); <?php use Amp\ByteStream\ResourceInputStream; use Amp\ByteStream\ResourceOutputStream; use Amp\ByteStream\ZlibInputStream; use Amp\Loop; require __DIR__ . "/../vendor/autoload.php"; Loop::run(function () { $stdin = new ResourceInputStream(STDIN); $stdout = new ResourceOutputStream(STDOUT); $gzin = new ZlibInputStream($stdin, ZLIB_ENCODING_GZIP); while (($chunk = yield $gzin->read()) !== null) { yield $stdout->write($chunk); } }); <?php use Amp\ByteStream\ResourceInputStream; use Amp\ByteStream\ResourceOutputStream; use Amp\ByteStream\ZlibOutputStream; use Amp\Loop; require __DIR__ . "/../vendor/autoload.php"; Loop::run(function () { $stdin = new ResourceInputStream(STDIN); $stdout = new ResourceOutputStream(STDOUT); $gzout = new ZlibOutputStream($stdout, ZLIB_ENCODING_GZIP); while (($chunk = yield $stdin->read()) !== null) { yield $gzout->write($chunk); } }); { "name": "amphp/byte-stream", "homepage": "http://amphp.org/byte-stream", "description": "A stream abstraction to make working with non-blocking I/O simple.", "support": { "issues": "https://github.com/amphp/byte-stream/issues", "irc": "irc://irc.freenode.org/amphp" }, "keywords": [ "stream", "async", "non-blocking", "amp", "amphp", "io" ], "license": "MIT", "authors": [ { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" }, { "name": "Niklas Keller", "email": "me@kelunik.com" } ], "require": { "amphp/amp": "^2" }, "require-dev": { "amphp/phpunit-util": "^1", "phpunit/phpunit": "^6", "friendsofphp/php-cs-fixer": "^2.3", "amphp/php-cs-fixer-config": "dev-master", "infection/infection": "^0.9.3" }, "autoload": { "psr-4": { "Amp\\ByteStream\\": "lib" }, "files": [ "lib/functions.php" ] }, "autoload-dev": { "psr-4": { "Amp\\ByteStream\\Test\\": "test" } }, "config": { "platform": { "php": "7.0.0" } } } <?php namespace Amp\ByteStream; use Amp\Deferred; use Amp\Failure; use Amp\Iterator; use Amp\Promise; final class IteratorStream implements InputStream { private $iterator; private $exception; private $pending = false; public function __construct(Iterator $iterator) { $this->iterator = $iterator; } /** @inheritdoc */ public function read(): Promise { if ($this->exception) { return new Failure($this->exception); } if ($this->pending) { throw new PendingReadError; } $this->pending = true; $deferred = new Deferred; $this->iterator->advance()->onResolve(function ($error, $hasNextElement) use ($deferred) { $this->pending = false; if ($error) { $this->exception = $error; $deferred->fail($error); } elseif ($hasNextElement) { $chunk = $this->iterator->getCurrent(); if (!\is_string($chunk)) { $this->exception = new StreamException(\sprintf( "Unexpected iterator value of type '%s', expected string", \is_object($chunk) ? \get_class($chunk) : \gettype($chunk) )); $deferred->fail($this->exception); return; } $deferred->resolve($chunk); } else { $deferred->resolve(); } }); return $deferred->promise(); } } <?php namespace Amp\ByteStream; use Amp\Loop; use Amp\Promise; use function Amp\call; // @codeCoverageIgnoreStart if (\strlen('…') !== 3) { throw new \Error( 'The mbstring.func_overload ini setting is enabled. It must be disabled to use the stream package.' ); } // @codeCoverageIgnoreEnd if (!\defined('STDOUT')) { \define('STDOUT', \fopen('php://stdout', 'w')); } if (!\defined('STDERR')) { \define('STDERR', \fopen('php://stderr', 'w')); } /** * @param \Amp\ByteStream\InputStream $source * @param \Amp\ByteStream\OutputStream $destination * * @return \Amp\Promise */ function pipe(InputStream $source, OutputStream $destination): Promise { return call(function () use ($source, $destination): \Generator { $written = 0; while (($chunk = yield $source->read()) !== null) { $written += \strlen($chunk); $writePromise = $destination->write($chunk); $chunk = null; // free memory yield $writePromise; } return $written; }); } /** * @param \Amp\ByteStream\InputStream $source * * @return \Amp\Promise */ function buffer(InputStream $source): Promise { return call(function () use ($source): \Generator { $buffer = ""; while (($chunk = yield $source->read()) !== null) { $buffer .= $chunk; $chunk = null; // free memory } return $buffer; }); } /** * The STDIN stream for the process associated with the currently active event loop. * * @return ResourceInputStream */ function getStdin(): ResourceInputStream { static $key = InputStream::class . '\\stdin'; $stream = Loop::getState($key); if (!$stream) { $stream = new ResourceInputStream(\STDIN); Loop::setState($key, $stream); } return $stream; } /** * The STDOUT stream for the process associated with the currently active event loop. * * @return ResourceOutputStream */ function getStdout(): ResourceOutputStream { static $key = OutputStream::class . '\\stdout'; $stream = Loop::getState($key); if (!$stream) { $stream = new ResourceOutputStream(\STDOUT); Loop::setState($key, $stream); } return $stream; } /** * The STDERR stream for the process associated with the currently active event loop. * * @return ResourceOutputStream */ function getStderr(): ResourceOutputStream { static $key = OutputStream::class . '\\stderr'; $stream = Loop::getState($key); if (!$stream) { $stream = new ResourceOutputStream(\STDERR); Loop::setState($key, $stream); } return $stream; } <?php namespace Amp\ByteStream; /** * Thrown in case a second read operation is attempted while another read operation is still pending. */ final class PendingReadError extends \Error { public function __construct( string $message = "The previous read operation must complete before read can be called again", int $code = 0, \Throwable $previous = null ) { parent::__construct($message, $code, $previous); } } <?php namespace Amp\ByteStream; use Amp\Promise; use function Amp\call; /** * Allows decompression of input streams using Zlib. */ final class ZlibInputStream implements InputStream { private $source; private $encoding; private $options; private $resource; /** * @param InputStream $source Input stream to read compressed data from. * @param int $encoding Compression algorithm used, see `inflate_init()`. * @param array $options Algorithm options, see `inflate_init()`. * * @throws StreamException * @throws \Error * * @see http://php.net/manual/en/function.inflate-init.php */ public function __construct(InputStream $source, int $encoding, array $options = []) { $this->source = $source; $this->encoding = $encoding; $this->options = $options; $this->resource = @\inflate_init($encoding, $options); if ($this->resource === false) { throw new StreamException("Failed initializing deflate context"); } } /** @inheritdoc */ public function read(): Promise { return call(function () { if ($this->resource === null) { return null; } $data = yield $this->source->read(); // Needs a double guard, as stream might have been closed while reading if ($this->resource === null) { return null; } if ($data === null) { $decompressed = @\inflate_add($this->resource, "", \ZLIB_FINISH); if ($decompressed === false) { throw new StreamException("Failed adding data to deflate context"); } $this->close(); return $decompressed; } $decompressed = @\inflate_add($this->resource, $data, \ZLIB_SYNC_FLUSH); if ($decompressed === false) { throw new StreamException("Failed adding data to deflate context"); } return $decompressed; }); } /** @internal */ private function close() { $this->resource = null; $this->source = null; } /** * Gets the used compression encoding. * * @return int Encoding specified on construction time. */ public function getEncoding(): int { return $this->encoding; } /** * Gets the used compression options. * * @return array Options array passed on construction time. */ public function getOptions(): array { return $this->options; } } <?php namespace Amp\ByteStream; use Amp\Promise; /** * An `OutputStream` allows writing data in chunks. Writers can wait on the returned promises to feel the backpressure. */ interface OutputStream { /** * Writes data to the stream. * * @param string $data Bytes to write. * * @return Promise Succeeds once the data has been successfully written to the stream. * * @throws ClosedException If the stream has already been closed. */ public function write(string $data): Promise; /** * Marks the stream as no longer writable. Optionally writes a final data chunk before. Note that this is not the * same as forcefully closing the stream. This method waits for all pending writes to complete before closing the * stream. Socket streams implementing this interface should only close the writable side of the stream. * * @param string $finalData Bytes to write. * * @return Promise Succeeds once the data has been successfully written to the stream. * * @throws ClosedException If the stream has already been closed. */ public function end(string $finalData = ""): Promise; } <?php namespace Amp\ByteStream; final class ClosedException extends StreamException { } <?php namespace Amp\ByteStream; use Amp\Deferred; use Amp\Promise; use Amp\Success; class OutputBuffer implements OutputStream, Promise { /** @var \Amp\Deferred|null */ private $deferred; /** @var string */ private $contents; private $closed = false; public function __construct() { $this->deferred = new Deferred; } public function write(string $data): Promise { if ($this->closed) { throw new ClosedException("The stream has already been closed."); } $this->contents .= $data; return new Success(\strlen($data)); } public function end(string $finalData = ""): Promise { if ($this->closed) { throw new ClosedException("The stream has already been closed."); } $this->contents .= $finalData; $this->closed = true; $this->deferred->resolve($this->contents); $this->contents = ""; return new Success(\strlen($finalData)); } public function onResolve(callable $onResolved) { $this->deferred->promise()->onResolve($onResolved); } } <?php namespace Amp\ByteStream; use Amp\Promise; /** * An `InputStream` allows reading byte streams in chunks. * * **Example** * * ```php * function readAll(InputStream $in): Promise { * return Amp\call(function () use ($in) { * $buffer = ""; * * while (($chunk = yield $in->read()) !== null) { * $buffer .= $chunk; * } * * return $buffer; * }); * } * ``` */ interface InputStream { /** * Reads data from the stream. * * @return Promise Resolves with a string when new data is available or `null` if the stream has closed. * * @throws PendingReadError Thrown if another read operation is still pending. */ public function read(): Promise; } <?php namespace Amp\ByteStream; use Amp\Deferred; use Amp\Loop; use Amp\Promise; use Amp\Success; /** * Input stream abstraction for PHP's stream resources. */ final class ResourceInputStream implements InputStream { const DEFAULT_CHUNK_SIZE = 8192; /** @var resource */ private $resource; /** @var string */ private $watcher; /** @var \Amp\Deferred|null */ private $deferred; /** @var bool */ private $readable = true; /** @var int */ private $chunkSize; /** @var bool */ private $useSingleRead; /** @var callable */ private $immediateCallable; /** @var string */ private $immediateWatcher; /** * @param resource $stream Stream resource. * @param int $chunkSize Chunk size per read operation. * * @throws \Error If an invalid stream or parameter has been passed. */ public function __construct($stream, int $chunkSize = self::DEFAULT_CHUNK_SIZE) { if (!\is_resource($stream) || \get_resource_type($stream) !== 'stream') { throw new \Error("Expected a valid stream"); } $meta = \stream_get_meta_data($stream); $useSingleRead = $meta["stream_type"] === "udp_socket" || $meta["stream_type"] === "STDIO"; $this->useSingleRead = $useSingleRead; if (\strpos($meta["mode"], "r") === false && \strpos($meta["mode"], "+") === false) { throw new \Error("Expected a readable stream"); } \stream_set_blocking($stream, false); \stream_set_read_buffer($stream, 0); $this->resource = $stream; $this->chunkSize = $chunkSize; $deferred = &$this->deferred; $readable = &$this->readable; $this->watcher = Loop::onReadable($this->resource, static function ($watcher, $stream) use ( &$deferred, &$readable, $chunkSize, $useSingleRead ) { if ($useSingleRead) { $data = @\fread($stream, $chunkSize); } else { $data = @\stream_get_contents($stream, $chunkSize); } \assert($data !== false, "Trying to read from a previously fclose()'d resource. Do NOT manually fclose() resources the loop still has a reference to."); // Error suppression, because pthreads does crazy things with resources, // which might be closed during two operations. // See https://github.com/amphp/byte-stream/issues/32 if ($data === '' && @\feof($stream)) { $readable = false; Loop::cancel($watcher); $data = null; // Stream closed, resolve read with null. } Loop::disable($watcher); $temp = $deferred; $deferred = null; $temp->resolve($data); }); $this->immediateCallable = static function ($watcherId, $data) use (&$deferred) { $temp = $deferred; $deferred = null; $temp->resolve($data); }; Loop::disable($this->watcher); } /** @inheritdoc */ public function read(): Promise { if ($this->deferred !== null) { throw new PendingReadError; } if (!$this->readable) { return new Success; // Resolve with null on closed stream. } // Attempt a direct read, because Windows suffers from slow I/O on STDIN otherwise. if ($this->useSingleRead) { $data = @\fread($this->resource, $this->chunkSize); } else { $data = @\stream_get_contents($this->resource, $this->chunkSize); } \assert($data !== false, "Trying to read from a previously fclose()'d resource. Do NOT manually fclose() resources the loop still has a reference to."); if ($data === '') { // Error suppression, because pthreads does crazy things with resources, // which might be closed during two operations. // See https://github.com/amphp/byte-stream/issues/32 if (@\feof($this->resource)) { $this->readable = false; Loop::cancel($this->watcher); $data = null; // Stream closed, resolve read with null. } else { $this->deferred = new Deferred; Loop::enable($this->watcher); return $this->deferred->promise(); } } // Prevent an immediate read → write loop from blocking everything // See e.g. examples/benchmark-throughput.php $this->deferred = new Deferred; $this->immediateWatcher = Loop::defer($this->immediateCallable, $data); return $this->deferred->promise(); } /** * Closes the stream forcefully. Multiple `close()` calls are ignored. * * @return void */ public function close() { if ($this->resource) { // Error suppression, as resource might already be closed $meta = @\stream_get_meta_data($this->resource); if ($meta && \strpos($meta["mode"], "+") !== false) { @\stream_socket_shutdown($this->resource, \STREAM_SHUT_RD); } else { @\fclose($this->resource); } $this->resource = null; } $this->free(); } /** * Nulls reference to resource, marks stream unreadable, and succeeds any pending read with null. */ private function free() { $this->readable = false; if ($this->deferred !== null) { $deferred = $this->deferred; $this->deferred = null; $deferred->resolve(); } Loop::cancel($this->watcher); if ($this->immediateWatcher !== null) { Loop::cancel($this->immediateWatcher); } } /** * @return resource|null The stream resource or null if the stream has closed. */ public function getResource() { return $this->resource; } /** * References the read watcher, so the loop keeps running in case there's an active read. * * @see Loop::reference() */ public function reference() { if (!$this->resource) { throw new \Error("Resource has already been freed"); } Loop::reference($this->watcher); } /** * Unreferences the read watcher, so the loop doesn't keep running even if there are active reads. * * @see Loop::unreference() */ public function unreference() { if (!$this->resource) { throw new \Error("Resource has already been freed"); } Loop::unreference($this->watcher); } public function __destruct() { if ($this->resource !== null) { $this->free(); } } } <?php namespace Amp\ByteStream; use Amp\Coroutine; use Amp\Deferred; use Amp\Failure; use Amp\Promise; use Amp\Success; /** * Creates a buffered message from an InputStream. The message can be consumed in chunks using the read() API or it may * be buffered and accessed in its entirety by waiting for the promise to resolve. * * Other implementations may extend this class to add custom properties such as a `isBinary()` flag for WebSocket * messages. * * Buffering Example: * * $stream = new Message($inputStream); * $content = yield $stream; * * Streaming Example: * * $stream = new Message($inputStream); * * while (($chunk = yield $stream->read()) !== null) { * // Immediately use $chunk, reducing memory consumption since the entire message is never buffered. * } * * @deprecated Use Amp\ByteStream\Payload instead. */ class Message implements InputStream, Promise { /** @var InputStream */ private $source; /** @var string */ private $buffer = ""; /** @var \Amp\Deferred|null */ private $pendingRead; /** @var \Amp\Coroutine */ private $coroutine; /** @var bool True if onResolve() has been called. */ private $buffering = false; /** @var \Amp\Deferred|null */ private $backpressure; /** @var bool True if the iterator has completed. */ private $complete = false; /** @var \Throwable Used to fail future reads on failure. */ private $error; /** * @param InputStream $source An iterator that only emits strings. */ public function __construct(InputStream $source) { $this->source = $source; } private function consume(): \Generator { while (($chunk = yield $this->source->read()) !== null) { $buffer = $this->buffer .= $chunk; if ($buffer === "") { continue; // Do not succeed reads with empty string. } elseif ($this->pendingRead) { $deferred = $this->pendingRead; $this->pendingRead = null; $this->buffer = ""; $deferred->resolve($buffer); $buffer = ""; // Destroy last emitted chunk to free memory. } elseif (!$this->buffering) { $buffer = ""; // Destroy last emitted chunk to free memory. $this->backpressure = new Deferred; yield $this->backpressure->promise(); } } $this->complete = true; if ($this->pendingRead) { $deferred = $this->pendingRead; $this->pendingRead = null; $deferred->resolve($this->buffer !== "" ? $this->buffer : null); $this->buffer = ""; } return $this->buffer; } /** @inheritdoc */ final public function read(): Promise { if ($this->pendingRead) { throw new PendingReadError; } if ($this->coroutine === null) { $this->coroutine = new Coroutine($this->consume()); $this->coroutine->onResolve(function ($error) { if ($error) { $this->error = $error; } if ($this->pendingRead) { $deferred = $this->pendingRead; $this->pendingRead = null; $deferred->fail($error); } }); } if ($this->error) { return new Failure($this->error); } if ($this->buffer !== "") { $buffer = $this->buffer; $this->buffer = ""; if ($this->backpressure) { $backpressure = $this->backpressure; $this->backpressure = null; $backpressure->resolve(); } return new Success($buffer); } if ($this->complete) { return new Success; } $this->pendingRead = new Deferred; return $this->pendingRead->promise(); } /** @inheritdoc */ final public function onResolve(callable $onResolved) { $this->buffering = true; if ($this->coroutine === null) { $this->coroutine = new Coroutine($this->consume()); } if ($this->backpressure) { $backpressure = $this->backpressure; $this->backpressure = null; $backpressure->resolve(); } $this->coroutine->onResolve($onResolved); } /** * Exposes the source input stream. * * This might be required to resolve a promise with an InputStream, because promises in Amp can't be resolved with * other promises. * * @return InputStream */ final public function getInputStream(): InputStream { return $this->source; } } <?php namespace Amp\ByteStream; use Amp\Promise; /** * Allows compression of output streams using Zlib. */ final class ZlibOutputStream implements OutputStream { private $destination; private $encoding; private $options; private $resource; /** * @param OutputStream $destination Output stream to write the compressed data to. * @param int $encoding Compression encoding to use, see `deflate_init()`. * @param array $options Compression options to use, see `deflate_init()`. * * @throws StreamException If an invalid encoding or invalid options have been passed. * * @see http://php.net/manual/en/function.deflate-init.php */ public function __construct(OutputStream $destination, int $encoding, array $options = []) { $this->destination = $destination; $this->encoding = $encoding; $this->options = $options; $this->resource = @\deflate_init($encoding, $options); if ($this->resource === false) { throw new StreamException("Failed initializing deflate context"); } } /** @inheritdoc */ public function write(string $data): Promise { if ($this->resource === null) { throw new ClosedException("The stream has already been closed"); } $compressed = \deflate_add($this->resource, $data, \ZLIB_SYNC_FLUSH); if ($compressed === false) { throw new StreamException("Failed adding data to deflate context"); } $promise = $this->destination->write($compressed); $promise->onResolve(function ($error) { if ($error) { $this->close(); } }); return $promise; } /** @inheritdoc */ public function end(string $finalData = ""): Promise { if ($this->resource === null) { throw new ClosedException("The stream has already been closed"); } $compressed = \deflate_add($this->resource, $finalData, \ZLIB_FINISH); if ($compressed === false) { throw new StreamException("Failed adding data to deflate context"); } $promise = $this->destination->end($compressed); $promise->onResolve(function () { $this->close(); }); return $promise; } /** @internal */ private function close() { $this->resource = null; $this->destination = null; } /** * Gets the used compression encoding. * * @return int Encoding specified on construction time. */ public function getEncoding(): int { return $this->encoding; } /** * Gets the used compression options. * * @return array Options array passed on construction time. */ public function getOptions(): array { return $this->options; } } <?php namespace Amp\ByteStream; use Amp\Promise; use Amp\Success; /** * Input stream with a single already known data chunk. */ final class InMemoryStream implements InputStream { private $contents; /** * @param string|null $contents Data chunk or `null` for no data chunk. */ public function __construct(string $contents = null) { $this->contents = $contents; } /** * Reads data from the stream. * * @return Promise Resolves with the full contents or `null` if the stream has closed / already been consumed. */ public function read(): Promise { if ($this->contents === null) { return new Success; } $promise = new Success($this->contents); $this->contents = null; return $promise; } } <?php namespace Amp\ByteStream; class StreamException extends \Exception { } <?php namespace Amp\ByteStream; use Amp\Coroutine; use Amp\Promise; use function Amp\call; /** * Creates a buffered message from an InputStream. The message can be consumed in chunks using the read() API or it may * be buffered and accessed in its entirety by calling buffer(). Once buffering is requested through buffer(), the * stream cannot be read in chunks. On destruct any remaining data is read from the InputStream given to this class. */ class Payload implements InputStream { /** @var InputStream */ private $stream; /** @var \Amp\Promise|null */ private $promise; /** @var \Amp\Promise|null */ private $lastRead; /** * @param \Amp\ByteStream\InputStream $stream */ public function __construct(InputStream $stream) { $this->stream = $stream; } public function __destruct() { if (!$this->promise) { Promise\rethrow(new Coroutine($this->consume())); } } private function consume(): \Generator { try { if ($this->lastRead && null === yield $this->lastRead) { return; } while (null !== yield $this->stream->read()) { // Discard unread bytes from message. } } catch (\Throwable $exception) { // If exception is thrown here the connection closed anyway. } } /** * @inheritdoc * * @throws \Error If a buffered message was requested by calling buffer(). */ final public function read(): Promise { if ($this->promise) { throw new \Error("Cannot stream message data once a buffered message has been requested"); } return $this->lastRead = $this->stream->read(); } /** * Buffers the entire message and resolves the returned promise then. * * @return Promise<string> Resolves with the entire message contents. */ final public function buffer(): Promise { if ($this->promise) { return $this->promise; } return $this->promise = call(function () { $buffer = ''; if ($this->lastRead && null === yield $this->lastRead) { return $buffer; } while (null !== $chunk = yield $this->stream->read()) { $buffer .= $chunk; } return $buffer; }); } } <?php namespace Amp\ByteStream; use Amp\Deferred; use Amp\Failure; use Amp\Loop; use Amp\Promise; use Amp\Success; /** * Output stream abstraction for PHP's stream resources. */ final class ResourceOutputStream implements OutputStream { const MAX_CONSECUTIVE_EMPTY_WRITES = 3; const LARGE_CHUNK_SIZE = 128 * 1024; /** @var resource */ private $resource; /** @var string */ private $watcher; /** @var \SplQueue */ private $writes; /** @var bool */ private $writable = true; /** @var int|null */ private $chunkSize; /** * @param resource $stream Stream resource. * @param int|null $chunkSize Chunk size per `fwrite()` operation. */ public function __construct($stream, int $chunkSize = null) { if (!\is_resource($stream) || \get_resource_type($stream) !== 'stream') { throw new \Error("Expected a valid stream"); } $meta = \stream_get_meta_data($stream); if (\strpos($meta["mode"], "r") !== false && \strpos($meta["mode"], "+") === false) { throw new \Error("Expected a writable stream"); } \stream_set_blocking($stream, false); \stream_set_write_buffer($stream, 0); $this->resource = $stream; $this->chunkSize = $chunkSize; $writes = $this->writes = new \SplQueue; $writable = &$this->writable; $resource = &$this->resource; $this->watcher = Loop::onWritable($stream, static function ($watcher, $stream) use ($writes, $chunkSize, &$writable, &$resource) { static $emptyWrites = 0; try { while (!$writes->isEmpty()) { /** @var \Amp\Deferred $deferred */ list($data, $previous, $deferred) = $writes->shift(); $length = \strlen($data); if ($length === 0) { $deferred->resolve(0); continue; } if (!\is_resource($stream) || @\feof($stream)) { throw new StreamException("The stream was closed by the peer"); } // Error reporting suppressed since fwrite() emits E_WARNING if the pipe is broken or the buffer is full. // Use conditional, because PHP doesn't like getting null passed if ($chunkSize) { $written = @\fwrite($stream, $data, $chunkSize); } else { $written = @\fwrite($stream, $data); } \assert($written !== false, "Trying to write on a previously fclose()'d resource. Do NOT manually fclose() resources the loop still has a reference to."); // Broken pipes between processes on macOS/FreeBSD do not detect EOF properly. if ($written === 0) { if ($emptyWrites++ > self::MAX_CONSECUTIVE_EMPTY_WRITES) { $message = "Failed to write to stream after multiple attempts"; if ($error = \error_get_last()) { $message .= \sprintf("; %s", $error["message"]); } throw new StreamException($message); } $writes->unshift([$data, $previous, $deferred]); return; } $emptyWrites = 0; if ($length > $written) { $data = \substr($data, $written); $writes->unshift([$data, $written + $previous, $deferred]); return; } $deferred->resolve($written + $previous); } } catch (\Throwable $exception) { $resource = null; $writable = false; $deferred->fail($exception); while (!$writes->isEmpty()) { list(, , $deferred) = $writes->shift(); $deferred->fail($exception); } Loop::cancel($watcher); } finally { if ($writes->isEmpty()) { Loop::disable($watcher); } } }); Loop::disable($this->watcher); } /** * Writes data to the stream. * * @param string $data Bytes to write. * * @return Promise Succeeds once the data has been successfully written to the stream. * * @throws ClosedException If the stream has already been closed. */ public function write(string $data): Promise { return $this->send($data, false); } /** * Closes the stream after all pending writes have been completed. Optionally writes a final data chunk before. * * @param string $finalData Bytes to write. * * @return Promise Succeeds once the data has been successfully written to the stream. * * @throws ClosedException If the stream has already been closed. */ public function end(string $finalData = ""): Promise { return $this->send($finalData, true); } private function send(string $data, bool $end = false): Promise { if (!$this->writable) { return new Failure(new ClosedException("The stream is not writable")); } $length = \strlen($data); $written = 0; if ($end) { $this->writable = false; } if ($this->writes->isEmpty()) { if ($length === 0) { if ($end) { $this->close(); } return new Success(0); } if (!\is_resource($this->resource) || @\feof($this->resource)) { return new Failure(new StreamException("The stream was closed by the peer")); } // Error reporting suppressed since fwrite() emits E_WARNING if the pipe is broken or the buffer is full. // Use conditional, because PHP doesn't like getting null passed. if ($this->chunkSize) { $written = @\fwrite($this->resource, $data, $this->chunkSize); } else { $written = @\fwrite($this->resource, $data); } \assert($written !== false, "Trying to write on a previously fclose()'d resource. Do NOT manually fclose() resources the loop still has a reference to."); if ($length === $written) { if ($end) { $this->close(); } return new Success($written); } $data = \substr($data, $written); } $deferred = new Deferred; if ($length - $written > self::LARGE_CHUNK_SIZE) { $chunks = \str_split($data, self::LARGE_CHUNK_SIZE); $data = \array_pop($chunks); foreach ($chunks as $chunk) { $this->writes->push([$chunk, $written, new Deferred]); $written += self::LARGE_CHUNK_SIZE; } } $this->writes->push([$data, $written, $deferred]); Loop::enable($this->watcher); $promise = $deferred->promise(); if ($end) { $promise->onResolve([$this, "close"]); } return $promise; } /** * Closes the stream forcefully. Multiple `close()` calls are ignored. * * @return void */ public function close() { if ($this->resource) { // Error suppression, as resource might already be closed $meta = @\stream_get_meta_data($this->resource); if ($meta && \strpos($meta["mode"], "+") !== false) { @\stream_socket_shutdown($this->resource, \STREAM_SHUT_WR); } else { @\fclose($this->resource); } } $this->free(); } /** * Nulls reference to resource, marks stream unwritable, and fails any pending write. */ private function free() { $this->resource = null; $this->writable = false; if (!$this->writes->isEmpty()) { $exception = new ClosedException("The socket was closed before writing completed"); do { /** @var \Amp\Deferred $deferred */ list(, , $deferred) = $this->writes->shift(); $deferred->fail($exception); } while (!$this->writes->isEmpty()); } Loop::cancel($this->watcher); } /** * @return resource|null Stream resource or null if end() has been called or the stream closed. */ public function getResource() { return $this->resource; } public function __destruct() { if ($this->resource !== null) { $this->free(); } } } { "name": "amphp/socket", "homepage": "https://github.com/amphp/socket", "description": "Async socket connection / server tools for Amp.", "support": { "issues": "https://github.com/amphp/socket/issues" }, "keywords": [ "tcp", "sockets", "tls", "encryption", "async", "non-blocking", "amp" ], "license": "MIT", "authors": [ { "name": "Daniel Lowrey", "email": "rdlowrey@gmail.com" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" }, { "name": "Niklas Keller", "email": "me@kelunik.com" } ], "require": { "php": ">=7.0", "amphp/amp": "^2", "amphp/dns": "^0.9", "amphp/byte-stream": "^1.1", "amphp/uri": "^0.1" }, "require-dev": { "amphp/phpunit-util": "^1", "phpunit/phpunit": "^6", "friendsofphp/php-cs-fixer": "^2.3" }, "autoload": { "psr-4": { "Amp\\Socket\\": "src" }, "files": [ "src/functions.php", "src/Internal/functions.php" ] }, "autoload-dev": { "psr-4": { "Amp\\Socket\\Test\\": "test" } }, "config": { "platform": { "php": "7.0.0" } }, "scripts": { "test": "@php -dzend.assertions=1 -dassert.exception=1 ./vendor/bin/phpunit", "code-style": "@php ./vendor/bin/php-cs-fixer fix" } } <?php namespace Amp\Socket\Internal; use Amp\Deferred; use Amp\Failure; use Amp\Loop; use Amp\Promise; use Amp\Socket\CryptoException; use Amp\Success; use function Amp\call; /** * Parse an URI into [scheme, host, port]. * * @param string $uri * * @return array * * @throws \Error If an invalid URI has been passed. * * @internal */ function parseUri(string $uri): array { if (\stripos($uri, "unix://") === 0 || \stripos($uri, "udg://") === 0) { list($scheme, $path) = \explode("://", $uri, 2); return [$scheme, \ltrim($path, "/"), 0]; } if (!$uriParts = @\parse_url($uri)) { throw new \Error( "Invalid URI: {$uri}" ); } $scheme = $uriParts["scheme"] ?? "tcp"; $host = $uriParts["host"] ?? ""; $port = $uriParts["port"] ?? 0; if (!($scheme === "tcp" || $scheme === "udp")) { throw new \Error( "Invalid URI scheme ({$scheme}); tcp, udp, unix or udg scheme expected" ); } if (empty($host) || empty($port)) { throw new \Error( "Invalid URI ({$uri}); host and port components required" ); } if (\strpos($host, ":") !== false) { // IPv6 address $host = \sprintf("[%s]", \trim($host, "[]")); } return [$scheme, $host, $port]; } /** * Enable encryption on an existing socket stream. * * @param resource $socket * @param array $options * @param bool $force Forces enabling without prior disabling if already enabled. * * @return Promise * * @throws \Error If an invalid options array has been passed. * * @internal */ function enableCrypto($socket, array $options = [], bool $force = false): Promise { $ctx = \stream_context_get_options($socket); if (!$force && !empty($ctx['ssl']) && !empty($ctx["ssl"]["_enabled"])) { $cmp = array_merge($ctx["ssl"], $options["ssl"] ?? []); $ctx = $ctx['ssl']; // Use weak comparison so the order of the items doesn't matter if ($ctx == $cmp) { return new Success; } return call(function () use ($socket, $options) { yield disableCrypto($socket); return enableCrypto($socket, $options); }); } $options["ssl"]["_enabled"] = true; // avoid recursion \error_clear_last(); \stream_context_set_option($socket, $options); $result = @\stream_socket_enable_crypto($socket, $enable = true); // Yes, that function can return true / false / 0, don't use weak comparisons. if ($result === true) { return new Success($socket); } if ($result === false) { return new Failure(new CryptoException( "Crypto negotiation failed: " . (\error_get_last()["message"] ?? "Unknown error") )); } return call(function () use ($socket) { $deferred = new Deferred; $watcher = Loop::onReadable($socket, function (string $watcher, $socket, Deferred $deferred) { $result = @\stream_socket_enable_crypto($socket, $enable = true); // If $result is 0, just wait for the next invocation if ($result === true) { $deferred->resolve(); } elseif ($result === false) { $deferred->fail(new CryptoException("Crypto negotiation failed: " . (\feof($socket) ? "Connection reset by peer" : \error_get_last()["message"]))); } }, $deferred); try { yield $deferred->promise(); } finally { Loop::cancel($watcher); } return $socket; }); } /** * Disable encryption on an existing socket stream. * * @param resource $socket * * @return Promise * * @internal */ function disableCrypto($socket): Promise { // note that disabling crypto *ALWAYS* returns false, immediately \stream_context_set_option($socket, ["ssl" => ["_enabled" => false]]); @\stream_socket_enable_crypto($socket, false); return new Success; } /** * Normalizes "bindto" options to add a ":0" in case no port is present, otherwise PHP will silently ignore those. * * @param string|null $bindTo * * @return string|null * * @throws \Error If an invalid option has been passed. */ function normalizeBindToOption(string $bindTo = null) { if ($bindTo === null) { // all fine return null; } elseif (\preg_match("/\\[(?P<ip>[0-9a-f:]+)\\](:(?P<port>\\d+))?$/", $bindTo ?? "", $match)) { $ip = $match['ip']; $port = $match['port'] ?? 0; if (@\inet_pton($ip) === false) { throw new \Error("Invalid IPv6 address: {$ip}"); } if ($port < 0 || $port > 65535) { throw new \Error("Invalid port: {$port}"); } return "[{$ip}]:{$port}"; } if (\preg_match("/(?P<ip>\\d+\\.\\d+\\.\\d+\\.\\d+)(:(?P<port>\\d+))?$/", $bindTo ?? "", $match)) { $ip = $match['ip']; $port = $match['port'] ?? 0; if (@\inet_pton($ip) === false) { throw new \Error("Invalid IPv4 address: {$ip}"); } if ($port < 0 || $port > 65535) { throw new \Error("Invalid port: {$port}"); } return "{$ip}:{$port}"; } throw new \Error("Invalid bindTo value: {$bindTo}"); } /** * Cleans up return values of stream_socket_get_name. * * @param string|false $address * * @return string|null */ function cleanupSocketName($address) { // https://3v4l.org/5C1lo if ($address === false || $address === "\0") { return null; } // Check if this is an IPv6 address which includes multiple colons but no square brackets // @see https://github.com/reactphp/socket/blob/v0.8.10/src/TcpServer.php#L179-L184 // @license https://github.com/reactphp/socket/blob/v0.8.10/LICENSE $pos = strrpos($address, ':'); if ($pos !== false && strpos($address, ':') < $pos && substr($address, 0, 1) !== '[') { $port = substr($address, $pos + 1); $address = '[' . substr($address, 0, $pos) . ']:' . $port; } // -- End of imported code ----- // return $address; } <?php namespace Amp\Socket; use Amp\CancellationToken; use Amp\Deferred; use Amp\Dns; use Amp\Loop; use Amp\NullCancellationToken; use Amp\Promise; use Amp\TimeoutException; use function Amp\call; /** * Listen for client connections on the specified server address. * * If you want to accept TLS connections, you have to use `yield $socket->enableCrypto()` after accepting new clients. * * @param string $uri URI in scheme://host:port format. TCP is assumed if no scheme is present. * @param ServerListenContext $socketContext Context options for listening. * @param ServerTlsContext $tlsContext Context options for TLS connections. * * @return Server * * @throws SocketException If binding to the specified URI failed. * @throws \Error If an invalid scheme is given. */ function listen(string $uri, ServerListenContext $socketContext = null, ServerTlsContext $tlsContext = null): Server { $socketContext = $socketContext ?? new ServerListenContext; $scheme = \strstr($uri, "://", true); if ($scheme === false) { $scheme = "tcp"; } if (!\in_array($scheme, ["tcp", "udp", "unix", "udg"])) { throw new \Error("Only tcp, udp, unix and udg schemes allowed for server creation"); } if ($tlsContext) { $context = \array_merge( $socketContext->toStreamContextArray(), $tlsContext->toStreamContextArray() ); } else { $context = $socketContext->toStreamContextArray(); } $context = \stream_context_create($context); // Error reporting suppressed since stream_socket_server() emits an E_WARNING on failure (checked below). $server = @\stream_socket_server($uri, $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $context); if (!$server || $errno) { throw new SocketException(\sprintf("Could not create server %s: [Error: #%d] %s", $uri, $errno, $errstr), $errno); } return new Server($server, Socket::DEFAULT_CHUNK_SIZE); } /** * Asynchronously establish a socket connection to the specified URI. * * @param string $uri URI in scheme://host:port format. TCP is assumed if no scheme is present. * @param ClientConnectContext $socketContext Socket connect context to use when connecting. * @param CancellationToken|null $token * * @return Promise<\Amp\Socket\ClientSocket> */ function connect(string $uri, ClientConnectContext $socketContext = null, CancellationToken $token = null): Promise { return call(function () use ($uri, $socketContext, $token) { $socketContext = $socketContext ?? new ClientConnectContext; $token = $token ?? new NullCancellationToken; $attempt = 0; $uris = []; $failures = []; list($scheme, $host, $port) = Internal\parseUri($uri); if ($host[0] === '[') { $host = substr($host, 1, -1); } if ($port === 0 || @\inet_pton($host)) { // Host is already an IP address or file path. $uris = [$uri]; } else { // Host is not an IP address, so resolve the domain name. $records = yield Dns\resolve($host, $socketContext->getDnsTypeRestriction()); // Usually the faster response should be preferred, but we don't have a reliable way of determining IPv6 // support, so we always prefer IPv4 here. \usort($records, function (Dns\Record $a, Dns\Record $b) { return $a->getType() - $b->getType(); }); foreach ($records as $record) { /** @var Dns\Record $record */ if ($record->getType() === Dns\Record::AAAA) { $uris[] = \sprintf("%s://[%s]:%d", $scheme, $record->getValue(), $port); } else { $uris[] = \sprintf("%s://%s:%d", $scheme, $record->getValue(), $port); } } } $flags = \STREAM_CLIENT_CONNECT | \STREAM_CLIENT_ASYNC_CONNECT; $timeout = $socketContext->getConnectTimeout(); foreach ($uris as $builtUri) { try { $context = \stream_context_create($socketContext->toStreamContextArray()); if (!$socket = @\stream_socket_client($builtUri, $errno, $errstr, null, $flags, $context)) { throw new ConnectException(\sprintf( "Connection to %s failed: [Error #%d] %s%s", $uri, $errno, $errstr, $failures ? "; previous attempts: " . \implode($failures) : "" ), $errno); } \stream_set_blocking($socket, false); $deferred = new Deferred; $watcher = Loop::onWritable($socket, [$deferred, 'resolve']); $id = $token->subscribe([$deferred, 'fail']); try { yield Promise\timeout($deferred->promise(), $timeout); } catch (TimeoutException $e) { throw new ConnectException(\sprintf( "Connecting to %s failed: timeout exceeded (%d ms)%s", $uri, $timeout, $failures ? "; previous attempts: " . \implode($failures) : "" ), 110); // See ETIMEDOUT in http://www.virtsync.com/c-error-codes-include-errno } finally { Loop::cancel($watcher); $token->unsubscribe($id); } // The following hack looks like the only way to detect connection refused errors with PHP's stream sockets. if (\stream_socket_get_name($socket, true) === false) { \fclose($socket); throw new ConnectException(\sprintf( "Connection to %s refused%s", $uri, $failures ? "; previous attempts: " . \implode($failures) : "" ), 111); // See ECONNREFUSED in http://www.virtsync.com/c-error-codes-include-errno } } catch (ConnectException $e) { // Includes only error codes used in this file, as error codes on other OS families might be different. // In fact, this might show a confusing error message on OS families that return 110 or 111 by itself. $knownReasons = [ 110 => "connection timeout", 111 => "connection refused", ]; $code = $e->getCode(); $reason = $knownReasons[$code] ?? ("Error #" . $code); if (++$attempt === $socketContext->getMaxAttempts()) { break; } $failures[] = "{$uri} ({$reason})"; continue; // Could not connect to host, try next host in the list. } return new ClientSocket($socket); } // This is reached if either all URIs failed or the maximum number of attempts is reached. throw $e; }); } /** * Asynchronously establish an encrypted TCP connection (non-blocking). * * Note: Once resolved the socket stream will already be set to non-blocking mode. * * @param string $uri * @param ClientConnectContext $socketContext * @param ClientTlsContext $tlsContext * @param CancellationToken $token * * @return Promise<ClientSocket> */ function cryptoConnect( string $uri, ClientConnectContext $socketContext = null, ClientTlsContext $tlsContext = null, CancellationToken $token = null ): Promise { return call(function () use ($uri, $socketContext, $tlsContext, $token) { $tlsContext = $tlsContext ?? new ClientTlsContext; if ($tlsContext->getPeerName() === null) { $tlsContext = $tlsContext->withPeerName(\parse_url($uri, PHP_URL_HOST)); } /** @var ClientSocket $socket */ $socket = yield connect($uri, $socketContext, $token); $promise = $socket->enableCrypto($tlsContext); if ($token) { $deferred = new Deferred; $id = $token->subscribe([$deferred, "fail"]); $promise->onResolve(function ($exception) use ($id, $token, $deferred) { if ($token->isRequested()) { return; } $token->unsubscribe($id); if ($exception) { $deferred->fail($exception); return; } $deferred->resolve(); }); $promise = $deferred->promise(); } try { yield $promise; } catch (\Throwable $exception) { $socket->close(); throw $exception; } return $socket; }); } /** * Returns a pair of connected stream socket resources. * * @return resource[] Pair of socket resources. * * @throws \Amp\Socket\SocketException If creating the sockets fails. */ function pair(): array { if (($sockets = @\stream_socket_pair(\stripos(PHP_OS, "win") === 0 ? STREAM_PF_INET : STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP)) === false) { $message = "Failed to create socket pair."; if ($error = \error_get_last()) { $message .= \sprintf(" Errno: %d; %s", $error["type"], $error["message"]); } throw new SocketException($message); } return $sockets; } <?php namespace Amp\Socket; use Amp\CancellationToken; use Amp\CancelledException; use Amp\Failure; use Amp\Loop; use Amp\Promise; use Amp\Struct; use Amp\Success; use Amp\Uri\Uri; use function Amp\call; final class BasicSocketPool implements SocketPool { private $sockets = []; private $socketIdUriMap = []; private $pendingCount = []; private $idleTimeout; private $socketContext; public function __construct(int $idleTimeout = 10000, ClientConnectContext $socketContext = null) { $this->idleTimeout = $idleTimeout; $this->socketContext = $socketContext ?? new ClientConnectContext; } private function normalizeUri(string $uri): string { if (stripos($uri, 'unix://') === 0) { return $uri; } return (new Uri($uri))->normalize(); } /** @inheritdoc */ public function checkout(string $uri, CancellationToken $token = null): Promise { // A request might already be cancelled before we reach the checkout, so do not even attempt to checkout in that // case. The weird logic is required to throw the token's exception instead of creating a new one. if ($token && $token->isRequested()) { try { $token->throwIfRequested(); } catch (CancelledException $e) { return new Failure($e); } } $uri = $this->normalizeUri($uri); if (empty($this->sockets[$uri])) { return $this->checkoutNewSocket($uri, $token); } foreach ($this->sockets[$uri] as $socketId => $socket) { if (!$socket->isAvailable) { continue; } elseif (!\is_resource($socket->resource) || \feof($socket->resource)) { $this->clear(new ClientSocket($socket->resource)); continue; } $socket->isAvailable = false; if ($socket->idleWatcher !== null) { Loop::disable($socket->idleWatcher); } return new Success(new ClientSocket($socket->resource)); } return $this->checkoutNewSocket($uri, $token); } private function checkoutNewSocket(string $uri, CancellationToken $token = null): Promise { return call(function () use ($uri, $token) { $this->pendingCount[$uri] = ($this->pendingCount[$uri] ?? 0) + 1; try { /** @var ClientSocket $rawSocket */ $rawSocket = yield connect($uri, $this->socketContext, $token); } finally { if (--$this->pendingCount[$uri] === 0) { unset($this->pendingCount[$uri]); } } $socketId = (int) $rawSocket->getResource(); $socket = new class { use Struct; public $id; public $uri; public $resource; public $isAvailable; public $idleWatcher; }; $socket->id = $socketId; $socket->uri = $uri; $socket->resource = $rawSocket->getResource(); $socket->isAvailable = false; $this->sockets[$uri][$socketId] = $socket; $this->socketIdUriMap[$socketId] = $uri; return $rawSocket; }); } /** @inheritdoc */ public function clear(ClientSocket $socket) { $socketId = (int) $socket->getResource(); if (!isset($this->socketIdUriMap[$socketId])) { throw new \Error( sprintf('Unknown socket: %d', $socketId) ); } $uri = $this->socketIdUriMap[$socketId]; $socket = $this->sockets[$uri][$socketId]; if ($socket->idleWatcher) { Loop::cancel($socket->idleWatcher); } unset( $this->sockets[$uri][$socketId], $this->socketIdUriMap[$socketId] ); if (empty($this->sockets[$uri])) { unset($this->sockets[$uri]); } } /** @inheritdoc */ public function checkin(ClientSocket $socket) { $socketId = (int) $socket->getResource(); if (!isset($this->socketIdUriMap[$socketId])) { throw new \Error( \sprintf('Unknown socket: %d', $socketId) ); } $uri = $this->socketIdUriMap[$socketId]; if (!\is_resource($socket->getResource()) || \feof($socket->getResource())) { $this->clear($socket); return; } $socket = $this->sockets[$uri][$socketId]; $socket->isAvailable = true; if (isset($socket->idleWatcher)) { Loop::enable($socket->idleWatcher); } else { $socket->idleWatcher = Loop::delay($this->idleTimeout, function () use ($socket) { $this->clear(new ClientSocket($socket->resource)); }); Loop::unreference($socket->idleWatcher); } } } <?php namespace Amp\Socket; use Amp\ByteStream\ClosedException; use Amp\Failure; use Amp\Promise; class ServerSocket extends Socket { /** @inheritdoc */ public function enableCrypto(): Promise { if (($resource = $this->getResource()) === null) { return new Failure(new ClosedException("The socket has been closed")); } $ctx = \stream_context_get_options($resource); if (empty($ctx['ssl'])) { return new Failure(new CryptoException( "Can't enable TLS without configuration. " . "If you used Amp\\Socket\\listen(), be sure to pass a ServerTlsContext as third argument, " . "otherwise set the 'ssl' context option to the PHP stream resource." )); } return Internal\enableCrypto($resource, [], true); } } <?php namespace Amp\Socket; /** * Thrown in case a second read operation is attempted while another read operation is still pending. */ final class PendingAcceptError extends \Error { public function __construct( string $message = "The previous accept operation must complete before accept can be called again", int $code = 0, \Throwable $previous = null ) { parent::__construct($message, $code, $previous); } } <?php namespace Amp\Socket; use Amp\ByteStream\ClosedException; use Amp\ByteStream\InputStream; use Amp\ByteStream\OutputStream; use Amp\ByteStream\ResourceInputStream; use Amp\ByteStream\ResourceOutputStream; use Amp\Failure; use Amp\Promise; abstract class Socket implements InputStream, OutputStream { const DEFAULT_CHUNK_SIZE = ResourceInputStream::DEFAULT_CHUNK_SIZE; /** @var \Amp\ByteStream\ResourceInputStream */ private $reader; /** @var \Amp\ByteStream\ResourceOutputStream */ private $writer; /** * @param resource $resource Stream resource. * @param int $chunkSize Read and write chunk size. * * @throws \Error If a stream resource is not given for $resource. */ public function __construct($resource, int $chunkSize = self::DEFAULT_CHUNK_SIZE) { $this->reader = new ResourceInputStream($resource, $chunkSize); $this->writer = new ResourceOutputStream($resource, $chunkSize); } /** * Raw stream socket resource. * * @return resource|null */ public function getResource() { return $this->reader->getResource(); } /** * Enables encryption on this socket. * * @return Promise */ abstract public function enableCrypto(): Promise; /** * Disables encryption on this socket. * * @return Promise */ public function disableCrypto(): Promise { if (($resource = $this->reader->getResource()) === null) { return new Failure(new ClosedException("The socket has been closed")); } return Internal\disableCrypto($resource); } /** @inheritdoc */ public function read(): Promise { return $this->reader->read(); } /** @inheritdoc */ public function write(string $data): Promise { return $this->writer->write($data); } /** @inheritdoc */ public function end(string $data = ""): Promise { $promise = $this->writer->end($data); $promise->onResolve(function () { $this->close(); }); return $promise; } /** * References the read watcher, so the loop keeps running in case there's an active read. * * @see Loop::reference() */ public function reference() { $this->reader->reference(); } /** * Unreferences the read watcher, so the loop doesn't keep running even if there are active reads. * * @see Loop::unreference() */ public function unreference() { $this->reader->unreference(); } /** * Force closes the socket, failing any pending reads or writes. */ public function close() { $this->reader->close(); $this->writer->close(); } public function getLocalAddress() { return $this->getAddress(false); } public function getRemoteAddress() { return $this->getAddress(true); } private function getAddress(bool $wantPeer) { $remoteCleaned = Internal\cleanupSocketName(@\stream_socket_get_name($this->getResource(), $wantPeer)); if ($remoteCleaned !== null) { return $remoteCleaned; } $meta = @stream_get_meta_data($this->getResource()) ?? []; if (array_key_exists('stream_type', $meta) && $meta['stream_type'] === 'unix_socket') { return Internal\cleanupSocketName(@\stream_socket_get_name($this->getResource(), !$wantPeer)); } return null; } } <?php namespace Amp\Socket; use function Amp\Socket\Internal\normalizeBindToOption; final class ServerListenContext { private $bindTo = null; private $backlog = 128; private $reusePort = false; private $broadcast = false; private $tcpNoDelay = false; public function withBindTo(string $bindTo = null): self { $bindTo = normalizeBindToOption($bindTo); $clone = clone $this; $clone->bindTo = $bindTo; return $clone; } public function getBindTo() { return $this->bindTo; } public function getBacklog() { return $this->backlog; } public function withBacklog(int $backlog): self { $clone = clone $this; $clone->backlog = $backlog; return $clone; } public function hasReusePort(): bool { return $this->reusePort; } public function withReusePort(): self { $clone = clone $this; $clone->reusePort = true; return $clone; } public function withoutReusePort(): self { $clone = clone $this; $clone->reusePort = false; return $clone; } public function hasBroadcast(): bool { return $this->broadcast; } public function withBroadcast(): self { $clone = clone $this; $clone->broadcast = true; return $clone; } public function withoutBroadcast(): self { $clone = clone $this; $clone->broadcast = false; return $clone; } public function hasTcpNoDelay(): bool { return $this->tcpNoDelay; } public function withTcpNoDelay(): self { $clone = clone $this; $clone->tcpNoDelay = true; return $clone; } public function withoutTcpNoDelay(): self { $clone = clone $this; $clone->tcpNoDelay = false; return $clone; } public function toStreamContextArray(): array { return ["socket" => [ "bindto" => $this->bindTo, "backlog" => $this->backlog, "ipv6_v6only" => true, // SO_REUSEADDR has SO_REUSEPORT semantics on Windows "so_reuseaddr" => $this->reusePort && \stripos(\PHP_OS, "WIN") === 0, "so_reuseport" => $this->reusePort, "so_broadcast" => $this->broadcast, "tcp_nodelay" => $this->tcpNoDelay, ]]; } } <?php namespace Amp\Socket; /** * @see ServerTlsContext::withDefaultCertificate() * @see ServerTlsContext::withCertificates() */ class Certificate { private $certFile; private $keyFile; /** * @param string $certFile Certificate file with the certificate + intermediaries. * @param string|null $keyFile Key file with the corresponding private key or `null` if the key is in $certFile. */ public function __construct(string $certFile, string $keyFile = null) { $this->certFile = $certFile; $this->keyFile = $keyFile ?? $certFile; } /** * @return string */ public function getCertFile(): string { return $this->certFile; } /** * @return string */ public function getKeyFile(): string { return $this->keyFile; } } <?php namespace Amp\Socket; class CryptoException extends SocketException { } <?php namespace Amp\Socket; final class ServerTlsContext { const TLSv1_0 = \STREAM_CRYPTO_METHOD_TLSv1_0_SERVER; const TLSv1_1 = \STREAM_CRYPTO_METHOD_TLSv1_1_SERVER; const TLSv1_2 = \STREAM_CRYPTO_METHOD_TLSv1_2_SERVER; /** @var int */ private $minVersion = \STREAM_CRYPTO_METHOD_TLSv1_0_SERVER; /** @var null|string */ private $peerName = null; /** @var bool */ private $verifyPeer = false; /** @var int */ private $verifyDepth = 10; /** @var null|string */ private $ciphers = null; /** @var null|string */ private $caFile = null; /** @var null|string */ private $caPath = null; /** @var bool */ private $capturePeer = false; /** @var null|Certificate */ private $defaultCertificate = null; /** @var Certificate[] */ private $certificates = []; /** @var int */ private $securityLevel = 2; /** * Minimum TLS version to negotiate. * * Defaults to TLS 1.0. * * @param int $version `ServerTlsContext::TLSv1_0`, `ServerTlsContext::TLSv1_1`, or `ServerTlsContext::TLSv1_2`. * * @return self Cloned, modified instance. * @throws \Error If an invalid minimum version is given. */ public function withMinimumVersion(int $version): self { if ($version !== self::TLSv1_0 && $version !== self::TLSv1_1 && $version !== self::TLSv1_2) { throw new \Error("Invalid minimum version, only TLSv1.0, TLSv1.1 or TLSv1.2 allowed"); } $clone = clone $this; $clone->minVersion = $version; return $clone; } /** * Returns the minimum TLS version to negotiate. * * @return int */ public function getMinimumVersion(): int { return $this->minVersion; } /** * Expected name of the peer. * * @param string|null $peerName * * @return self Cloned, modified instance. */ public function withPeerName(string $peerName = null): self { $clone = clone $this; $clone->peerName = $peerName; return $clone; } /** * @return null|string Expected name of the peer or `null` if such an expectation doesn't exist. */ public function getPeerName() { return $this->peerName; } /** * Enable peer verification. * * @return self Cloned, modified instance. */ public function withPeerVerification(): self { $clone = clone $this; $clone->verifyPeer = true; return $clone; } /** * Disable peer verification, this is the default for servers. * * @return self Cloned, modified instance. */ public function withoutPeerVerification(): self { $clone = clone $this; $clone->verifyPeer = false; return $clone; } /** * @return bool Whether peer verification is enabled. */ public function hasPeerVerification(): bool { return $this->verifyPeer; } /** * Maximum chain length the peer might present including the certificates in the local trust store. * * @param int $verifyDepth Maximum length of the certificate chain. * * @return self Cloned, modified instance. */ public function withVerificationDepth(int $verifyDepth): self { if ($verifyDepth < 0) { throw new \Error("Invalid verification depth ({$verifyDepth}), must be greater than or equal to 0"); } $clone = clone $this; $clone->verifyDepth = $verifyDepth; return $clone; } /** * @return int Maximum length of the certificate chain. */ public function getVerificationDepth(): int { return $this->verifyDepth; } /** * List of ciphers to negotiate, the server's order is always preferred. * * @param string|null $ciphers List of ciphers in OpenSSL's format (colon separated). * * @return self Cloned, modified instance. */ public function withCiphers(string $ciphers = null): self { $clone = clone $this; $clone->ciphers = $ciphers; return $clone; } /** * @return string List of ciphers in OpenSSL's format (colon separated). */ public function getCiphers(): string { return $this->ciphers ?? \OPENSSL_DEFAULT_STREAM_CIPHERS; } /** * CAFile to check for trusted certificates. * * @param string|null $cafile Path to the file or `null` to unset. * * @return self Cloned, modified instance. */ public function withCaFile(string $cafile = null): self { $clone = clone $this; $clone->caFile = $cafile; return $clone; } /** * @return null|string Path to the file if one is set, otherwise `null`. */ public function getCaFile() { return $this->caFile; } /** * CAPath to check for trusted certificates. * * @param string|null $capath Path to the file or `null` to unset. * * @return self Cloned, modified instance. */ public function withCaPath(string $capath = null): self { $clone = clone $this; $clone->caPath = $capath; return $clone; } /** * @return null|string Path to the file if one is set, otherwise `null`. */ public function getCaPath() { return $this->caPath; } /** * Capture the certificates sent by the peer. * * Note: This is the chain as sent by the peer, NOT the verified chain. * * @return self Cloned, modified instance. */ public function withPeerCapturing(): self { $clone = clone $this; $clone->capturePeer = true; return $clone; } /** * Don't capture the certificates sent by the peer. * * @return self Cloned, modified instance. */ public function withoutPeerCapturing(): self { $clone = clone $this; $clone->capturePeer = false; return $clone; } /** * @return bool Whether to capture the certificates sent by the peer. */ public function hasPeerCapturing(): bool { return $this->capturePeer; } /** * Default certificate to use in case no SNI certificate matches. * * @param Certificate|null $defaultCertificate * * @return self Cloned, modified instance. */ public function withDefaultCertificate(Certificate $defaultCertificate = null): self { $clone = clone $this; $clone->defaultCertificate = $defaultCertificate; return $clone; } /** * @return Certificate|null Default certificate to use in case no SNI certificate matches, or `null` if unset. */ public function getDefaultCertificate() { return $this->defaultCertificate; } /** * Certificates to use for the given host names. * * @param array $certificates Must be a associative array mapping hostnames to certificate instances. * * @return self Cloned, modified instance. */ public function withCertificates(array $certificates): self { foreach ($certificates as $key => $certificate) { if (!\is_string($key)) { throw new \TypeError("Expected an array mapping domain names to Certificate instances"); } if (!$certificate instanceof Certificate) { throw new \TypeError("Expected an array of Certificate instances"); } if (\PHP_VERSION_ID < 70200 && $certificate->getCertFile() !== $certificate->getKeyFile()) { throw new \Error( "Different files for cert and key are not supported on this version of PHP. " . "Please upgrade to PHP 7.2 or later." ); } } $clone = clone $this; $clone->certificates = $certificates; return $clone; } /** * @return array Associative array mapping hostnames to certificate instances. */ public function getCertificates(): array { return $this->certificates; } /** * Security level to use. * * Requires OpenSSL 1.1.0 or higher. * * @param int $level Must be between 0 and 5. * * @return self Cloned, modified instance. */ public function withSecurityLevel(int $level): self { // See https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set_security_level.html // Level 2 is not recommended, because of SHA-1 by that document, // but SHA-1 should be phased out now on general internet use. // We therefore default to level 2. if ($level < 0 || $level > 5) { throw new \Error("Invalid security level ({$level}), must be between 0 and 5."); } if (\OPENSSL_VERSION_NUMBER < 0x10100000) { throw new \Error("Can't set a security level, as PHP is compiled with OpenSSL < 1.1.0."); } $clone = clone $this; $clone->securityLevel = $level; return $clone; } /** * @return int Security level between 0 and 5. Always 0 for OpenSSL < 1.1.0. */ public function getSecurityLevel(): int { // 0 is equivalent to previous versions of OpenSSL and just does nothing if (\OPENSSL_VERSION_NUMBER < 0x10100000) { return 0; } return $this->securityLevel; } /** * Converts this TLS context into PHP's equivalent stream context array. * * @return array Stream context array compatible with PHP's streams. */ public function toStreamContextArray(): array { $options = [ "crypto_method" => $this->toStreamCryptoMethod(), "peer_name" => $this->peerName, "verify_peer" => $this->verifyPeer, "verify_peer_name" => $this->verifyPeer, "verify_depth" => $this->verifyDepth, "ciphers" => $this->ciphers ?? \OPENSSL_DEFAULT_STREAM_CIPHERS, "honor_cipher_order" => true, "single_dh_use" => true, "no_ticket" => true, "capture_peer_cert" => $this->capturePeer, "capture_peer_chain" => $this->capturePeer, ]; if ($this->defaultCertificate !== null) { $options["local_cert"] = $this->defaultCertificate->getCertFile(); if ($this->defaultCertificate->getCertFile() !== $this->defaultCertificate->getKeyFile()) { $options["local_pk"] = $this->defaultCertificate->getKeyFile(); } } if ($this->certificates) { $options["SNI_server_certs"] = array_map(function (Certificate $certificate) { if ($certificate->getCertFile() === $certificate->getKeyFile()) { return $certificate->getCertFile(); } return [ "local_cert" => $certificate->getCertFile(), "local_pk" => $certificate->getKeyFile(), ]; }, $this->certificates); } if ($this->caFile !== null) { $options["cafile"] = $this->caFile; } if ($this->caPath !== null) { $options["capath"] = $this->caPath; } if (\OPENSSL_VERSION_NUMBER >= 0x10100000) { $options["security_level"] = $this->securityLevel; } return ["ssl" => $options]; } /** * @return int Crypto method compatible with PHP's streams. */ public function toStreamCryptoMethod(): int { return (~($this->minVersion - 1) & \STREAM_CRYPTO_METHOD_ANY_SERVER) & (~1); } } <?php namespace Amp\Socket; class ConnectException extends SocketException { } <?php namespace Amp\Socket; use Amp\ByteStream\StreamException; class SocketException extends StreamException { } <?php namespace Amp\Socket; use Amp\ByteStream\ClosedException; use Amp\Failure; use Amp\Promise; class ClientSocket extends Socket { /** * {@inheritdoc} * * @param ClientTlsContext|null $tlsContext */ public function enableCrypto(ClientTlsContext $tlsContext = null): Promise { if (($resource = $this->getResource()) === null) { return new Failure(new ClosedException("The socket has been closed")); } $tlsContext = $tlsContext ?? new ClientTlsContext; return Internal\enableCrypto($resource, $tlsContext->toStreamContextArray()); } } <?php namespace Amp\Socket; final class ClientTlsContext { const TLSv1_0 = \STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT; const TLSv1_1 = \STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; const TLSv1_2 = \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; private $minVersion = \STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT; private $peerName = null; private $verifyPeer = true; private $verifyDepth = 10; private $ciphers = null; private $caFile = null; private $caPath = null; private $capturePeer = false; private $sniEnabled = true; private $securityLevel = 2; private $certificate = null; /** * Minimum TLS version to negotiate. * * Defaults to TLS 1.0. * * @param int $version `ServerTlsContext::TLSv1_0`, `ServerTlsContext::TLSv1_1`, or `ServerTlsContext::TLSv1_2`. * * @return self Cloned, modified instance. * @throws \Error If an invalid minimum version is given. */ public function withMinimumVersion(int $version): self { if ($version !== self::TLSv1_0 && $version !== self::TLSv1_1 && $version !== self::TLSv1_2) { throw new \Error("Invalid minimum version, only TLSv1.0, TLSv1.1 or TLSv1.2 allowed"); } $clone = clone $this; $clone->minVersion = $version; return $clone; } /** * Returns the minimum TLS version to negotiate. * * @return int */ public function getMinimumVersion(): int { return $this->minVersion; } /** * Expected name of the peer. * * @param string|null $peerName * * @return self Cloned, modified instance. */ public function withPeerName(string $peerName = null): self { $clone = clone $this; $clone->peerName = $peerName; return $clone; } /** * @return null|string Expected name of the peer or `null` if such an expectation doesn't exist. */ public function getPeerName() { return $this->peerName; } /** * Enable peer verification. * * @return self Cloned, modified instance. */ public function withPeerVerification(): self { $clone = clone $this; $clone->verifyPeer = true; return $clone; } /** * Disable peer verification, this is the default for servers. * * @return self Cloned, modified instance. */ public function withoutPeerVerification(): self { $clone = clone $this; $clone->verifyPeer = false; return $clone; } /** * @return bool Whether peer verification is enabled. */ public function hasPeerVerification(): bool { return $this->verifyPeer; } /** * Maximum chain length the peer might present including the certificates in the local trust store. * * @param int $verifyDepth Maximum length of the certificate chain. * * @return self Cloned, modified instance. */ public function withVerificationDepth(int $verifyDepth): self { if ($verifyDepth < 0) { throw new \Error("Invalid verification depth ({$verifyDepth}), must be greater than or equal to 0"); } $clone = clone $this; $clone->verifyDepth = $verifyDepth; return $clone; } /** * @return int Maximum length of the certificate chain. */ public function getVerificationDepth(): int { return $this->verifyDepth; } /** * List of ciphers to negotiate, the server's order is always preferred. * * @param string|null $ciphers List of ciphers in OpenSSL's format (colon separated). * * @return self Cloned, modified instance. */ public function withCiphers(string $ciphers = null): self { $clone = clone $this; $clone->ciphers = $ciphers; return $clone; } /** * @return string List of ciphers in OpenSSL's format (colon separated). */ public function getCiphers(): string { return $this->ciphers ?? \OPENSSL_DEFAULT_STREAM_CIPHERS; } /** * CAFile to check for trusted certificates. * * @param string|null $cafile Path to the file or `null` to unset. * * @return self Cloned, modified instance. */ public function withCaFile(string $cafile = null): self { $clone = clone $this; $clone->caFile = $cafile; return $clone; } /** * @return null|string Path to the file if one is set, otherwise `null`. */ public function getCaFile() { return $this->caFile; } /** * CAPath to check for trusted certificates. * * @param string|null $capath Path to the file or `null` to unset. * * @return self Cloned, modified instance. */ public function withCaPath(string $capath = null): self { $clone = clone $this; $clone->caPath = $capath; return $clone; } /** * @return null|string Path to the file if one is set, otherwise `null`. */ public function getCaPath() { return $this->caPath; } /** * Capture the certificates sent by the peer. * * Note: This is the chain as sent by the peer, NOT the verified chain. * * @return self Cloned, modified instance. */ public function withPeerCapturing(): self { $clone = clone $this; $clone->capturePeer = true; return $clone; } /** * Don't capture the certificates sent by the peer. * * @return self Cloned, modified instance. */ public function withoutPeerCapturing(): self { $clone = clone $this; $clone->capturePeer = false; return $clone; } /** * @return bool Whether to capture the certificates sent by the peer. */ public function hasPeerCapturing(): bool { return $this->capturePeer; } /** * Enable SNI. * * @return self Cloned, modified instance. */ public function withSni(): self { $clone = clone $this; $clone->sniEnabled = true; return $clone; } /** * Disable SNI. * * @return self Cloned, modified instance. */ public function withoutSni(): self { $clone = clone $this; $clone->sniEnabled = false; return $clone; } /** * @return bool Whether SNI is enabled or not. */ public function hasSni(): bool { return $this->sniEnabled; } /** * Security level to use. * * Requires OpenSSL 1.1.0 or higher. * * @param int $level Must be between 0 and 5. * * @return self Cloned, modified instance. */ public function withSecurityLevel(int $level): self { // See https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set_security_level.html // Level 2 is not recommended, because of SHA-1 by that document, // but SHA-1 should be phased out now on general internet use. // We therefore default to level 2. if ($level < 0 || $level > 5) { throw new \Error("Invalid security level ({$level}), must be between 0 and 5."); } if (\OPENSSL_VERSION_NUMBER < 0x10100000) { throw new \Error("Can't set a security level, as PHP is compiled with OpenSSL < 1.1.0."); } $clone = clone $this; $clone->securityLevel = $level; return $clone; } /** * @return int Security level between 0 and 5. Always 0 for OpenSSL < 1.1.0. */ public function getSecurityLevel(): int { // 0 is equivalent to previous versions of OpenSSL and just does nothing if (\OPENSSL_VERSION_NUMBER < 0x10100000) { return 0; } return $this->securityLevel; } /** * Client certificate to use, if key is no present it assumes it is present in the same file as the certificate. * * @return self Cloned, modified instance. */ public function withCertificate(Certificate $certificate = null): self { $clone = clone $this; $clone->certificate = $certificate; return $clone; } public function getCertificate() { return $this->certificate; } /** * Converts this TLS context into PHP's equivalent stream context array. * * @return array Stream context array compatible with PHP's streams. */ public function toStreamContextArray(): array { $options = [ "crypto_method" => $this->toStreamCryptoMethod(), "peer_name" => $this->peerName, "verify_peer" => $this->verifyPeer, "verify_peer_name" => $this->verifyPeer, "verify_depth" => $this->verifyDepth, "ciphers" => $this->ciphers ?? \OPENSSL_DEFAULT_STREAM_CIPHERS, "capture_peer_cert" => $this->capturePeer, "capture_peer_cert_chain" => $this->capturePeer, "SNI_enabled" => $this->sniEnabled, ]; if ($this->certificate !== null) { $options["local_cert"] = $this->certificate->getCertFile(); if ($this->certificate->getCertFile() !== $this->certificate->getKeyFile()) { $options["local_pk"] = $this->certificate->getKeyFile(); } } if ($this->caFile !== null) { $options["cafile"] = $this->caFile; } if ($this->caPath !== null) { $options["capath"] = $this->caPath; } if (\OPENSSL_VERSION_NUMBER >= 0x10100000) { $options["security_level"] = $this->securityLevel; } return ["ssl" => $options]; } /** * @return int Crypto method compatible with PHP's streams. */ public function toStreamCryptoMethod(): int { // -2 to clear client flag and then make all lower versions bits 1 return (~($this->minVersion - 2) & \STREAM_CRYPTO_METHOD_ANY_CLIENT) | 1; } } <?php namespace Amp\Socket; use Amp\CancellationToken; use Amp\Promise; final class StaticSocketPool implements SocketPool { private $uri; private $socketPool; public function __construct(string $uri, SocketPool $socketPool = null) { $this->uri = $uri; $this->socketPool = $socketPool ?? new BasicSocketPool; } /** @inheritdoc */ public function checkout(string $uri, CancellationToken $token = null): Promise { return $this->socketPool->checkout($this->uri, $token); } /** @inheritdoc */ public function checkin(ClientSocket $socket) { $this->socketPool->checkin($socket); } /** @inheritdoc */ public function clear(ClientSocket $socket) { $this->socketPool->clear($socket); } } <?php namespace Amp\Socket; use Amp\CancellationToken; use Amp\Promise; /** * Allows pooling of connections for stateless protocols. */ interface SocketPool { /** * Checkout a socket from the specified URI authority. * * The resulting socket resource should be checked back in via `SocketPool::checkin()` once the calling code is * finished with the stream (even if the socket has been closed). Failure to checkin sockets will result in memory * leaks and socket queue blockage. Instead of checking the socket in again, it can also be cleared. * * @param string $uri A string of the form tcp://example.com:80 or tcp://192.168.1.1:443. * @param CancellationToken $token Optional cancellation token to cancel the checkout request. * * @return Promise Resolves to a Socket instance once a connection is available. */ public function checkout(string $uri, CancellationToken $token = null): Promise; /** * Return a previously checked-out socket to the pool so it can be reused. * * @param ClientSocket $socket Socket instance. * * @throws \Error If the provided resource is unknown to the pool. */ public function checkin(ClientSocket $socket); /** * Remove the specified socket from the pool. * * @param ClientSocket $socket Socket instance. * * @throws \Error If the provided resource is unknown to the pool. */ public function clear(ClientSocket $socket); } <?php namespace Amp\Socket; use Amp\Deferred; use Amp\Loop; use Amp\Promise; use Amp\Success; class Server { /** @var resource Stream socket server resource. */ private $socket; /** @var string Watcher ID. */ private $watcher; /** @var string|null Stream socket name */ private $address; /** @var int */ private $chunkSize; /** @var Deferred|null */ private $acceptor; /** * @param resource $socket A bound socket server resource * @param int $chunkSize Chunk size for the input and output stream. * * @throws \Error If a stream resource is not given for $socket. */ public function __construct($socket, int $chunkSize = Socket::DEFAULT_CHUNK_SIZE) { if (!\is_resource($socket) || \get_resource_type($socket) !== 'stream') { throw new \Error('Invalid resource given to constructor!'); } $this->socket = $socket; $this->chunkSize = $chunkSize; $this->address = Internal\cleanupSocketName(@\stream_socket_get_name($this->socket, false)); \stream_set_blocking($this->socket, false); $acceptor = &$this->acceptor; $this->watcher = Loop::onReadable($this->socket, static function ($watcher, $socket) use (&$acceptor, $chunkSize) { // Error reporting suppressed since stream_socket_accept() emits E_WARNING on client accept failure. if (!$client = @\stream_socket_accept($socket, 0)) { // Timeout of 0 to be non-blocking. return; // Accepting client failed. } $deferred = $acceptor; $acceptor = null; $deferred->resolve(new ServerSocket($client, $chunkSize)); if (!$acceptor) { Loop::disable($watcher); } }); Loop::disable($this->watcher); } /** * Automatically cancels the loop watcher. */ public function __destruct() { if (!$this->socket) { return; } $this->free(); } /** * @return \Amp\Promise<ServerSocket|null> * * @throws \Amp\Socket\PendingAcceptError If another accept request is pending. */ public function accept(): Promise { if ($this->acceptor) { throw new PendingAcceptError; } if (!$this->socket) { return new Success; // Resolve with null when server is closed. } // Error reporting suppressed since stream_socket_accept() emits E_WARNING on client accept failure. if ($client = @\stream_socket_accept($this->socket, 0)) { // Timeout of 0 to be non-blocking. return new Success(new ServerSocket($client, $this->chunkSize)); } $this->acceptor = new Deferred; Loop::enable($this->watcher); return $this->acceptor->promise(); } /** * Closes the server and stops accepting connections. Any socket clients accepted will not be closed. */ public function close() { if ($this->socket) { \fclose($this->socket); } $this->free(); } /** * @return string|null */ public function getAddress() { return $this->address; } private function free() { Loop::cancel($this->watcher); $this->socket = null; if ($this->acceptor) { $this->acceptor->resolve(); $this->acceptor = null; } } /** * Raw stream socket resource. * * @return resource|null */ public function getResource() { return $this->socket; } } <?php namespace Amp\Socket; use Amp\Dns\Record; use function Amp\Socket\Internal\normalizeBindToOption; final class ClientConnectContext { private $bindTo = null; private $connectTimeout = 10000; private $maxAttempts = 2; private $typeRestriction = null; private $tcpNoDelay = false; public function withBindTo(string $bindTo = null): self { $bindTo = normalizeBindToOption($bindTo); $clone = clone $this; $clone->bindTo = $bindTo; return $clone; } public function getBindTo() { return $this->bindTo; } public function withConnectTimeout(int $timeout): self { if ($timeout <= 0) { throw new \Error("Invalid connect timeout ({$timeout}), must be greater than 0"); } $clone = clone $this; $clone->connectTimeout = $timeout; return $clone; } public function getConnectTimeout(): int { return $this->connectTimeout; } public function withMaxAttempts(int $maxAttempts): self { if ($maxAttempts <= 0) { throw new \Error("Invalid max attempts ({$maxAttempts}), must be greater than 0"); } $clone = clone $this; $clone->maxAttempts = $maxAttempts; return $clone; } public function getMaxAttempts(): int { return $this->maxAttempts; } public function withDnsTypeRestriction(int $type = null): self { if ($type !== null && $type !== Record::AAAA && $type !== Record::A) { throw new \Error("Invalid resolver type restriction"); } $clone = clone $this; $clone->typeRestriction = $type; return $clone; } public function getDnsTypeRestriction() { return $this->typeRestriction; } public function hasTcpNoDelay(): bool { return $this->tcpNoDelay; } public function withTcpNoDelay(): self { $clone = clone $this; $clone->tcpNoDelay = true; return $clone; } public function withoutTcpNoDelay(): self { $clone = clone $this; $clone->tcpNoDelay = false; return $clone; } public function toStreamContextArray(): array { $options = [ "tcp_nodelay" => $this->tcpNoDelay, ]; if ($this->bindTo !== null) { $options["bindto"] = $this->bindTo; } return ["socket" => $options]; } } { "name": "amphp/dns", "homepage": "https://github.com/amphp/dns", "description": "Async DNS resolution for Amp.", "keywords": [ "dns", "resolve", "client", "async", "amp", "amphp" ], "license": "MIT", "authors": [ { "name": "Chris Wright", "email": "addr@daverandom.com" }, { "name": "Daniel Lowrey", "email": "rdlowrey@php.net" }, { "name": "Bob Weinand", "email": "bobwei9@hotmail.com" }, { "name": "Niklas Keller", "email": "me@kelunik.com" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" } ], "require": { "php": ">=7.0", "amphp/amp": "^2", "amphp/byte-stream": "^1.1", "amphp/cache": "^1.2", "amphp/file": "^0.2 || ^0.3", "amphp/parser": "^1", "amphp/uri": "^0.1", "amphp/windows-registry": "^0.3", "daverandom/libdns": "^2.0.1", "ext-filter": "*" }, "require-dev": { "amphp/phpunit-util": "^1", "phpunit/phpunit": "^6", "friendsofphp/php-cs-fixer": "^2.3" }, "autoload": { "psr-4": { "Amp\\Dns\\": "lib" }, "files": [ "lib/functions.php" ] }, "autoload-dev": { "psr-4": { "Amp\\Dns\\Test\\": "test" } }, "config": { "platform": { "php": "7.0.0" } } } <?php namespace Amp\Dns; use Amp\Cache\ArrayCache; use Amp\Cache\Cache; use Amp\Dns\Internal\Socket; use Amp\Dns\Internal\TcpSocket; use Amp\Dns\Internal\UdpSocket; use Amp\Loop; use Amp\MultiReasonException; use Amp\Promise; use Amp\Success; use LibDNS\Messages\Message; use LibDNS\Records\Question; use LibDNS\Records\QuestionFactory; use function Amp\call; use function Amp\Uri\normalizeDnsName; final class BasicResolver implements Resolver { const CACHE_PREFIX = "amphp.dns."; /** @var \Amp\Dns\ConfigLoader */ private $configLoader; /** @var \LibDNS\Records\QuestionFactory */ private $questionFactory; /** @var \Amp\Dns\Config|null */ private $config; /** @var Promise|null */ private $pendingConfig; /** @var Cache */ private $cache; /** @var Socket[] */ private $sockets = []; /** @var Promise[] */ private $pendingSockets = []; /** @var Promise[] */ private $pendingQueries = []; /** @var string */ private $gcWatcher; public function __construct(Cache $cache = null, ConfigLoader $configLoader = null) { $this->cache = $cache ?? new ArrayCache(5000 /* default gc interval */, 256 /* size */); $this->configLoader = $configLoader ?? (\stripos(PHP_OS, "win") === 0 ? new WindowsConfigLoader : new UnixConfigLoader); $this->questionFactory = new QuestionFactory; $sockets = &$this->sockets; $this->gcWatcher = Loop::repeat(5000, static function () use (&$sockets) { if (!$sockets) { return; } $now = \time(); foreach ($sockets as $key => $server) { if ($server->getLastActivity() < $now - 60) { $server->close(); unset($sockets[$key]); } } }); Loop::unreference($this->gcWatcher); } public function __destruct() { Loop::cancel($this->gcWatcher); } /** @inheritdoc */ public function resolve(string $name, int $typeRestriction = null): Promise { if ($typeRestriction !== null && $typeRestriction !== Record::A && $typeRestriction !== Record::AAAA) { throw new \Error("Invalid value for parameter 2: null|Record::A|Record::AAAA expected"); } return call(function () use ($name, $typeRestriction) { if (!$this->config) { yield $this->reloadConfig(); } switch ($typeRestriction) { case Record::A: if (filter_var($name, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { return [new Record($name, Record::A, null)]; } elseif (filter_var($name, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { throw new ResolutionException("Got an IPv6 address, but type is restricted to IPv4"); } break; case Record::AAAA: if (filter_var($name, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { return [new Record($name, Record::AAAA, null)]; } elseif (filter_var($name, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { throw new ResolutionException("Got an IPv4 address, but type is restricted to IPv6"); } break; default: if (filter_var($name, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { return [new Record($name, Record::A, null)]; } elseif (filter_var($name, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { return [new Record($name, Record::AAAA, null)]; } break; } $name = normalizeDnsName($name); if ($records = $this->queryHosts($name, $typeRestriction)) { return $records; } for ($redirects = 0; $redirects < 5; $redirects++) { try { if ($typeRestriction) { $records = yield $this->query($name, $typeRestriction); } else { try { list(, $records) = yield Promise\some([ $this->query($name, Record::A), $this->query($name, Record::AAAA), ]); $records = \array_merge(...$records); break; // Break redirect loop, otherwise we query the same records 5 times } catch (MultiReasonException $e) { $errors = []; foreach ($e->getReasons() as $reason) { if ($reason instanceof NoRecordException) { throw $reason; } $errors[] = $reason->getMessage(); } throw new ResolutionException("All query attempts failed for {$name}: " . \implode(", ", $errors), 0, $e); } } } catch (NoRecordException $e) { try { /** @var Record[] $cnameRecords */ $cnameRecords = yield $this->query($name, Record::CNAME); $name = $cnameRecords[0]->getValue(); continue; } catch (NoRecordException $e) { /** @var Record[] $dnameRecords */ $dnameRecords = yield $this->query($name, Record::DNAME); $name = $dnameRecords[0]->getValue(); continue; } } } return $records; }); } private function queryHosts(string $name, int $typeRestriction = null): array { $hosts = $this->config->getKnownHosts(); $records = []; $returnIPv4 = $typeRestriction === null || $typeRestriction === Record::A; $returnIPv6 = $typeRestriction === null || $typeRestriction === Record::AAAA; if ($returnIPv4 && isset($hosts[Record::A][$name])) { $records[] = new Record($hosts[Record::A][$name], Record::A, null); } if ($returnIPv6 && isset($hosts[Record::AAAA][$name])) { $records[] = new Record($hosts[Record::AAAA][$name], Record::AAAA, null); } return $records; } /** @inheritdoc */ public function query(string $name, int $type): Promise { $pendingQueryKey = $type . " " . $name; if (isset($this->pendingQueries[$pendingQueryKey])) { return $this->pendingQueries[$pendingQueryKey]; } $promise = call(function () use ($name, $type) { if (!$this->config) { yield $this->reloadConfig(); } $name = $this->normalizeName($name, $type); $question = $this->createQuestion($name, $type); if (null !== $cachedValue = yield $this->cache->get($this->getCacheKey($name, $type))) { return $this->decodeCachedResult($name, $type, $cachedValue); } $nameservers = $this->config->getNameservers(); $attempts = $this->config->getAttempts(); $protocol = "udp"; $attempt = 0; /** @var Socket $socket */ $uri = $protocol . "://" . $nameservers[0]; $socket = yield $this->getSocket($uri); $attemptDescription = []; while ($attempt < $attempts) { try { if (!$socket->isAlive()) { unset($this->sockets[$uri]); $socket->close(); /** @var Socket $server */ $i = $attempt % \count($nameservers); $uri = $protocol . "://" . $nameservers[$i]; $socket = yield $this->getSocket($uri); } $attemptDescription[] = $uri; /** @var Message $response */ $response = yield $socket->ask($question, $this->config->getTimeout()); $this->assertAcceptableResponse($response); // UDP sockets are never reused, they're not in the $this->sockets map if ($protocol === "udp") { // Defer call, because it interferes with the unreference() call in Internal\Socket otherwise Loop::defer(function () use ($socket) { $socket->close(); }); } if ($response->isTruncated()) { if ($protocol !== "tcp") { // Retry with TCP, don't count attempt $protocol = "tcp"; $i = $attempt % \count($nameservers); $uri = $protocol . "://" . $nameservers[$i]; $socket = yield $this->getSocket($uri); continue; } throw new ResolutionException("Server returned a truncated response for '{$name}' (" . Record::getName($type) . ")"); } $answers = $response->getAnswerRecords(); $result = []; $ttls = []; /** @var \LibDNS\Records\Resource $record */ foreach ($answers as $record) { $recordType = $record->getType(); $result[$recordType][] = (string) $record->getData(); // Cache for max one day $ttls[$recordType] = \min($ttls[$recordType] ?? 86400, $record->getTTL()); } foreach ($result as $recordType => $records) { // We don't care here whether storing in the cache fails $this->cache->set($this->getCacheKey($name, $recordType), \json_encode($records), $ttls[$recordType]); } if (!isset($result[$type])) { // "it MUST NOT cache it for longer than five (5) minutes" per RFC 2308 section 7.1 $this->cache->set($this->getCacheKey($name, $type), \json_encode([]), 300); throw new NoRecordException("No records returned for '{$name}' (" . Record::getName($type) . ")"); } return \array_map(function ($data) use ($type, $ttls) { return new Record($data, $type, $ttls[$type]); }, $result[$type]); } catch (TimeoutException $e) { // Defer call, because it might interfere with the unreference() call in Internal\Socket otherwise Loop::defer(function () use ($socket, $uri) { unset($this->sockets[$uri]); $socket->close(); }); $i = ++$attempt % \count($nameservers); $uri = $protocol . "://" . $nameservers[$i]; $socket = yield $this->getSocket($uri); continue; } } throw new TimeoutException(\sprintf( "No response for '%s' (%s) from any nameserver after %d attempts, tried %s", $name, Record::getName($type), $attempts, \implode(", ", $attemptDescription) )); }); $this->pendingQueries[$type . " " . $name] = $promise; $promise->onResolve(function () use ($name, $type) { unset($this->pendingQueries[$type . " " . $name]); }); return $promise; } /** * Reloads the configuration in the background. * * Once it's finished, the configuration will be used for new requests. * * @return Promise */ public function reloadConfig(): Promise { if ($this->pendingConfig) { return $this->pendingConfig; } $promise = call(function () { try { $this->config = yield $this->configLoader->loadConfig(); } catch (\Exception $e) { $this->config = new Config(['1.1.1.1:53', '1.0.0.1:53', '[2606:4700:4700::1111]:53', '[2606:4700:4700::1001]:53']); } }); $this->pendingConfig = $promise; $promise->onResolve(function () { $this->pendingConfig = null; }); return $promise; } /** * @param string $name * @param int $type * * @return \LibDNS\Records\Question */ private function createQuestion(string $name, int $type): Question { if (0 > $type || 0xffff < $type) { $message = \sprintf('%d does not correspond to a valid record type (must be between 0 and 65535).', $type); throw new \Error($message); } $question = $this->questionFactory->create($type); $question->setName($name); return $question; } private function getCacheKey(string $name, int $type): string { return self::CACHE_PREFIX . $name . "#" . $type; } private function decodeCachedResult(string $name, string $type, string $encoded) { $decoded = \json_decode($encoded, true); if (!$decoded) { throw new NoRecordException("No records returned for {$name} (cached result)"); } $result = []; foreach ($decoded as $data) { $result[] = new Record($data, $type); } return $result; } private function normalizeName(string $name, int $type) { if ($type === Record::PTR) { if (($packedIp = @inet_pton($name)) !== false) { if (isset($packedIp[4])) { // IPv6 $name = \wordwrap(\strrev(\bin2hex($packedIp)), 1, ".", true) . ".ip6.arpa"; } else { // IPv4 $name = \inet_ntop(\strrev($packedIp)) . ".in-addr.arpa"; } } } elseif (\in_array($type, [Record::A, Record::AAAA])) { $name = normalizeDnsName($name); } return $name; } private function getSocket($uri): Promise { // We use a new socket for each UDP request, as that increases the entropy and mitigates response forgery. if (\substr($uri, 0, 3) === "udp") { return UdpSocket::connect($uri); } // Over TCP we might reuse sockets if the server allows to keep them open. Sequence IDs in TCP are already // better than a random port. Additionally, a TCP connection is more expensive. if (isset($this->sockets[$uri])) { return new Success($this->sockets[$uri]); } if (isset($this->pendingSockets[$uri])) { return $this->pendingSockets[$uri]; } $server = TcpSocket::connect($uri); $server->onResolve(function ($error, $server) use ($uri) { unset($this->pendingSockets[$uri]); if (!$error) { $this->sockets[$uri] = $server; } }); return $server; } private function assertAcceptableResponse(Message $response) { if ($response->getResponseCode() !== 0) { throw new ResolutionException(\sprintf("Server returned error code: %d", $response->getResponseCode())); } } } <?php namespace Amp\Dns; class TimeoutException extends ResolutionException { } <?php namespace Amp\Dns\Internal; use Amp\Dns\ResolutionException; use Amp\Promise; use Amp\Success; use LibDNS\Decoder\DecoderFactory; use LibDNS\Encoder\EncoderFactory; use LibDNS\Messages\Message; use function Amp\call; /** @internal */ class UdpSocket extends Socket { /** @var \LibDNS\Encoder\Encoder */ private $encoder; /** @var \LibDNS\Decoder\Decoder */ private $decoder; public static function connect(string $uri): Promise { if (!$socket = @\stream_socket_client($uri, $errno, $errstr, 0, STREAM_CLIENT_ASYNC_CONNECT)) { throw new ResolutionException(\sprintf( "Connection to %s failed: [Error #%d] %s", $uri, $errno, $errstr )); } return new Success(new self($socket)); } protected function __construct($socket) { parent::__construct($socket); $this->encoder = (new EncoderFactory)->create(); $this->decoder = (new DecoderFactory)->create(); } protected function send(Message $message): Promise { $data = $this->encoder->encode($message); return $this->write($data); } protected function receive(): Promise { return call(function () { $data = yield $this->read(); if ($data === null) { throw new ResolutionException("Reading from the server failed"); } return $this->decoder->decode($data); }); } public function isAlive(): bool { return true; } } <?php namespace Amp\Dns\Internal; use Amp; use Amp\ByteStream\ResourceInputStream; use Amp\ByteStream\ResourceOutputStream; use Amp\ByteStream\StreamException; use Amp\Deferred; use Amp\Dns\ResolutionException; use Amp\Dns\TimeoutException; use Amp\Promise; use LibDNS\Messages\Message; use LibDNS\Messages\MessageFactory; use LibDNS\Messages\MessageTypes; use LibDNS\Records\Question; use function Amp\call; /** @internal */ abstract class Socket { const MAX_CONCURRENT_REQUESTS = 500; /** @var ResourceInputStream */ private $input; /** @var ResourceOutputStream */ private $output; /** @var array Contains already sent queries with no response yet. For UDP this is exactly zero or one item. */ private $pending = []; /** @var MessageFactory */ private $messageFactory; /** @var callable */ private $onResolve; /** @var int Used for determining whether the socket can be garbage collected, because it's inactive. */ private $lastActivity; /** @var bool */ private $receiving = false; /** @var array Queued requests if the number of concurrent requests is too large. */ private $queue = []; /** * @param string $uri * * @return Promise<\Amp\Dns\Server> */ abstract public static function connect(string $uri): Promise; /** * @param Message $message * * @return Promise<int> */ abstract protected function send(Message $message): Promise; /** * @return Promise<Message> */ abstract protected function receive(): Promise; /** * @return bool */ abstract public function isAlive(): bool; public function getLastActivity(): int { return $this->lastActivity; } protected function __construct($socket) { $this->input = new ResourceInputStream($socket); $this->output = new ResourceOutputStream($socket); $this->messageFactory = new MessageFactory; $this->lastActivity = \time(); $this->onResolve = function (\Throwable $exception = null, Message $message = null) { $this->lastActivity = \time(); $this->receiving = false; if ($exception) { $this->error($exception); return; } $id = $message->getId(); // Ignore duplicate and invalid responses. if (isset($this->pending[$id]) && $this->matchesQuestion($message, $this->pending[$id]->question)) { /** @var Deferred $deferred */ $deferred = $this->pending[$id]->deferred; unset($this->pending[$id]); $deferred->resolve($message); } if (empty($this->pending)) { $this->input->unreference(); } elseif (!$this->receiving) { $this->input->reference(); $this->receiving = true; $this->receive()->onResolve($this->onResolve); } }; } /** * @param \LibDNS\Records\Question $question * @param int $timeout * * @return \Amp\Promise<\LibDNS\Messages\Message> */ public function ask(Question $question, int $timeout): Promise { return call(function () use ($question, $timeout) { $this->lastActivity = \time(); if (\count($this->pending) > self::MAX_CONCURRENT_REQUESTS) { $deferred = new Deferred; $this->queue[] = $deferred; yield $deferred->promise(); } do { $id = \random_int(0, 0xffff); } while (isset($this->pending[$id])); $message = $this->createMessage($question, $id); try { yield $this->send($message); } catch (StreamException $exception) { $exception = new ResolutionException("Sending the request failed", 0, $exception); $this->error($exception); throw $exception; } $deferred = new Deferred; $pending = new class { use Amp\Struct; public $deferred; public $question; }; $pending->deferred = $deferred; $pending->question = $question; $this->pending[$id] = $pending; $this->input->reference(); if (!$this->receiving) { $this->receiving = true; $this->receive()->onResolve($this->onResolve); } try { // Work around an OPCache issue that returns an empty array with "return ...", // so assign to a variable first and return after the try block. // // See https://github.com/amphp/dns/issues/58. // See https://bugs.php.net/bug.php?id=74840. $result = yield Promise\timeout($deferred->promise(), $timeout); } catch (Amp\TimeoutException $exception) { unset($this->pending[$id]); if (empty($this->pending)) { $this->input->unreference(); } throw new TimeoutException("Didn't receive a response within {$timeout} milliseconds."); } finally { if ($this->queue) { $deferred = array_shift($this->queue); $deferred->resolve(); } } return $result; }); } public function close() { $this->input->close(); $this->output->close(); } private function error(\Throwable $exception) { $this->close(); if (empty($this->pending)) { return; } if (!$exception instanceof ResolutionException) { $message = "Unexpected error during resolution: " . $exception->getMessage(); $exception = new ResolutionException($message, 0, $exception); } $pending = $this->pending; $this->pending = []; foreach ($pending as $pendingQuestion) { /** @var Deferred $deferred */ $deferred = $pendingQuestion->deferred; $deferred->fail($exception); } } protected function read(): Promise { return $this->input->read(); } protected function write(string $data): Promise { return $this->output->write($data); } protected function createMessage(Question $question, int $id): Message { $request = $this->messageFactory->create(MessageTypes::QUERY); $request->getQuestionRecords()->add($question); $request->isRecursionDesired(true); $request->setID($id); return $request; } private function matchesQuestion(Message $message, Question $question): bool { if ($message->getType() !== MessageTypes::RESPONSE) { return false; } $questionRecords = $message->getQuestionRecords(); // We only ever ask one question at a time if (\count($questionRecords) !== 1) { return false; } $questionRecord = $questionRecords->getIterator()->current(); if ($questionRecord->getClass() !== $question->getClass()) { return false; } if ($questionRecord->getType() !== $question->getType()) { return false; } if ($questionRecord->getName()->getValue() !== $question->getName()->getValue()) { return false; } return true; } } <?php namespace Amp\Dns\Internal; use Amp; use Amp\Deferred; use Amp\Dns\ResolutionException; use Amp\Dns\TimeoutException; use Amp\Loop; use Amp\Parser\Parser; use Amp\Promise; use Amp\Success; use LibDNS\Decoder\DecoderFactory; use LibDNS\Encoder\EncoderFactory; use LibDNS\Messages\Message; use function Amp\call; /** @internal */ class TcpSocket extends Socket { /** @var \LibDNS\Encoder\Encoder */ private $encoder; /** @var \SplQueue */ private $queue; /** @var Parser */ private $parser; /** @var bool */ private $isAlive = true; public static function connect(string $uri, int $timeout = 5000): Promise { if (!$socket = @\stream_socket_client($uri, $errno, $errstr, 0, STREAM_CLIENT_ASYNC_CONNECT)) { throw new ResolutionException(\sprintf( "Connection to %s failed: [Error #%d] %s", $uri, $errno, $errstr )); } \stream_set_blocking($socket, false); return call(function () use ($uri, $socket, $timeout) { $deferred = new Deferred; $watcher = Loop::onWritable($socket, static function () use ($socket, $deferred) { $deferred->resolve(new self($socket)); }); try { return yield Promise\timeout($deferred->promise(), $timeout); } catch (Amp\TimeoutException $e) { throw new TimeoutException("Name resolution timed out, could not connect to server at $uri"); } finally { Loop::cancel($watcher); } }); } public static function parser(callable $callback): \Generator { $decoder = (new DecoderFactory)->create(); while (true) { $length = yield 2; $length = \unpack("n", $length)[1]; $rawData = yield $length; $callback($decoder->decode($rawData)); } } protected function __construct($socket) { parent::__construct($socket); $this->encoder = (new EncoderFactory)->create(); $this->queue = new \SplQueue; $this->parser = new Parser(self::parser([$this->queue, 'push'])); } protected function send(Message $message): Promise { $data = $this->encoder->encode($message); $promise = $this->write(\pack("n", \strlen($data)) . $data); $promise->onResolve(function ($error) { if ($error) { $this->isAlive = false; } }); return $promise; } protected function receive(): Promise { if ($this->queue->isEmpty()) { return call(function () { do { $chunk = yield $this->read(); if ($chunk === null) { $this->isAlive = false; throw new ResolutionException("Reading from the server failed"); } $this->parser->push($chunk); } while ($this->queue->isEmpty()); return $this->queue->shift(); }); } return new Success($this->queue->shift()); } public function isAlive(): bool { return $this->isAlive; } } <?php namespace Amp\Dns; use Amp\File; use Amp\File\FilesystemException; use Amp\Promise; use function Amp\call; final class UnixConfigLoader implements ConfigLoader { private $path; private $hostLoader; public function __construct(string $path = "/etc/resolv.conf", HostLoader $hostLoader = null) { $this->path = $path; $this->hostLoader = $hostLoader ?? new HostLoader; } public function loadConfig(): Promise { return call(function () { $path = $this->path; $nameservers = []; $timeout = 3000; $attempts = 2; try { $fileContent = yield File\get($path); $lines = \explode("\n", $fileContent); foreach ($lines as $line) { $line = \preg_split('#\s+#', $line, 2); if (\count($line) !== 2) { continue; } list($type, $value) = $line; if ($type === "nameserver") { $value = \trim($value); $ip = @\inet_pton($value); if ($ip === false) { continue; } if (isset($ip[15])) { // IPv6 $nameservers[] = "[" . $value . "]:53"; } else { // IPv4 $nameservers[] = $value . ":53"; } } elseif ($type === "options") { $optline = \preg_split('#\s+#', $value, 2); if (\count($optline) !== 2) { continue; } list($option, $value) = $optline; switch ($option) { case "timeout": $timeout = (int) $value; break; case "attempts": $attempts = (int) $value; } } } } catch (FilesystemException $e) { throw new ConfigException("Could not read configuration file ({$path})", $e); } $hosts = yield $this->hostLoader->loadHosts(); return new Config($nameservers, $hosts, $timeout, $attempts); }); } } <?php namespace Amp\Dns; use Amp\Loop; use Amp\Promise; const LOOP_STATE_IDENTIFIER = Resolver::class; /** * Retrieve the application-wide dns resolver instance. * * @param \Amp\Dns\Resolver $resolver Optionally specify a new default dns resolver instance * * @return \Amp\Dns\Resolver Returns the application-wide dns resolver instance */ function resolver(Resolver $resolver = null): Resolver { if ($resolver === null) { $resolver = Loop::getState(LOOP_STATE_IDENTIFIER); if ($resolver) { return $resolver; } $resolver = driver(); } Loop::setState(LOOP_STATE_IDENTIFIER, $resolver); return $resolver; } /** * Create a new dns resolver best-suited for the current environment. * * @return \Amp\Dns\Resolver */ function driver(): Resolver { return new BasicResolver; } /** * @see Resolver::resolve() */ function resolve(string $name, int $typeRestriction = null): Promise { return resolver()->resolve($name, $typeRestriction); } /** * @see Resolver::query() */ function query(string $name, int $type): Promise { return resolver()->query($name, $type); } <?php namespace Amp\Dns; use Throwable; /** * MUST be thrown in case the config can't be read and no fallback is available. */ class ConfigException extends ResolutionException { public function __construct(string $message, Throwable $previous = null) { parent::__construct($message, 0, $previous); } } <?php namespace Amp\Dns; use Amp\Promise; interface ConfigLoader { public function loadConfig(): Promise; } <?php namespace Amp\Dns; class ResolutionException extends \Exception { } <?php namespace Amp\Dns; class InvalidNameError extends \Error { } <?php namespace Amp\Dns; use Amp\Promise; interface Resolver { /** * Resolves a hostname name to an IP address [hostname as defined by RFC 3986]. * * Upon success the returned promise resolves to an array of Record objects. * * A null $ttl value indicates the DNS name was resolved from the cache or the local hosts file. * * @param string $name The hostname to resolve. * @param int $typeRestriction Optional type restriction to `Record::A` or `Record::AAAA`, otherwise `null`. * * @return Promise */ public function resolve(string $name, int $typeRestriction = null): Promise; /** * Query specific DNS records. * * Upon success the returned promise resolves to an array of Record objects. * * @param string $name Record to question, A, AAAA and PTR queries are automatically normalized. * @param int $type Use constants of Amp\Dns\Record. * * @return Promise */ public function query(string $name, int $type): Promise; } <?php namespace Amp\Dns; use Amp\File; use Amp\Promise; use Amp\Uri\InvalidDnsNameException; use function Amp\call; use function Amp\Uri\normalizeDnsName; class HostLoader { private $path; public function __construct(string $path = null) { $this->path = $path ?? $this->getDefaultPath(); } private function getDefaultPath(): string { return \stripos(PHP_OS, "win") === 0 ? 'C:\Windows\system32\drivers\etc\hosts' : '/etc/hosts'; } public function loadHosts(): Promise { return call(function () { $data = []; try { $contents = yield File\get($this->path); } catch (File\FilesystemException $e) { return []; } $lines = \array_filter(\array_map("trim", \explode("\n", $contents))); foreach ($lines as $line) { if ($line[0] === "#") { // Skip comments continue; } $parts = \preg_split('/\s+/', $line); if (!($ip = @\inet_pton($parts[0]))) { continue; } elseif (isset($ip[4])) { $key = Record::AAAA; } else { $key = Record::A; } for ($i = 1, $l = \count($parts); $i < $l; $i++) { try { $normalizedName = normalizeDnsName($parts[$i]); $data[$key][$normalizedName] = $parts[0]; } catch (InvalidDnsNameException $e) { // ignore invalid entries } } } return $data; }); } } <?php namespace Amp\Dns; class NoRecordException extends ResolutionException { } <?php namespace Amp\Dns; use LibDNS\Records\ResourceQTypes; use LibDNS\Records\ResourceTypes; final class Record { const A = ResourceTypes::A; const AAAA = ResourceTypes::AAAA; const AFSDB = ResourceTypes::AFSDB; // const APL = ResourceTypes::APL; const CAA = ResourceTypes::CAA; const CERT = ResourceTypes::CERT; const CNAME = ResourceTypes::CNAME; const DHCID = ResourceTypes::DHCID; const DLV = ResourceTypes::DLV; const DNAME = ResourceTypes::DNAME; const DNSKEY = ResourceTypes::DNSKEY; const DS = ResourceTypes::DS; const HINFO = ResourceTypes::HINFO; // const HIP = ResourceTypes::HIP; // const IPSECKEY = ResourceTypes::IPSECKEY; const KEY = ResourceTypes::KEY; const KX = ResourceTypes::KX; const ISDN = ResourceTypes::ISDN; const LOC = ResourceTypes::LOC; const MB = ResourceTypes::MB; const MD = ResourceTypes::MD; const MF = ResourceTypes::MF; const MG = ResourceTypes::MG; const MINFO = ResourceTypes::MINFO; const MR = ResourceTypes::MR; const MX = ResourceTypes::MX; const NAPTR = ResourceTypes::NAPTR; const NS = ResourceTypes::NS; // const NSEC = ResourceTypes::NSEC; // const NSEC3 = ResourceTypes::NSEC3; // const NSEC3PARAM = ResourceTypes::NSEC3PARAM; const NULL = ResourceTypes::NULL; const PTR = ResourceTypes::PTR; const RP = ResourceTypes::RP; // const RRSIG = ResourceTypes::RRSIG; const RT = ResourceTypes::RT; const SIG = ResourceTypes::SIG; const SOA = ResourceTypes::SOA; const SPF = ResourceTypes::SPF; const SRV = ResourceTypes::SRV; const TXT = ResourceTypes::TXT; const WKS = ResourceTypes::WKS; const X25 = ResourceTypes::X25; const AXFR = ResourceQTypes::AXFR; const MAILB = ResourceQTypes::MAILB; const MAILA = ResourceQTypes::MAILA; const ALL = ResourceQTypes::ALL; private $value; private $type; private $ttl; public function __construct(string $value, int $type, int $ttl = null) { $this->value = $value; $this->type = $type; $this->ttl = $ttl; } public function getValue(): string { return $this->value; } public function getType(): int { return $this->type; } public function getTtl() { return $this->ttl; } /** * Converts an record type integer back into its name as defined in this class. * * Returns "unknown (<type>)" in case a name for this record is not known. * * @param int $type Record type as integer. * * @return string Name of the constant for this record in this class. */ public static function getName(int $type): string { static $types; if (0 > $type || 0xffff < $type) { $message = \sprintf('%d does not correspond to a valid record type (must be between 0 and 65535).', $type); throw new \Error($message); } if ($types === null) { $types = \array_flip( (new \ReflectionClass(self::class)) ->getConstants() ); } return $types[$type] ?? "unknown ({$type})"; } } <?php namespace Amp\Dns; final class Config { private $nameservers; private $knownHosts; private $timeout; private $attempts; public function __construct(array $nameservers, array $knownHosts = [], int $timeout = 3000, int $attempts = 2) { if (\count($nameservers) < 1) { throw new ConfigException("At least one nameserver is required for a valid config"); } foreach ($nameservers as $nameserver) { $this->validateNameserver($nameserver); } if ($timeout < 0) { throw new ConfigException("Invalid timeout ({$timeout}), must be 0 or greater"); } if ($attempts < 1) { throw new ConfigException("Invalid attempt count ({$attempts}), must be 1 or greater"); } // Windows does not include localhost in its host file. Fetch it from the system instead if (!isset($knownHosts[Record::A]["localhost"]) && !isset($knownHosts[Record::AAAA]["localhost"])) { // PHP currently provides no way to **resolve** IPv6 hostnames (not even with fallback) $local = \gethostbyname("localhost"); if ($local !== "localhost") { $knownHosts[Record::A]["localhost"] = $local; } else { $knownHosts[Record::A]["localhost"] = '127.0.0.1'; } $knownHosts[Record::AAAA]["localhost"] = "::1"; } $this->nameservers = $nameservers; $this->knownHosts = $knownHosts; $this->timeout = $timeout; $this->attempts = $attempts; } private function validateNameserver($nameserver) { if (!$nameserver || !\is_string($nameserver)) { throw new ConfigException("Invalid nameserver: {$nameserver}"); } if ($nameserver[0] === "[") { // IPv6 $addr = \strstr(\substr($nameserver, 1), "]", true); $port = \substr($nameserver, \strrpos($nameserver, "]") + 1); if ($port !== "" && !\preg_match("(^:(\\d+)$)", $port, $match)) { throw new ConfigException("Invalid nameserver: {$nameserver}"); } $port = $port === "" ? 53 : \substr($port, 1); } else { // IPv4 $arr = \explode(":", $nameserver, 2); if (\count($arr) === 2) { list($addr, $port) = $arr; } else { $addr = $arr[0]; $port = 53; } } $addr = \trim($addr, "[]"); $port = (int) $port; if (!$inAddr = @\inet_pton($addr)) { throw new ConfigException("Invalid server IP: {$addr}"); } if ($port < 1 || $port > 65535) { throw new ConfigException("Invalid server port: {$port}"); } } public function getNameservers(): array { return $this->nameservers; } public function getKnownHosts(): array { return $this->knownHosts; } public function getTimeout(): int { return $this->timeout; } public function getAttempts(): int { return $this->attempts; } } <?php namespace Amp\Dns; use Amp\Promise; use Amp\WindowsRegistry\KeyNotFoundException; use Amp\WindowsRegistry\WindowsRegistry; use function Amp\call; final class WindowsConfigLoader implements ConfigLoader { private $hostLoader; public function __construct(HostLoader $hostLoader = null) { $this->hostLoader = $hostLoader ?? new HostLoader; } public function loadConfig(): Promise { return call(function () { $keys = [ "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\NameServer", "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\DhcpNameServer", ]; $reader = new WindowsRegistry; $nameserver = ""; while ($nameserver === "" && ($key = \array_shift($keys))) { try { $nameserver = yield $reader->read($key); } catch (KeyNotFoundException $e) { // retry other possible locations } } if ($nameserver === "") { $interfaces = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces"; $subKeys = yield $reader->listKeys($interfaces); foreach ($subKeys as $key) { foreach (["NameServer", "DhcpNameServer"] as $property) { try { $nameserver = yield $reader->read("{$key}\\{$property}"); if ($nameserver !== "") { break 2; } } catch (KeyNotFoundException $e) { // retry other possible locations } } } } if ($nameserver === "") { throw new ConfigException("Could not find a nameserver in the Windows Registry"); } $nameservers = []; // Microsoft documents space as delimiter, AppVeyor uses comma, we just accept both foreach (\explode(" ", \strtr($nameserver, ",", " ")) as $nameserver) { $nameserver = \trim($nameserver); $ip = @\inet_pton($nameserver); if ($ip === false) { continue; } if (isset($ip[15])) { // IPv6 $nameservers[] = "[" . $nameserver . "]:53"; } else { // IPv4 $nameservers[] = $nameserver . ":53"; } } $hosts = yield $this->hostLoader->loadHosts(); return new Config($nameservers, $hosts); }); } } { "name": "amphp/uri", "homepage": "https://github.com/amphp/uri", "description": "Uri Parser and Resolver.", "license": "MIT", "authors": [ { "name": "Daniel Lowrey" }, { "name": "Niklas Keller", "email": "me@kelunik.com" } ], "support": { "issues": "https://github.com/amphp/uri/issues" }, "require-dev": { "phpunit/phpunit": "^6", "friendsofphp/php-cs-fixer": "^2.3" }, "autoload": { "psr-4": { "Amp\\Uri\\": "src" }, "files": [ "src/functions.php" ] } } <?php namespace Amp\Uri; class InvalidDnsNameException extends \Exception { } <?php namespace Amp\Uri; /** * Checks whether a string is a valid DNS name. * * @param string $name String to check. * * @return bool */ function isValidDnsName(string $name) { try { normalizeDnsName($name); return true; } catch (InvalidDnsNameException $e) { return false; } } /** * Normalizes a DNS name and automatically checks it for validity. * * @param string $name DNS name. * * @return string Normalized DNS name. * * @throws InvalidDnsNameException If an invalid name or an IDN name without ext/intl being installed has been passed. */ function normalizeDnsName(string $name): string { static $pattern = '/^(?<name>[a-z0-9]([a-z0-9-_]{0,61}[a-z0-9])?)(\.(?&name))*\.?$/i'; if (\function_exists('idn_to_ascii') && \defined('INTL_IDNA_VARIANT_UTS46')) { if (false === $result = \idn_to_ascii($name, 0, \INTL_IDNA_VARIANT_UTS46)) { throw new InvalidDnsNameException("Name '{$name}' could not be processed for IDN."); } $name = $result; } else { if (\preg_match('/[\x80-\xff]/', $name)) { throw new InvalidDnsNameException( "Name '{$name}' contains non-ASCII characters and IDN support is not available. " . "Verify that ext/intl is installed for IDN support and that ICU is at least version 4.6." ); } } if (isset($name[253]) || !\preg_match($pattern, $name)) { throw new InvalidDnsNameException("Name '{$name}' is not a valid hostname."); } if ($name[strlen($name)-1] === '.') { $name = substr($name, 0, -1); } return $name; } <?php namespace Amp\Uri; /** * Provides URI parsing and can resolve URIs. */ final class Uri { private $defaultPortMap = [ "http" => 80, "https" => 443, "ftp" => 21, "ftps" => 990, "smtp" => 25, ]; private $uri; private $scheme = ''; private $user = ''; private $pass = ''; private $host = ''; private $port = 0; private $path = ''; private $query = ''; private $fragment = ''; private $queryParameters = []; private $isIpV4 = false; private $isIpV6 = false; public function __construct(string $uri) { /** @var false|array $parts */ if (!$parts = parse_url($uri)) { throw new InvalidUriException( 'Invalid URI specified at ' . self::class . '::__construct Argument 1: ' . $uri ); } $this->uri = $uri; foreach ($parts as $key => $value) { $this->{$key} = $value; } // http://www.apps.ietf.org/rfc/rfc3986.html#sec-3.1 // "schemes are case-insensitive" $this->scheme = \strtolower($this->scheme); // http://www.apps.ietf.org/rfc/rfc3986.html#sec-3.2.2 // "Although host is case-insensitive, producers and normalizers should use lowercase for // registered names and hexadecimal addresses for the sake of uniformity" if ($inAddr = @\inet_pton(\trim($this->host, "[]"))) { $this->host = \strtolower($this->host); if (isset($inAddr[4])) { $this->isIpV6 = true; } else { $this->isIpV4 = true; } } elseif ($this->host) { try { $this->host = normalizeDnsName($this->host); } catch (InvalidDnsNameException $e) { throw new InvalidUriException("Invalid URI: Invalid host: {$this->host}", 0, $e); } } if ($this->port === 0) { if (isset($this->defaultPortMap[$this->scheme])) { $this->port = $this->defaultPortMap[$this->scheme]; } } $this->parseQueryParameters(); if ($this->fragment) { $this->fragment = rawurldecode($this->fragment); $this->fragment = rawurlencode($this->fragment); } } public function __toString() { return $this->reconstitute( $this->scheme, $this->getAuthority(), $this->path, $this->query, $this->fragment ); } /** * @see http://tools.ietf.org/html/rfc3986#section-5.3 */ private function reconstitute($scheme, $authority, $path, $query, $fragment): string { $result = ''; if ($scheme) { $result .= $scheme . ':'; } if ($authority) { $result .= '//'; $result .= $authority; } $result .= $path; if ($query) { $result .= '?'; $result .= $query; } if ($fragment) { $result .= '#'; $result .= $fragment; } return $result; } /** * Normalizes the URI for maximal comparison success. * * @return string */ public function normalize(): string { if (!$this->uri) { return ''; } $path = $this->path ?: '/'; $path = $this->removeDotSegments($path); $path = $this->decodeUnreservedCharacters($path); $path = $this->decodeReservedSubDelimiters($path); return $this->reconstitute( $this->scheme, $this->getAuthority(), $path, $this->query, $this->fragment ); } /** * "URI producers and normalizers should omit the port component and its ":" delimiter if port * is empty or if its value would be the same as that of the scheme's default". * * @see http://www.apps.ietf.org/rfc/rfc3986.html#sec-3.2.3 */ private function getNormalizedDefaultPort(): string { if ($this->port === 0) { return ""; } if (isset($this->defaultPortMap[$this->scheme])) { $defaultPort = $this->defaultPortMap[$this->scheme]; if ($defaultPort === $this->port) { return ""; } } return ":" . $this->port; } /** * @param string $input * * @return string * * @link http://www.apps.ietf.org/rfc/rfc3986.html#sec-5.2.4 */ private function removeDotSegments(string $input): string { $output = ''; $patternA = ',^(\.\.?/),'; $patternB1 = ',^(/\./),'; $patternB2 = ',^(/\.)$,'; $patternC = ',^(/\.\./|/\.\.),'; // $patternD = ',^(\.\.?)$,'; $patternE = ',(/*[^/]*),'; while ($input !== '') { if (\preg_match($patternA, $input)) { $input = \preg_replace($patternA, '', $input); } elseif (\preg_match($patternB1, $input, $match) || \preg_match($patternB2, $input, $match)) { $input = preg_replace(",^" . $match[1] . ",", '/', $input); } elseif (\preg_match($patternC, $input, $match)) { $input = \preg_replace(',^' . \preg_quote($match[1], ',') . ',', '/', $input); $output = \preg_replace(',/([^/]+)$,', '', $output); } elseif ($input === '.' || $input === '..') { // pattern D $input = ''; } elseif (\preg_match($patternE, $input, $match)) { $initialSegment = $match[1]; $input = \preg_replace(',^' . \preg_quote($initialSegment, ',') . ',', '', $input, 1); $output .= $initialSegment; } } return $output; } /** * @see http://www.apps.ietf.org/rfc/rfc3986.html#sec-2.3 */ private function decodeUnreservedCharacters($str) { $str = \rawurldecode($str); $str = \rawurlencode($str); $encoded = ['%2F', '%3A', '%40']; $decoded = ['/', ':', '@']; return \str_replace($encoded, $decoded, $str); } /** * @see http://www.apps.ietf.org/rfc/rfc3986.html#sec-2.2 */ private function decodeReservedSubDelimiters($str) { $encoded = ['%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C', '%3B', '%3D']; $decoded = ['!', '$', '&', "'", '(', ')', '*', '+', ',', ';', '=']; return \str_replace($encoded, $decoded, $str); } /** * @param string $toResolve * * @return Uri * * @see http://tools.ietf.org/html/rfc3986#section-5.2.2 */ public function resolve(string $toResolve) { $r = new Uri($toResolve); if ((string) $r === '') { return clone $this; } $base = $this; $t = new \stdClass; $t->scheme = ''; $t->authority = ''; $t->path = ''; $t->query = ''; $t->fragment = ''; if ('' !== $r->getScheme()) { $t->scheme = $r->getScheme(); $t->authority = $r->getAuthority(); $t->path = $this->removeDotSegments($r->getPath()); $t->query = $r->getQuery(); } else { if ('' !== $r->getAuthority()) { $t->authority = $r->getAuthority(); $t->path = $this->removeDotSegments($r->getPath()); $t->query = $r->getQuery(); } else { if ('' === $r->getPath()) { $t->path = $base->getPath(); if ($r->getQuery()) { $t->query = $r->getQuery(); } else { $t->query = $base->getQuery(); }; } else { if ($r->getPath() && substr($r->getPath(), 0, 1) === "/") { $t->path = $this->removeDotSegments($r->getPath()); } else { $t->path = $this->mergePaths($base->getPath(), $r->getPath()); }; $t->query = $r->getQuery(); }; $t->authority = $base->getAuthority(); }; $t->scheme = $base->getScheme(); }; $t->fragment = $r->getFragment(); $result = $this->reconstitute($t->scheme, $t->authority, $t->path, $t->query, $t->fragment); return new Uri($result); } /** * @link http://tools.ietf.org/html/rfc3986#section-5.2.3 */ private function mergePaths($basePath, $pathToMerge) { if ($basePath === '') { $merged = '/' . $pathToMerge; } else { $parts = \explode('/', $basePath); \array_pop($parts); $parts[] = $pathToMerge; $merged = \implode('/', $parts); } return $this->removeDotSegments($merged); } /** * @return string */ public function getScheme(): string { return $this->scheme; } /** * @return string */ public function getUser(): string { return $this->user; } /** * @return string */ public function getPass(): string { return $this->pass; } /** * @return string */ public function getHost(): string { return $this->host; } /** * @return int */ public function getPort(): int { return $this->port; } /** * @return string */ public function getPath(): string { return $this->path; } /** * @return string */ public function getQuery(): string { return $this->query; } /** * @return string */ public function getFragment(): string { return $this->fragment; } /** * Retrieve the URI without the fragment component. */ public function getAbsoluteUri() { return $this->reconstitute( $this->scheme, $this->getAuthority(), $this->path, $this->query, $fragment = '' ); } /** * @return bool */ public function isIpV4(): bool { return $this->isIpV4; } /** * @return bool */ public function isIpV6(): bool { return $this->isIpV6; } /** * @param bool $hiddenPass Whether to hide the password. * * @return string * * @see http://www.apps.ietf.org/rfc/rfc3986.html#sec-3.2 */ public function getAuthority(bool $hiddenPass = true): string { $authority = $this->user; $authority .= $this->pass !== '' ? (':' . ($hiddenPass ? '********' : $this->pass)) : ''; $authority .= $authority ? '@' : ''; $authority .= $this->isIpV6 ? "[{$this->host}]" : $this->host; $authority .= $this->getNormalizedDefaultPort(); return $authority; } private function parseQueryParameters() { if ($this->query) { $parameters = []; foreach (\explode("&", $this->query) as $pair) { $pair = explode("=", $pair, 2); $parameters[\urldecode($pair[0])][] = \urldecode($pair[1] ?? ""); } $this->queryParameters = $parameters; } } /** * Check whether the specified query parameter exists. * * @param string $parameter * * @return bool */ public function hasQueryParameter(string $parameter): bool { return isset($this->queryParameters[$parameter]); } /** * Get the first occurrence of the specified query parameter. * * @param string $parameter * * @return string|null */ public function getQueryParameter(string $parameter) { return $this->queryParameters[$parameter][0] ?? null; } /** * Get all occurrences of the specified query parameter. * * @param string $parameter * * @return string[] */ public function getQueryParameterArray(string $parameter): array { return $this->queryParameters[$parameter] ?? []; } /** * @return array */ public function getAllQueryParameters(): array { return $this->queryParameters; } /** * @return string */ public function getOriginalUri(): string { return $this->uri; } /** * Test whether the specified string is a valid URI. * * @param string $uri * * @return bool */ public static function isValid(string $uri): bool { try { new self($uri); } catch (InvalidUriException $e) { return false; } return true; } } <?php namespace Amp\Uri; class InvalidUriException extends \Exception { } { "name": "amphp/sync", "description": "Mutex, Semaphore, and other synchronization tools for Amp.", "keywords": [ "asynchronous", "async", "mutex", "semaphore", "synchronization" ], "homepage": "https://github.com/amphp/sync", "license": "MIT", "authors": [ { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" }, { "name": "Stephen Coakley", "email": "me@stephencoakley.com" } ], "require": { "amphp/amp": "^2" }, "require-dev": { "phpunit/phpunit": "^6", "amphp/phpunit-util": "^1", "friendsofphp/php-cs-fixer": "^2.3" }, "autoload": { "psr-4": { "Amp\\Sync\\": "lib" }, "files": [ "lib/functions.php" ] }, "autoload-dev": { "psr-4": { "Amp\\Sync\\Test\\": "test" } } } <?php namespace Amp\Sync\Internal; use Amp\Delayed; use Amp\Promise; use Amp\Sync\Lock; use function Amp\call; class MutexStorage extends \Threaded { const LATENCY_TIMEOUT = 10; /** @var bool */ private $locked = false; /** * @return \Amp\Promise */ public function acquire(): Promise { return call(function () { $tsl = function () { if ($this->locked) { return true; } $this->locked = true; return false; }; while ($this->locked || $this->synchronized($tsl)) { yield new Delayed(self::LATENCY_TIMEOUT); } return new Lock(0, function () { $this->locked = false; }); }); } } <?php namespace Amp\Sync\Internal; use Amp\Delayed; use Amp\Promise; use Amp\Sync\Lock; use function Amp\call; class SemaphoreStorage extends \Threaded { const LATENCY_TIMEOUT = 10; /** * Creates a new semaphore with a given number of locks. * * @param int $locks The maximum number of locks that can be acquired from the semaphore. */ public function __construct(int $locks) { foreach (\range(0, $locks - 1) as $lock) { $this[] = $lock; } } /** * @return \Amp\Promise */ public function acquire(): Promise { /** * Uses a double locking mechanism to acquire a lock without blocking. A * synchronous mutex is used to make sure that the semaphore is queried one * at a time to preserve the integrity of the semaphore itself. Then a lock * count is used to check if a lock is available without blocking. * * If a lock is not available, we add the request to a queue and set a timer * to check again in the future. */ return call(function () { $tsl = function () { // If there are no locks available or the wait queue is not empty, // we need to wait our turn to acquire a lock. if (!$this->count()) { return null; } return $this->shift(); }; while (!$this->count() || ($id = $this->synchronized($tsl)) === null) { yield new Delayed(self::LATENCY_TIMEOUT); } return new Lock($id, function (Lock $lock) { $id = $lock->getId(); $this->synchronized(function () use ($id) { $this[] = $id; }); }); }); } } <?php namespace Amp\Sync; use Amp\Promise; use function Amp\call; /** * Invokes the given callback while maintaining a lock from the provided mutex. The lock is automatically released after * invoking the callback or once the promise returned by the callback is resolved. If the callback returns a Generator, * it will be run as a coroutine. See Amp\call(). * * @param \Amp\Sync\Mutex $mutex * @param callable $callback * @param ...$args * * @return \Amp\Promise Resolves with the return value of the callback. */ function synchronized(Mutex $mutex, callable $callback,...$args): Promise { return call(function () use ($mutex, $callback, $args) { /** @var \Amp\Sync\Lock $lock */ $lock = yield $mutex->acquire(); try { return yield call($callback,...$args); } finally { $lock->release(); } }); } <?php namespace Amp\Sync; use Amp\Promise; /** * A non-blocking counting semaphore. * * Objects that implement this interface should guarantee that all operations * are atomic. Implementations do not have to guarantee that acquiring a lock * is first-come, first serve. */ interface Semaphore { /** * Acquires a lock on the semaphore. * * @return \Amp\Promise<\Amp\Sync\Lock> Resolves with an integer keyed lock object. Identifiers returned by the * locks should be 0-indexed. Releasing an identifier MUST make that same identifier available. May fail with * a SyncException if an error occurs when attempting to obtain the lock (e.g. a shared memory segment closed). */ public function acquire(): Promise; } <?php namespace Amp\Sync; use Amp\Coroutine; use Amp\Delayed; use Amp\Promise; /** * A non-blocking, interprocess POSIX semaphore. * * Uses a POSIX message queue to store a queue of permits in a lock-free data structure. This semaphore implementation * is preferred over other implementations when available, as it provides the best performance. * * Not compatible with Windows. */ class PosixSemaphore implements Semaphore { const LATENCY_TIMEOUT = 10; /** @var string */ private $id; /** @var int The semaphore key. */ private $key; /** @var int PID of the process that created the semaphore. */ private $initializer = 0; /** @var resource A message queue of available locks. */ private $queue; /** * Creates a new semaphore with a given ID and number of locks. * * @param string $id The unique name for the new semaphore. * @param int $maxLocks The maximum number of locks that can be acquired from the semaphore. * @param int $permissions Permissions to access the semaphore. Use file permission format specified as 0xxx. * * @throws SyncException If the semaphore could not be created due to an internal error. */ public static function create(string $id, int $maxLocks, int $permissions = 0600): self { if ($maxLocks < 1) { throw new \Error("Number of locks must be greater than 0"); } $semaphore = new self($id); $semaphore->init($maxLocks, $permissions); return $semaphore; } /** * @param string $id The unique name of the semaphore to use. * * @return \Amp\Sync\PosixSemaphore */ public static function use(string $id): self { $semaphore = new self($id); $semaphore->open(); return $semaphore; } /** * @param string $id * * @throws \Error If the sysvmsg extension is not loaded. */ private function __construct(string $id) { if (!\extension_loaded("sysvmsg")) { throw new \Error(__CLASS__ . " requires the sysvmsg extension."); } $this->id = $id; $this->key = self::makeKey($this->id); } /** * Private method to prevent cloning. */ private function __clone() { } /** * Private to prevent serialization. */ private function __sleep() { } public function getId(): string { return $this->id; } private function open() { if (!\msg_queue_exists($this->key)) { throw new SyncException('No semaphore with that ID found'); } $this->queue = \msg_get_queue($this->key); if (!$this->queue) { throw new SyncException('Failed to open the semaphore.'); } } /** * @param int $maxLocks The maximum number of locks that can be acquired from the semaphore. * @param int $permissions Permissions to access the semaphore. * * @throws SyncException If the semaphore could not be created due to an internal error. */ private function init(int $maxLocks, int $permissions) { if (\msg_queue_exists($this->key)) { throw new SyncException('A semaphore with that ID already exists'); } $this->queue = \msg_get_queue($this->key, $permissions); if (!$this->queue) { throw new SyncException('Failed to create the semaphore.'); } $this->initializer = \getmypid(); // Fill the semaphore with locks. while (--$maxLocks >= 0) { $this->release($maxLocks); } } /** * Gets the access permissions of the semaphore. * * @return int A permissions mode. */ public function getPermissions(): int { $stat = \msg_stat_queue($this->queue); return $stat['msg_perm.mode']; } /** * Sets the access permissions of the semaphore. * * The current user must have access to the semaphore in order to change the permissions. * * @param int $mode A permissions mode to set. * * @throws SyncException If the operation failed. */ public function setPermissions(int $mode) { if (!\msg_set_queue($this->queue, [ 'msg_perm.mode' => $mode ])) { throw new SyncException('Failed to change the semaphore permissions.'); } } public function acquire(): Promise { return new Coroutine($this->doAcquire()); } /** * {@inheritdoc} */ private function doAcquire(): \Generator { do { // Attempt to acquire a lock from the semaphore. if (@\msg_receive($this->queue, 0, $type, 1, $id, false, \MSG_IPC_NOWAIT, $errno)) { // A free lock was found, so resolve with a lock object that can // be used to release the lock. return new Lock(\unpack("C", $id)[1], function (Lock $lock) { $this->release($lock->getId()); }); } // Check for unusual errors. if ($errno !== \MSG_ENOMSG) { throw new SyncException(\sprintf('Failed to acquire a lock; errno: %d', $errno)); } } while (yield new Delayed(self::LATENCY_TIMEOUT, true)); } /** * Removes the semaphore if it still exists. * * @throws SyncException If the operation failed. */ public function __destruct() { if ($this->initializer === 0 || $this->initializer !== \getmypid()) { return; } if (!\is_resource($this->queue) || !\msg_queue_exists($this->key)) { return; } \msg_remove_queue($this->queue); } /** * Releases a lock from the semaphore. * * @param int $id Lock identifier. * * @throws SyncException If the operation failed. */ protected function release(int $id) { if (!$this->queue) { return; // Queue already destroyed. } // Call send in non-blocking mode. If the call fails because the queue // is full, then the number of locks configured is too large. if (!@\msg_send($this->queue, 1, \pack("C", $id), false, false, $errno)) { if ($errno === \MSG_EAGAIN) { throw new SyncException('The semaphore size is larger than the system allows.'); } throw new SyncException('Failed to release the lock.'); } } private static function makeKey(string $id): int { return \abs(\unpack("l", \md5($id, true))[1]); } } <?php namespace Amp\Sync; use Amp\Coroutine; use Amp\Delayed; use Amp\Promise; /** * A cross-platform mutex that uses exclusive files as the lock mechanism. * * This mutex implementation is not always atomic and depends on the operating * system's implementation of file creation operations. Use this implementation * only if no other mutex types are available. * * This implementation avoids using [flock()](http://php.net/flock) * because flock() is known to have some atomicity issues on some systems. In * addition, flock() does not work as expected when trying to lock a file * multiple times in the same process on Linux. Instead, exclusive file creation * is used to create a lock file, which is atomic on most systems. * * @see http://php.net/fopen */ class FileMutex implements Mutex { const LATENCY_TIMEOUT = 10; /** @var string The full path to the lock file. */ private $fileName; /** * Creates a new mutex. * * @param string|null */ public function __construct(string $fileName) { $this->fileName = $fileName; } /** * {@inheritdoc} */ public function acquire(): Promise { return new Coroutine($this->doAcquire()); } /** * @coroutine * * @return \Generator */ private function doAcquire(): \Generator { // Try to create the lock file. If the file already exists, someone else // has the lock, so set an asynchronous timer and try again. while (($handle = @\fopen($this->fileName, 'x')) === false) { yield new Delayed(self::LATENCY_TIMEOUT); } // Return a lock object that can be used to release the lock on the mutex. $lock = new Lock(0, function () { $this->release(); }); \fclose($handle); return $lock; } /** * Releases the lock on the mutex. * * @throws SyncException If the unlock operation failed. */ protected function release() { $success = @\unlink($this->fileName); if (!$success) { throw new SyncException('Failed to unlock the mutex file.'); } } } <?php namespace Amp\Sync; use Amp\CallableMaker; use Amp\Deferred; use Amp\Promise; use Amp\Success; class LocalMutex implements Mutex { use CallableMaker; /** @var bool */ private $locked = false; /** @var \Amp\Deferred[] */ private $queue = []; /** @var callable */ private $release; public function __construct() { $this->release = $this->callableFromInstanceMethod("release"); } /** {@inheritdoc} */ public function acquire(): Promise { if (!$this->locked) { $this->locked = true; return new Success(new Lock(0, $this->release)); } $this->queue[] = $deferred = new Deferred; return $deferred->promise(); } private function release() { if (!empty($this->queue)) { $deferred = \array_shift($this->queue); $deferred->resolve(new Lock(0, $this->release)); return; } $this->locked = false; } } <?php namespace Amp\Sync; use Amp\Promise; /** * An asynchronous semaphore based on pthreads' synchronization methods. * * This is an implementation of a thread-safe semaphore that has non-blocking * acquire methods. There is a small tradeoff for asynchronous semaphores; you * may not acquire a lock immediately when one is available and there may be a * small delay. However, the small delay will not block the thread. */ class ThreadedSemaphore implements Semaphore { /** @var \Threaded */ private $semaphore; /** * Creates a new semaphore with a given number of locks. * * @param int $locks The maximum number of locks that can be acquired from the semaphore. */ public function __construct(int $locks) { if ($locks < 1) { throw new \Error("The number of locks should be a positive integer"); } $this->semaphore = new Internal\SemaphoreStorage($locks); } /** * {@inheritdoc} */ public function acquire(): Promise { return $this->semaphore->acquire(); } } <?php namespace Amp\Sync; class SyncException extends \Exception { } <?php namespace Amp\Sync; /** * A handle on an acquired lock from a synchronization object. * * This object is not thread-safe; after acquiring a lock from a mutex or * semaphore, the lock should reside in the same thread or process until it is * released. */ class Lock { /** @var callable|null The function to be called on release or null if the lock has been released. */ private $releaser; /** @var int */ private $id; /** * Creates a new lock permit object. * * @param int $id The lock identifier. * @param callable $releaser A function to be called upon release. The function will be passed this object as the * first parameter. */ public function __construct(int $id, callable $releaser) { $this->id = $id; $this->releaser = $releaser; } /** * Checks if the lock has already been released. * * @return bool True if the lock has already been released, otherwise false. */ public function isReleased(): bool { return !$this->releaser; } /** * @return int Lock identifier. */ public function getId(): int { return $this->id; } /** * Releases the lock. No-op if the lock has already been released. */ public function release() { if (!$this->releaser) { return; } // Invoke the releaser function given to us by the synchronization source // to release the lock. $releaser = $this->releaser; $this->releaser = null; ($releaser)($this); } /** * Releases the lock when there are no more references to it. */ public function __destruct() { if ($this->releaser) { $this->release(); } } } <?php namespace Amp\Sync; use Amp\Promise; /** * A non-blocking synchronization primitive that can be used for mutual exclusion across contexts. * * Objects that implement this interface should guarantee that all operations * are atomic. Implementations do not have to guarantee that acquiring a lock * is first-come, first serve. */ interface Mutex { /** * Acquires a lock on the mutex. * * @return \Amp\Promise<\Amp\Sync\Lock> Resolves with a lock object with an ID of 0. May fail with a SyncException * if an error occurs when attempting to obtain the lock (e.g. a shared memory segment closed). */ public function acquire(): Promise; } <?php namespace Amp\Sync; use Amp\CallableMaker; use Amp\Deferred; use Amp\Promise; use Amp\Success; class LocalSemaphore implements Semaphore { use CallableMaker; /** @var int[] */ private $locks; /** @var \Amp\Deferred[] */ private $queue = []; /** @var callable */ private $release; public function __construct(int $maxLocks) { if ($maxLocks < 1) { throw new \Error("The number of locks must be greater than 0"); } $this->release = $this->callableFromInstanceMethod("release"); $this->locks = \range(0, $maxLocks - 1); } /** {@inheritdoc} */ public function acquire(): Promise { if (!empty($this->locks)) { return new Success(new Lock(\array_shift($this->locks), $this->release)); } $this->queue[] = $deferred = new Deferred; return $deferred->promise(); } private function release(Lock $lock) { $id = $lock->getId(); if (!empty($this->queue)) { $deferred = \array_shift($this->queue); $deferred->resolve(new Lock($id, $this->release)); return; } $this->locks[] = $id; } } <?php namespace Amp\Sync; use Amp\Promise; /** * A thread-safe, asynchronous mutex using the pthreads locking mechanism. * * Compatible with POSIX systems and Microsoft Windows. */ class ThreadedMutex implements Mutex { /** @var Internal\MutexStorage */ private $mutex; /** * Creates a new threaded mutex. */ public function __construct() { $this->mutex = new Internal\MutexStorage; } /** * {@inheritdoc} */ public function acquire(): Promise { return $this->mutex->acquire(); } } <?php namespace Amp\Sync; use Amp\Promise; use function Amp\call; class SemaphoreMutex implements Mutex { /** @var \Amp\Sync\Semaphore */ private $semaphore; /** * @param \Amp\Sync\Semaphore $semaphore A semaphore with a single lock. */ public function __construct(Semaphore $semaphore) { $this->semaphore = $semaphore; } /** {@inheritdoc} */ public function acquire(): Promise { return call(function () { /** @var \Amp\Sync\Lock $lock */ $lock = yield $this->semaphore->acquire(); if ($lock->getId() !== 0) { $lock->release(); throw new \Error("Cannot use a semaphore with more than a single lock"); } return $lock; }); } } { "name": "amphp/parser", "homepage": "https://github.com/amphp/parser", "description": "A generator parser to make streaming parsers simple.", "support": { "issues": "https://github.com/amphp/parser/issues" }, "keywords": [ "stream", "async", "non-blocking", "parser" ], "license": "MIT", "authors": [ { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" }, { "name": "Niklas Keller", "email": "me@kelunik.com" } ], "require": { "php": ">=7" }, "require-dev": { "phpunit/phpunit": "^6", "friendsofphp/php-cs-fixer": "^2.3" }, "autoload": { "psr-4": { "Amp\\Parser\\": "lib" } }, "autoload-dev": { "psr-4": { "Amp\\Parser\\Test\\": "test" } } } <?php namespace Amp\Parser; class InvalidDelimiterError extends \Error { /** * @param \Generator $generator * @param string $prefix * @param \Throwable|null $previous */ public function __construct(\Generator $generator, string $prefix, \Throwable $previous = null) { $yielded = $generator->current(); $prefix .= \sprintf( "; %s yielded at key %s", \is_object($yielded) ? \get_class($yielded) : \gettype($yielded), \var_export($generator->key(), true) ); if (!$generator->valid()) { parent::__construct($prefix, 0, $previous); return; } $reflGen = new \ReflectionGenerator($generator); $exeGen = $reflGen->getExecutingGenerator(); if ($isSubgenerator = ($exeGen !== $generator)) { $reflGen = new \ReflectionGenerator($exeGen); } parent::__construct(\sprintf( "%s on line %s in %s", $prefix, $reflGen->getExecutingLine(), $reflGen->getExecutingFile() ), 0, $previous); } } <?php namespace Amp\Parser; class Parser { /** @var \Generator */ private $generator; /** @var string */ private $buffer = ''; /** @var int|string|null */ private $delimiter; /** * @param \Generator $generator * * @throws InvalidDelimiterError If the generator yields an invalid delimiter. * @throws \Throwable If the generator throws. */ public function __construct(\Generator $generator) { $this->generator = $generator; $this->delimiter = $this->generator->current(); if (!$this->generator->valid()) { $this->generator = null; return; } if ($this->delimiter !== null && (!\is_int($this->delimiter) || $this->delimiter <= 0) && (!\is_string($this->delimiter) || !\strlen($this->delimiter)) ) { throw new InvalidDelimiterError( $generator, \sprintf( "Invalid value yielded: Expected NULL, an int greater than 0, or a non-empty string; %s given", \is_object($this->delimiter) ? \sprintf("instance of %s", \get_class($this->delimiter)) : \gettype($this->delimiter) ) ); } } /** * Cancels the generator parser and returns any remaining data in the internal buffer. Writing data after calling * this method will result in an error. * * @return string */ final public function cancel(): string { $this->generator = null; return $this->buffer; } /** * @return bool True if the parser can still receive more data to parse, false if it has ended and calling push * will throw an exception. */ final public function isValid(): bool { return $this->generator !== null; } /** * Adds data to the internal buffer and tries to continue parsing. * * @param string $data Data to append to the internal buffer. * * @throws InvalidDelimiterError If the generator yields an invalid delimiter. * @throws \Error If parsing has already been cancelled. * @throws \Throwable If the generator throws. */ final public function push(string $data) { if ($this->generator === null) { throw new \Error("The parser is no longer writable"); } $this->buffer .= $data; $end = false; try { while ($this->buffer !== "") { if (\is_int($this->delimiter)) { if (\strlen($this->buffer) < $this->delimiter) { break; // Too few bytes in buffer. } $send = \substr($this->buffer, 0, $this->delimiter); $this->buffer = \substr($this->buffer, $this->delimiter); } elseif (\is_string($this->delimiter)) { if (($position = \strpos($this->buffer, $this->delimiter)) === false) { break; } $send = \substr($this->buffer, 0, $position); $this->buffer = \substr($this->buffer, $position + \strlen($this->delimiter)); } else { $send = $this->buffer; $this->buffer = ""; } $this->delimiter = $this->generator->send($send); if (!$this->generator->valid()) { $end = true; break; } if ($this->delimiter !== null && (!\is_int($this->delimiter) || $this->delimiter <= 0) && (!\is_string($this->delimiter) || !\strlen($this->delimiter)) ) { throw new InvalidDelimiterError( $this->generator, \sprintf( "Invalid value yielded: Expected NULL, an int greater than 0, or a non-empty string; %s given", \is_object($this->delimiter) ? \sprintf("instance of %s", \get_class($this->delimiter)) : \gettype($this->delimiter) ) ); } } } catch (\Throwable $exception) { $end = true; throw $exception; } finally { if ($end) { $this->generator = null; } } } } { "name": "amphp/parallel", "description": "Parallel processing component for Amp.", "keywords": [ "asynchronous", "async", "concurrent", "multi-threading", "multi-processing" ], "homepage": "https://github.com/amphp/parallel", "license": "MIT", "authors": [ { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" }, { "name": "Stephen Coakley", "email": "me@stephencoakley.com" } ], "require": { "amphp/amp": "^2", "amphp/byte-stream": "^1.5", "amphp/parser": "^1", "amphp/process": "^1", "amphp/sync": "^1.0.1" }, "require-dev": { "phpunit/phpunit": "^6", "amphp/phpunit-util": "^1", "amphp/php-cs-fixer-config": "dev-master" }, "suggest": { "ext-pthreads": "Required for thread contexts" }, "autoload": { "psr-4": { "Amp\\Parallel\\": "lib" }, "files": [ "lib/Worker/functions.php" ] }, "autoload-dev": { "psr-4": { "Amp\\Parallel\\Example\\": "examples", "Amp\\Parallel\\Test\\": "test" } }, "config": { "platform": { "php": "7.0.0" } }, "scripts": { "check": [ "@cs", "@test" ], "cs": "php-cs-fixer fix -v --diff --dry-run", "cs-fix": "php-cs-fixer fix -v --diff", "test": "@php -dzend.assertions=1 -dassert.exception=1 ./vendor/bin/phpunit --coverage-text" } } <?php namespace Amp\Parallel\Worker; /** * A worker process that executes task objects. */ final class WorkerProcess extends TaskWorker { const SCRIPT_PATH = __DIR__ . "/Internal/worker-process.php"; /** * @param string $envClassName Name of class implementing \Amp\Parallel\Worker\Environment to instigate. * Defaults to \Amp\Parallel\Worker\BasicEnvironment. * @param mixed[] $env Array of environment variables to pass to the worker. Empty array inherits from the current * PHP process. See the $env parameter of \Amp\Process\Process::__construct(). * @param string|null $binary Path to PHP binary. Null will attempt to automatically locate the binary. * * @throws \Error If the PHP binary path given cannot be found or is not executable. */ public function __construct(string $envClassName = BasicEnvironment::class, array $env = [], string $binary = null) { $script = [ self::SCRIPT_PATH, $envClassName, ]; parent::__construct(new Internal\WorkerProcess($script, $env, $binary)); } } <?php namespace Amp\Parallel\Worker; use Amp\Parallel\Context\Thread; /** * The built-in worker factory type. */ final class DefaultWorkerFactory implements WorkerFactory { /** @var string */ private $className; /** * @param string $envClassName Name of class implementing \Amp\Parallel\Worker\Environment to instigate in each * worker. Defaults to \Amp\Parallel\Worker\BasicEnvironment. * * @throws \Error If the given class name does not exist or does not implement \Amp\Parallel\Worker\Environment. */ public function __construct(string $envClassName = BasicEnvironment::class) { if (!\class_exists($envClassName)) { throw new \Error(\sprintf("Invalid environment class name '%s'", $envClassName)); } if (!\is_subclass_of($envClassName, Environment::class)) { throw new \Error(\sprintf( "The class '%s' does not implement '%s'", $envClassName, Environment::class )); } $this->className = $envClassName; } /** * {@inheritdoc} * * The type of worker created depends on the extensions available. If multi-threading is enabled, a WorkerThread * will be created. If threads are not available a WorkerProcess will be created. */ public function create(): Worker { if (Thread::isSupported()) { return new WorkerThread($this->className); } return new WorkerProcess( $this->className, [], \getenv("AMP_PHP_BINARY") ?: (\defined("AMP_PHP_BINARY") ? \AMP_PHP_BINARY : null) ); } } <?php namespace Amp\Parallel\Worker; /** * A runnable unit of execution. */ interface Task { /** * Runs the task inside the caller's context. * * Does not have to be a coroutine, can also be a regular function returning a value. * * @param \Amp\Parallel\Worker\Environment * * @return mixed|\Amp\Promise|\Generator */ public function run(Environment $environment); } <?php namespace Amp\Parallel\Worker; use Amp\Failure; use Amp\Parallel\Context\Context; use Amp\Parallel\Context\StatusError; use Amp\Parallel\Sync\ChannelException; use Amp\Promise; use Amp\Success; use function Amp\call; /** * Base class for most common types of task workers. */ abstract class TaskWorker implements Worker { /** @var \Amp\Parallel\Context\Context */ private $context; /** @var \Amp\Promise|null */ private $pending; /** @var \Amp\Promise|null */ private $exitStatus; /** * @param \Amp\Parallel\Context\Context $context A context running an instance of TaskRunner. */ public function __construct(Context $context) { if ($context->isRunning()) { throw new \Error("The context was already running"); } $this->context = $context; } /** * {@inheritdoc} */ public function isRunning(): bool { return !$this->exitStatus; } /** * {@inheritdoc} */ public function isIdle(): bool { return $this->pending === null; } /** * {@inheritdoc} */ public function enqueue(Task $task): Promise { if ($this->exitStatus) { throw new StatusError("The worker has been shut down"); } $promise = $this->pending = call(function () use ($task) { if ($this->pending) { try { yield $this->pending; } catch (\Throwable $exception) { // Ignore error from prior job. } } if ($this->exitStatus) { throw new WorkerException("The worker was shutdown"); } if (!$this->context->isRunning()) { yield $this->context->start(); } $job = new Internal\Job($task); try { yield $this->context->send($job); $result = yield $this->context->receive(); } catch (ChannelException $exception) { throw new WorkerException("Communicating with the worker failed", 0, $exception); } if (!$result instanceof Internal\TaskResult) { $this->kill(); throw new WorkerException("Context did not return a task result"); } if ($result->getId() !== $job->getId()) { $this->kill(); throw new WorkerException("Task results returned out of order"); } return $result->promise(); }); $promise->onResolve(function () use ($promise) { if ($this->pending === $promise) { $this->pending = null; } }); return $promise; } /** * {@inheritdoc} */ public function shutdown(): Promise { if ($this->exitStatus) { return $this->exitStatus; } if (!$this->context->isRunning()) { return $this->exitStatus = new Success(0); } return $this->exitStatus = call(function () { if ($this->pending) { // If a task is currently running, wait for it to finish. yield Promise\any([$this->pending]); } yield $this->context->send(0); return yield $this->context->join(); }); } /** * {@inheritdoc} */ public function kill() { if ($this->exitStatus) { return; } if ($this->context->isRunning()) { $this->context->kill(); $this->exitStatus = new Failure(new WorkerException("The worker was killed")); return; } $this->exitStatus = new Success(0); } } <?php namespace Amp\Parallel\Worker; use Amp\Loop; use Amp\Struct; final class BasicEnvironment implements Environment { /** @var array */ private $data = []; /** @var \SplPriorityQueue */ private $queue; /** @var string */ private $timer; public function __construct() { $this->queue = $queue = new \SplPriorityQueue; $data = &$this->data; $this->timer = Loop::repeat(1000, static function ($watcherId) use ($queue, &$data) { $time = \time(); while (!$queue->isEmpty()) { list($key, $expiration) = $queue->top(); if (!isset($data[$key])) { // Item removed. $queue->extract(); continue; } $struct = $data[$key]; if ($struct->expire === 0) { // Item was set again without a TTL. $queue->extract(); continue; } if ($struct->expire !== $expiration) { // Expiration changed or TTL updated. $queue->extract(); continue; } if ($time < $struct->expire) { // Item at top has not expired, break out of loop. break; } unset($data[$key]); $queue->extract(); } if ($queue->isEmpty()) { Loop::disable($watcherId); } }); Loop::disable($this->timer); Loop::unreference($this->timer); } /** * @param string $key * * @return bool */ public function exists(string $key): bool { return isset($this->data[$key]); } /** * @param string $key * * @return mixed|null Returns null if the key does not exist. */ public function get(string $key) { if (!isset($this->data[$key])) { return null; } $struct = $this->data[$key]; if ($struct->ttl !== null) { $expire = \time() + $struct->ttl; if ($struct->expire < $expire) { $struct->expire = $expire; $this->queue->insert([$key, $struct->expire], -$struct->expire); } } return $struct->data; } /** * @param string $key * @param mixed $value Using null for the value deletes the key. * @param int $ttl Number of seconds until data is automatically deleted. Use null for unlimited TTL. * * @throws \Error If the time-to-live is not a positive integer. */ public function set(string $key, $value, int $ttl = null) { if ($value === null) { $this->delete($key); return; } if ($ttl !== null && $ttl <= 0) { throw new \Error("The time-to-live must be a positive integer or null"); } $struct = new class { use Struct; public $data; public $expire = 0; public $ttl; }; $struct->data = $value; if ($ttl !== null) { $struct->ttl = $ttl; $struct->expire = \time() + $ttl; $this->queue->insert([$key, $struct->expire], -$struct->expire); Loop::enable($this->timer); } $this->data[$key] = $struct; } /** * @param string $key */ public function delete(string $key) { unset($this->data[$key]); } /** * Alias of exists(). * * @param $key * * @return bool */ public function offsetExists($key) { return $this->exists($key); } /** * Alias of get(). * * @param string $key * * @return mixed */ public function offsetGet($key) { return $this->get($key); } /** * Alias of set() with $ttl = null. * * @param string $key * @param mixed $value */ public function offsetSet($key, $value) { $this->set($key, $value); } /** * Alias of delete(). * * @param string $key */ public function offsetUnset($key) { $this->delete($key); } /** * Removes all values. */ public function clear() { $this->data = []; Loop::disable($this->timer); $this->queue = new \SplPriorityQueue; } } <?php namespace Amp\Parallel\Worker\Internal; use Amp\ByteStream; use Amp\Parallel\Context\Context; use Amp\Parallel\Context\Process; use Amp\Promise; use function Amp\call; class WorkerProcess implements Context { /** @var Process */ private $process; public function __construct($script, array $env = [], string $binary = null) { $this->process = new Process($script, null, $env, $binary); } public function receive(): Promise { return $this->process->receive(); } public function send($data): Promise { return $this->process->send($data); } public function isRunning(): bool { return $this->process->isRunning(); } public function start(): Promise { return call(function () { $result = yield $this->process->start(); $stdout = $this->process->getStdout(); $stdout->unreference(); $stderr = $this->process->getStderr(); $stderr->unreference(); ByteStream\pipe($stdout, ByteStream\getStdout()); ByteStream\pipe($stderr, ByteStream\getStderr()); return $result; }); } public function kill() { $this->process->kill(); } public function join(): Promise { return $this->process->join(); } } <?php namespace Amp\Parallel\Worker\Internal; use Amp\Parallel\Worker\Task; use Amp\Parallel\Worker\Worker; use Amp\Promise; /** @internal */ final class PooledWorker implements Worker { /** @var callable */ private $push; /** @var \Amp\Parallel\Worker\Worker */ private $worker; /** * @param \Amp\Parallel\Worker\Worker $worker * @param callable $push Callable to push the worker back into the queue. */ public function __construct(Worker $worker, callable $push) { $this->worker = $worker; $this->push = $push; } /** * Automatically pushes the worker back into the queue. */ public function __destruct() { ($this->push)($this->worker); } /** * {@inheritdoc} */ public function isRunning(): bool { return $this->worker->isRunning(); } /** * {@inheritdoc} */ public function isIdle(): bool { return $this->worker->isIdle(); } /** * {@inheritdoc} */ public function enqueue(Task $task): Promise { return $this->worker->enqueue($task); } /** * {@inheritdoc} */ public function shutdown(): Promise { return $this->worker->shutdown(); } /** * {@inheritdoc} */ public function kill() { $this->worker->kill(); } } <?php namespace Amp\Parallel\Worker\Internal; use Amp\Parallel\Sync; use Amp\Parallel\Worker; use Amp\Promise; return function (Sync\Channel $channel) use ($argv): Promise { if (!\defined("AMP_WORKER")) { \define("AMP_WORKER", "amp-worker"); } if (!isset($argv[1])) { throw new \Error("No environment class name provided"); } $className = $argv[1]; if (!\class_exists($className)) { throw new \Error(\sprintf("Invalid environment class name '%s'", $className)); } if (!\is_subclass_of($className, Worker\Environment::class)) { throw new \Error(\sprintf( "The class '%s' does not implement '%s'", $className, Worker\Environment::class )); } $environment = new $className; $runner = new Worker\TaskRunner($channel, $environment); return $runner->run(); }; <?php namespace Amp\Parallel\Worker\Internal; use Amp\Failure; use Amp\Parallel\Worker\Task; use Amp\Promise; use Amp\Success; /** @internal */ final class TaskSuccess extends TaskResult { /** @var mixed Result of task. */ private $result; public function __construct(string $id, $result) { parent::__construct($id); $this->result = $result; } public function promise(): Promise { if ($this->result instanceof \__PHP_Incomplete_Class) { return new Failure(new \Error(\sprintf( "Class instances returned from %s::run() must be autoloadable by the Composer autoloader", Task::class ))); } return new Success($this->result); } } <?php namespace Amp\Parallel\Worker\Internal; use Amp\Promise; /** @internal */ abstract class TaskResult { /** @var string Task identifier. */ private $id; /** * @param string $id Task identifier. */ public function __construct(string $id) { $this->id = $id; } /** * @return string Task identifier. */ public function getId(): string { return $this->id; } /** * @return \Amp\Promise<mixed> Resolved with the task result or failure reason. */ abstract public function promise(): Promise; } <?php namespace Amp\Parallel\Worker\Internal; use Amp\Parallel\Worker\Task; /** @internal */ final class Job { /** @var string */ private $id; /** @var \Amp\Parallel\Worker\Task */ private $task; public function __construct(Task $task) { static $id = 'a'; $this->task = $task; $this->id = $id++; } public function getId(): string { return $this->id; } public function getTask(): Task { // Classes that cannot be autoloaded will be unserialized as an instance of __PHP_Incomplete_Class. if ($this->task instanceof \__PHP_Incomplete_Class) { throw new \Error(\sprintf("Classes implementing %s must be autoloadable by the Composer autoloader", Task::class)); } return $this->task; } } <?php namespace Amp\Parallel\Worker\Internal; use Amp\Failure; use Amp\Parallel\Worker\TaskError; use Amp\Parallel\Worker\TaskException; use Amp\Promise; /** @internal */ final class TaskFailure extends TaskResult { const PARENT_EXCEPTION = 0; const PARENT_ERROR = 1; /** @var string */ private $type; /** @var int */ private $parent; /** @var string */ private $message; /** @var int|string */ private $code; /** @var array */ private $trace; public function __construct(string $id, \Throwable $exception) { parent::__construct($id); $this->type = \get_class($exception); $this->parent = $exception instanceof \Error ? self::PARENT_ERROR : self::PARENT_EXCEPTION; $this->message = $exception->getMessage(); $this->code = $exception->getCode(); $this->trace = $exception->getTraceAsString(); } public function promise(): Promise { switch ($this->parent) { case self::PARENT_ERROR: $exception = new TaskError( $this->type, \sprintf( 'Uncaught %s in worker with message "%s" and code "%s"', $this->type, $this->message, $this->code ), $this->trace ); break; default: $exception = new TaskException( $this->type, \sprintf( 'Uncaught %s in worker with message "%s" and code "%s"', $this->type, $this->message, $this->code ), $this->trace ); } return new Failure($exception); } } <?php namespace Amp\Parallel\Worker; /** * An interface for worker pools. */ interface Pool extends Worker { /** @var int The default maximum pool size. */ const DEFAULT_MAX_SIZE = 32; /** * Gets a worker from the pool. The worker is marked as busy and will only be reused if the pool runs out of * idle workers. The worker will be automatically marked as idle once no references to the returned worker remain. * * @return \Amp\Parallel\Worker\Worker * * @throws \Amp\Parallel\Context\StatusError If the queue is not running. */ public function getWorker(): Worker; /** * Gets the number of workers currently running in the pool. * * @return int The number of workers. */ public function getWorkerCount(): int; /** * Gets the number of workers that are currently idle. * * @return int The number of idle workers. */ public function getIdleWorkerCount(): int; /** * Gets the maximum number of workers the pool may spawn to handle concurrent tasks. * * @return int The maximum number of workers. */ public function getMaxSize(): int; } <?php namespace Amp\Parallel\Worker; use Amp\Loop; use Amp\Promise; const LOOP_POOL_IDENTIFIER = Pool::class; const LOOP_FACTORY_IDENTIFIER = WorkerFactory::class; /** * Gets or sets the global worker pool. * * @param \Amp\Parallel\Worker\Pool|null $pool A worker pool instance. * * @return \Amp\Parallel\Worker\Pool The global worker pool instance. */ function pool(Pool $pool = null): Pool { if ($pool === null) { $pool = Loop::getState(LOOP_POOL_IDENTIFIER); if ($pool) { return $pool; } $pool = new DefaultPool; } Loop::setState(LOOP_POOL_IDENTIFIER, $pool); return $pool; } /** * Enqueues a task to be executed by the global worker pool. * * @param \Amp\Parallel\Worker\Task $task The task to enqueue. * * @return \Amp\Promise<mixed> */ function enqueue(Task $task): Promise { return pool()->enqueue($task); } /** * Gets a worker from the global worker pool. * * @return \Amp\Parallel\Worker\Worker */ function worker(): Worker { return pool()->getWorker(); } /** * Creates a worker using the global worker factory. * * @return \Amp\Parallel\Worker\Worker */ function create(): Worker { return factory()->create(); } /** * Gets or sets the global worker factory. * * @param \Amp\Parallel\Worker\WorkerFactory|null $factory * * @return \Amp\Parallel\Worker\WorkerFactory */ function factory(WorkerFactory $factory = null): WorkerFactory { if ($factory === null) { $factory = Loop::getState(LOOP_FACTORY_IDENTIFIER); if ($factory) { return $factory; } $factory = new DefaultWorkerFactory; } Loop::setState(LOOP_FACTORY_IDENTIFIER, $factory); return $factory; } <?php namespace Amp\Parallel\Worker; class WorkerException extends \Exception { } <?php namespace Amp\Parallel\Worker; final class TaskException extends \Exception { /** @var string Class name of exception thrown from task. */ private $name; /** @var string Stack trace of the exception thrown from task. */ private $trace; /** * @param string $name The exception class name. * @param string $message The panic message. * @param string $trace The panic stack trace. */ public function __construct(string $name, string $message = '', string $trace = '') { parent::__construct($message); $this->name = $name; $this->trace = $trace; } /** * Returns the class name of the exception thrown from the task. * * @return string */ public function getName(): string { return $this->name; } /** * Gets the stack trace at the point the exception was thrown in the task. * * @return string */ public function getWorkerTrace(): string { return $this->trace; } } <?php namespace Amp\Parallel\Worker; interface Environment extends \ArrayAccess { /** * @param string $key * * @return bool */ public function exists(string $key): bool; /** * @param string $key * * @return mixed|null Returns null if the key does not exist. */ public function get(string $key); /** * @param string $key * @param mixed $value Using null for the value deletes the key. * @param int $ttl Number of seconds until data is automatically deleted. Use 0 for unlimited TTL. */ public function set(string $key, $value, int $ttl = null); /** * @param string $key */ public function delete(string $key); /** * Removes all values. */ public function clear(); } <?php namespace Amp\Parallel\Worker; /** * Interface for factories used to create new workers. */ interface WorkerFactory { /** * Creates a new worker instance. * * @return Worker The newly created worker. */ public function create(): Worker; } <?php namespace Amp\Parallel\Worker; final class TaskError extends \Error { /** @var string Class name of error thrown from task. */ private $name; /** @var string Stack trace of the error thrown from task. */ private $trace; /** * @param string $name The exception class name. * @param string $message The panic message. * @param string $trace The panic stack trace. */ public function __construct(string $name, string $message = '', string $trace = '') { parent::__construct($message); $this->name = $name; $this->trace = $trace; } /** * Returns the class name of the error thrown from the task. * * @return string */ public function getName(): string { return $this->name; } /** * Gets the stack trace at the point the error was thrown in the task. * * @return string */ public function getWorkerTrace(): string { return $this->trace; } } <?php namespace Amp\Parallel\Worker; use Amp\Parallel\Context\Thread; use Amp\Parallel\Sync\Channel; use Amp\Promise; /** * A worker thread that executes task objects. */ final class WorkerThread extends TaskWorker { /** * @param string $envClassName Name of class implementing \Amp\Parallel\Worker\Environment to instigate. * Defaults to \Amp\Parallel\Worker\BasicEnvironment. */ public function __construct(string $envClassName = BasicEnvironment::class) { parent::__construct(new Thread(function (Channel $channel, string $className): Promise { if (!\class_exists($className)) { throw new \Error(\sprintf("Invalid environment class name '%s'", $className)); } if (!\is_subclass_of($className, Environment::class)) { throw new \Error(\sprintf("The class '%s' does not implement '%s'", $className, Environment::class)); } $environment = new $className; if (!\defined("AMP_WORKER")) { \define("AMP_WORKER", "amp-worker"); } $runner = new TaskRunner($channel, $environment); return $runner->run(); }, $envClassName)); } } <?php namespace Amp\Parallel\Worker; use Amp\Coroutine; use Amp\Parallel\Sync\Channel; use Amp\Parallel\Sync\SerializationException; use Amp\Promise; use function Amp\call; final class TaskRunner { /** @var \Amp\Parallel\Sync\Channel */ private $channel; /** @var \Amp\Parallel\Worker\Environment */ private $environment; public function __construct(Channel $channel, Environment $environment) { $this->channel = $channel; $this->environment = $environment; } /** * Runs the task runner, receiving tasks from the parent and sending the result of those tasks. * * @return \Amp\Promise */ public function run(): Promise { return new Coroutine($this->execute()); } /** * @coroutine * * @return \Generator */ private function execute(): \Generator { $job = yield $this->channel->receive(); while ($job instanceof Internal\Job) { try { $result = yield call([$job->getTask(), "run"], $this->environment); $result = new Internal\TaskSuccess($job->getId(), $result); } catch (\Throwable $exception) { $result = new Internal\TaskFailure($job->getId(), $exception); } $job = null; // Free memory from last job. try { yield $this->channel->send($result); } catch (SerializationException $exception) { // Could not serialize task result. yield $this->channel->send(new Internal\TaskFailure($result->getId(), $exception)); } $result = null; // Free memory from last result. $job = yield $this->channel->receive(); } return $job; } } <?php namespace Amp\Parallel\Worker; use Amp\Parallel\Context\StatusError; use Amp\Promise; /** * Provides a pool of workers that can be used to execute multiple tasks asynchronously. * * A worker pool is a collection of worker threads that can perform multiple * tasks simultaneously. The load on each worker is balanced such that tasks * are completed as soon as possible and workers are used efficiently. */ final class DefaultPool implements Pool { /** @var bool Indicates if the pool is currently running. */ private $running = true; /** @var int The maximum number of workers the pool should spawn. */ private $maxSize; /** @var WorkerFactory A worker factory to be used to create new workers. */ private $factory; /** @var \SplObjectStorage A collection of all workers in the pool. */ private $workers; /** @var \SplQueue A collection of idle workers. */ private $idleWorkers; /** @var \SplQueue A queue of workers that have been assigned to tasks. */ private $busyQueue; /** @var \Closure */ private $push; /** @var \Amp\Promise|null */ private $exitStatus; /** * Creates a new worker pool. * * @param int $maxSize The maximum number of workers the pool should spawn. * Defaults to `Pool::DEFAULT_MAX_SIZE`. * @param \Amp\Parallel\Worker\WorkerFactory|null $factory A worker factory to be used to create * new workers. * * @throws \Error */ public function __construct(int $maxSize = self::DEFAULT_MAX_SIZE, WorkerFactory $factory = null) { if ($maxSize < 0) { throw new \Error("Maximum size must be a non-negative integer"); } $this->maxSize = $maxSize; // Use the global factory if none is given. $this->factory = $factory ?: factory(); $this->workers = new \SplObjectStorage; $this->idleWorkers = new \SplQueue; $this->busyQueue = new \SplQueue; $workers = $this->workers; $idleWorkers = $this->idleWorkers; $busyQueue = $this->busyQueue; $this->push = static function (Worker $worker) use ($workers, $idleWorkers, $busyQueue) { \assert($workers->contains($worker), "The provided worker was not part of this queue"); if (($workers[$worker] -= 1) === 0) { // Worker is completely idle, remove from busy queue and add to idle queue. foreach ($busyQueue as $key => $busy) { if ($busy === $worker) { unset($busyQueue[$key]); break; } } $idleWorkers->push($worker); } }; } public function __destruct() { if ($this->isRunning()) { $this->kill(); } } /** * Checks if the pool is running. * * @return bool True if the pool is running, otherwise false. */ public function isRunning(): bool { return $this->running; } /** * Checks if the pool has any idle workers. * * @return bool True if the pool has at least one idle worker, otherwise false. */ public function isIdle(): bool { return $this->idleWorkers->count() > 0 || $this->workers->count() === 0; } /** * {@inheritdoc} */ public function getMaxSize(): int { return $this->maxSize; } /** * {@inheritdoc} */ public function getWorkerCount(): int { return $this->workers->count(); } /** * {@inheritdoc} */ public function getIdleWorkerCount(): int { return $this->idleWorkers->count(); } /** * Enqueues a task to be executed by the worker pool. * * @param Task $task The task to enqueue. * * @return \Amp\Promise<mixed> The return value of Task::run(). * * @throws \Amp\Parallel\Context\StatusError If the pool has been shutdown. * @throws \Amp\Parallel\Worker\TaskException If the task throws an exception. */ public function enqueue(Task $task): Promise { $worker = $this->pull(); $promise = $worker->enqueue($task); $promise->onResolve(function () use ($worker) { ($this->push)($worker); }); return $promise; } /** * Shuts down the pool and all workers in it. * * @return \Amp\Promise<int[]> Array of exit status from all workers. * * @throws \Amp\Parallel\Context\StatusError If the pool has not been started. */ public function shutdown(): Promise { if ($this->exitStatus) { return $this->exitStatus; } $this->running = false; $shutdowns = []; foreach ($this->workers as $worker) { if ($worker->isRunning()) { $shutdowns[] = $worker->shutdown(); } } return $this->exitStatus = Promise\all($shutdowns); } /** * Kills all workers in the pool and halts the worker pool. */ public function kill() { $this->running = false; foreach ($this->workers as $worker) { $worker->kill(); } } /** * Creates a worker and adds them to the pool. * * @return Worker The worker created. */ private function createWorker(): Worker { $worker = $this->factory->create(); $this->workers->attach($worker, 0); return $worker; } /** * {@inheritdoc} */ public function getWorker(): Worker { return new Internal\PooledWorker($this->pull(), $this->push); } /** * Pulls a worker from the pool. * * @return \Amp\Parallel\Worker\Worker * @throws \Amp\Parallel\Context\StatusError */ private function pull(): Worker { if (!$this->isRunning()) { throw new StatusError("The pool was shutdown"); } do { if ($this->idleWorkers->isEmpty()) { if ($this->getWorkerCount() >= $this->maxSize) { // All possible workers busy, so shift from head (will be pushed back onto tail below). $worker = $this->busyQueue->shift(); } else { // Max worker count has not been reached, so create another worker. $worker = $this->createWorker(); break; } } else { // Shift a worker off the idle queue. $worker = $this->idleWorkers->shift(); } if ($worker->isRunning()) { break; } $this->workers->detach($worker); } while (true); $this->busyQueue->push($worker); $this->workers[$worker] += 1; return $worker; } } <?php namespace Amp\Parallel\Worker; use Amp\Promise; /** * An interface for a parallel worker thread that runs a queue of tasks. */ interface Worker { /** * Checks if the worker is running. * * @return bool True if the worker is running, otherwise false. */ public function isRunning(): bool; /** * Checks if the worker is currently idle. * * @return bool */ public function isIdle(): bool; /** * Enqueues a task to be executed by the worker. * * @param Task $task The task to enqueue. * * @return \Amp\Promise<mixed> Resolves with the return value of Task::run(). */ public function enqueue(Task $task): Promise; /** * @return \Amp\Promise<int> Exit code. */ public function shutdown(): Promise; /** * Immediately kills the context. */ public function kill(); } <?php namespace Amp\Parallel\Context\Internal; use Amp\Deferred; use Amp\Loop; use Amp\Parallel\Context\ContextException; use Amp\Parallel\Sync\ChannelledSocket; use Amp\Promise; use Amp\TimeoutException; use function Amp\call; final class ProcessHub { const PROCESS_START_TIMEOUT = 5000; const KEY_RECEIVE_TIMEOUT = 1000; /** @var resource|null */ private $server; /** @var string|null */ private $uri; /** @var int[] */ private $keys; /** @var string|null */ private $watcher; /** @var Deferred[] */ private $acceptor = []; public function __construct() { $isWindows = \strncasecmp(\PHP_OS, "WIN", 3) === 0; if ($isWindows) { $this->uri = "tcp://127.0.0.1:0"; } else { $this->uri = "unix://" . \tempnam(\sys_get_temp_dir(), "amp-parallel-ipc-") . ".sock"; } $this->server = \stream_socket_server($this->uri, $errno, $errstr, \STREAM_SERVER_BIND | \STREAM_SERVER_LISTEN); if (!$this->server) { throw new \RuntimeException(\sprintf("Could not create IPC server: (Errno: %d) %s", $errno, $errstr)); } if ($isWindows) { $name = \stream_socket_get_name($this->server, false); $port = \substr($name, \strrpos($name, ":") + 1); $this->uri = "tcp://127.0.0.1:" . $port; } $keys = &$this->keys; $acceptor = &$this->acceptor; $this->watcher = Loop::onReadable($this->server, static function (string $watcher, $server) use (&$keys, &$acceptor) { // Error reporting suppressed since stream_socket_accept() emits E_WARNING on client accept failure. if (!$client = @\stream_socket_accept($server, 0)) { // Timeout of 0 to be non-blocking. return; // Accepting client failed. } $channel = new ChannelledSocket($client, $client); try { $received = yield Promise\timeout($channel->receive(), self::KEY_RECEIVE_TIMEOUT); } catch (TimeoutException $exception) { $channel->close(); return; // Ignore possible foreign connection attempt. } if (!\is_string($received) || !isset($keys[$received])) { $channel->close(); return; // Ignore possible foreign connection attempt. } $pid = $keys[$received]; $deferred = $acceptor[$pid]; unset($acceptor[$pid], $keys[$received]); $deferred->resolve($channel); }); Loop::disable($this->watcher); } public function __destruct() { Loop::cancel($this->watcher); \fclose($this->server); } public function getUri(): string { return $this->uri; } public function generateKey(int $pid, int $length): string { $key = \random_bytes($length); $this->keys[$key] = $pid; return $key; } public function accept(int $pid): Promise { return call(function () use ($pid) { $this->acceptor[$pid] = new Deferred; Loop::enable($this->watcher); try { $channel = yield Promise\timeout($this->acceptor[$pid]->promise(), self::PROCESS_START_TIMEOUT); } catch (TimeoutException $exception) { $key = \array_search($pid, $this->keys, true); \assert(\is_string($key), "Key for {$pid} not found"); unset($this->acceptor[$pid], $this->keys[$key]); throw new ContextException("Starting the process timed out", 0, $exception); } finally { if (empty($this->acceptor)) { Loop::disable($this->watcher); } } return $channel; }); } } <?php namespace Amp\Parallel\Context\Internal; use Amp\Loop; use Amp\Parallel\Context\Process; use Amp\Parallel\Sync; use function Amp\call; // Doesn't exist in phpdbg... if (\function_exists("cli_set_process_title")) { @\cli_set_process_title("amp-process"); } (function () { $paths = [ \dirname(__DIR__, 5) . "/autoload.php", \dirname(__DIR__, 3) . "/vendor/autoload.php", ]; foreach ($paths as $path) { if (\file_exists($path)) { $autoloadPath = $path; break; } } if (!isset($autoloadPath)) { \trigger_error("Could not locate autoload.php in any of the following files: " . \implode(", ", $paths), E_USER_ERROR); exit(1); } require $autoloadPath; })(); Loop::run(function () use ($argc, $argv) { // Remove this scripts path from process arguments. --$argc; \array_shift($argv); if (!isset($argv[0])) { throw new \Error("No socket path provided"); } // Remove socket path from process arguments. --$argc; $uri = \array_shift($argv); $key = ""; // Read random key from STDIN and send back to parent over IPC socket to authenticate. do { if (($chunk = \fread(\STDIN, Process::KEY_LENGTH)) === false || \feof(\STDIN)) { \trigger_error("Could not read key from parent", E_USER_ERROR); exit(1); } $key .= $chunk; } while (\strlen($key) < Process::KEY_LENGTH); if (!$socket = \stream_socket_client($uri, $errno, $errstr, 5, \STREAM_CLIENT_CONNECT)) { \trigger_error("Could not connect to IPC socket", E_USER_ERROR); exit(1); } $channel = new Sync\ChannelledSocket($socket, $socket); try { yield $channel->send($key); } catch (\Throwable $exception) { \trigger_error("Could not send key to parent", E_USER_ERROR); exit(1); } try { if (!isset($argv[0])) { throw new \Error("No script path given"); } if (!\is_file($argv[0])) { throw new \Error(\sprintf("No script found at '%s' (be sure to provide the full path to the script)", $argv[0])); } // Protect current scope by requiring script within another function. $callable = (function () use ($argc, $argv) { // Using $argc so it is available to the required script. return require $argv[0]; })(); if (!\is_callable($callable)) { throw new \Error(\sprintf("Script '%s' did not return a callable function", $argv[0])); } $result = new Sync\ExitSuccess(yield call($callable, $channel)); } catch (\Throwable $exception) { $result = new Sync\ExitFailure($exception); } try { try { yield $channel->send($result); } catch (Sync\SerializationException $exception) { // Serializing the result failed. Send the reason why. yield $channel->send(new Sync\ExitFailure($exception)); } } catch (\Throwable $exception) { \trigger_error("Could not send result to parent", E_USER_ERROR); exit(1); } }); <?php namespace Amp\Parallel\Context\Internal; use Amp\Loop; use Amp\Parallel\Sync\Channel; use Amp\Parallel\Sync\ChannelException; use Amp\Parallel\Sync\ChannelledSocket; use Amp\Parallel\Sync\ExitFailure; use Amp\Parallel\Sync\ExitSuccess; use Amp\Parallel\Sync\SerializationException; use function Amp\call; /** * An internal thread that executes a given function concurrently. * * @internal */ final class Thread extends \Thread { const KILL_CHECK_FREQUENCY = 250; /** @var callable The function to execute in the thread. */ private $function; /** @var mixed[] Arguments to pass to the function. */ private $args; /** @var resource */ private $socket; /** @var bool */ private $killed = false; /** * Creates a new thread object. * * @param resource $socket IPC communication socket. * @param callable $function The function to execute in the thread. * @param mixed[] $args Arguments to pass to the function. */ public function __construct($socket, callable $function, array $args = []) { $this->function = $function; $this->args = $args; $this->socket = $socket; } /** * Runs the thread code and the initialized function. * * @codeCoverageIgnore Only executed in thread. */ public function run() { /* First thing we need to do is re-initialize the class autoloader. If * we don't do this first, any object of a class that was loaded after * the thread started will just be garbage data and unserializable * values (like resources) will be lost. This happens even with * thread-safe objects. */ // Protect scope by using an unbound closure (protects static access as well). (static function () { $paths = [ \dirname(__DIR__, 3) . \DIRECTORY_SEPARATOR . "vendor" . \DIRECTORY_SEPARATOR . "autoload.php", \dirname(__DIR__, 5) . \DIRECTORY_SEPARATOR . "autoload.php", ]; foreach ($paths as $path) { if (\file_exists($path)) { $autoloadPath = $path; break; } } if (!isset($autoloadPath)) { throw new \Error("Could not locate autoload.php"); } require $autoloadPath; })->bindTo(null, null)(); // At this point, the thread environment has been prepared so begin using the thread. if ($this->killed) { return; // Thread killed while requiring autoloader, simply exit. } Loop::run(function () { $watcher = Loop::repeat(self::KILL_CHECK_FREQUENCY, function () { if ($this->killed) { Loop::stop(); } }); Loop::unreference($watcher); try { $channel = new ChannelledSocket($this->socket, $this->socket); yield from $this->execute($channel); } catch (\Throwable $exception) { return; // Parent context exited or destroyed thread, no need to continue. } finally { Loop::cancel($watcher); } }); } /** * Sets a local variable to true so the running event loop can check for a kill signal. */ public function kill() { return $this->killed = true; } /** * @param \Amp\Parallel\Sync\Channel $channel * * @return \Generator * * @codeCoverageIgnore Only executed in thread. */ private function execute(Channel $channel): \Generator { try { $result = new ExitSuccess(yield call($this->function, $channel,...$this->args)); } catch (\Throwable $exception) { $result = new ExitFailure($exception); } if ($this->killed) { return; // Parent is not listening for a result. } // Attempt to return the result. try { try { yield $channel->send($result); } catch (SerializationException $exception) { // Serializing the result failed. Send the reason why. yield $channel->send(new ExitFailure($exception)); } } catch (ChannelException $exception) { // The result was not sendable! The parent context must have died or killed the context. } } } <?php namespace Amp\Parallel\Context; class ContextException extends \Exception { } <?php namespace Amp\Parallel\Context; use Amp\Failure; use Amp\Loop; use Amp\Parallel\Sync\ChannelException; use Amp\Parallel\Sync\ChannelledSocket; use Amp\Parallel\Sync\ExitResult; use Amp\Parallel\Sync\SynchronizationError; use Amp\Promise; use Amp\Success; use function Amp\call; /** * Implements an execution context using native multi-threading. * * The thread context is not itself threaded. A local instance of the context is * maintained both in the context that creates the thread and in the thread * itself. */ final class Thread implements Context { const EXIT_CHECK_FREQUENCY = 250; /** @var Internal\Thread An internal thread instance. */ private $thread; /** @var \Amp\Parallel\Sync\ChannelledSocket A channel for communicating with the thread. */ private $channel; /** @var resource */ private $socket; /** @var callable */ private $function; /** @var mixed[] */ private $args; /** @var int */ private $oid = 0; /** @var string */ private $watcher; /** * Checks if threading is enabled. * * @return bool True if threading is enabled, otherwise false. */ public static function isSupported(): bool { return \extension_loaded('pthreads'); } /** * Creates and starts a new thread. * * @param callable $function The callable to invoke in the thread. First argument is an instance of * \Amp\Parallel\Sync\Channel. * @param ...$args Additional arguments to pass to the given callable. * * @return Promise<Thread> The thread object that was spawned. */ public static function run(callable $function,...$args): Promise { $thread = new self($function,...$args); return call(function () use ($thread) { yield $thread->start(); return $thread; }); } /** * Creates a new thread. * * @param callable $function The callable to invoke in the thread. First argument is an instance of * \Amp\Parallel\Sync\Channel. * @param ...$args Additional arguments to pass to the given callable. * * @throws \Error Thrown if the pthreads extension is not available. */ public function __construct(callable $function,...$args) { if (!self::isSupported()) { throw new \Error("The pthreads extension is required to create threads."); } $this->function = $function; $this->args = $args; } /** * Returns the thread to the condition before starting. The new thread can be started and run independently of the * first thread. */ public function __clone() { $this->thread = null; $this->socket = null; $this->channel = null; $this->oid = 0; } /** * Kills the thread if it is still running. * * @throws \Amp\Parallel\Context\ContextException */ public function __destruct() { if (\getmypid() === $this->oid) { $this->kill(); } } /** * Checks if the context is running. * * @return bool True if the context is running, otherwise false. */ public function isRunning(): bool { return $this->channel !== null; } /** * Spawns the thread and begins the thread's execution. * * @return Promise<null> Resolved once the thread has started. * * @throws \Amp\Parallel\Context\StatusError If the thread has already been started. * @throws \Amp\Parallel\Context\ContextException If starting the thread was unsuccessful. */ public function start(): Promise { if ($this->oid !== 0) { throw new StatusError('The thread has already been started.'); } $this->oid = \getmypid(); $sockets = @\stream_socket_pair( \stripos(\PHP_OS, "win") === 0 ? STREAM_PF_INET : STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP ); if ($sockets === false) { $message = "Failed to create socket pair"; if ($error = \error_get_last()) { $message .= \sprintf(" Errno: %d; %s", $error["type"], $error["message"]); } return new Failure(new ContextException($message)); } list($channel, $this->socket) = $sockets; $thread = $this->thread = new Internal\Thread($this->socket, $this->function, $this->args); if (!$this->thread->start(\PTHREADS_INHERIT_INI)) { return new Failure(new ContextException('Failed to start the thread.')); } $channel = $this->channel = new ChannelledSocket($channel, $channel); $this->watcher = Loop::repeat(self::EXIT_CHECK_FREQUENCY, static function ($watcher) use ($thread, $channel) { if (!$thread->isRunning()) { // Delay closing to avoid race condition between thread exiting and data becoming available. Loop::delay(self::EXIT_CHECK_FREQUENCY, [$channel, "close"]); Loop::cancel($watcher); } }); Loop::disable($this->watcher); return new Success; } /** * Immediately kills the context. * * @throws ContextException If killing the thread was unsuccessful. */ public function kill() { if ($this->thread !== null) { try { if ($this->thread->isRunning() && !$this->thread->kill()) { throw new ContextException('Could not kill thread.'); } } finally { $this->close(); } } } /** * Closes channel and socket if still open. */ private function close() { if ($this->channel !== null) { $this->channel->close(); } $this->channel = null; Loop::cancel($this->watcher); } /** * Gets a promise that resolves when the context ends and joins with the * parent context. * * @return \Amp\Promise<mixed> * * @throws StatusError Thrown if the context has not been started. * @throws SynchronizationError Thrown if an exit status object is not received. * @throws ContextException If the context stops responding. */ public function join(): Promise { if ($this->channel == null || $this->thread === null) { throw new StatusError('The thread has not been started or has already finished.'); } return call(function () { Loop::enable($this->watcher); try { $response = yield $this->channel->receive(); if (!$response instanceof ExitResult) { throw new SynchronizationError('Did not receive an exit result from thread.'); } } catch (ChannelException $exception) { $this->kill(); throw new ContextException( "The context stopped responding, potentially due to a fatal error or calling exit", 0, $exception ); } catch (\Throwable $exception) { $this->kill(); throw $exception; } finally { Loop::disable($this->watcher); $this->close(); } return $response->getResult(); }); } /** * {@inheritdoc} */ public function receive(): Promise { if ($this->channel === null) { throw new StatusError('The process has not been started.'); } return call(function () { Loop::enable($this->watcher); try { $data = yield $this->channel->receive(); } finally { Loop::disable($this->watcher); } if ($data instanceof ExitResult) { $data = $data->getResult(); throw new SynchronizationError(\sprintf( 'Thread process unexpectedly exited with result of type: %s', \is_object($data) ? \get_class($data) : \gettype($data) )); } return $data; }); } /** * {@inheritdoc} */ public function send($data): Promise { if ($this->channel === null) { throw new StatusError('The thread has not been started or has already finished.'); } if ($data instanceof ExitResult) { throw new \Error('Cannot send exit result objects.'); } return call(function () use ($data) { Loop::enable($this->watcher); try { $result = yield $this->channel->send($data); } finally { Loop::disable($this->watcher); } return $result; }); } } <?php namespace Amp\Parallel\Context; use Amp\Parallel\Sync\Channel; use Amp\Promise; interface Context extends Channel { /** * @return bool */ public function isRunning(): bool; /** * Starts the execution context. * * @return Promise<null> Resolved once the context has started. */ public function start(): Promise; /** * Immediately kills the context. */ public function kill(); /** * @return \Amp\Promise<mixed> Resolves with the returned from the context. * * @throws \Amp\Parallel\Context\ContextException If the context dies unexpectedly. * @throws \Amp\Parallel\Sync\PanicError If the context throws an uncaught exception. */ public function join(): Promise; } <?php namespace Amp\Parallel\Context; use Amp\Loop; use Amp\Parallel\Sync\ChannelException; use Amp\Parallel\Sync\ExitResult; use Amp\Parallel\Sync\SynchronizationError; use Amp\Process\Process as BaseProcess; use Amp\Process\ProcessInputStream; use Amp\Process\ProcessOutputStream; use Amp\Promise; use function Amp\call; final class Process implements Context { const SCRIPT_PATH = __DIR__ . "/Internal/process-runner.php"; const KEY_LENGTH = 32; /** @var string|null External version of SCRIPT_PATH if inside a PHAR. */ private static $pharScriptPath; /** @var string|null PHAR path with a '.phar' extension. */ private static $pharCopy; /** @var string|null Cached path to located PHP binary. */ private static $binaryPath; /** @var Internal\ProcessHub */ private $hub; /** @var \Amp\Process\Process */ private $process; /** @var \Amp\Parallel\Sync\Channel */ private $channel; /** * Creates and starts the process at the given path using the optional PHP binary path. * * @param string|array $script Path to PHP script or array with first element as path and following elements options * to the PHP script (e.g.: ['bin/worker', 'Option1Value', 'Option2Value']. * @param string|null $cwd Working directory. * @param mixed[] $env Array of environment variables. * @param string $binary Path to PHP binary. Null will attempt to automatically locate the binary. * * @return Promise<Process> */ public static function run($script, string $cwd = null, array $env = [], string $binary = null): Promise { $process = new self($script, $cwd, $env, $binary); return call(function () use ($process) { yield $process->start(); return $process; }); } /** * @param string|array $script Path to PHP script or array with first element as path and following elements options * to the PHP script (e.g.: ['bin/worker', 'Option1Value', 'Option2Value']. * @param string|null $cwd Working directory. * @param mixed[] $env Array of environment variables. * @param string $binary Path to PHP binary. Null will attempt to automatically locate the binary. * * @throws \Error If the PHP binary path given cannot be found or is not executable. */ public function __construct($script, string $cwd = null, array $env = [], string $binary = null) { $this->hub = Loop::getState(self::class); if (!$this->hub instanceof Internal\ProcessHub) { $this->hub = new Internal\ProcessHub; Loop::setState(self::class, $this->hub); } $options = [ "html_errors" => "0", "display_errors" => "0", "log_errors" => "1", ]; if ($binary === null) { if (\PHP_SAPI === "cli") { $binary = \PHP_BINARY; } else { $binary = self::$binaryPath ?? self::locateBinary(); } } elseif (!\is_executable($binary)) { throw new \Error(\sprintf("The PHP binary path '%s' was not found or is not executable", $binary)); } // Write process runner to external file if inside a PHAR, // because PHP can't open files inside a PHAR directly except for the stub. if (\strpos(self::SCRIPT_PATH, "phar://") === 0) { if (self::$pharScriptPath) { $scriptPath = self::$pharScriptPath; } else { $path = \dirname(self::SCRIPT_PATH); if (\substr(\Phar::running(false), -5) !== ".phar") { self::$pharCopy = \sys_get_temp_dir() . "/phar-" . \bin2hex(\random_bytes(10)) . ".phar"; \copy(\Phar::running(false), self::$pharCopy); \register_shutdown_function(static function () { @\unlink(self::$pharCopy); }); $path = "phar://" . self::$pharCopy . "/" . \substr($path, \strlen(\Phar::running(true))); } $contents = \file_get_contents(self::SCRIPT_PATH); $contents = \str_replace("__DIR__", \var_export($path, true), $contents); self::$pharScriptPath = $scriptPath = \tempnam(\sys_get_temp_dir(), "amp-process-runner-"); \file_put_contents($scriptPath, $contents); \register_shutdown_function(static function () { @\unlink(self::$pharScriptPath); }); } // Monkey-patch the script path in the same way, only supported if the command is given as array. if (isset(self::$pharCopy) && \is_array($script) && isset($script[0])) { $script[0] = "phar://" . self::$pharCopy . \substr($script[0], \strlen(\Phar::running(true))); } } else { $scriptPath = self::SCRIPT_PATH; } if (\is_array($script)) { $script = \implode(" ", \array_map("escapeshellarg", $script)); } else { $script = \escapeshellarg($script); } $command = \implode(" ", [ \escapeshellarg($binary), $this->formatOptions($options), \escapeshellarg($scriptPath), $this->hub->getUri(), $script, ]); $this->process = new BaseProcess($command, $cwd, $env); } private static function locateBinary(): string { $executable = \strncasecmp(\PHP_OS, "WIN", 3) === 0 ? "php.exe" : "php"; $paths = \array_filter(\explode(\PATH_SEPARATOR, \getenv("PATH"))); $paths[] = \PHP_BINDIR; $paths = \array_unique($paths); foreach ($paths as $path) { $path .= \DIRECTORY_SEPARATOR . $executable; if (\is_executable($path)) { return self::$binaryPath = $path; } } throw new \Error("Could not locate PHP executable binary"); } private function formatOptions(array $options) { $result = []; foreach ($options as $option => $value) { $result[] = \sprintf("-d%s=%s", $option, $value); } return \implode(" ", $result); } /** * Private method to prevent cloning. */ private function __clone() { } /** * {@inheritdoc} */ public function start(): Promise { return call(function () { try { $pid = yield $this->process->start(); yield $this->process->getStdin()->write($this->hub->generateKey($pid, self::KEY_LENGTH)); $this->channel = yield $this->hub->accept($pid); } catch (\Throwable $exception) { $this->process->kill(); throw new ContextException("Staring the process failed", 0, $exception); } }); } /** * {@inheritdoc} */ public function isRunning(): bool { return $this->process->isRunning(); } /** * {@inheritdoc} */ public function receive(): Promise { if ($this->channel === null) { throw new StatusError("The process has not been started"); } return call(function () { try { $data = yield $this->channel->receive(); } catch (ChannelException $e) { throw new ContextException("The context stopped responding, potentially due to a fatal error or calling exit", 0, $e); } if ($data instanceof ExitResult) { $data = $data->getResult(); throw new SynchronizationError(\sprintf( 'Process unexpectedly exited with result of type: %s', \is_object($data) ? \get_class($data) : \gettype($data) )); } return $data; }); } /** * {@inheritdoc} */ public function send($data): Promise { if ($this->channel === null) { throw new StatusError("The process has not been started"); } if ($data instanceof ExitResult) { throw new \Error("Cannot send exit result objects"); } return $this->channel->send($data); } /** * {@inheritdoc} */ public function join(): Promise { if ($this->channel === null) { throw new StatusError("The process has not been started"); } return call(function () { try { $data = yield $this->channel->receive(); if (!$data instanceof ExitResult) { throw new SynchronizationError("Did not receive an exit result from process"); } } catch (\Throwable $exception) { $this->kill(); throw $exception; } $code = yield $this->process->join(); if ($code !== 0) { throw new ContextException(\sprintf("Process exited with code %d", $code)); } return $data->getResult(); }); } /** * Send a signal to the process. * * @see \Amp\Process\Process::signal() * * @param int $signo * * @throws \Amp\Process\ProcessException * @throws \Amp\Process\StatusError */ public function signal(int $signo) { $this->process->signal($signo); } /** * Returns the PID of the process. * * @see \Amp\Process\Process::getPid() * * @return int * * @throws \Amp\Process\StatusError */ public function getPid(): int { return $this->process->getPid(); } /** * Returns the STDIN stream of the process. * * @see \Amp\Process\Process::getStdin() * * @return ProcessOutputStream * * @throws \Amp\Process\StatusError */ public function getStdin(): ProcessOutputStream { return $this->process->getStdin(); } /** * Returns the STDOUT stream of the process. * * @see \Amp\Process\Process::getStdout() * * @return ProcessInputStream * * @throws \Amp\Process\StatusError */ public function getStdout(): ProcessInputStream { return $this->process->getStdout(); } /** * Returns the STDOUT stream of the process. * * @see \Amp\Process\Process::getStderr() * * @return ProcessInputStream * * @throws \Amp\Process\StatusError */ public function getStderr(): ProcessInputStream { return $this->process->getStderr(); } /** * {@inheritdoc} */ public function kill() { $this->process->kill(); } } <?php namespace Amp\Parallel\Context; class StatusError extends \Error { } <?php namespace Amp\Parallel\Sync; class SerializationException extends \Exception { } <?php namespace Amp\Parallel\Sync; class SynchronizationError extends \Error { } <?php namespace Amp\Parallel\Sync\Internal; final class ParcelStorage extends \Threaded { /** @var mixed */ private $value; /** * @param mixed $value */ public function __construct($value) { $this->value = $value; } /** * @return mixed */ public function get() { return $this->value; } /** * @param mixed $value */ public function set($value) { $this->value = $value; } } <?php namespace Amp\Parallel\Sync; use Amp\CallableMaker; use Amp\Parser\Parser; final class ChannelParser extends Parser { use CallableMaker; const HEADER_LENGTH = 5; /** * @param callable(mixed $data) Callback invoked when data is parsed. */ public function __construct(callable $callback) { parent::__construct(self::parser($callback, self::callableFromStaticMethod("errorHandler"))); } /** * @param mixed $data Data to encode to send over a channel. * * @return string Encoded data that can be parsed by this class. * * @throws \Amp\Parallel\Sync\SerializationException */ public function encode($data): string { try { $data = \serialize($data); } catch (\Throwable $exception) { throw new SerializationException( "The given data cannot be sent because it is not serializable.", 0, $exception ); } return \pack("CL", 0, \strlen($data)) . $data; } /** * @param callable $push * @param callable $errorHandler * * @return \Generator * * @throws \Amp\Parallel\Sync\ChannelException * @throws \Amp\Parallel\Sync\SerializationException */ private static function parser(callable $push, callable $errorHandler): \Generator { while (true) { $header = yield self::HEADER_LENGTH; $data = \unpack("Cprefix/Llength", $header); if ($data["prefix"] !== 0) { $data = $header . yield; $data = \preg_replace_callback("/[^\x20-\x7e]/", function (array $matches) { return "\\x" . \dechex(\ord($matches[0])); }, $data); throw new ChannelException("Invalid packet received: " . $data); } $data = yield $data["length"]; \set_error_handler($errorHandler); // Attempt to unserialize the received data. try { $data = \unserialize($data); } catch (\Throwable $exception) { throw new SerializationException("Exception thrown when unserializing data", 0, $exception); } finally { \restore_error_handler(); } $push($data); } } private static function errorHandler($errno, $errstr, $errfile, $errline) { if ($errno & \error_reporting()) { throw new ChannelException(\sprintf( 'Received corrupted data. Errno: %d; %s in file %s on line %d', $errno, $errstr, $errfile, $errline )); } } } <?php namespace Amp\Parallel\Sync; use Amp\Promise; /** * Interface for sending messages between execution contexts. */ interface Channel { /** * @return \Amp\Promise<mixed> * * @throws \Amp\Parallel\Context\StatusError Thrown if the context has not been started. * @throws \Amp\Parallel\Sync\SynchronizationError If the context has not been started or the context * unexpectedly ends. * @throws \Amp\Parallel\Sync\ChannelException If receiving from the channel fails. * @throws \Amp\Parallel\Sync\SerializationException If unserializing the data fails. */ public function receive(): Promise; /** * @param mixed $data * * @return \Amp\Promise<int> Resolves with the number of bytes sent on the channel. * * @throws \Amp\Parallel\Context\StatusError Thrown if the context has not been started. * @throws \Amp\Parallel\Sync\SynchronizationError If the context has not been started or the context * unexpectedly ends. * @throws \Amp\Parallel\Sync\ChannelException If sending on the channel fails. * @throws \Error If an ExitResult object is given. * @throws \Amp\Parallel\Sync\SerializationException If serializing the data fails. */ public function send($data): Promise; } <?php namespace Amp\Parallel\Sync; interface ExitResult { /** * @return mixed Return value of the callable given to the execution context. * * @throws \Amp\Parallel\Sync\PanicError If the context exited with an uncaught exception. */ public function getResult(); } <?php namespace Amp\Parallel\Sync; class SharedMemoryException extends \Exception { } <?php namespace Amp\Parallel\Sync; use Amp\Promise; /** * A parcel object for sharing data across execution contexts. * * A parcel is an object that stores a value in a safe way that can be shared * between different threads or processes. Different handles to the same parcel * will access the same data, and a parcel handle itself is serializable and * can be transported to other execution contexts. * * Wrapping and unwrapping values in the parcel are not atomic. To prevent race * conditions and guarantee safety, you should use the provided synchronization * methods to acquire a lock for exclusive access to the parcel first before * accessing the contained value. */ interface Parcel { /** * Asynchronously invokes a callback while maintaining an exclusive lock on the parcel. The current value of the * parcel is provided as the first argument to the callback function. * * @param callable $callback The synchronized callback to invoke. The parcel value is given as the single argument * to the callback function. The callback may be a regular function or a coroutine. * * @return \Amp\Promise<mixed> Resolves with the return value of $callback or fails if $callback * throws an exception. */ public function synchronized(callable $callback): Promise; /** * @return \Amp\Promise<mixed> A promise for the value inside the parcel. */ public function unwrap(): Promise; } <?php namespace Amp\Parallel\Sync; use Amp\ByteStream\ResourceInputStream; use Amp\ByteStream\ResourceOutputStream; use Amp\Promise; final class ChannelledSocket implements Channel { /** @var ChannelledStream */ private $channel; /** @var ResourceInputStream */ private $read; /** @var ResourceOutputStream */ private $write; /** * @param resource $read Readable stream resource. * @param resource $write Writable stream resource. * * @throws \Error If a stream resource is not given for $resource. */ public function __construct($read, $write) { $this->channel = new ChannelledStream( $this->read = new ResourceInputStream($read), $this->write = new ResourceOutputStream($write) ); } /** * {@inheritdoc} */ public function receive(): Promise { return $this->channel->receive(); } /** * {@inheritdoc} */ public function send($data): Promise { return $this->channel->send($data); } /** * Closes the read and write resource streams. */ public function close() { $this->read->close(); $this->write->close(); } } <?php namespace Amp\Parallel\Sync; use Amp\Failure; use Amp\Promise; use Amp\Success; use Amp\Sync\PosixSemaphore; use function Amp\call; /** * A container object for sharing a value across contexts. * * A shared object is a container that stores an object inside shared memory. * The object can be accessed and mutated by any thread or process. The shared * object handle itself is serializable and can be sent to any thread or process * to give access to the value that is shared in the container. * * Because each shared object uses its own shared memory segment, it is much * more efficient to store a larger object containing many values inside a * single shared container than to use many small shared containers. * * Note that accessing a shared object is not atomic. Access to a shared object * should be protected with a mutex to preserve data integrity. * * When used with forking, the object must be created prior to forking for both * processes to access the synchronized object. * * @see http://php.net/manual/en/book.shmop.php The shared memory extension. * @see http://man7.org/linux/man-pages/man2/shmctl.2.html How shared memory works on Linux. * @see https://msdn.microsoft.com/en-us/library/ms810613.aspx How shared memory works on Windows. */ final class SharedMemoryParcel implements Parcel { /** @var int The byte offset to the start of the object data in memory. */ const MEM_DATA_OFFSET = 7; // A list of valid states the object can be in. const STATE_UNALLOCATED = 0; const STATE_ALLOCATED = 1; const STATE_MOVED = 2; const STATE_FREED = 3; /** @var string */ private $id; /** @var int The shared memory segment key. */ private $key; /** @var PosixSemaphore A semaphore for synchronizing on the parcel. */ private $semaphore; /** @var int An open handle to the shared memory segment. */ private $handle; /** @var int */ private $initializer = 0; /** * @param string $id * @param mixed $value * @param int $size The initial size in bytes of the shared memory segment. It will automatically be expanded as * necessary. * @param int $permissions Permissions to access the semaphore. Use file permission format specified as 0xxx. * * @return \Amp\Parallel\Sync\SharedMemoryParcel */ public static function create(string $id, $value, int $size = 8192, int $permissions = 0600): self { $parcel = new self($id); $parcel->init($value, $size, $permissions); return $parcel; } /** * @param string $id * * @return \Amp\Parallel\Sync\SharedMemoryParcel */ public static function use(string $id): self { $parcel = new self($id); $parcel->open(); return $parcel; } /** * Creates a new local object container. * * The object given will be assigned a new object ID and will have a * reference to it stored in memory local to the thread. * * @param mixed $value The value to store in the container. * @param int $size The number of bytes to allocate for the object. * If not specified defaults to 16384 bytes. * @param int $permissions The access permissions to set for the object. * If not specified defaults to 0600. */ private function __construct(string $id) { if (!\extension_loaded("shmop")) { throw new \Error(__CLASS__ . " requires the shmop extension."); } $this->id = $id; $this->key = self::makeKey($this->id); } /** * @param mixed $value * @param int $size * @param int $permissions */ private function init($value, int $size = 8192, int $permissions = 0600) { $this->semaphore = PosixSemaphore::create($this->id, 1); $this->initializer = \getmypid(); $this->memOpen($this->key, 'n', $permissions, $size + self::MEM_DATA_OFFSET); $this->setHeader(self::STATE_ALLOCATED, 0, $permissions); $this->wrap($value); } private function open() { $this->semaphore = PosixSemaphore::use($this->id); $this->memOpen($this->key, 'w', 0, 0); } /** * Checks if the object has been freed. * * Note that this does not check if the object has been destroyed; it only * checks if this handle has freed its reference to the object. * * @return bool True if the object is freed, otherwise false. */ private function isFreed(): bool { // If we are no longer connected to the memory segment, check if it has // been invalidated. if ($this->handle !== null) { $this->handleMovedMemory(); $header = $this->getHeader(); return $header['state'] === static::STATE_FREED; } return true; } /** * {@inheritdoc} */ public function unwrap(): Promise { if ($this->isFreed()) { return new Failure(new SharedMemoryException('The object has already been freed.')); } $header = $this->getHeader(); // Make sure the header is in a valid state and format. if ($header['state'] !== self::STATE_ALLOCATED || $header['size'] <= 0) { new Failure(new SharedMemoryException('Shared object memory is corrupt.')); } // Read the actual value data from memory and unserialize it. $data = $this->memGet(self::MEM_DATA_OFFSET, $header['size']); return new Success(\unserialize($data)); } /** * If the value requires more memory to store than currently allocated, a * new shared memory segment will be allocated with a larger size to store * the value in. The previous memory segment will be cleaned up and marked * for deletion. Other processes and threads will be notified of the new * memory segment on the next read attempt. Once all running processes and * threads disconnect from the old segment, it will be freed by the OS. */ protected function wrap($value) { if ($this->isFreed()) { throw new SharedMemoryException('The object has already been freed.'); } $serialized = \serialize($value); $size = \strlen($serialized); $header = $this->getHeader(); /* If we run out of space, we need to allocate a new shared memory segment that is larger than the current one. To coordinate with other processes, we will leave a message in the old segment that the segment has moved and along with the new key. The old segment will be discarded automatically after all other processes notice the change and close the old handle. */ if (\shmop_size($this->handle) < $size + self::MEM_DATA_OFFSET) { $this->key = $this->key < 0xffffffff ? $this->key + 1 : \mt_rand(0x10, 0xfffffffe); $this->setHeader(self::STATE_MOVED, $this->key, 0); $this->memDelete(); \shmop_close($this->handle); $this->memOpen($this->key, 'n', $header['permissions'], $size * 2); } // Rewrite the header and the serialized value to memory. $this->setHeader(self::STATE_ALLOCATED, $size, $header['permissions']); $this->memSet(self::MEM_DATA_OFFSET, $serialized); } /** * {@inheritdoc} */ public function synchronized(callable $callback): Promise { return call(function () use ($callback) { /** @var \Amp\Sync\Lock $lock */ $lock = yield $this->semaphore->acquire(); try { $result = yield call($callback, yield $this->unwrap()); if ($result !== null) { $this->wrap($result); } } finally { $lock->release(); } return $result; }); } /** * Frees the shared object from memory. * * The memory containing the shared value will be invalidated. When all * process disconnect from the object, the shared memory block will be * destroyed by the OS. */ public function __destruct() { if ($this->initializer === 0 || $this->initializer !== \getmypid()) { return; } if ($this->isFreed()) { return; } // Invalidate the memory block by setting its state to FREED. $this->setHeader(static::STATE_FREED, 0, 0); // Request the block to be deleted, then close our local handle. $this->memDelete(); \shmop_close($this->handle); $this->handle = null; $this->semaphore = null; } /** * Private method to prevent cloning. */ private function __clone() { } /** * Private method to prevent serialization. */ private function __sleep() { } /** * Updates the current memory segment handle, handling any moves made on the * data. */ private function handleMovedMemory() { // Read from the memory block and handle moved blocks until we find the // correct block. while (true) { $header = $this->getHeader(); // If the state is STATE_MOVED, the memory is stale and has been moved // to a new location. Move handle and try to read again. if ($header['state'] !== self::STATE_MOVED) { break; } \shmop_close($this->handle); $this->key = $header['size']; $this->memOpen($this->key, 'w', 0, 0); } } /** * Reads and returns the data header at the current memory segment. * * @return array An associative array of header data. */ private function getHeader(): array { $data = $this->memGet(0, self::MEM_DATA_OFFSET); return \unpack('Cstate/Lsize/Spermissions', $data); } /** * Sets the header data for the current memory segment. * * @param int $state An object state. * @param int $size The size of the stored data, or other value. * @param int $permissions The permissions mask on the memory segment. */ private function setHeader(int $state, int $size, int $permissions) { $header = \pack('CLS', $state, $size, $permissions); $this->memSet(0, $header); } /** * Opens a shared memory handle. * * @param int $key The shared memory key. * @param string $mode The mode to open the shared memory in. * @param int $permissions Process permissions on the shared memory. * @param int $size The size to crate the shared memory in bytes. */ private function memOpen(int $key, string $mode, int $permissions, int $size) { $this->handle = @\shmop_open($key, $mode, $permissions, $size); if ($this->handle === false) { throw new SharedMemoryException('Failed to create shared memory block.'); } } /** * Reads binary data from shared memory. * * @param int $offset The offset to read from. * @param int $size The number of bytes to read. * * @return string The binary data at the given offset. */ private function memGet(int $offset, int $size): string { $data = \shmop_read($this->handle, $offset, $size); if ($data === false) { throw new SharedMemoryException('Failed to read from shared memory block.'); } return $data; } /** * Writes binary data to shared memory. * * @param int $offset The offset to write to. * @param string $data The binary data to write. */ private function memSet(int $offset, string $data) { if (!\shmop_write($this->handle, $data, $offset)) { throw new SharedMemoryException('Failed to write to shared memory block.'); } } /** * Requests the shared memory segment to be deleted. */ private function memDelete() { if (!\shmop_delete($this->handle)) { throw new SharedMemoryException('Failed to discard shared memory block.'); } } private static function makeKey(string $id): int { return \abs(\unpack("l", \md5($id, true))[1]); } } <?php namespace Amp\Parallel\Sync; final class ExitSuccess implements ExitResult { /** @var mixed */ private $result; public function __construct($result) { $this->result = $result; } /** * {@inheritdoc} */ public function getResult() { return $this->result; } } <?php namespace Amp\Parallel\Sync; final class ExitFailure implements ExitResult { /** @var string */ private $type; /** @var string */ private $message; /** @var int|string */ private $code; /** @var array */ private $trace; public function __construct(\Throwable $exception) { $this->type = \get_class($exception); $this->message = $exception->getMessage(); $this->code = $exception->getCode(); $this->trace = $exception->getTraceAsString(); } /** * {@inheritdoc} */ public function getResult() { throw new PanicError( $this->type, \sprintf( 'Uncaught %s in execution context with message "%s" and code "%s"', $this->type, $this->message, $this->code ), $this->trace ); } } <?php namespace Amp\Parallel\Sync; final class PanicError extends \Error { /** @var string Class name of uncaught exception. */ private $name; /** @var string Stack trace of the panic. */ private $trace; /** * Creates a new panic error. * * @param string $name The uncaught exception class. * @param string $message The panic message. * @param string $trace The panic stack trace. */ public function __construct(string $name, string $message = '', string $trace = '') { parent::__construct($message); $this->name = $name; $this->trace = $trace; } /** * Returns the class name of the uncaught exception. * * @return string */ public function getName(): string { return $this->name; } /** * Gets the stack trace at the point the panic occurred. * * @return string */ public function getPanicTrace(): string { return $this->trace; } } <?php namespace Amp\Parallel\Sync; class ChannelException extends \Exception { } <?php namespace Amp\Parallel\Sync; use Amp\Promise; use Amp\Success; use Amp\Sync\ThreadedMutex; use function Amp\call; /** * A thread-safe container that shares a value between multiple threads. */ final class ThreadedParcel implements Parcel { /** @var \Amp\Sync\ThreadedMutex */ private $mutex; /** @var \Threaded */ private $storage; /** * Creates a new shared object container. * * @param mixed $value The value to store in the container. */ public function __construct($value) { $this->mutex = new ThreadedMutex; $this->storage = new Internal\ParcelStorage($value); } /** * {@inheritdoc} */ public function unwrap(): Promise { return new Success($this->storage->get()); } /** * @return \Amp\Promise */ public function synchronized(callable $callback): Promise { return call(function () use ($callback) { /** @var \Amp\Sync\Lock $lock */ $lock = yield $this->mutex->acquire(); try { $result = yield call($callback, $this->storage->get()); if ($result !== null) { $this->storage->set($result); } } finally { $lock->release(); } return $result; }); } } <?php namespace Amp\Parallel\Sync; use Amp\ByteStream\InputStream; use Amp\ByteStream\OutputStream; use Amp\ByteStream\StreamException; use Amp\Promise; use function Amp\call; /** * An asynchronous channel for sending data between threads and processes. * * Supports full duplex read and write. */ final class ChannelledStream implements Channel { /** @var \Amp\ByteStream\InputStream */ private $read; /** @var \Amp\ByteStream\OutputStream */ private $write; /** @var \SplQueue */ private $received; /** @var \Amp\Parser\Parser */ private $parser; /** * Creates a new channel from the given stream objects. Note that $read and $write can be the same object. * * @param \Amp\ByteStream\InputStream $read * @param \Amp\ByteStream\OutputStream $write */ public function __construct(InputStream $read, OutputStream $write) { $this->read = $read; $this->write = $write; $this->received = new \SplQueue; $this->parser = new ChannelParser([$this->received, 'push']); } /** * {@inheritdoc} */ public function send($data): Promise { return call(function () use ($data) { try { return yield $this->write->write($this->parser->encode($data)); } catch (StreamException $exception) { throw new ChannelException("Sending on the channel failed. Did the context die?", 0, $exception); } }); } /** * {@inheritdoc} */ public function receive(): Promise { return call(function () { while ($this->received->isEmpty()) { try { $chunk = yield $this->read->read(); } catch (StreamException $exception) { throw new ChannelException("Reading from the channel failed. Did the context die?", 0, $exception); } if ($chunk === null) { throw new ChannelException("The channel closed unexpectedly. Did the context die?"); } $this->parser->push($chunk); } return $this->received->shift(); }); } } <?php require dirname(__DIR__) . '/vendor/autoload.php'; use Amp\Delayed; use Amp\Websocket; // Connects to the websocket endpoint in demo.php provided with Aerys (https://github.com/amphp/aerys). Amp\Loop::run(function () { /** @var Websocket\Connection $connection */ $connection = yield Websocket\connect('ws://localhost:1337/ws'); yield $connection->send('Hello!'); $i = 0; /** @var Websocket\Message $message */ while ($message = yield $connection->receive()) { $payload = yield $message->buffer(); printf("Received: %s\n", $payload); if ($payload === 'Goodbye!') { $connection->close(); break; } yield new Delayed(1000); if ($i < 3) { yield $connection->send('Ping: ' . ++$i); } else { yield $connection->send('Goodbye!'); } } }); <?php require dirname(__DIR__) . '/vendor/autoload.php'; use Amp\Delayed; use Amp\Websocket; Amp\Loop::run(function () { /** @var Websocket\Connection $connection */ $connection = yield Websocket\connect('ws://demos.kaazing.com/echo'); yield $connection->send('Hello!'); $i = 0; /** @var Websocket\Message $message */ while ($message = yield $connection->receive()) { $payload = yield $message->buffer(); printf("Received: %s\n", $payload); if ($payload === 'Goodbye!') { $connection->close(); break; } yield new Delayed(1000); if ($i < 3) { yield $connection->send('Ping: ' . ++$i); } else { yield $connection->send('Goodbye!'); } } }); <?php use Amp\ByteStream\StreamException; use Amp\Loop; use Amp\Websocket; require __DIR__ . '/../vendor/autoload.php'; const AGENT = 'amphp/websocket'; Loop::run(function () { $errors = 0; $options = (new Websocket\Options) ->withMaximumMessageSize(32 * 1024 * 1024) ->withMaximumFrameSize(32 * 1024 * 1024) ->withValidateUtf8(true); /** @var Websocket\Connection $connection */ $connection = yield Websocket\connect('ws://127.0.0.1:9001/getCaseCount'); /** @var Websocket\Message $message */ $message = yield $connection->receive(); $cases = (int) yield $message->buffer(); echo "Going to run {$cases} test cases." . PHP_EOL; for ($i = 1; $i < $cases; $i++) { $connection = yield Websocket\connect('ws://127.0.0.1:9001/getCaseInfo?case=' . $i . '&agent=' . AGENT); $message = yield $connection->receive(); $info = \json_decode(yield $message->buffer(), true); print $info['id'] . ' ' . str_repeat('-', 80 - strlen($info['id']) - 1) . PHP_EOL; print wordwrap($info['description'], 80, PHP_EOL) . ' '; $connection = yield Websocket\connect('ws://127.0.0.1:9001/runCase?case=' . $i . '&agent=' . AGENT, null, null, $options); try { while ($message = yield $connection->receive()) { $content = yield $message->buffer(); if ($message->isBinary()) { yield $connection->sendBinary($content); } else { yield $connection->send($content); } } } catch (Websocket\ClosedException $e) { // ignore } catch (AssertionError $e) { print 'Assertion error: ' . $e->getMessage() . PHP_EOL; $connection->close(); } catch (Error $e) { print 'Error: ' . $e->getMessage() . PHP_EOL; $connection->close(); } catch (StreamException $e) { print 'Stream exception: ' . $e->getMessage() . PHP_EOL; $connection->close(); } $connection = yield Websocket\connect('ws://127.0.0.1:9001/getCaseStatus?case=' . $i . '&agent=' . AGENT); $message = yield $connection->receive(); print ($result = \json_decode(yield $message->buffer(), true)['behavior']); if ($result === 'FAILED') { $errors++; } print PHP_EOL . PHP_EOL; } $connection = yield Websocket\connect('ws://127.0.0.1:9001/updateReports?agent=' . AGENT); $connection->close(); Loop::stop(); if ($errors) { exit(1); } }); { "url": "ws://127.0.0.1:9001", "outdir": "./reports/clients", "cases": ["*"], "exclude-cases": ["7.*", "12.*", "13.*"], "exclude-agent-cases": {} } { "name": "amphp/websocket-client", "description": "Async WebSocket client for PHP based on Amp.", "license": "MIT", "authors": [ { "name": "Bob Weinand", "email": "bobwei9@hotmail.com" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" }, { "name": "Niklas Keller", "email": "me@kelunik.com" } ], "support": { "issues": "https://github.com/amphp/websocket-client/issues" }, "keywords": [ "async", "non-blocking", "websocket", "client", "http", "amp", "amphp" ], "require": { "php": ">=7", "amphp/amp": "^2", "amphp/byte-stream": "^1", "amphp/socket": "^0.10" }, "require-dev": { "amphp/aerys": "^0.7.2", "amphp/phpunit-util": "^1", "friendsofphp/php-cs-fixer": "^2.9", "phpunit/phpunit": "^6" }, "autoload": { "psr-4": { "Amp\\Websocket\\": "lib" }, "files": [ "lib/functions.php" ] }, "autoload-dev": { "psr-4": { "Amp\\Websocket\\Test\\": "test" } }, "config": { "platform": { "php": "7.0.0" } } } <?php namespace Amp\Websocket\Test\Helper; use Aerys\Request; use Aerys\Response; use Aerys\Websocket; class WebsocketAdapter implements Websocket { /** @var Websocket\Endpoint */ protected $endpoint; public function onStart(Websocket\Endpoint $endpoint) { $this->endpoint = $endpoint; } public function onHandshake(Request $request, Response $response) { // nothing to do } public function onOpen(int $clientId, $handshakeData) { // nothing to do } public function onData(int $clientId, Websocket\Message $msg) { // nothing to do } public function onClose(int $clientId, int $code, string $reason) { // nothing to do } public function onStop() { // nothing to do } } <?php namespace Amp\Websocket\Test; use Aerys\Bootable; use Aerys\Host; use Aerys\Server; use Aerys\ServerObserver; use Aerys\Websocket; use Amp\PHPUnit\TestCase; use Amp\Promise; use Amp\Success; use Amp\Websocket\Connection; use Amp\Websocket\Message; use Amp\Websocket\Test\Helper\WebsocketAdapter; use Amp\Websocket\WebSocketException; use Psr\Log\LoggerInterface as PsrLogger; use Psr\Log\NullLogger; use function Aerys\initServer; use function Aerys\websocket; use function Amp\call; use function Amp\Promise\wait; use function Amp\Websocket\connect; class WebSocketTest extends TestCase { /** @var Server[] */ private $servers = []; protected function tearDown() { foreach ($this->servers as $server) { wait($server->stop()); } parent::tearDown(); } /** * This method creates a new server that listens on a randomly assigned port and returns the used port. * * The server will automatically shut down after a test case ends. * * @param Websocket $websocket * * @return Promise<int> Resolves to the used port number. */ public function createServer(Websocket $websocket): Promise { $context = \stream_context_create([ 'socket' => [ 'so_reuseport' => true, ], ]); // Error reporting suppressed since stream_socket_server() emits an E_WARNING on failure (checked below). $portReserveSocket = @\stream_socket_server('tcp://127.0.0.1:0', $errno, $errstr, STREAM_SERVER_BIND, $context); if (!$portReserveSocket || $errno) { throw new \Exception(\sprintf('Could not create server 127.0.0.1:0 [Error: #%d] %s', $errno, $errstr), $errno); } $address = \stream_socket_get_name($portReserveSocket, false); $port = (int) \explode(':', $address, 2)[1]; $host = (new Host) ->expose('127.0.0.1', $port) ->name('localhost') ->use(websocket($websocket)) ->use(new class($portReserveSocket) implements Bootable, ServerObserver { private $socket; public function __construct($socket) { $this->socket = $socket; } public function boot(Server $server, PsrLogger $logger) { $server->attach($this); } public function update(Server $server): Promise { if ($server->state() === Server::STARTED) { \fclose($this->socket); } return new Success; } }); $this->servers[] = $server = initServer(new NullLogger, [$host]); return call(function () use ($server, $port) { yield $server->start(); return $port; }); } public function testSimpleBinaryEcho() { wait(call(function () { $port = yield $this->createServer(new class extends WebsocketAdapter { public function onData(int $clientId, Websocket\Message $msg) { if ($msg->isBinary()) { return $this->endpoint->sendBinary(yield $msg, $clientId); } return $this->endpoint->send(yield $msg, $clientId); } }); /** @var Connection $client */ $client = yield connect('ws://localhost:' . $port . '/'); $client->sendBinary('Hey!'); /** @var Message $message */ $message = yield $client->receive(); $this->assertInstanceOf(Message::class, $message); $this->assertTrue($message->isBinary()); $this->assertSame('Hey!', yield $message->buffer()); $promise = $client->receive(); $client->close(); $this->assertNull(yield $promise); })); } public function testSimpleTextEcho() { wait(call(function () { $port = yield $this->createServer(new class extends WebsocketAdapter { public function onData(int $clientId, Websocket\Message $msg) { if ($msg->isBinary()) { return $this->endpoint->sendBinary(yield $msg, $clientId); } return $this->endpoint->send(yield $msg, $clientId); } }); /** @var Connection $client */ $client = yield connect('ws://localhost:' . $port . '/'); $client->send('Hey!'); /** @var Message $message */ $message = yield $client->receive(); $this->assertInstanceOf(Message::class, $message); $this->assertFalse($message->isBinary()); $this->assertSame('Hey!', yield $message->buffer()); $promise = $client->receive(); $client->close(); $this->assertNull(yield $promise); })); } public function testUnconsumedMessage() { wait(call(function () { $port = yield $this->createServer(new class extends WebsocketAdapter { public function onOpen(int $clientId, $handshakeData) { yield $this->endpoint->send(\str_repeat('.', 1024 * 1024 * 1), $clientId); yield $this->endpoint->send('Message', $clientId); } }); /** @var Connection $client */ $client = yield connect('ws://localhost:' . $port . '/'); /** @var Message $message */ $message = yield $client->receive(); $this->assertInstanceOf(Message::class, $message); // Do not consume the bytes from the first message. $message = yield $client->receive(); $this->assertFalse($message->isBinary()); $this->assertSame('Message', yield $message->buffer()); $this->assertInstanceOf(Message::class, $message); $promise = $client->receive(); $client->close(); $this->assertNull(yield $promise); })); } public function testVeryLongMessage() { wait(call(function () { $port = yield $this->createServer(new class extends WebsocketAdapter { public function onOpen(int $clientId, $handshakeData) { $payload = \str_repeat('.', 1024 * 1024 * 10); // 10 MiB yield $this->endpoint->sendBinary($payload, $clientId); } }); /** @var Connection $client */ $client = yield connect('ws://localhost:' . $port . '/'); /** @var Message $message */ $message = yield $client->receive(); $this->assertSame(\str_repeat('.', 1024 * 1024 * 10), yield $message->buffer()); })); } public function testTooLongMessage() { wait(call(function () { $port = yield $this->createServer(new class extends WebsocketAdapter { public function onOpen(int $clientId, $handshakeData) { $payload = \str_repeat('.', 1024 * 1024 * 10 + 1); // 10 MiB yield $this->endpoint->sendBinary($payload, $clientId); } }); /** @var Connection $client */ $client = yield connect('ws://localhost:' . $port . '/'); /** @var Message $message */ $message = yield $client->receive(); $this->expectException(WebSocketException::class); $this->expectExceptionMessage('The connection was closed: Received payload exceeds maximum allowable size'); yield $message->buffer(); })); } } <?php namespace Amp\Websocket; final class Handshake { // defined in https://tools.ietf.org/html/rfc6455#section-4 const ACCEPT_CONCAT = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'; const ACCEPT_NONCE_LENGTH = 16; private $encrypted; private $remoteAddress; private $path; private $headers = []; private $accept; /** * @param string $url target address of websocket (e.g. ws://foo.bar/baz or wss://crypto.example/?secureConnection) */ public function __construct(string $url) { $url = \parse_url($url); $this->encrypted = $url['scheme'] === 'wss'; $defaultPort = $this->encrypted ? 443 : 80; $host = $url['host']; $port = $url['port'] ?? $defaultPort; $this->remoteAddress = $host . ':' . $port; if ($port !== $defaultPort) { $host .= ':' . $port; } $this->headers['host'][] = $host; $this->path = $url['path'] ?? '/'; if (isset($url['query'])) { $this->path .= "?{$url['query']}"; } } public function addHeader(string $field, string $value): self { $this->headers[$field][] = $value; return $this; } public function getRemoteAddress(): string { return $this->remoteAddress; } public function isEncrypted(): bool { return $this->encrypted; } public function getHeaders(): array { return $this->headers; } public function generateRequest(): string { $headers = ''; foreach ($this->headers as $field => $values) { /** @var array $values */ foreach ($values as $value) { $headers .= "$field: $value\r\n"; } } // This has to be generated for each connect attempt, once a new request has been generated, // we use the new key for validation. $this->accept = \base64_encode(\random_bytes(self::ACCEPT_NONCE_LENGTH)); return 'GET ' . $this->path . " HTTP/1.1\r\nConnection: Upgrade\r\nUpgrade: websocket\r\nSec-Websocket-Version: 13\r\nSec-Websocket-Key: {$this->accept}\r\n$headers\r\n"; } public function decodeResponse(string $headerBuffer): array { $startLine = \substr($headerBuffer, 0, \strpos($headerBuffer, "\r\n")); if (!\preg_match("(^HTTP/1.1[\x20\x09]101[\x20\x09]*[^\x01-\x08\x10-\x19]*$)", $startLine)) { throw new WebSocketException('Did not receive switching protocols response: ' . $startLine); } \preg_match_all("( (?P<field>[^()<>@,;:\\\"/[\\]?={}\x01-\x20\x7F]+):[\x20\x09]* (?P<value>[^\x01-\x08\x0A-\x1F\x7F]*)\x0D?[\x20\x09]*\r?\n )x", $headerBuffer, $responseHeaders); $headers = []; /** @var array[] $responseHeaders */ foreach ($responseHeaders['field'] as $idx => $field) { $headers[\strtolower($field)][] = $responseHeaders['value'][$idx]; } $upgrade = $headers['upgrade'][0] ?? ''; if (\strtolower($upgrade) !== 'websocket') { throw new WebSocketException('Missing "Upgrade: websocket" header.'); } $connection = $headers['connection'][0] ?? ''; if (!\in_array('upgrade', \array_map('trim', \array_map('strtolower', \explode(',', $connection))), true)) { throw new WebSocketException('Missing "Connection: upgrade" header.'); } $secWebsocketAccept = $headers['sec-websocket-accept'][0] ?? ''; if ($secWebsocketAccept !== \base64_encode(\sha1($this->accept . self::ACCEPT_CONCAT, true))) { throw new WebSocketException('Invalid "Sec-WebSocket-Accept" header.'); } // TODO: Check extension header and fail handshake if extensions are not supported return $headers; } } <?php namespace Amp\Websocket; use Amp\Promise; use Amp\Socket; use Amp\Socket\ClientConnectContext; use Amp\Socket\ClientSocket; use Amp\Socket\ClientTlsContext; use function Amp\call; /** * @param string|\Amp\Websocket\Handshake $handshake * @param \Amp\Socket\ClientConnectContext|null $connectContext * @param \Amp\Socket\ClientTlsContext|null $tlsContext * @param Options $options * * @return \Amp\Promise<\Amp\WebSocket\Connection> * * @throws \TypeError If $handshake is not a string or instance of \Amp\WebSocket\Handshake. */ function connect($handshake, ClientConnectContext $connectContext = null, ClientTlsContext $tlsContext = null, Options $options = null): Promise { if (\is_string($handshake)) { $handshake = new Handshake($handshake); } elseif (!$handshake instanceof Handshake) { throw new \TypeError(\sprintf('Must provide an instance of %s or a URL as a string', Handshake::class)); } $options = $options ?? new Options; return call(function () use ($handshake, $connectContext, $tlsContext, $options) { if ($handshake->isEncrypted()) { /** @var ClientSocket $socket */ $socket = yield Socket\cryptoConnect($handshake->getRemoteAddress(), $connectContext, $tlsContext); } else { /** @var ClientSocket $socket */ $socket = yield Socket\connect($handshake->getRemoteAddress(), $connectContext); } yield $socket->write($handshake->generateRequest()); $buffer = ''; while (($chunk = yield $socket->read()) !== null) { $buffer .= $chunk; if ($position = \strpos($buffer, "\r\n\r\n")) { $headerBuffer = \substr($buffer, 0, $position + 4); $buffer = \substr($buffer, $position + 4); $headers = $handshake->decodeResponse($headerBuffer); return new Rfc6455Connection($socket, $headers, $buffer, $options); } } throw new WebSocketException('Failed to read response from server'); }); } <?php namespace Amp\Websocket; final class ClosedException extends WebSocketException { /** @var string */ private $reason; public function __construct(string $message, int $code, string $reason) { parent::__construct($message, $code); $this->reason = $reason; } public function getReason(): string { return $this->reason; } } <?php namespace Amp\Websocket; use Amp\Promise; interface Connection { /** * Exposes all headers of the handshake response. * * **Format** * * ``` * [ * 'header-name' => [ * 'value1', * 'value2', * ], * 'other-header' => [ * 'value-1' * ], * ] * ``` * * All header name keys must be lowercase. * * @return array */ public function getHeaders(): array; /** * Provides access to a specific header. * * @param string $field Case-insensitive header name. * * @return string|null First header value or null if header was not present. */ public function getHeader(string $field); /** * Provides access to a specific header. * * @param string $field Case-insensitive header name. * * @return array All header values, might be an empty array if header was not present. */ public function getHeaderArray(string $field): array; /** * Sends text data to the remote. * * All data sent with this method must be valid UTF-8. Use `sendBinary()` if you want to send binary data. * * @param string $data Payload to send. * * @return Promise * * @see Connection::sendBinary() */ public function send(string $data): Promise; /** * Sends binary data to the remote. * * @param string $data Payload to send. * * @return Promise * * @see Connection::send() */ public function sendBinary(string $data): Promise; /** * Receive a message from the remote. * * @return Promise<array<Message>|null> Resolves to message sent by the remote or `null` if the connection was * closed locally. */ public function receive(): Promise; /** * Check whether the connection has been closed. * * @return bool Returns `true` as soon as the closing handshake has started by one side (either client or server). */ public function isClosed(): bool; /** * Closes the connection. * * @param int $code Close code. * @param string $reason Close reason. * * @return void */ public function close(int $code = Code::NORMAL_CLOSE, string $reason = ''); /** * Returns connection metadata. * * ``` * [ * 'bytes_read' => int, * 'bytes_sent' => int, * 'frames_read' => int, * 'frames_sent' => int, * 'messages_read' => int, * 'messages_sent' => int, * 'connected_at' => int, * 'closed_at' => int, * 'last_read_at' => int, * 'last_sent_at' => int, * 'last_data_read_at' => int, * 'last_data_sent_at' => int, * ] * ``` * * @return array Array in the format described above. */ public function getInfo(): array; } <?php namespace Amp\Websocket; use Amp\ByteStream\IteratorStream; use Amp\Coroutine; use Amp\Deferred; use Amp\Emitter; use Amp\Loop; use Amp\Promise; use Amp\Socket\Socket; use Amp\Success; final class Rfc6455Connection implements Connection { /** @var Options */ private $options; /** @var Socket */ private $socket; /** @var array[] */ private $headers; /** @var \Generator */ private $parser; public $pingCount = 0; public $pongCount = 0; private $emitBuffer = ""; /** @var Emitter */ private $currentMessageEmitter; /** @var Message[] */ private $messages = []; /** @var Deferred */ private $nextMessageDeferred; /** @var bool */ private $serverInitiatedClose = false; /** @var bool */ private $parseError = false; /** @var Promise|null */ private $lastWrite; /** @var Promise */ private $lastEmit; /** @var string */ private $timeoutWatcher; // getInfo() properties private $connectedAt; private $closedAt = 0; private $lastReadAt = 0; private $lastSentAt = 0; private $lastDataReadAt = 0; private $lastDataSentAt = 0; private $bytesRead = 0; private $bytesSent = 0; private $framesRead = 0; private $framesSent = 0; private $messagesRead = 0; private $messagesSent = 0; private $closeCode; private $closeReason; /* Frame control bits */ const FIN = 0b1; const RSV_NONE = 0b000; const OP_CONT = 0x00; const OP_TEXT = 0x01; const OP_BIN = 0x02; const OP_CLOSE = 0x08; const OP_PING = 0x09; const OP_PONG = 0x0A; const CONTROL = -1; const ERROR = -2; public function __construct(Socket $socket, array $headers, string $buffer, Options $options) { $this->headers = $headers; $this->options = $options; $this->connectedAt = \time(); $this->socket = $socket; $this->parser = $this->parser(); if ($buffer !== '') { $this->lastReadAt = \time(); $this->bytesRead += \strlen($buffer); $this->framesRead += $this->parser->send($buffer); } Promise\rethrow(new Coroutine($this->read())); } /** @inheritdoc */ public function getHeaders(): array { return $this->headers; } /** @inheritdoc */ public function getHeader(string $field) { return $this->headers[\strtolower($field)][0] ?? null; } /** @inheritdoc */ public function getHeaderArray(string $field): array { return $this->headers[\strtolower($field)] ?? []; } /** @inheritdoc */ public function close(int $code = Code::NORMAL_CLOSE, string $reason = '') { // Only proceed if we haven't already begun the close handshake elsewhere if ($this->closedAt) { return; } $this->closeCode = $code; $this->closeReason = $reason; $this->sendCloseFrame($code, $reason); $exception = new ClosedException('The connection was closed: ' . $reason, $code, $reason); if ($this->currentMessageEmitter) { $emitter = $this->currentMessageEmitter; $this->currentMessageEmitter = null; $emitter->fail($exception); } if ($this->nextMessageDeferred) { $deferred = $this->nextMessageDeferred; $this->nextMessageDeferred = null; if ($this->serverInitiatedClose || $this->parseError) { $deferred->fail($exception); } else { $deferred->resolve(); } } $this->timeoutWatcher = Loop::delay($this->options->getClosePeriod() * 1000, function () { $this->unloadServer(); }); // Don't unload the client here, it will be unloaded upon timeout } /** @inheritdoc */ public function isClosed(): bool { return (bool) $this->closedAt; } private function sendCloseFrame(int $code, string $message): Promise { $promise = $this->write(self::OP_CLOSE, \pack('n', $code) . $message); $promise->onResolve(function () { $this->socket->close(); }); $this->closedAt = \time(); return $promise; } private function unloadServer() { $this->parser = null; $this->socket->close(); if ($this->timeoutWatcher) { Loop::cancel($this->timeoutWatcher); } $exception = new WebSocketException('The connection was closed'); // fail not yet terminated message streams; they *must not* be failed before client is removed if ($this->currentMessageEmitter) { $this->currentMessageEmitter->fail($exception); } if ($this->nextMessageDeferred && ($this->serverInitiatedClose || $this->parseError)) { $deferred = $this->nextMessageDeferred; $this->nextMessageDeferred = null; $deferred->fail(new ClosedException('The connection was closed: ' . $this->closeReason, $this->closeCode, $this->closeReason)); } } private function onParsedControlFrame(int $opcode, string $data) { if ($this->closedAt) { return; } switch ($opcode) { case self::OP_CLOSE: if ($this->closedAt) { $this->unloadServer(); } else { $length = \strlen($data); if ($length === 0) { $this->close(); return; } elseif ($length < 2) { $this->close(Code::PROTOCOL_ERROR, 'Close code must be two bytes'); return; } $code = \current(\unpack('n', \substr($data, 0, 2))); $reason = \substr($data, 2); $this->serverInitiatedClose = true; // Note: There's a test for 1004, but only 1005 and 1006 must not be used for closing by an endpoint if ($code < 1000 || $code === 1005 || $code === 1006 || $code === 1015) { $this->close(Code::PROTOCOL_ERROR, 'Invalid close code'); return; } if ($this->options->isValidateUtf8() && !\preg_match('//u', $reason)) { $this->close(Code::INCONSISTENT_FRAME_DATA_TYPE, 'Close reason must be valid UTF-8'); } else { $this->close($code, $reason); } } break; case self::OP_PING: $this->write(self::OP_PONG, $data); break; case self::OP_PONG: // We need a min() here, else someone might just send a pong frame with a very high pong count and leave TCP connection in open state... $this->pongCount = \min($this->pingCount, $data); break; } } private function onParsedData(int $opcode, string $data, bool $terminated) { if ($this->closedAt) { return; } $this->lastDataReadAt = \time(); if (!$this->currentMessageEmitter) { if ($opcode === self::OP_CONT) { $this->onParsedError(Code::PROTOCOL_ERROR, 'Nothing to continue'); return; } $binary = $opcode === self::OP_BIN; $this->currentMessageEmitter = new Emitter; if ($this->nextMessageDeferred) { $deferred = $this->nextMessageDeferred; $this->nextMessageDeferred = null; $deferred->resolve(new Message(new IteratorStream($this->currentMessageEmitter->iterate()), $binary)); } else { $this->messages[] = new Message(new IteratorStream($this->currentMessageEmitter->iterate()), $binary); } } elseif ($opcode !== self::OP_CONT) { $this->onParsedError(Code::PROTOCOL_ERROR, 'Non-terminated message was not continued'); return; } $this->emitBuffer .= $data; if ($terminated || \strlen($this->emitBuffer) >= $this->options->getStreamThreshold()) { $promise = $this->currentMessageEmitter->emit($this->emitBuffer); $this->lastEmit = $this->nextMessageDeferred ? null : $promise; $this->emitBuffer = ''; } if ($terminated) { $emitter = $this->currentMessageEmitter; $this->currentMessageEmitter = null; $emitter->complete(); ++$this->messagesRead; } } private function onParsedError(int $code, string $message) { if ($this->closedAt) { return; } $this->parseError = true; $this->close($code, $message); } private function read(): \Generator { while (($chunk = yield $this->socket->read()) !== null) { $this->lastReadAt = \time(); $this->bytesRead += \strlen($chunk); $this->framesRead += $this->parser->send($chunk); if ($this->lastEmit) { yield $this->lastEmit; } } if (!$this->closedAt) { $this->closedAt = \time(); $this->closeCode = Code::ABNORMAL_CLOSE; $this->closeReason = 'Client closed the underlying TCP connection'; $this->serverInitiatedClose = true; } $this->unloadServer(); } private function compile(int $opcode, string $message, bool $fin): string { $rsv = 0b000; // @TODO Add filter mechanism (e.g. for gzip encoding) $len = \strlen($message); $w = \chr(($fin << 7) | ($rsv << 4) | $opcode); if ($len > 0xFFFF) { $w .= "\xFF" . \pack('J', $len); } elseif ($len > 0x7D) { $w .= "\xFE" . \pack('n', $len); } else { $w .= \chr($len | 0x80); } $mask = \pack('N', \random_int(\PHP_INT_MIN, \PHP_INT_MAX)); $w .= $mask; $w .= $message ^ \str_repeat($mask, ($len + 3) >> 2); return $w; } private function write(int $opcode, string $data, bool $terminated = true): Promise { $frame = $this->compile($opcode, $data, $terminated); $this->framesSent++; $this->bytesSent += \strlen($frame); $this->lastSentAt = \time(); return $this->socket->write($frame); } /** @inheritdoc */ public function send(string $data): Promise { $this->messagesSent++; \assert(\preg_match('//u', $data), 'non-binary data needs to be UTF-8 compatible'); return $this->lastWrite = new Coroutine($this->doSend(self::OP_TEXT, $data)); } /** @inheritdoc */ public function sendBinary(string $data): Promise { $this->messagesSent++; return $this->lastWrite = new Coroutine($this->doSend(self::OP_BIN, $data)); } private function doSend(int $opcode, string $data): \Generator { if ($this->lastWrite) { yield $this->lastWrite; } try { $bytes = 0; if (\strlen($data) > $this->options->getFrameSplitThreshold()) { $len = \strlen($data); $slices = \ceil($len / $this->options->getFrameSplitThreshold()); $chunks = \str_split($data, \ceil($len / $slices)); $final = \array_pop($chunks); foreach ($chunks as $chunk) { $bytes += yield $this->write($opcode, $chunk, false); $opcode = self::OP_CONT; } $bytes += yield $this->write($opcode, $final); } else { $bytes = yield $this->write($opcode, $data); } } catch (\Throwable $exception) { $this->close(); throw $exception; } return $bytes; } /** @inheritdoc */ public function receive(): Promise { if ($this->nextMessageDeferred) { throw new \Error('Await the previous promise returned from receive() before calling receive() again.'); } // There might be messages already buffered and a close frame already received if ($this->messages) { $message = \reset($this->messages); unset($this->messages[\key($this->messages)]); return new Success($message); } if ($this->isClosed()) { // User kept in while loop after previous promise already resolved if ($this->serverInitiatedClose) { throw new ClosedException('The connection was closed: ' . $this->closeReason, $this->closeCode, $this->closeReason); } // Might happen if close() is called outside the receive coroutine. // Succeed with null instead of erroring out just as with a pending receive on close. return new Success; } $this->nextMessageDeferred = new Deferred; return $this->nextMessageDeferred->promise(); } /** @inheritdoc */ public function getInfo(): array { return [ 'bytes_read' => $this->bytesRead, 'bytes_sent' => $this->bytesSent, 'frames_read' => $this->framesRead, 'frames_sent' => $this->framesSent, 'messages_read' => $this->messagesRead, 'messages_sent' => $this->messagesSent, 'connected_at' => $this->connectedAt, 'closed_at' => $this->closedAt, 'last_read_at' => $this->lastReadAt, 'last_sent_at' => $this->lastSentAt, 'last_data_read_at' => $this->lastDataReadAt, 'last_data_sent_at' => $this->lastDataSentAt, ]; } /** * A stateful generator WebSocket frame parser. * * @return \Generator */ private function parser(): \Generator { // @TODO add minimum average frame size rate threshold to prevent tiny-frame DoS $maxFrameSize = $this->options->getMaximumFrameSize(); $maxMsgSize = $this->options->getMaximumMessageSize(); $textOnly = $this->options->isTextOnly(); $doUtf8Validation = $validateUtf8 = $this->options->isValidateUtf8(); $dataMsgBytesRecd = 0; $savedBuffer = ''; $buffer = yield; $offset = 0; $bufferSize = \strlen($buffer); $frames = 0; while (1) { if ($bufferSize < 2) { $buffer = \substr($buffer, $offset); $offset = 0; do { $buffer .= yield $frames; $bufferSize = \strlen($buffer); $frames = 0; } while ($bufferSize < 2); } $firstByte = \ord($buffer[$offset]); $secondByte = \ord($buffer[$offset + 1]); $offset += 2; $bufferSize -= 2; $fin = (bool) ($firstByte & 0b10000000); $rsv = ($firstByte & 0b01110000) >> 4; $opcode = $firstByte & 0b00001111; $isMasked = (bool) ($secondByte & 0b10000000); $maskingKey = null; $frameLength = $secondByte & 0b01111111; if ($rsv !== 0) { $this->onParsedError(Code::PROTOCOL_ERROR, 'RSV must be 0 if no extensions are negotiated'); } if ($opcode >= 3 && $opcode <= 7) { $this->onParsedError(Code::PROTOCOL_ERROR, 'Use of reserved non-control frame opcode'); } if ($opcode >= 11 && $opcode <= 15) { $this->onParsedError(Code::PROTOCOL_ERROR, 'Use of reserved control frame opcode'); } $isControlFrame = $opcode >= 0x08; if ($validateUtf8 && $opcode !== self::OP_CONT && !$isControlFrame) { $doUtf8Validation = $opcode === self::OP_TEXT; } if ($frameLength === 0x7E) { if ($bufferSize < 2) { $buffer = \substr($buffer, $offset); $offset = 0; do { $buffer .= yield $frames; $bufferSize = \strlen($buffer); $frames = 0; } while ($bufferSize < 2); } $frameLength = \unpack('n', $buffer[$offset] . $buffer[$offset + 1])[1]; $offset += 2; $bufferSize -= 2; } elseif ($frameLength === 0x7F) { if ($bufferSize < 8) { $buffer = \substr($buffer, $offset); $offset = 0; do { $buffer .= yield $frames; $bufferSize = \strlen($buffer); $frames = 0; } while ($bufferSize < 8); } $lengthLong32Pair = \unpack('N2', \substr($buffer, $offset, 8)); $offset += 8; $bufferSize -= 8; if (PHP_INT_MAX === 0x7fffffff) { if ($lengthLong32Pair[1] !== 0 || $lengthLong32Pair[2] < 0) { $this->onParsedError( Code::MESSAGE_TOO_LARGE, 'Received payload exceeds maximum allowable size' ); return; } $frameLength = $lengthLong32Pair[2]; } else { $frameLength = ($lengthLong32Pair[1] << 32) | $lengthLong32Pair[2]; if ($frameLength < 0) { $this->onParsedError( Code::PROTOCOL_ERROR, 'Most significant bit of 64-bit length field set' ); return; } } } if ($isMasked) { $this->onParsedError( Code::PROTOCOL_ERROR, 'Payload must not be masked to client' ); return; } if ($isControlFrame) { if (!$fin) { $this->onParsedError( Code::PROTOCOL_ERROR, 'Illegal control frame fragmentation' ); return; } if ($frameLength > 125) { $this->onParsedError( Code::PROTOCOL_ERROR, 'Control frame payload must be of maximum 125 bytes or less' ); return; } } if ($maxFrameSize && $frameLength > $maxFrameSize) { $this->onParsedError( Code::MESSAGE_TOO_LARGE, 'Received payload exceeds maximum allowable size' ); return; } if ($maxMsgSize && ($frameLength + $dataMsgBytesRecd) > $maxMsgSize) { $this->onParsedError( Code::MESSAGE_TOO_LARGE, 'Received payload exceeds maximum allowable size' ); return; } if ($textOnly && $opcode === 0x02) { $this->onParsedError( Code::UNACCEPTABLE_TYPE, 'BINARY opcodes (0x02) not accepted' ); return; } while ($bufferSize < $frameLength) { $chunk = yield $frames; $buffer .= $chunk; $bufferSize += \strlen($chunk); $frames = 0; } if (!$isControlFrame) { $dataMsgBytesRecd += $frameLength; } $payload = \substr($buffer, $offset, $frameLength); $offset += $frameLength; $bufferSize -= $frameLength; if ($isControlFrame) { $this->onParsedControlFrame($opcode, $payload); } else { if ($savedBuffer !== '') { $payload = $savedBuffer . $payload; $savedBuffer = ''; } if ($doUtf8Validation) { if ($fin) { $i = \preg_match('//u', $payload) ? 0 : 8; } else { $string = $payload; for ($i = 0; !\preg_match('//u', $payload) && $i < 8; $i++) { $payload = \substr($payload, 0, -1); } if ($i > 0) { $savedBuffer = \substr($string, -$i); } } if ($i === 8) { $this->onParsedError( Code::INCONSISTENT_FRAME_DATA_TYPE, 'Invalid TEXT data; UTF-8 required' ); return; } } if ($fin) { $dataMsgBytesRecd = 0; } $this->onParsedData($opcode, $payload, $fin); if ($this->parseError) { return; } } $frames++; } } } <?php namespace Amp\Websocket; final class Code { const NORMAL_CLOSE = 1000; const GOING_AWAY = 1001; const PROTOCOL_ERROR = 1002; const UNACCEPTABLE_TYPE = 1003; const NONE = 1005; const ABNORMAL_CLOSE = 1006; const INCONSISTENT_FRAME_DATA_TYPE = 1007; const POLICY_VIOLATION = 1008; const MESSAGE_TOO_LARGE = 1009; const EXPECTED_EXTENSION_MISSING = 1010; const UNEXPECTED_SERVER_ERROR = 1011; const TLS_HANDSHAKE_FAILURE = 1015; private function __construct() { // no instances allowed } } <?php namespace Amp\Websocket; use Amp\Struct; final class Options { use Struct; private $streamThreshold = 32768; private $frameSplitThreshold = 32768; private $maximumFrameSize = 2097152; private $maximumMessageSize = 10485760; private $textOnly = false; private $validateUtf8 = false; private $closePeriod = 3; public function getStreamThreshold(): int { return $this->streamThreshold; } public function withStreamThreshold(int $streamThreshold): self { if ($streamThreshold < 1) { throw new \Error('$streamThreshold must be a positive integer greater than 0'); } $clone = clone $this; $clone->streamThreshold = $streamThreshold; return $clone; } public function getFrameSplitThreshold(): int { return $this->frameSplitThreshold; } public function withFrameSplitThreshold(int $frameSplitThreshold): self { if ($frameSplitThreshold < 1) { throw new \Error('$frameSplitThreshold must be a positive integer greater than 0'); } $clone = clone $this; $clone->frameSplitThreshold = $frameSplitThreshold; return $clone; } public function getMaximumFrameSize(): int { return $this->maximumFrameSize; } public function withMaximumFrameSize(int $maximumFrameSize): self { if ($maximumFrameSize < 1) { throw new \Error('$maximumFrameSize must be a positive integer greater than 0'); } $clone = clone $this; $clone->maximumFrameSize = $maximumFrameSize; return $clone; } public function getMaximumMessageSize(): int { return $this->maximumMessageSize; } public function withMaximumMessageSize(int $maximumMessageSize): self { if ($maximumMessageSize < 1) { throw new \Error('$maximumMessageSize must be a positive integer greater than 0'); } $clone = clone $this; $clone->maximumMessageSize = $maximumMessageSize; return $clone; } public function isTextOnly(): bool { return $this->textOnly; } public function withTextOnly(bool $textOnly): self { $clone = clone $this; $clone->textOnly = $textOnly; return $clone; } public function isValidateUtf8(): bool { return $this->validateUtf8; } public function withValidateUtf8(bool $validateUtf8): self { $clone = clone $this; $clone->validateUtf8 = $validateUtf8; return $clone; } public function getClosePeriod(): int { return $this->closePeriod; } public function withClosePeriod(int $closePeriod): self { if ($closePeriod < 1) { throw new \Error('$closePeriod must be a positive integer greater than 0'); } $clone = clone $this; $clone->closePeriod = $closePeriod; return $clone; } } <?php namespace Amp\Websocket; use Amp\ByteStream\InputStream; use Amp\Coroutine; use Amp\Promise; use function Amp\call; /** * This class allows streamed and buffered access to an `InputStream` similar to `Amp\ByteStream\Message`. * * `Amp\ByteStream\Message` is not extended due to it implementing `Amp\Promise`, which makes resolving promises with it * impossible. `Amp\ByteStream\Message` will probably be adjusted to follow this implementation in the future. */ final class Message implements InputStream { /** @var bool */ private $binary; /** @var InputStream */ private $stream; /** @var \Amp\Promise|null */ private $promise; /** @var \Amp\Promise|null */ private $lastRead; public function __construct(InputStream $stream, bool $binary) { $this->stream = $stream; $this->binary = $binary; } public function __destruct() { if (!$this->promise) { Promise\rethrow(new Coroutine($this->consume())); } } private function consume(): \Generator { try { if ($this->lastRead && null === yield $this->lastRead) { return; } while (null !== yield $this->stream->read()) { // Discard unread bytes from message. } } catch (\Throwable $exception) { // If exception is thrown here the connection closed anyway. } } /** * @return bool Returns a promise that resolves to true if the message is binary, false if it is UTF-8 text. */ public function isBinary(): bool { return $this->binary; } /** * @inheritdoc * * @throws \Error If a buffered message was requested by calling buffer(). */ public function read(): Promise { if ($this->promise) { throw new \Error("Cannot stream message data once a buffered message has been requested"); } return $this->lastRead = $this->stream->read(); } /** * Buffers the entire message and resolves the returned promise then. * * @return Promise<string> Resolves with the entire message contents. */ public function buffer(): Promise { if ($this->promise) { return $this->promise; } return $this->promise = call(function () { $buffer = ''; if ($this->lastRead && null === yield $this->lastRead) { return $buffer; } while (null !== $chunk = yield $this->stream->read()) { $buffer .= $chunk; } return $buffer; }); } } <?php namespace Amp\Websocket; class WebSocketException extends \Exception { } { "name": "amphp/file", "homepage": "https://github.com/amphp/file", "description": "Allows non-blocking access to the filesystem for Amp.", "support": { "issues": "https://github.com/amphp/file/issues" }, "keywords": [ "file", "disk", "static", "async", "non-blocking", "amp", "amphp", "io", "filesystem" ], "license": "MIT", "authors": [ { "name": "Daniel Lowrey", "email": "rdlowrey@php.net" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" }, { "name": "Niklas Keller", "email": "me@kelunik.com" } ], "require": { "amphp/amp": "^2", "amphp/byte-stream": "^1", "amphp/parallel": "^1" }, "require-dev": { "amphp/phpunit-util": "^1", "phpunit/phpunit": "^6", "amphp/php-cs-fixer-config": "dev-master" }, "autoload": { "psr-4": { "Amp\\File\\": "lib" }, "files": ["lib/functions.php"] }, "autoload-dev": { "psr-4": { "Amp\\File\\Test\\": "test" } }, "config": { "platform": { "php": "7.0.0" } } } <?php namespace Amp\File; use Amp\Loop; class StatCache { private static $cache = []; private static $timeouts = []; private static $ttl = 3; private static $now = null; private static function init() { self::$now = \time(); $watcher = Loop::repeat(1000, function () { self::$now = $now = \time(); foreach (self::$cache as $path => $expiry) { if ($now > $expiry) { unset( self::$cache[$path], self::$timeouts[$path] ); } else { break; } } }); Loop::unreference($watcher); Loop::setState(self::class, new class($watcher) { private $watcher; private $driver; public function __construct(string $watcher) { $this->watcher = $watcher; $this->driver = Loop::get(); } public function __destruct() { $this->driver->cancel($this->watcher); } }); } public static function get(string $path) { return isset(self::$cache[$path]) ? self::$cache[$path] : null; } public static function set(string $path, array $stat) { if (self::$ttl <= 0) { return; } if (Loop::getState(self::class) === null) { self::init(); } self::$cache[$path] = $stat; self::$timeouts[$path] = self::$now + self::$ttl; } public static function ttl(int $seconds) { self::$ttl = $seconds; } public static function clear(string $path = null) { if (isset($path)) { unset( self::$cache[$path], self::$timeouts[$path] ); } else { self::$cache = []; self::$timeouts = []; } } } <?php namespace Amp\File\Internal; use Amp\CallableMaker; use Amp\Loop; use Amp\Promise; class UvPoll { use CallableMaker; /** @var string */ private $watcher; /** @var int */ private $requests = 0; /** @var callable */ private $onDone; public function __construct() { $this->onDone = $this->callableFromInstanceMethod("done"); $this->watcher = Loop::repeat(\PHP_INT_MAX / 2, function () { // do nothing, it's a dummy watcher }); Loop::disable($this->watcher); Loop::setState(self::class, new class($this->watcher) { private $watcher; public function __construct(string $watcher) { $this->watcher = $watcher; } public function __destruct() { Loop::cancel($this->watcher); } }); } public function listen(Promise $promise) { if ($this->requests++ === 0) { Loop::enable($this->watcher); } $promise->onResolve($this->onDone); } private function done() { if (--$this->requests === 0) { Loop::disable($this->watcher); } \assert($this->requests >= 0); } } <?php namespace Amp\File\Internal; use Amp\CallableMaker; use Amp\Loop; use Amp\Promise; class EioPoll { use CallableMaker; /** @var resource */ private static $stream; /** @var string */ private $watcher; /** @var int */ private $requests = 0; /** @var callable */ private $onDone; public function __construct() { $this->onDone = $this->callableFromInstanceMethod("done"); if (!self::$stream) { \eio_init(); self::$stream = \eio_get_event_stream(); } $this->watcher = Loop::onReadable(self::$stream, static function () { while (\eio_npending()) { \eio_poll(); } }); Loop::disable($this->watcher); Loop::setState(self::class, new class($this->watcher) { private $watcher; public function __construct(string $watcher) { $this->watcher = $watcher; } public function __destruct() { Loop::cancel($this->watcher); // Ensure there are no active operations anymore. This is a safe-guard as some operations might not be // finished on loop exit due to not being yielded. This also ensures a clean shutdown for these if PHP // exists. \eio_event_loop(); } }); } public function listen(Promise $promise) { if ($this->requests++ === 0) { Loop::enable($this->watcher); } $promise->onResolve($this->onDone); } private function done() { if (--$this->requests === 0) { Loop::disable($this->watcher); } \assert($this->requests >= 0); } } <?php namespace Amp\File\Internal; use Amp\File\BlockingDriver; use Amp\File\BlockingHandle; use Amp\File\FilesystemException; use Amp\File\StatCache; use Amp\Parallel\Worker\Environment; use Amp\Parallel\Worker\Task; /** * @codeCoverageIgnore * * @internal */ class FileTask implements Task { const ENV_PREFIX = "amp/file#"; /** @var string */ private $operation; /** @var mixed[] */ private $args; /** @var string|null */ private $id; /** * @param string $operation * @param array $args * @param int $id File ID. * * @throws \Error */ public function __construct(string $operation, array $args = [], int $id = null) { if (!\strlen($operation)) { throw new \Error('Operation must be a non-empty string'); } $this->operation = $operation; $this->args = $args; $this->id = $id; } /** * {@inheritdoc} * * @throws \Amp\File\FilesystemException * @throws \Error */ public function run(Environment $environment) { if ('f' === $this->operation[0]) { if ("fopen" === $this->operation) { $path = $this->args[0]; $mode = \str_replace(['b', 't', 'e'], '', $this->args[1]); switch ($mode) { case "r": case "r+": case "w": case "w+": case "a": case "a+": case "x": case "x+": case "c": case "c+": break; default: throw new \Error("Invalid file mode"); } $handle = @\fopen($path, $mode . 'be'); if (!$handle) { $message = 'Could not open the file.'; if ($error = \error_get_last()) { $message .= \sprintf(" Errno: %d; %s", $error["type"], $error["message"]); } throw new FilesystemException($message); } $file = new BlockingHandle($handle, $path, $mode); $id = (int) $handle; $size = \fstat($handle)["size"]; $environment->set(self::makeId($id), $file); return [$id, $size, $mode]; } if ($this->id === null) { throw new FilesystemException("No file ID provided"); } $id = self::makeId($this->id); if (!$environment->exists($id)) { throw new FilesystemException(\sprintf("No file handle with the ID %d has been opened on the worker", $this->id)); } /** @var \Amp\File\BlockingHandle $file */ if (!($file = $environment->get($id)) instanceof BlockingHandle) { throw new FilesystemException("File storage found in inconsistent state"); } switch ($this->operation) { case "fread": case "fwrite": case "fseek": case "ftruncate": return ([$file, \substr($this->operation, 1)])(...$this->args); case "fclose": $environment->delete($id); $file->close(); return; default: throw new \Error('Invalid operation'); } } StatCache::clear(); switch ($this->operation) { case "stat": case "unlink": case "rename": case "link": case "symlink": case "readlink": case "lstat": case "exists": case "mkdir": case "scandir": case "rmdir": case "chmod": case "chown": case "touch": case "get": case "put": return ([new BlockingDriver, $this->operation])(...$this->args); default: throw new \Error("Invalid operation"); } } /** * @param int $id * * @return string */ private static function makeId(int $id): string { return self::ENV_PREFIX . $id; } } <?php namespace Amp\File; use Amp\ByteStream\ClosedException; use Amp\ByteStream\StreamException; use Amp\Deferred; use Amp\Promise; use Amp\Success; use function Amp\call; class EioHandle implements Handle { /** @var \Amp\File\Internal\EioPoll */ private $poll; /** @var resource eio file handle. */ private $fh; /** @var string */ private $path; /** @var string */ private $mode; /** @var int */ private $size; /** @var int */ private $position; /** @var \SplQueue */ private $queue; /** @var bool */ private $isActive = false; /** @var bool */ private $writable = true; /** @var \Amp\Promise|null */ private $closing; public function __construct(Internal\EioPoll $poll, $fh, string $path, string $mode, int $size) { $this->poll = $poll; $this->fh = $fh; $this->path = $path; $this->mode = $mode; $this->size = $size; $this->position = ($mode[0] === "a") ? $size : 0; $this->queue = new \SplQueue; } /** * {@inheritdoc} */ public function read(int $length = self::DEFAULT_READ_LENGTH): Promise { if ($this->isActive) { throw new PendingOperationError; } $this->isActive = true; $remaining = $this->size - $this->position; $length = $length > $remaining ? $remaining : $length; $deferred = new Deferred; $this->poll->listen($deferred->promise()); $onRead = function (Deferred $deferred, $result, $req) { $this->isActive = false; if ($result === -1) { $error = \eio_get_last_error($req); if ($error === "Bad file descriptor") { $deferred->fail(new ClosedException("Reading from the file failed due to a closed handle")); } else { $deferred->fail(new StreamException("Reading from the file failed:" . $error)); } } else { $this->position += \strlen($result); $deferred->resolve(\strlen($result) ? $result : null); } }; \eio_read( $this->fh, $length, $this->position, \EIO_PRI_DEFAULT, $onRead, $deferred ); return $deferred->promise(); } /** * {@inheritdoc} */ public function write(string $data): Promise { if ($this->isActive && $this->queue->isEmpty()) { throw new PendingOperationError; } if (!$this->writable) { throw new ClosedException("The file is no longer writable"); } $this->isActive = true; if ($this->queue->isEmpty()) { $promise = $this->push($data); } else { $promise = $this->queue->top(); $promise = call(function () use ($promise, $data) { yield $promise; return yield $this->push($data); }); } $this->queue->push($promise); return $promise; } private function push(string $data): Promise { $length = \strlen($data); $deferred = new Deferred; $this->poll->listen($deferred->promise()); $onWrite = function (Deferred $deferred, $result, $req) { if ($this->queue->isEmpty()) { $deferred->fail(new ClosedException('No pending write, the file may have been closed')); } $this->queue->shift(); if ($this->queue->isEmpty()) { $this->isActive = false; } if ($result === -1) { $error = \eio_get_last_error($req); if ($error === "Bad file descriptor") { $deferred->fail(new ClosedException("Writing to the file failed due to a closed handle")); } else { $deferred->fail(new StreamException("Writing to the file failed: " . $error)); } } else { $this->position += $result; if ($this->position > $this->size) { $this->size = $this->position; } $deferred->resolve($result); } }; \eio_write( $this->fh, $data, $length, $this->position, \EIO_PRI_DEFAULT, $onWrite, $deferred ); return $deferred->promise(); } /** * {@inheritdoc} */ public function end(string $data = ""): Promise { return call(function () use ($data) { $promise = $this->write($data); $this->writable = false; // ignore any errors yield Promise\any([$this->close()]); return $promise; }); } /** * {@inheritdoc} */ public function close(): Promise { if ($this->closing) { return $this->closing; } $deferred = new Deferred; $this->poll->listen($this->closing = $deferred->promise()); \eio_close($this->fh, \EIO_PRI_DEFAULT, function (Deferred $deferred) { // Ignore errors when closing file, as the handle will become invalid anyway. $deferred->resolve(); }, $deferred); return $deferred->promise(); } public function truncate(int $size): Promise { if ($this->isActive && $this->queue->isEmpty()) { throw new PendingOperationError; } if (!$this->writable) { throw new ClosedException("The file is no longer writable"); } $this->isActive = true; if ($this->queue->isEmpty()) { $promise = $this->trim($size); } else { $promise = $this->queue->top(); $promise = call(function () use ($promise, $size) { yield $promise; return yield $this->trim($size); }); } $this->queue->push($promise); return $promise; } private function trim(int $size): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); $onTruncate = function (Deferred $deferred, $result, $req) use ($size) { if ($this->queue->isEmpty()) { $deferred->fail(new ClosedException('No pending write, the file may have been closed')); } $this->queue->shift(); if ($this->queue->isEmpty()) { $this->isActive = false; } if ($result === -1) { $error = \eio_get_last_error($req); if ($error === "Bad file descriptor") { $deferred->fail(new ClosedException("Truncating the file failed due to a closed handle")); } else { $deferred->fail(new StreamException("Truncating the file failed: " . $error)); } } else { $this->size = $size; $deferred->resolve(); } }; \eio_ftruncate( $this->fh, $size, \EIO_PRI_DEFAULT, $onTruncate, $deferred ); return $deferred->promise(); } /** * {@inheritdoc} */ public function seek(int $offset, int $whence = \SEEK_SET): Promise { if ($this->isActive) { throw new PendingOperationError; } switch ($whence) { case \SEEK_SET: $this->position = $offset; break; case \SEEK_CUR: $this->position = $this->position + $offset; break; case \SEEK_END: $this->position = $this->size + $offset; break; default: throw new \Error( "Invalid whence parameter; SEEK_SET, SEEK_CUR or SEEK_END expected" ); } return new Success($this->position); } /** * {@inheritdoc} */ public function tell(): int { return $this->position; } /** * {@inheritdoc} */ public function eof(): bool { return !$this->queue->isEmpty() ? false : ($this->size <= $this->position); } /** * {@inheritdoc} */ public function path(): string { return $this->path; } /** * {@inheritdoc} */ public function mode(): string { return $this->mode; } } <?php namespace Amp\File; use Amp\Loop; use Amp\Promise; const LOOP_STATE_IDENTIFIER = Driver::class; /** * Retrieve the application-wide filesystem instance. * * @param \Amp\File\Driver $driver Use the specified object as the application-wide filesystem instance * @return \Amp\File\Driver */ function filesystem(Driver $driver = null): Driver { if ($driver === null) { $driver = Loop::getState(LOOP_STATE_IDENTIFIER); if ($driver) { return $driver; } $driver = driver(); } if (\defined("AMP_WORKER") && $driver instanceof ParallelDriver) { throw new \Error("Cannot use the parallel driver within a worker"); } Loop::setState(LOOP_STATE_IDENTIFIER, $driver); return $driver; } /** * Create a new filesystem driver best-suited for the current environment. * * @return \Amp\File\Driver */ function driver(): Driver { $driver = Loop::get(); if (UvDriver::isSupported($driver)) { return new UvDriver($driver); } if (EioDriver::isSupported()) { return new EioDriver; } if (\defined("AMP_WORKER")) { // Prevent spawning infinite workers. return new BlockingDriver; } return new ParallelDriver; } /** * Open a handle for the specified path. * * @param string $path * @param string $mode * @return \Amp\Promise<\Amp\File\Handle> */ function open(string $path, string $mode): Promise { return filesystem()->open($path, $mode); } /** * Execute a file stat operation. * * If the requested path does not exist the resulting Promise will resolve to NULL. * The returned Promise whould never resolve as a failure. * * @param string $path An absolute file system path * @return \Amp\Promise<array|null> */ function stat(string $path): Promise { return filesystem()->stat($path); } /** * Does the specified path exist? * * This function should never resolve as a failure -- only a successfull bool value * indicating the existence of the specified path. * * @param string $path An absolute file system path * @return \Amp\Promise<bool> */ function exists(string $path): Promise { return filesystem()->exists($path); } /** * Retrieve the size in bytes of the file at the specified path. * * If the path does not exist or is not a regular file this * function's returned Promise WILL resolve as a failure. * * @param string $path An absolute file system path * @fails \Amp\Files\FilesystemException If the path does not exist or is not a file * @return \Amp\Promise<int> */ function size(string $path): Promise { return filesystem()->size($path); } /** * Does the specified path exist and is it a directory? * * If the path does not exist the returned Promise will resolve * to FALSE and will not reject with an error. * * @param string $path An absolute file system path * @return \Amp\Promise<bool> */ function isdir(string $path): Promise { return filesystem()->isdir($path); } /** * Does the specified path exist and is it a file? * * If the path does not exist the returned Promise will resolve * to FALSE and will not reject with an error. * * @param string $path An absolute file system path * @return \Amp\Promise<bool> */ function isfile(string $path): Promise { return filesystem()->isfile($path); } /** * Retrieve the path's last modification time as a unix timestamp. * * @param string $path An absolute file system path * @fails \Amp\Files\FilesystemException If the path does not exist * @return \Amp\Promise<int> */ function mtime(string $path): Promise { return filesystem()->mtime($path); } /** * Retrieve the path's last access time as a unix timestamp. * * @param string $path An absolute file system path * @fails \Amp\Files\FilesystemException If the path does not exist * @return \Amp\Promise<int> */ function atime($path) { return filesystem()->atime($path); } /** * Retrieve the path's creation time as a unix timestamp. * * @param string $path An absolute file system path * @fails \Amp\Files\FilesystemException If the path does not exist * @return \Amp\Promise<int> */ function ctime(string $path): Promise { return filesystem()->ctime($path); } /** * Same as stat() except if the path is a link then the link's data is returned. * * If the requested path does not exist the resulting Promise will resolve to NULL. * The returned Promise whould never resolve as a failure. * * @param string $path An absolute file system path * @return \Amp\Promise<array|null> */ function lstat(string $path): Promise { return filesystem()->lstat($path); } /** * Create a symlink $link pointing to the file/directory located at $original. * * @param string $original * @param string $link * @fails \Amp\Files\FilesystemException If the operation fails * @return \Amp\Promise<null> */ function symlink(string $original, string $link): Promise { return filesystem()->symlink($original, $link); } /** * Create a hard link $link pointing to the file/directory located at $original. * * @param string $original * @param string $link * @fails \Amp\Files\FilesystemException If the operation fails * @return \Amp\Promise<null> */ function link(string $original, string $link): Promise { return filesystem()->symlink($original, $link); } /** * Read the symlink at $path. * * @param string $path * @fails \Amp\Files\FilesystemException If the operation fails * @return \Amp\Promise<string> */ function readlink(string $path): Promise { return filesystem()->readlink($path); } /** * Rename a file or directory. * * @param string $from * @param string $to * @fails \Amp\Files\FilesystemException If the operation fails * @return \Amp\Promise<null> */ function rename(string $from, string $to): Promise { return filesystem()->rename($from, $to); } /** * Delete a file. * * @param string $path * @return \Amp\Promise<null> */ function unlink(string $path): Promise { return filesystem()->unlink($path); } /** * Create a director. * * @param string $path * @param int $mode * @param bool $recursive * @return \Amp\Promise<null> */ function mkdir(string $path, int $mode = 0777, bool $recursive = false): Promise { return filesystem()->mkdir($path, $mode, $recursive); } /** * Delete a directory. * * @param string $path * @return \Amp\Promise<null> */ function rmdir(string $path): Promise { return filesystem()->rmdir($path); } /** * Retrieve an array of files and directories inside the specified path. * * Dot entries are not included in the resulting array (i.e. "." and ".."). * * @param string $path * @return \Amp\Promise<array> */ function scandir(string $path): Promise { return filesystem()->scandir($path); } /** * chmod a file or directory. * * @param string $path * @param int $mode * @return \Amp\Promise<null> */ function chmod(string $path, int $mode): Promise { return filesystem()->chmod($path, $mode); } /** * chown a file or directory. * * @param string $path * @param int $uid -1 to ignore * @param int $gid -1 to ignore * @return \Amp\Promise<null> */ function chown(string $path, int $uid, int $gid = -1): Promise { return filesystem()->chown($path, $uid, $gid); } /** * Update the access and modification time of the specified path. * * If the file does not exist it will be created automatically. * * @param string $path * @param int $time The touch time. If $time is not supplied, the current system time is used. * @param int $atime The access time. If $atime is not supplied, value passed to the $time parameter is used. * @return \Amp\Promise<null> */ function touch(string $path, int $time = null, int $atime = null): Promise { return filesystem()->touch($path, $time, $atime); } /** * Buffer the specified file's contents. * * @param string $path The file path from which to buffer contents * @return \Amp\Promise<string> */ function get(string $path): Promise { return filesystem()->get($path); } /** * Write the contents string to the specified path. * * @param string $path The file path to which to $contents should be written * @param string $contents The data to write to the specified $path * @return \Amp\Promise A promise resolving to the integer length written upon success */ function put(string $path, string $contents): Promise { return filesystem()->put($path, $contents); } <?php namespace Amp\File; use Amp\ByteStream\ClosedException; use Amp\ByteStream\StreamException; use Amp\Failure; use Amp\Promise; use Amp\Success; use function Amp\call; class BlockingHandle implements Handle { private $fh; private $path; private $mode; /** * @param resource $fh An open uv filesystem descriptor * @param string $path * @param string $mode */ public function __construct($fh, string $path, string $mode) { $this->fh = $fh; $this->path = $path; $this->mode = $mode; } public function __destruct() { if ($this->fh !== null) { \fclose($this->fh); } } /** * {@inheritdoc} */ public function read(int $length = self::DEFAULT_READ_LENGTH): Promise { if ($this->fh === null) { throw new ClosedException("The file has been closed"); } $data = \fread($this->fh, $length); if ($data !== false) { return new Success(\strlen($data) ? $data : null); } return new Failure(new StreamException( "Failed reading from file handle" )); } /** * {@inheritdoc} */ public function write(string $data): Promise { if ($this->fh === null) { throw new ClosedException("The file has been closed"); } $len = \fwrite($this->fh, $data); if ($len !== false) { return new Success($len); } return new Failure(new StreamException( "Failed writing to file handle" )); } /** * {@inheritdoc} */ public function end(string $data = ""): Promise { return call(function () use ($data) { $promise = $this->write($data); // ignore any errors yield Promise\any([$this->close()]); return $promise; }); } /** * {@inheritdoc} */ public function close(): Promise { if ($this->fh === null) { return new Success; } $fh = $this->fh; $this->fh = null; if (@\fclose($fh)) { return new Success; } return new Failure(new StreamException( "Failed closing file handle" )); } /** * {@inheritdoc} */ public function truncate(int $size): Promise { if ($this->fh === null) { throw new ClosedException("The file has been closed"); } if (!@\ftruncate($this->fh, $size)) { return new Failure(new StreamException("Could not truncate file")); } return new Success; } /** * {@inheritdoc} */ public function seek(int $position, int $whence = \SEEK_SET): Promise { if ($this->fh === null) { throw new ClosedException("The file has been closed"); } switch ($whence) { case \SEEK_SET: case \SEEK_CUR: case \SEEK_END: if (@\fseek($this->fh, $position, $whence) === -1) { return new Failure(new StreamException("Could not seek in file")); } return new Success($this->tell()); default: throw new \Error( "Invalid whence parameter; SEEK_SET, SEEK_CUR or SEEK_END expected" ); } } /** * {@inheritdoc} */ public function tell(): int { if ($this->fh === null) { throw new ClosedException("The file has been closed"); } return \ftell($this->fh); } /** * {@inheritdoc} */ public function eof(): bool { if ($this->fh === null) { throw new ClosedException("The file has been closed"); } return \feof($this->fh); } /** * {@inheritdoc} */ public function path(): string { return $this->path; } /** * {@inheritdoc} */ public function mode(): string { return $this->mode; } } <?php namespace Amp\File; use Amp\Coroutine; use Amp\Deferred; use Amp\File\Internal\UvPoll; use Amp\Loop; use Amp\Promise; use Amp\Success; class UvDriver implements Driver { /** @var \Amp\Loop\Driver */ private $driver; /** @var \UVLoop|resource Loop resource of type uv_loop or instance of \UVLoop. */ private $loop; /** @var UvPoll */ private $poll; /** * @param \Amp\Loop\Driver The currently active loop driver. * * @return bool Determines if this driver can be used based on the environment. */ public static function isSupported(Loop\Driver $driver): bool { return $driver instanceof Loop\UvDriver; } /** * @param \Amp\Loop\UvDriver $driver */ public function __construct(Loop\UvDriver $driver) { $this->driver = $driver; $this->loop = $driver->getHandle(); $this->poll = new UvPoll; } /** * {@inheritdoc} */ public function open(string $path, string $mode): Promise { $flags = $this->parseMode($mode); $chmod = ($flags & \UV::O_CREAT) ? 0644 : 0; $deferred = new Deferred; $this->poll->listen($deferred->promise()); $openArr = [$mode, $path, $deferred]; \uv_fs_open($this->loop, $path, $flags, $chmod, function ($fh) use ($openArr) { if ($fh) { $this->onOpenHandle($fh, $openArr); } else { list(, $path, $deferred) = $openArr; $deferred->fail(new FilesystemException( "Failed opening file handle to $path" )); } }); return $deferred->promise(); } private function parseMode(string $mode): int { $mode = \str_replace(['b', 't', 'e'], '', $mode); switch ($mode) { case "r": return \UV::O_RDONLY; case "r+": return \UV::O_RDWR; case "w": return \UV::O_WRONLY | \UV::O_CREAT; case "w+": return \UV::O_RDWR | \UV::O_CREAT; case "a": return \UV::O_WRONLY | \UV::O_CREAT | \UV::O_APPEND; case "a+": return \UV::O_RDWR | \UV::O_CREAT | \UV::O_APPEND; case "x": return \UV::O_WRONLY | \UV::O_CREAT | \UV::O_EXCL; case "x+": return \UV::O_RDWR | \UV::O_CREAT | \UV::O_EXCL; case "c": return \UV::O_WRONLY | \UV::O_CREAT; case "c+": return \UV::O_RDWR | \UV::O_CREAT; default: throw new \Error('Invalid file mode'); } } private function onOpenHandle($fh, array $openArr) { list($mode) = $openArr; if ($mode[0] === "w") { \uv_fs_ftruncate($this->loop, $fh, $length = 0, function ($fh) use ($openArr) { if ($fh) { $this->finalizeHandle($fh, $size = 0, $openArr); } else { list(, $path, $deferred) = $openArr; $deferred->fail(new FilesystemException( "Failed truncating file $path" )); } }); } else { \uv_fs_fstat($this->loop, $fh, function ($fh, $stat) use ($openArr) { if ($fh) { StatCache::set($openArr[1], $stat); $this->finalizeHandle($fh, $stat["size"], $openArr); } else { list(, $path, $deferred) = $openArr; $deferred->fail(new FilesystemException( "Failed reading file size from open handle pointing to $path" )); } }); } } private function finalizeHandle($fh, $size, array $openArr) { list($mode, $path, $deferred) = $openArr; $handle = new UvHandle($this->driver, $this->poll, $fh, $path, $mode, $size); $deferred->resolve($handle); } /** * {@inheritdoc} */ public function stat(string $path): Promise { if ($stat = StatCache::get($path)) { return new Success($stat); } $deferred = new Deferred; $this->poll->listen($deferred->promise()); \uv_fs_stat($this->loop, $path, function ($fh, $stat) use ($deferred, $path) { if (empty($fh)) { $stat = null; } else { // link is not a valid stat type but returned by the uv extension // change link to nlink if (isset($stat['link'])) { $stat['nlink'] = $stat['link']; unset($stat['link']); } StatCache::set($path, $stat); } $deferred->resolve($stat); }); return $deferred->promise(); } /** * {@inheritdoc} */ public function exists(string $path): Promise { $deferred = new Deferred; $this->stat($path)->onResolve(function ($error, $result) use ($deferred) { $deferred->resolve((bool) $result); }); return $deferred->promise(); } /** * {@inheritdoc} */ public function isdir(string $path): Promise { $deferred = new Deferred; $this->stat($path)->onResolve(function ($error, $result) use ($deferred) { if ($result) { $deferred->resolve(!($result["mode"] & \UV::S_IFREG)); } else { $deferred->resolve(false); } }); return $deferred->promise(); } /** * {@inheritdoc} */ public function isfile(string $path): Promise { $deferred = new Deferred; $this->stat($path)->onResolve(function ($error, $result) use ($deferred) { if ($result) { $deferred->resolve((bool) ($result["mode"] & \UV::S_IFREG)); } else { $deferred->resolve(false); } }); return $deferred->promise(); } /** * {@inheritdoc} */ public function size(string $path): Promise { $deferred = new Deferred; $this->stat($path)->onResolve(function ($error, $result) use ($deferred) { if (empty($result)) { $deferred->fail(new FilesystemException( "Specified path does not exist" )); } elseif (($result["mode"] & \UV::S_IFREG)) { $deferred->resolve($result["size"]); } else { $deferred->fail(new FilesystemException( "Specified path is not a regular file" )); } }); return $deferred->promise(); } /** * {@inheritdoc} */ public function mtime(string $path): Promise { $deferred = new Deferred; $this->stat($path)->onResolve(function ($error, $result) use ($deferred) { if ($result) { $deferred->resolve($result["mtime"]); } else { $deferred->fail(new FilesystemException( "Specified path does not exist" )); } }); return $deferred->promise(); } /** * {@inheritdoc} */ public function atime(string $path): Promise { $deferred = new Deferred; $this->stat($path)->onResolve(function ($error, $result) use ($deferred) { if ($result) { $deferred->resolve($result["atime"]); } else { $deferred->fail(new FilesystemException( "Specified path does not exist" )); } }); return $deferred->promise(); } /** * {@inheritdoc} */ public function ctime(string $path): Promise { $deferred = new Deferred; $this->stat($path)->onResolve(function ($error, $result) use ($deferred) { if ($result) { $deferred->resolve($result["ctime"]); } else { $deferred->fail(new FilesystemException( "Specified path does not exist" )); } }); return $deferred->promise(); } /** * {@inheritdoc} */ public function lstat(string $path): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); \uv_fs_lstat($this->loop, $path, function ($fh, $stat) use ($deferred) { if (empty($fh)) { $stat = null; } $deferred->resolve($stat); }); return $deferred->promise(); } /** * {@inheritdoc} */ public function symlink(string $target, string $link): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); \uv_fs_symlink($this->loop, $target, $link, \UV::S_IRWXU | \UV::S_IRUSR, function ($fh) use ($deferred) { $deferred->resolve((bool) $fh); }); return $deferred->promise(); } /** * {@inheritdoc} */ public function link(string $target, string $link): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); \uv_fs_link($this->loop, $target, $link, \UV::S_IRWXU | \UV::S_IRUSR, function ($fh) use ($deferred) { $deferred->resolve((bool) $fh); }); return $deferred->promise(); } /** * {@inheritdoc} */ public function readlink(string $path): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); \uv_fs_readlink($this->loop, $path, function ($fh, $target) use ($deferred) { if (!(bool) $fh) { $deferred->fail(new FilesystemException("Could not read symbolic link")); return; } $deferred->resolve($target); }); return $deferred->promise(); } /** * {@inheritdoc} */ public function rename(string $from, string $to): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); \uv_fs_rename($this->loop, $from, $to, function ($fh) use ($deferred, $from) { StatCache::clear($from); $deferred->resolve((bool) $fh); }); return $deferred->promise(); } /** * {@inheritdoc} */ public function unlink(string $path): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); \uv_fs_unlink($this->loop, $path, function ($fh) use ($deferred, $path) { StatCache::clear($path); $deferred->resolve((bool) $fh); }); return $deferred->promise(); } /** * {@inheritdoc} */ public function mkdir(string $path, int $mode = 0777, bool $recursive = false): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); if ($recursive) { $path = \str_replace("/", DIRECTORY_SEPARATOR, $path); $arrayPath = \explode(DIRECTORY_SEPARATOR, $path); $tmpPath = ""; $callback = function () use ( &$callback, &$arrayPath, &$tmpPath, $mode, $deferred ) { $tmpPath .= DIRECTORY_SEPARATOR . \array_shift($arrayPath); if (empty($arrayPath)) { \uv_fs_mkdir($this->loop, $tmpPath, $mode, function ($fh) use ($deferred) { $deferred->resolve((bool) $fh); }); } else { $this->isdir($tmpPath)->onResolve(function ($error, $result) use ( $callback, $tmpPath, $mode ) { if ($result) { $callback(); } else { \uv_fs_mkdir($this->loop, $tmpPath, $mode, $callback); } }); } }; $callback(); } else { \uv_fs_mkdir($this->loop, $path, $mode, function ($fh) use ($deferred) { $deferred->resolve((bool) $fh); }); } return $deferred->promise(); } /** * {@inheritdoc} */ public function rmdir(string $path): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); \uv_fs_rmdir($this->loop, $path, function ($fh) use ($deferred, $path) { StatCache::clear($path); $deferred->resolve((bool) $fh); }); return $deferred->promise(); } /** * {@inheritdoc} */ public function scandir(string $path): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); \uv_fs_readdir($this->loop, $path, 0, function ($fh, $data) use ($deferred, $path) { if (empty($fh) && $data !== 0) { $deferred->fail(new FilesystemException("Failed reading contents from {$path}")); } elseif ($data === 0) { $deferred->resolve([]); } else { $deferred->resolve($data); } }); return $deferred->promise(); } /** * {@inheritdoc} */ public function chmod(string $path, int $mode): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); \uv_fs_chmod($this->loop, $path, $mode, function ($fh) use ($deferred) { $deferred->resolve((bool) $fh); }); return $deferred->promise(); } /** * {@inheritdoc} */ public function chown(string $path, int $uid, int $gid): Promise { // @TODO Return a failure in windows environments $deferred = new Deferred; $this->poll->listen($deferred->promise()); \uv_fs_chown($this->loop, $path, $uid, $gid, function ($fh) use ($deferred) { $deferred->resolve((bool) $fh); }); return $deferred->promise(); } /** * {@inheritdoc} */ public function touch(string $path, int $time = null, int $atime = null): Promise { $time = $time ?? \time(); $atime = $atime ?? $time; $deferred = new Deferred; $this->poll->listen($deferred->promise()); \uv_fs_utime($this->loop, $path, $time, $atime, function () use ($deferred) { // The uv_fs_utime() callback does not receive any args at this time $deferred->resolve(true); }); return $deferred->promise(); } /** * {@inheritdoc} */ public function get(string $path): Promise { $promise = new Coroutine($this->doGet($path)); $this->poll->listen($promise); return $promise; } private function doGet($path): \Generator { $promise = $this->doFsOpen($path, $flags = \UV::O_RDONLY, $mode = 0); if (!$fh = yield $promise) { throw new FilesystemException("Failed opening file handle: {$path}"); } $deferred = new Deferred; $stat = yield $this->doFsStat($fh); if (empty($stat)) { $deferred->fail(new FilesystemException("stat operation failed on open file handle")); } elseif (!$stat["isfile"]) { \uv_fs_close($this->loop, $fh, function () use ($deferred) { $deferred->fail(new FilesystemException("cannot buffer contents: path is not a file")); }); } else { $buffer = yield $this->doFsRead($fh, $offset = 0, $stat["size"]); if ($buffer === false) { \uv_fs_close($this->loop, $fh, function () use ($deferred) { $deferred->fail(new FilesystemException("read operation failed on open file handle")); }); } else { \uv_fs_close($this->loop, $fh, function () use ($deferred, $buffer) { $deferred->resolve($buffer); }); } } return yield $deferred->promise(); } private function doFsOpen($path, $flags, $mode) { $deferred = new Deferred; \uv_fs_open($this->loop, $path, $flags, $mode, function ($fh) use ($deferred, $path) { $deferred->resolve($fh); }); return $deferred->promise(); } private function doFsStat($fh) { $deferred = new Deferred; \uv_fs_fstat($this->loop, $fh, function ($fh, $stat) use ($deferred) { if ($fh) { $stat["isdir"] = (bool) ($stat["mode"] & \UV::S_IFDIR); $stat["isfile"] = !$stat["isdir"]; $deferred->resolve($stat); } else { $deferred->resolve(); } }); return $deferred->promise(); } private function doFsRead($fh, $offset, $len) { $deferred = new Deferred; \uv_fs_read($this->loop, $fh, $offset, $len, function ($fh, $nread, $buffer) use ($deferred) { $deferred->resolve($nread < 0 ? false : $buffer); }); return $deferred->promise(); } /** * {@inheritdoc} */ public function put(string $path, string $contents): Promise { $promise = new Coroutine($this->doPut($path, $contents)); $this->poll->listen($promise); return $promise; } private function doPut($path, $contents): \Generator { $flags = \UV::O_WRONLY | \UV::O_CREAT; $mode = \UV::S_IRWXU | \UV::S_IRUSR; $promise = $this->doFsOpen($path, $flags, $mode); if (!$fh = yield $promise) { throw new FilesystemException("Failed opening write file handle"); } $deferred = new Deferred; $len = \strlen($contents); \uv_fs_write($this->loop, $fh, $contents, $offset = 0, function ($fh, $result) use ($deferred, $len) { \uv_fs_close($this->loop, $fh, function () use ($deferred, $result, $len) { if ($result < 0) { $deferred->fail(new FilesystemException(\uv_strerror($result))); } else { $deferred->resolve($len); } }); }); return yield $deferred->promise(); } } <?php namespace Amp\File; use Amp\ByteStream\InputStream; use Amp\ByteStream\OutputStream; use Amp\Promise; interface Handle extends InputStream, OutputStream { const DEFAULT_READ_LENGTH = 8192; /** * Read $len bytes from the open file handle starting at $offset. * * @param int $length * @return \Amp\Promise<string|null> */ public function read(int $length = self::DEFAULT_READ_LENGTH): Promise; /** * Write $data to the open file handle starting at $offset. * * @param string $data * @return \Amp\Promise<int> */ public function write(string $data): Promise; /** * Write $data to the open file handle and close the handle once the write completes. * * @param string $data * * @return \Amp\Promise<int> */ public function end(string $data = ""): Promise; /** * Close the file handle. * * Applications are not required to manually close handles -- they will * be unloaded automatically when the object is garbage collected. * * @return \Amp\Promise */ public function close(): Promise; /** * Truncates the file to the given length. If $size is larger than the current file size, the file is extended * with null bytes. * * @param int $size New file size. * * @return \Amp\Promise */ public function truncate(int $size): Promise; /** * Set the handle's internal pointer position. * * $whence values: * * SEEK_SET - Set position equal to offset bytes. * SEEK_CUR - Set position to current location plus offset. * SEEK_END - Set position to end-of-file plus offset. * * @param int $position * @param int $whence * @return \Amp\Promise<int> New offset position. */ public function seek(int $position, int $whence = \SEEK_SET): Promise; /** * Return the current internal offset position of the file handle. * * @return int */ public function tell(): int; /** * Test for "end-of-file" on the file handle. * * @return bool */ public function eof(): bool; /** * Retrieve the path used when opening the file handle. * * @return string */ public function path(): string; /** * Retrieve the mode used when opening the file handle. * * @return string */ public function mode(): string; } <?php namespace Amp\File; use Amp\ByteStream\ClosedException; use Amp\ByteStream\StreamException; use Amp\Parallel\Worker\TaskException; use Amp\Parallel\Worker\Worker; use Amp\Parallel\Worker\WorkerException; use Amp\Promise; use Amp\Success; use function Amp\call; class ParallelHandle implements Handle { /** @var \Amp\Parallel\Worker\Worker */ private $worker; /** @var int|null */ private $id; /** @var string */ private $path; /** @var int */ private $position; /** @var int */ private $size; /** @var string */ private $mode; /** @var bool True if an operation is pending. */ private $busy = false; /** @var int Number of pending write operations. */ private $pendingWrites = 0; /** @var bool */ private $writable = true; /** @var \Amp\Promise|null */ private $closing; /** * @param \Amp\Parallel\Worker\Worker $worker * @param int $id * @param string $path * @param int $size * @param string $mode */ public function __construct(Worker $worker, int $id, string $path, int $size, string $mode) { $this->worker = $worker; $this->id = $id; $this->path = $path; $this->size = $size; $this->mode = $mode; $this->position = $this->mode[0] === 'a' ? $this->size : 0; } public function __destruct() { if ($this->id !== null) { $this->close(); } } /** * {@inheritdoc} */ public function path(): string { return $this->path; } /** * {@inheritdoc} */ public function close(): Promise { if ($this->closing) { return $this->closing; } $this->writable = false; if ($this->worker->isRunning()) { $this->closing = $this->worker->enqueue(new Internal\FileTask('fclose', [], $this->id)); $this->id = null; } else { $this->closing = new Success; } return $this->closing; } /** * {@inheritdoc} */ public function truncate(int $size): Promise { if ($this->id === null) { throw new ClosedException("The file has been closed"); } if ($this->busy) { throw new PendingOperationError; } if (!$this->writable) { throw new ClosedException("The file is no longer writable"); } return call(function () use ($size) { ++$this->pendingWrites; $this->busy = true; try { yield $this->worker->enqueue(new Internal\FileTask('ftruncate', [$size], $this->id)); } catch (TaskException $exception) { throw new StreamException("Reading from the file failed", 0, $exception); } catch (WorkerException $exception) { throw new StreamException("Sending the task to the worker failed", 0, $exception); } finally { if (--$this->pendingWrites === 0) { $this->busy = false; } } }); } /** * {@inheritdoc} */ public function eof(): bool { return $this->pendingWrites === 0 && $this->size <= $this->position; } public function read(int $length = self::DEFAULT_READ_LENGTH): Promise { if ($this->id === null) { throw new ClosedException("The file has been closed"); } if ($this->busy) { throw new PendingOperationError; } return call(function () use ($length) { $this->busy = true; try { $data = yield $this->worker->enqueue(new Internal\FileTask('fread', [$length], $this->id)); $this->position += \strlen($data); } catch (TaskException $exception) { throw new StreamException("Reading from the file failed", 0, $exception); } catch (WorkerException $exception) { throw new StreamException("Sending the task to the worker failed", 0, $exception); } finally { $this->busy = false; } return $data; }); } /** * {@inheritdoc} */ public function write(string $data): Promise { if ($this->id === null) { throw new ClosedException("The file has been closed"); } if ($this->busy && $this->pendingWrites === 0) { throw new PendingOperationError; } if (!$this->writable) { throw new ClosedException("The file is no longer writable"); } return call(function () use ($data) { ++$this->pendingWrites; $this->busy = true; try { $length = yield $this->worker->enqueue(new Internal\FileTask('fwrite', [$data], $this->id)); } catch (TaskException $exception) { throw new StreamException("Writing to the file failed", 0, $exception); } catch (WorkerException $exception) { throw new StreamException("Sending the task to the worker failed", 0, $exception); } finally { if (--$this->pendingWrites === 0) { $this->busy = false; } } $this->position += $length; return $length; }); } /** * {@inheritdoc} */ public function end(string $data = ""): Promise { return call(function () use ($data) { $promise = $this->write($data); $this->writable = false; // ignore any errors yield Promise\any([$this->close()]); return $promise; }); } /** * {@inheritdoc} */ public function seek(int $offset, int $whence = SEEK_SET): Promise { if ($this->id === null) { throw new ClosedException("The file has been closed"); } if ($this->busy) { throw new PendingOperationError; } return call(function () use ($offset, $whence) { switch ($whence) { case \SEEK_SET: case \SEEK_CUR: case \SEEK_END: try { $this->position = yield $this->worker->enqueue( new Internal\FileTask('fseek', [$offset, $whence], $this->id) ); if ($this->position > $this->size) { $this->size = $this->position; } return $this->position; } catch (TaskException $exception) { throw new StreamException('Seeking in the file failed.', 0, $exception); } catch (WorkerException $exception) { throw new StreamException("Sending the task to the worker failed", 0, $exception); } default: throw new \Error('Invalid whence value. Use SEEK_SET, SEEK_CUR, or SEEK_END.'); } }); } /** * {@inheritdoc} */ public function tell(): int { return $this->position; } /** * {@inheritdoc} */ public function size(): int { return $this->size; } /** * {@inheritdoc} */ public function mode(): string { return $this->mode; } } <?php namespace Amp\File; class PendingOperationError extends \Error { public function __construct( string $message = "The previous file operation must complete before another can be started", int $code = 0, \Throwable $previous = null ) { parent::__construct($message, $code, $previous); } } <?php namespace Amp\File; use Amp\ByteStream\ClosedException; use Amp\ByteStream\StreamException; use Amp\Deferred; use Amp\File\Internal\UvPoll; use Amp\Loop; use Amp\Promise; use Amp\Success; use function Amp\call; class UvHandle implements Handle { /** @var UvPoll */ private $poll; /** @var \UVLoop */ private $loop; /** @var resource */ private $fh; /** @var string */ private $path; /** @var string */ private $mode; /** @var int */ private $size; /** @var int */ private $position; /** @var \SplQueue */ private $queue; /** @var bool */ private $isActive = false; /** @var bool */ private $writable = true; /** @var \Amp\Promise|null */ private $closing; /** * @param \Amp\Loop\UvDriver $driver * @param UvPoll $poll Poll for keeping the loop active. * @param resource $fh File handle. * @param string $path * @param string $mode * @param int $size */ public function __construct(Loop\UvDriver $driver, UvPoll $poll, $fh, string $path, string $mode, int $size) { $this->poll = $poll; $this->fh = $fh; $this->path = $path; $this->mode = $mode; $this->size = $size; $this->loop = $driver->getHandle(); $this->position = ($mode[0] === "a") ? $size : 0; $this->queue = new \SplQueue; } public function read(int $length = self::DEFAULT_READ_LENGTH): Promise { if ($this->isActive) { throw new PendingOperationError; } $deferred = new Deferred; $this->poll->listen($deferred->promise()); $this->isActive = true; $onRead = function ($fh, $result, $buffer) use ($deferred) { $this->isActive = false; if ($result < 0) { $error = \uv_strerror($result); if ($error === "bad file descriptor") { $deferred->fail(new ClosedException("Reading from the file failed due to a closed handle")); } else { $deferred->fail(new StreamException("Reading from the file failed: " . $error)); } } else { $length = \strlen($buffer); $this->position = $this->position + $length; $deferred->resolve($length ? $buffer : null); } }; \uv_fs_read($this->loop, $this->fh, $this->position, $length, $onRead); return $deferred->promise(); } /** * {@inheritdoc} */ public function write(string $data): Promise { if ($this->isActive && $this->queue->isEmpty()) { throw new PendingOperationError; } if (!$this->writable) { throw new ClosedException("The file is no longer writable"); } $this->isActive = true; if ($this->queue->isEmpty()) { $promise = $this->push($data); } else { $promise = $this->queue->top(); $promise = call(function () use ($promise, $data) { yield $promise; return yield $this->push($data); }); } $this->queue->push($promise); return $promise; } /** * {@inheritdoc} */ public function end(string $data = ""): Promise { return call(function () use ($data) { $promise = $this->write($data); $this->writable = false; // ignore any errors yield Promise\any([$this->close()]); return $promise; }); } private function push(string $data): Promise { $length = \strlen($data); $deferred = new Deferred; $this->poll->listen($deferred->promise()); $onWrite = function ($fh, $result) use ($deferred, $length) { if ($this->queue->isEmpty()) { $deferred->fail(new ClosedException('No pending write, the file may have been closed')); } $this->queue->shift(); if ($this->queue->isEmpty()) { $this->isActive = false; } if ($result < 0) { $error = \uv_strerror($result); if ($error === "bad file descriptor") { $deferred->fail(new ClosedException("Writing to the file failed due to a closed handle")); } else { $deferred->fail(new StreamException("Writing to the file failed: " . $error)); } } else { StatCache::clear($this->path); $newPosition = $this->position + $length; $delta = $newPosition - $this->position; $this->position = ($this->mode[0] === "a") ? $this->position : $newPosition; $this->size += $delta; $deferred->resolve($length); } }; \uv_fs_write($this->loop, $this->fh, $data, $this->position, $onWrite); return $deferred->promise(); } public function truncate(int $size): Promise { if ($this->isActive && $this->queue->isEmpty()) { throw new PendingOperationError; } if (!$this->writable) { throw new ClosedException("The file is no longer writable"); } $this->isActive = true; if ($this->queue->isEmpty()) { $promise = $this->trim($size); } else { $promise = $this->queue->top(); $promise = call(function () use ($promise, $size) { yield $promise; return yield $this->trim($size); }); } $this->queue->push($promise); return $promise; } private function trim(int $size): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); $onTruncate = function ($fh) use ($deferred, $size) { if ($this->queue->isEmpty()) { $deferred->fail(new ClosedException('No pending write, the file may have been closed')); } $this->queue->shift(); if ($this->queue->isEmpty()) { $this->isActive = false; } StatCache::clear($this->path); $this->size = $size; $deferred->resolve(); }; \uv_fs_ftruncate( $this->loop, $this->fh, $size, $onTruncate ); return $deferred->promise(); } /** * {@inheritdoc} */ public function seek(int $offset, int $whence = \SEEK_SET): Promise { if ($this->isActive) { throw new PendingOperationError; } $offset = (int) $offset; switch ($whence) { case \SEEK_SET: $this->position = $offset; break; case \SEEK_CUR: $this->position = $this->position + $offset; break; case \SEEK_END: $this->position = $this->size + $offset; break; default: throw new \Error( "Invalid whence parameter; SEEK_SET, SEEK_CUR or SEEK_END expected" ); } return new Success($this->position); } /** * {@inheritdoc} */ public function tell(): int { return $this->position; } /** * {@inheritdoc} */ public function eof(): bool { return !$this->queue->isEmpty() ? false : ($this->size <= $this->position); } /** * {@inheritdoc} */ public function path(): string { return $this->path; } /** * {@inheritdoc} */ public function mode(): string { return $this->mode; } /** * {@inheritdoc} */ public function close(): Promise { if ($this->closing) { return $this->closing; } $deferred = new Deferred; $this->poll->listen($this->closing = $deferred->promise()); \uv_fs_close($this->loop, $this->fh, function ($fh) use ($deferred) { // Ignore errors when closing file, as the handle will become invalid anyway. $deferred->resolve(); }); return $deferred->promise(); } } <?php namespace Amp\File; use Amp\Promise; interface Driver { /** * Open a handle for the specified path. * * @param string $path * @param string $mode * @return \Amp\Promise<\Amp\File\Handle> */ public function open(string $path, string $mode): Promise; /** * Execute a file stat operation. * * If the requested path does not exist the resulting Promise will resolve to NULL. * * @param string $path The file system path to stat * @return \Amp\Promise<array|null> */ public function stat(string $path): Promise; /** * Does the specified path exist? * * This function should never resolve as a failure -- only a successfull bool value * indicating the existence of the specified path. * * @param string $path An absolute file system path * @return \Amp\Promise<bool> */ public function exists(string $path): Promise; /** * Retrieve the size in bytes of the file at the specified path. * * If the path does not exist or is not a regular file this * function's returned Promise WILL resolve as a failure. * * @param string $path An absolute file system path * @return \Amp\Promise<int> */ public function size(string $path): Promise; /** * Does the specified path exist and is it a directory? * * If the path does not exist the returned Promise will resolve * to FALSE and will not reject with an error. * * @param string $path An absolute file system path * @return \Amp\Promise<bool> */ public function isdir(string $path): Promise; /** * Does the specified path exist and is it a file? * * If the path does not exist the returned Promise will resolve * to FALSE and will not reject with an error. * * @param string $path An absolute file system path * @return \Amp\Promise<bool> */ public function isfile(string $path): Promise; /** * Retrieve the path's last modification time as a unix timestamp. * * @param string $path An absolute file system path * @return \Amp\Promise<int> */ public function mtime(string $path): Promise; /** * Retrieve the path's last access time as a unix timestamp. * * @param string $path An absolute file system path * @return \Amp\Promise<int> */ public function atime(string $path): Promise; /** * Retrieve the path's creation time as a unix timestamp. * * @param string $path An absolute file system path * @return \Amp\Promise<int> */ public function ctime(string $path): Promise; /** * Same as stat() except if the path is a link then the link's data is returned. * * @param string $path The file system path to stat * @return \Amp\Promise A promise resolving to an associative array upon successful resolution */ public function lstat(string $path): Promise; /** * Create a symlink $link pointing to the file/directory located at $target. * * @param string $target * @param string $link * @return \Amp\Promise */ public function symlink(string $target, string $link): Promise; /** * Create a hard link $link pointing to the file/directory located at $target. * * @param string $target * @param string $link * @return \Amp\Promise */ public function link(string $target, string $link): Promise; /** * Read the symlink at $path. * * @param string $target * @return \Amp\Promise */ public function readlink(string $target): Promise; /** * Rename a file or directory. * * @param string $from * @param string $to * @return \Amp\Promise */ public function rename(string $from, string $to): Promise; /** * Delete a file. * * @param string $path * @return \Amp\Promise */ public function unlink(string $path): Promise; /** * Create a director. * * @param string $path * @param int $mode * @param bool $recursive * @return \Amp\Promise */ public function mkdir(string $path, int $mode = 0777, bool $recursive = false): Promise; /** * Delete a directory. * * @param string $path * @return \Amp\Promise */ public function rmdir(string $path): Promise; /** * Retrieve an array of files and directories inside the specified path. * * Dot entries are not included in the resulting array (i.e. "." and ".."). * * @param string $path * @return \Amp\Promise */ public function scandir(string $path): Promise; /** * chmod a file or directory. * * @param string $path * @param int $mode * @return \Amp\Promise */ public function chmod(string $path, int $mode): Promise; /** * chown a file or directory. * * @param string $path * @param int $uid * @param int $gid * @return \Amp\Promise */ public function chown(string $path, int $uid, int $gid): Promise; /** * Update the access and modification time of the specified path. * * If the file does not exist it will be created automatically. * * @param string $path * @param int $time The touch time. If $time is not supplied, the current system time is used. * @param int $atime The access time. If $atime is not supplied, value passed to the $time parameter is used. * @return \Amp\Promise */ public function touch(string $path, int $time = null, int $atime = null): Promise; /** * Buffer the specified file's contents. * * @param string $path The file path from which to buffer contents * @return \Amp\Promise A promise resolving to a string upon successful resolution */ public function get(string $path): Promise; /** * Write the contents string to the specified path. * * @param string $path The file path to which to $contents should be written * @param string $contents The data to write to the specified $path * @return \Amp\Promise A promise resolving to the integer length written upon success */ public function put(string $path, string $contents): Promise; } <?php namespace Amp\File; use Amp\Deferred; use Amp\Promise; use Amp\Success; class EioDriver implements Driver { /** @var \Amp\File\Internal\EioPoll */ private $poll; /** * @return bool Determines if this driver can be used based on the environment. */ public static function isSupported(): bool { return \extension_loaded('eio'); } public function __construct() { $this->poll = new Internal\EioPoll; } /** * {@inheritdoc} */ public function open(string $path, string $mode): Promise { $flags = \EIO_O_NONBLOCK | \EIO_O_FSYNC | $this->parseMode($mode); $chmod = ($flags & \EIO_O_CREAT) ? 0644 : 0; $deferred = new Deferred; $this->poll->listen($deferred->promise()); $openArr = [$mode, $path, $deferred]; \eio_open($path, $flags, $chmod, \EIO_PRI_DEFAULT, [$this, "onOpenHandle"], $openArr); return $deferred->promise(); } private function parseMode(string $mode): int { $mode = \str_replace(['b', 't', 'e'], '', $mode); switch ($mode) { case 'r': return \EIO_O_RDONLY; case 'r+': return \EIO_O_RDWR; case 'w': return \EIO_O_WRONLY | \EIO_O_TRUNC | \EIO_O_CREAT; case 'w+': return \EIO_O_RDWR | \EIO_O_TRUNC | \EIO_O_CREAT; case 'a': return \EIO_O_WRONLY | \EIO_O_APPEND | \EIO_O_CREAT; case 'a+': return \EIO_O_RDWR | \EIO_O_APPEND | \EIO_O_CREAT; case 'x': return \EIO_O_WRONLY | \EIO_O_CREAT | \EIO_O_EXCL; case 'x+': return \EIO_O_RDWR | \EIO_O_CREAT | \EIO_O_EXCL; case 'c': return \EIO_O_WRONLY | \EIO_O_CREAT; case 'c+': return \EIO_O_RDWR | \EIO_O_CREAT; default: throw new \Error('Invalid file mode'); } } private function onOpenHandle($openArr, $result, $req) { list($mode, $path, $deferred) = $openArr; if ($result === -1) { $deferred->fail(new FilesystemException(\eio_get_last_error($req))); } elseif ($mode[0] === "a") { \array_unshift($openArr, $result); \eio_ftruncate($result, $offset = 0, \EIO_PRI_DEFAULT, [$this, "onOpenFtruncate"], $openArr); } else { \array_unshift($openArr, $result); \eio_fstat($result, \EIO_PRI_DEFAULT, [$this, "onOpenFstat"], $openArr); } } private function onOpenFtruncate($openArr, $result, $req) { list($fh, $mode, $path, $deferred) = $openArr; if ($result === -1) { $deferred->fail(new FilesystemException(\eio_get_last_error($req))); } else { $handle = new EioHandle($this->poll, $fh, $path, $mode, $size = 0); $deferred->resolve($handle); } } private function onOpenFstat($openArr, $result, $req) { list($fh, $mode, $path, $deferred) = $openArr; if ($result === -1) { $deferred->fail(new FilesystemException(\eio_get_last_error($req))); } else { StatCache::set($path, $result); $handle = new EioHandle($this->poll, $fh, $path, $mode, $result["size"]); $deferred->resolve($handle); } } /** * {@inheritdoc} */ public function stat(string $path): Promise { if ($stat = StatCache::get($path)) { return new Success($stat); } $deferred = new Deferred; $this->poll->listen($deferred->promise()); $priority = \EIO_PRI_DEFAULT; $data = [$deferred, $path]; \eio_stat($path, $priority, [$this, "onStat"], $data); return $deferred->promise(); } private function onStat($data, $result, $req) { list($deferred, $path) = $data; if ($result === -1) { $deferred->resolve(null); } else { StatCache::set($path, $result); $deferred->resolve($result); } } /** * {@inheritdoc} */ public function exists(string $path): Promise { $deferred = new Deferred; $this->stat($path)->onResolve(function ($error, $result) use ($deferred) { $deferred->resolve((bool) $result); }); return $deferred->promise(); } /** * {@inheritdoc} */ public function isdir(string $path): Promise { $deferred = new Deferred; $this->stat($path)->onResolve(function ($error, $result) use ($deferred) { if ($result) { $deferred->resolve(!($result["mode"] & \EIO_S_IFREG)); } else { $deferred->resolve(false); } }); return $deferred->promise(); } /** * {@inheritdoc} */ public function isfile(string $path): Promise { $deferred = new Deferred; $this->stat($path)->onResolve(function ($error, $result) use ($deferred) { if ($result) { $deferred->resolve((bool) ($result["mode"] & \EIO_S_IFREG)); } else { $deferred->resolve(false); } }); return $deferred->promise(); } /** * {@inheritdoc} */ public function size(string $path): Promise { $deferred = new Deferred; $this->stat($path)->onResolve(function ($error, $result) use ($deferred) { if (empty($result)) { $deferred->fail(new FilesystemException( "Specified path does not exist" )); } elseif ($result["mode"] & \EIO_S_IFREG) { $deferred->resolve($result["size"]); } else { $deferred->fail(new FilesystemException( "Specified path is not a regular file" )); } }); return $deferred->promise(); } /** * {@inheritdoc} */ public function mtime(string $path): Promise { $deferred = new Deferred; $this->stat($path)->onResolve(function ($error, $result) use ($deferred) { if ($result) { $deferred->resolve($result["mtime"]); } else { $deferred->fail(new FilesystemException( "Specified path does not exist" )); } }); return $deferred->promise(); } /** * {@inheritdoc} */ public function atime(string $path): Promise { $deferred = new Deferred; $this->stat($path)->onResolve(function ($error, $result) use ($deferred) { if ($result) { $deferred->resolve($result["atime"]); } else { $deferred->fail(new FilesystemException( "Specified path does not exist" )); } }); return $deferred->promise(); } /** * {@inheritdoc} */ public function ctime(string $path): Promise { $deferred = new Deferred; $this->stat($path)->onResolve(function ($error, $result) use ($deferred) { if ($result) { $deferred->resolve($result["ctime"]); } else { $deferred->fail(new FilesystemException( "Specified path does not exist" )); } }); return $deferred->promise(); } /** * {@inheritdoc} */ public function lstat(string $path): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); $priority = \EIO_PRI_DEFAULT; \eio_lstat($path, $priority, [$this, "onLstat"], $deferred); return $deferred->promise(); } private function onLstat($deferred, $result, $req) { if ($result === -1) { $deferred->resolve(null); } else { $deferred->resolve($result); } } /** * {@inheritdoc} */ public function symlink(string $target, string $link): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); $priority = \EIO_PRI_DEFAULT; \eio_symlink($target, $link, $priority, [$this, "onGenericResult"], $deferred); return $deferred->promise(); } /** * {@inheritdoc} */ public function link(string $target, string $link): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); $priority = \EIO_PRI_DEFAULT; \eio_link($target, $link, $priority, [$this, "onGenericResult"], $deferred); return $deferred->promise(); } /** * {@inheritdoc} */ public function readlink(string $path): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); $priority = \EIO_PRI_DEFAULT; \eio_readlink($path, $priority, [$this, "onReadlink"], $deferred); return $deferred->promise(); } private function onReadlink($deferred, $result, $req) { if ($result === -1) { $deferred->fail(new FilesystemException(\eio_get_last_error($req))); } else { $deferred->resolve($result); } } private function onGenericResult($deferred, $result, $req) { if ($result === -1) { $deferred->fail(new FilesystemException(\eio_get_last_error($req))); } else { $deferred->resolve(true); } } /** * {@inheritdoc} */ public function rename(string $from, string $to): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); $priority = \EIO_PRI_DEFAULT; \eio_rename($from, $to, $priority, [$this, "onGenericResult"], $deferred); return $deferred->promise(); } /** * {@inheritdoc} */ public function unlink(string $path): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); $priority = \EIO_PRI_DEFAULT; $data = [$deferred, $path]; \eio_unlink($path, $priority, [$this, "onUnlink"], $data); return $deferred->promise(); } private function onUnlink($data, $result, $req) { list($deferred, $path) = $data; if ($result === -1) { $deferred->fail(new FilesystemException(\eio_get_last_error($req))); } else { StatCache::clear($path); $deferred->resolve(true); } } /** * {@inheritdoc} */ public function mkdir(string $path, int $mode = 0777, bool $recursive = false): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); $priority = \EIO_PRI_DEFAULT; if ($recursive) { $path = \str_replace("/", DIRECTORY_SEPARATOR, $path); $arrayPath = \explode(DIRECTORY_SEPARATOR, $path); $tmpPath = ""; $callback = function () use ( &$callback, &$arrayPath, &$tmpPath, $mode, $priority, $deferred ) { $tmpPath .= DIRECTORY_SEPARATOR . \array_shift($arrayPath); if (empty($arrayPath)) { \eio_mkdir($tmpPath, $mode, $priority, [$this, "onGenericResult"], $deferred); } else { $this->isdir($tmpPath)->onResolve(function ($error, $result) use ( $callback, $tmpPath, $mode, $priority ) { if ($result) { $callback(); } else { \eio_mkdir($tmpPath, $mode, $priority, $callback); } }); } }; $callback(); } else { \eio_mkdir($path, $mode, $priority, [$this, "onGenericResult"], $deferred); } return $deferred->promise(); } /** * {@inheritdoc} */ public function rmdir(string $path): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); $priority = \EIO_PRI_DEFAULT; $data = [$deferred, $path]; \eio_rmdir($path, $priority, [$this, "onRmdir"], $data); return $deferred->promise(); } private function onRmdir($data, $result, $req) { list($deferred, $path) = $data; if ($result === -1) { $deferred->fail(new FilesystemException(\eio_get_last_error($req))); } else { StatCache::clear($path); $deferred->resolve(true); } } /** * {@inheritdoc} */ public function scandir(string $path): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); $flags = \EIO_READDIR_STAT_ORDER | \EIO_READDIR_DIRS_FIRST; $priority = \EIO_PRI_DEFAULT; \eio_readdir($path, $flags, $priority, [$this, "onScandir"], $deferred); return $deferred->promise(); } private function onScandir($deferred, $result, $req) { if ($result === -1) { $deferred->fail(new FilesystemException(\eio_get_last_error($req))); } else { $result = $result["names"]; \sort($result); $deferred->resolve($result); } } /** * {@inheritdoc} */ public function chmod(string $path, int $mode): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); $priority = \EIO_PRI_DEFAULT; \eio_chmod($path, $mode, $priority, [$this, "onGenericResult"], $deferred); return $deferred->promise(); } /** * {@inheritdoc} */ public function chown(string $path, int $uid, int $gid): Promise { $deferred = new Deferred; $this->poll->listen($deferred->promise()); $priority = \EIO_PRI_DEFAULT; \eio_chown($path, $uid, $gid, $priority, [$this, "onGenericResult"], $deferred); return $deferred->promise(); } /** * {@inheritdoc} */ public function touch(string $path, int $time = null, int $atime = null): Promise { $time = $time ?? \time(); $atime = $atime ?? $time; $deferred = new Deferred; $this->poll->listen($deferred->promise()); $priority = \EIO_PRI_DEFAULT; \eio_utime($path, $atime, $time, $priority, [$this, "onGenericResult"], $deferred); return $deferred->promise(); } /** * {@inheritdoc} */ public function get(string $path): Promise { $flags = $flags = \EIO_O_RDONLY; $mode = 0; $priority = \EIO_PRI_DEFAULT; $deferred = new Deferred; $this->poll->listen($deferred->promise()); \eio_open($path, $flags, $mode, $priority, [$this, "onGetOpen"], $deferred); return $deferred->promise(); } private function onGetOpen($deferred, $result, $req) { if ($result === -1) { $deferred->fail(new FilesystemException(\eio_get_last_error($req))); } else { $priority = \EIO_PRI_DEFAULT; \eio_fstat($result, $priority, [$this, "onGetFstat"], [$result, $deferred]); } } private function onGetFstat($fhAndPromisor, $result, $req) { list($fh, $deferred) = $fhAndPromisor; if ($result === -1) { $deferred->fail(new FilesystemException(\eio_get_last_error($req))); return; } $offset = 0; $length = $result["size"]; $priority = \EIO_PRI_DEFAULT; \eio_read($fh, $length, $offset, $priority, [$this, "onGetRead"], $fhAndPromisor); } private function onGetRead($fhAndPromisor, $result, $req) { list($fh, $deferred) = $fhAndPromisor; \eio_close($fh); if ($result === -1) { $deferred->fail(new FilesystemException(\eio_get_last_error($req))); } else { $deferred->resolve($result); } } /** * {@inheritdoc} */ public function put(string $path, string $contents): Promise { $flags = \EIO_O_RDWR | \EIO_O_CREAT; $mode = \EIO_S_IRUSR | \EIO_S_IWUSR | \EIO_S_IXUSR; $priority = \EIO_PRI_DEFAULT; $deferred = new Deferred; $this->poll->listen($deferred->promise()); $data = [$contents, $deferred]; \eio_open($path, $flags, $mode, $priority, [$this, "onPutOpen"], $data); return $deferred->promise(); } private function onPutOpen($data, $result, $req) { list($contents, $deferred) = $data; if ($result === -1) { $deferred->fail(new FilesystemException(\eio_get_last_error($req))); } else { $length = \strlen($contents); $offset = 0; $priority = \EIO_PRI_DEFAULT; $callback = [$this, "onPutWrite"]; $fhAndPromisor = [$result, $deferred]; \eio_write($result, $contents, $length, $offset, $priority, $callback, $fhAndPromisor); } } private function onPutWrite($fhAndPromisor, $result, $req) { list($fh, $deferred) = $fhAndPromisor; \eio_close($fh); if ($result === -1) { $deferred->fail(new FilesystemException(\eio_get_last_error($req))); } else { $deferred->resolve($result); } } } <?php namespace Amp\File; use Amp\Failure; use Amp\Promise; use Amp\Success; class BlockingDriver implements Driver { /** * {@inheritdoc} */ public function open(string $path, string $mode): Promise { $mode = \str_replace(['b', 't', 'e'], '', $mode); switch ($mode) { case "r": case "r+": case "w": case "w+": case "a": case "a+": case "x": case "x+": case "c": case "c+": break; default: throw new \Error("Invalid file mode"); } if (!$fh = \fopen($path, $mode . 'be')) { return new Failure(new FilesystemException( "Failed opening file handle" )); } return new Success(new BlockingHandle($fh, $path, $mode)); } /** * {@inheritdoc} */ public function stat(string $path): Promise { if ($stat = StatCache::get($path)) { return new Success($stat); } elseif ($stat = @\stat($path)) { StatCache::set($path, $stat); \clearstatcache(true, $path); } else { $stat = null; } return new Success($stat); } /** * {@inheritdoc} */ public function exists(string $path): Promise { if ($exists = @\file_exists($path)) { \clearstatcache(true, $path); } return new Success($exists); } /** * Retrieve the size in bytes of the file at the specified path. * * If the path does not exist or is not a regular file this * function's returned Promise WILL resolve as a failure. * * @param string $path An absolute file system path * @return \Amp\Promise<int> */ public function size(string $path): Promise { if (!@\file_exists($path)) { return new Failure(new FilesystemException( "Path does not exist" )); } if (!@\is_file($path)) { return new Failure(new FilesystemException( "Path is not a regular file" )); } if (($size = @\filesize($path)) === false) { $message = 'Could not open the file.'; if ($error = \error_get_last()) { $message .= \sprintf(" Errno: %d; %s", $error["type"], $error["message"]); } return new Failure(new FilesystemException($message)); } \clearstatcache(true, $path); return new Success($size); } /** * Does the specified path exist and is it a directory? * * If the path does not exist the returned Promise will resolve * to FALSE. It will NOT reject with an error. * * @param string $path An absolute file system path * @return \Amp\Promise<bool> */ public function isdir(string $path): Promise { if (!@\file_exists($path)) { return new Success(false); } $isDir = @\is_dir($path); \clearstatcache(true, $path); return new Success($isDir); } /** * Does the specified path exist and is it a file? * * If the path does not exist the returned Promise will resolve * to FALSE. It will NOT reject with an error. * * @param string $path An absolute file system path * @return \Amp\Promise<bool> */ public function isfile(string $path): Promise { if (!@\file_exists($path)) { return new Success(false); } $isFile = @\is_file($path); \clearstatcache(true, $path); return new Success($isFile); } /** * Retrieve the path's last modification time as a unix timestamp. * * @param string $path An absolute file system path * @return \Amp\Promise<int> */ public function mtime(string $path): Promise { if (!@\file_exists($path)) { return new Failure(new FilesystemException( "Path does not exist" )); } $mtime = @\filemtime($path); \clearstatcache(true, $path); return new Success($mtime); } /** * Retrieve the path's last access time as a unix timestamp. * * @param string $path An absolute file system path * @return \Amp\Promise<int> */ public function atime(string $path): Promise { if (!@\file_exists($path)) { return new Failure(new FilesystemException( "Path does not exist" )); } $atime = @\fileatime($path); \clearstatcache(true, $path); return new Success($atime); } /** * Retrieve the path's creation time as a unix timestamp. * * @param string $path An absolute file system path * @return \Amp\Promise<int> */ public function ctime(string $path): Promise { if (!@\file_exists($path)) { return new Failure(new FilesystemException( "Path does not exist" )); } $ctime = @\filectime($path); \clearstatcache(true, $path); return new Success($ctime); } /** * {@inheritdoc} */ public function lstat(string $path): Promise { if ($stat = @\lstat($path)) { \clearstatcache(true, $path); } else { $stat = null; } return new Success($stat); } /** * {@inheritdoc} */ public function symlink(string $target, string $link): Promise { if (!@\symlink($target, $link)) { return new Failure(new FilesystemException("Could not create symbolic link")); } return new Success(true); } /** * {@inheritdoc} */ public function link(string $target, string $link): Promise { if (!@\link($target, $link)) { return new Failure(new FilesystemException("Could not create hard link")); } return new Success(true); } /** * {@inheritdoc} */ public function readlink(string $path): Promise { if (!($result = @\readlink($path))) { return new Failure(new FilesystemException("Could not read symbolic link")); } return new Success($result); } /** * {@inheritdoc} */ public function rename(string $from, string $to): Promise { if (!@\rename($from, $to)) { return new Failure(new FilesystemException("Could not rename file")); } return new Success(true); } /** * {@inheritdoc} */ public function unlink(string $path): Promise { StatCache::clear($path); return new Success((bool) @\unlink($path)); } /** * {@inheritdoc} */ public function mkdir(string $path, int $mode = 0777, bool $recursive = false): Promise { return new Success((bool) @\mkdir($path, $mode, $recursive)); } /** * {@inheritdoc} */ public function rmdir(string $path): Promise { StatCache::clear($path); return new Success((bool) @\rmdir($path)); } /** * {@inheritdoc} */ public function scandir(string $path): Promise { if (!@\is_dir($path)) { return new Failure(new FilesystemException( "Not a directory" )); } elseif ($arr = @\scandir($path)) { $arr = \array_values(\array_filter($arr, function ($el) { return !($el === "." || $el === ".."); })); \clearstatcache(true, $path); return new Success($arr); } return new Failure(new FilesystemException( "Failed reading contents from {$path}" )); } /** * {@inheritdoc} */ public function chmod(string $path, int $mode): Promise { return new Success((bool) @\chmod($path, $mode)); } /** * {@inheritdoc} */ public function chown(string $path, int $uid, int $gid): Promise { if ($uid !== -1 && !@\chown($path, $uid)) { $message = 'Could not open the file.'; if ($error = \error_get_last()) { $message .= \sprintf(" Errno: %d; %s", $error["type"], $error["message"]); } return new Failure(new FilesystemException($message)); } if ($gid !== -1 && !@\chgrp($path, $gid)) { $message = 'Could not open the file.'; if ($error = \error_get_last()) { $message .= \sprintf(" Errno: %d; %s", $error["type"], $error["message"]); } return new Failure(new FilesystemException($message)); } return new Success; } /** * {@inheritdoc} */ public function touch(string $path, int $time = null, int $atime = null): Promise { $time = $time ?? \time(); $atime = $atime ?? $time; return new Success((bool) \touch($path, $time, $atime)); } /** * {@inheritdoc} */ public function get(string $path): Promise { $result = @\file_get_contents($path); if ($result === false) { $message = 'Could not open the file.'; if ($error = \error_get_last()) { $message .= \sprintf(" Errno: %d; %s", $error["type"], $error["message"]); } } return ($result === false) ? new Failure(new FilesystemException($message)) : new Success($result); } /** * {@inheritdoc} */ public function put(string $path, string $contents): Promise { $result = @\file_put_contents($path, $contents); if ($result === false) { $message = 'Could not open the file.'; if ($error = \error_get_last()) { $message .= \sprintf(" Errno: %d; %s", $error["type"], $error["message"]); } } return ($result === false) ? new Failure(new FilesystemException($message)) : new Success($result); } } <?php namespace Amp\File; class FilesystemException extends \Exception { public function __construct(string $message, \Throwable $previous = null) { parent::__construct($message, 0, $previous); } } <?php namespace Amp\File; use Amp\Coroutine; use Amp\Parallel\Worker; use Amp\Parallel\Worker\Pool; use Amp\Parallel\Worker\TaskException; use Amp\Parallel\Worker\WorkerException; use Amp\Promise; use Amp\Success; use function Amp\call; class ParallelDriver implements Driver { /** * @var \Amp\Parallel\Worker\Pool */ private $pool; /** * @param \Amp\Parallel\Worker\Pool|null $pool */ public function __construct(Pool $pool = null) { $this->pool = $pool ?: Worker\pool(); } /** * {@inheritdoc} */ public function open(string $path, string $mode): Promise { return call(function () use ($path, $mode) { $worker = $this->pool->getWorker(); try { list($id, $size, $mode) = yield $worker->enqueue(new Internal\FileTask("fopen", [$path, $mode])); } catch (TaskException $exception) { throw new FilesystemException("Could not open file", $exception); } catch (WorkerException $exception) { throw new FilesystemException("Could not send open request to worker", $exception); } return new ParallelHandle($worker, $id, $path, $size, $mode); }); } private function runFileTask(Internal\FileTask $task): \Generator { try { return yield $this->pool->enqueue($task); } catch (TaskException $exception) { throw new FilesystemException("The file operation failed", $exception); } catch (WorkerException $exception) { throw new FilesystemException("Could not send the file task to worker", $exception); } } /** * {@inheritdoc} */ public function unlink(string $path): Promise { return call(function () use ($path) { $result = yield from $this->runFileTask(new Internal\FileTask("unlink", [$path])); StatCache::clear($path); return $result; }); } /** * {@inheritdoc} */ public function stat(string $path): Promise { if ($stat = StatCache::get($path)) { return new Success($stat); } return call(function () use ($path) { $stat = yield from $this->runFileTask(new Internal\FileTask("stat", [$path])); if (!empty($stat)) { StatCache::set($path, $stat); } return $stat; }); } /** * {@inheritdoc} */ public function rename(string $from, string $to): Promise { return new Coroutine($this->runFileTask(new Internal\FileTask("rename", [$from, $to]))); } /** * {@inheritdoc} */ public function isfile(string $path): Promise { return call(function () use ($path) { $stat = yield $this->stat($path); if (empty($stat)) { return false; } if ($stat["mode"] & 0100000) { return true; } return false; }); } /** * {@inheritdoc} */ public function isdir(string $path): Promise { return call(function () use ($path) { $stat = yield $this->stat($path); if (empty($stat)) { return false; } if ($stat["mode"] & 0040000) { return true; } return false; }); } /** * {@inheritdoc} */ public function link(string $target, string $link): Promise { return new Coroutine($this->runFileTask(new Internal\FileTask("link", [$target, $link]))); } /** * {@inheritdoc} */ public function symlink(string $target, string $link): Promise { return new Coroutine($this->runFileTask(new Internal\FileTask("symlink", [$target, $link]))); } /** * {@inheritdoc} */ public function readlink(string $path): Promise { return new Coroutine($this->runFileTask(new Internal\FileTask("readlink", [$path]))); } /** * {@inheritdoc} */ public function mkdir(string $path, int $mode = 0777, bool $recursive = false): Promise { return new Coroutine($this->runFileTask(new Internal\FileTask("mkdir", [$path, $mode, $recursive]))); } /** * {@inheritdoc} */ public function scandir(string $path): Promise { return new Coroutine($this->runFileTask(new Internal\FileTask("scandir", [$path]))); } /** * {@inheritdoc} */ public function rmdir(string $path): Promise { return call(function () use ($path) { $result = yield from $this->runFileTask(new Internal\FileTask("rmdir", [$path])); StatCache::clear($path); return $result; }); } /** * {@inheritdoc} */ public function chmod(string $path, int $mode): Promise { return new Coroutine($this->runFileTask(new Internal\FileTask("chmod", [$path, $mode]))); } /** * {@inheritdoc} */ public function chown(string $path, int $uid, int $gid): Promise { return new Coroutine($this->runFileTask(new Internal\FileTask("chown", [$path, $uid, $gid]))); } /** * {@inheritdoc} */ public function exists(string $path): Promise { return new Coroutine($this->runFileTask(new Internal\FileTask("exists", [$path]))); } /** * {@inheritdoc} */ public function size(string $path): Promise { return call(function () use ($path) { $stat = yield $this->stat($path); if (empty($stat)) { throw new FilesystemException("Specified path does not exist"); } if ($stat["mode"] & 0100000) { return $stat["size"]; } throw new FilesystemException("Specified path is not a regular file"); }); } /** * {@inheritdoc} */ public function mtime(string $path): Promise { return call(function () use ($path) { $stat = yield $this->stat($path); if (empty($stat)) { throw new FilesystemException("Specified path does not exist"); } return $stat["mtime"]; }); } /** * {@inheritdoc} */ public function atime(string $path): Promise { return call(function () use ($path) { $stat = yield $this->stat($path); if (empty($stat)) { throw new FilesystemException("Specified path does not exist"); } return $stat["atime"]; }); } /** * {@inheritdoc} */ public function ctime(string $path): Promise { return call(function () use ($path) { $stat = yield $this->stat($path); if (empty($stat)) { throw new FilesystemException("Specified path does not exist"); } return $stat["ctime"]; }); } /** * {@inheritdoc} */ public function lstat(string $path): Promise { return new Coroutine($this->runFileTask(new Internal\FileTask("lstat", [$path]))); } /** * {@inheritdoc} */ public function touch(string $path, int $time = null, int $atime = null): Promise { return new Coroutine($this->runFileTask(new Internal\FileTask("touch", [$path, $time, $atime]))); } /** * {@inheritdoc} */ public function get(string $path): Promise { return new Coroutine($this->runFileTask(new Internal\FileTask("get", [$path]))); } /** * {@inheritdoc} */ public function put(string $path, string $contents): Promise { return new Coroutine($this->runFileTask(new Internal\FileTask("put", [$path, $contents]))); } } { "name": "amphp/process", "homepage": "https://github.com/amphp/process", "description": "Asynchronous process manager.", "require": { "php": ">=7", "amphp/amp": "^2", "amphp/byte-stream": "^1.4" }, "require-dev": { "phpunit/phpunit": "^6", "amphp/phpunit-util": "^1", "amphp/php-cs-fixer-config": "dev-master" }, "license": "MIT", "authors": [ { "name": "Bob Weinand", "email": "bobwei9@hotmail.com" }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" }, { "name": "Niklas Keller", "email": "me@kelunik.com" } ], "autoload": { "psr-4": { "Amp\\Process\\": "lib" }, "files": ["lib/constants.php"] }, "autoload-dev": { "psr-4": { "Amp\\Process\\Test\\": "test" } }, "config": { "platform": { "php": "7.0.0" } }, "scripts": { "check": [ "@cs", "@test" ], "cs": "php-cs-fixer fix -v --diff --dry-run", "cs-fix": "php-cs-fixer fix -v --diff", "test": "@php -dzend.assertions=1 -dassert.exception=1 ./vendor/bin/phpunit --coverage-text" } } <?php namespace Amp\Process; const BIN_DIR = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bin'; <?php namespace Amp\Process\Internal; use Amp\Process\ProcessException; use Amp\Promise; interface ProcessRunner { /** * Start a process using the supplied parameters. * * @param string $command The command to execute. * @param string|null $cwd The working directory for the child process. * @param array $env Environment variables to pass to the child process. * @param array $options `proc_open()` options. * * @return ProcessHandle * * @throws ProcessException If starting the process fails. */ public function start(string $command, string $cwd = null, array $env = [], array $options = []): ProcessHandle; /** * Wait for the child process to end. * * @param ProcessHandle $handle The process descriptor. * * @return Promise <int> Succeeds with exit code of the process or fails if the process is killed. */ public function join(ProcessHandle $handle): Promise; /** * Forcibly end the child process. * * @param ProcessHandle $handle The process descriptor. * * @throws ProcessException If terminating the process fails. */ public function kill(ProcessHandle $handle); /** * Send a signal signal to the child process. * * @param ProcessHandle $handle The process descriptor. * @param int $signo Signal number to send to process. * * @throws ProcessException If sending the signal fails. */ public function signal(ProcessHandle $handle, int $signo); /** * Release all resources held by the process handle. * * @param ProcessHandle $handle The process descriptor. */ public function destroy(ProcessHandle $handle); } <?php namespace Amp\Process\Internal\Posix; use Amp\ByteStream\ResourceInputStream; use Amp\ByteStream\ResourceOutputStream; use Amp\Deferred; use Amp\Loop; use Amp\Process\Internal\ProcessHandle; use Amp\Process\Internal\ProcessRunner; use Amp\Process\Internal\ProcessStatus; use Amp\Process\ProcessException; use Amp\Process\ProcessInputStream; use Amp\Process\ProcessOutputStream; use Amp\Promise; /** @internal */ final class Runner implements ProcessRunner { const FD_SPEC = [ ["pipe", "r"], // stdin ["pipe", "w"], // stdout ["pipe", "w"], // stderr ["pipe", "w"], // exit code pipe ]; public static function onProcessEndExtraDataPipeReadable($watcher, $stream, Handle $handle) { Loop::cancel($watcher); $handle->extraDataPipeWatcher = null; $handle->status = ProcessStatus::ENDED; if (!\is_resource($stream) || \feof($stream)) { $handle->joinDeferred->fail(new ProcessException("Process ended unexpectedly")); } else { $handle->joinDeferred->resolve((int) \rtrim(@\stream_get_contents($stream))); } } public static function onProcessStartExtraDataPipeReadable($watcher, $stream, $data) { Loop::cancel($watcher); $pid = \rtrim(@\fgets($stream)); /** @var $deferreds Deferred[] */ list($handle, $pipes, $deferreds) = $data; if (!$pid || !\is_numeric($pid)) { $error = new ProcessException("Could not determine PID"); $handle->pidDeferred->fail($error); foreach ($deferreds as $deferred) { /** @var $deferred Deferred */ $deferred->fail($error); } if ($handle->status < ProcessStatus::ENDED) { $handle->status = ProcessStatus::ENDED; $handle->joinDeferred->fail($error); } return; } $handle->status = ProcessStatus::RUNNING; $handle->pidDeferred->resolve((int) $pid); $deferreds[0]->resolve($pipes[0]); $deferreds[1]->resolve($pipes[1]); $deferreds[2]->resolve($pipes[2]); if ($handle->extraDataPipeWatcher !== null) { Loop::enable($handle->extraDataPipeWatcher); } } /** @inheritdoc */ public function start(string $command, string $cwd = null, array $env = [], array $options = []): ProcessHandle { $command = \sprintf( '{ (%s) <&3 3<&- 3>/dev/null & } 3<&0;' . 'pid=$!; echo $pid >&3; wait $pid; RC=$?; echo $RC >&3; exit $RC', $command ); $handle = new Handle; $handle->proc = @\proc_open($command, self::FD_SPEC, $pipes, $cwd ?: null, $env ?: null, $options); if (!\is_resource($handle->proc)) { $message = "Could not start process"; if ($error = \error_get_last()) { $message .= \sprintf(" Errno: %d; %s", $error["type"], $error["message"]); } throw new ProcessException($message); } $status = \proc_get_status($handle->proc); if (!$status) { \proc_close($handle->proc); throw new ProcessException("Could not get process status"); } $stdinDeferred = new Deferred; $handle->stdin = new ProcessOutputStream($stdinDeferred->promise()); $stdoutDeferred = new Deferred; $handle->stdout = new ProcessInputStream($stdoutDeferred->promise()); $stderrDeferred = new Deferred; $handle->stderr = new ProcessInputStream($stderrDeferred->promise()); $handle->extraDataPipe = $pipes[3]; \stream_set_blocking($pipes[3], false); $handle->extraDataPipeStartWatcher = Loop::onReadable($pipes[3], [self::class, 'onProcessStartExtraDataPipeReadable'], [$handle, [ new ResourceOutputStream($pipes[0]), new ResourceInputStream($pipes[1]), new ResourceInputStream($pipes[2]), ], [ $stdinDeferred, $stdoutDeferred, $stderrDeferred ]]); $handle->extraDataPipeWatcher = Loop::onReadable($pipes[3], [self::class, 'onProcessEndExtraDataPipeReadable'], $handle); Loop::unreference($handle->extraDataPipeWatcher); Loop::disable($handle->extraDataPipeWatcher); return $handle; } /** @inheritdoc */ public function join(ProcessHandle $handle): Promise { /** @var Handle $handle */ if ($handle->extraDataPipeWatcher !== null) { Loop::reference($handle->extraDataPipeWatcher); } return $handle->joinDeferred->promise(); } /** @inheritdoc */ public function kill(ProcessHandle $handle) { /** @var Handle $handle */ if ($handle->extraDataPipeWatcher !== null) { Loop::cancel($handle->extraDataPipeWatcher); $handle->extraDataPipeWatcher = null; } /** @var Handle $handle */ if ($handle->extraDataPipeStartWatcher !== null) { Loop::cancel($handle->extraDataPipeStartWatcher); $handle->extraDataPipeStartWatcher = null; } if (!\proc_terminate($handle->proc, 9)) { // Forcefully kill the process using SIGKILL. throw new ProcessException("Terminating process failed"); } if ($handle->status < ProcessStatus::ENDED) { $handle->status = ProcessStatus::ENDED; $handle->joinDeferred->fail(new ProcessException("The process was killed")); } $this->free($handle); } /** @inheritdoc */ public function signal(ProcessHandle $handle, int $signo) { /** @var Handle $handle */ if (!\proc_terminate($handle->proc, $signo)) { throw new ProcessException("Sending signal to process failed"); } } /** @inheritdoc */ public function destroy(ProcessHandle $handle) { /** @var Handle $handle */ if ($handle->status < ProcessStatus::ENDED && \getmypid() === $handle->originalParentPid) { try { $this->kill($handle); return; } catch (ProcessException $e) { // ignore } } $this->free($handle); } private function free(Handle $handle) { /** @var Handle $handle */ if ($handle->extraDataPipeWatcher !== null) { Loop::cancel($handle->extraDataPipeWatcher); $handle->extraDataPipeWatcher = null; } /** @var Handle $handle */ if ($handle->extraDataPipeStartWatcher !== null) { Loop::cancel($handle->extraDataPipeStartWatcher); $handle->extraDataPipeStartWatcher = null; } if (\is_resource($handle->extraDataPipe)) { \fclose($handle->extraDataPipe); } $handle->stdin->close(); $handle->stdout->close(); $handle->stderr->close(); if (\is_resource($handle->proc)) { \proc_close($handle->proc); } } } <?php namespace Amp\Process\Internal\Posix; use Amp\Deferred; use Amp\Process\Internal\ProcessHandle; /** @internal */ final class Handle extends ProcessHandle { public function __construct() { $this->pidDeferred = new Deferred; $this->joinDeferred = new Deferred; $this->originalParentPid = \getmypid(); } /** @var Deferred */ public $joinDeferred; /** @var resource */ public $proc; /** @var resource */ public $extraDataPipe; /** @var string */ public $extraDataPipeWatcher; /** @var string */ public $extraDataPipeStartWatcher; /** @var int */ public $originalParentPid; } <?php namespace Amp\Process\Internal\Windows; use Amp\Deferred; use Amp\Loop; use Amp\Process\Internal\ProcessHandle; use Amp\Process\Internal\ProcessRunner; use Amp\Process\Internal\ProcessStatus; use Amp\Process\ProcessException; use Amp\Process\ProcessInputStream; use Amp\Process\ProcessOutputStream; use Amp\Promise; use const Amp\Process\BIN_DIR; /** * @internal * @codeCoverageIgnore Windows only. */ final class Runner implements ProcessRunner { const FD_SPEC = [ ["pipe", "r"], // stdin ["pipe", "w"], // stdout ["pipe", "w"], // stderr ["pipe", "w"], // exit code pipe ]; const WRAPPER_EXE_PATH = PHP_INT_SIZE === 8 ? BIN_DIR . '\\windows\\ProcessWrapper64.exe' : BIN_DIR . '\\windows\\ProcessWrapper.exe'; private static $pharWrapperPath; private $socketConnector; private function makeCommand(string $workingDirectory): string { $wrapperPath = self::WRAPPER_EXE_PATH; // We can't execute the exe from within the PHAR, so copy it out... if (\strncmp($wrapperPath, "phar://", 7) === 0) { if (self::$pharWrapperPath === null) { self::$pharWrapperPath = \tempnam(\sys_get_temp_dir(), "amphp-process-wrapper-"); \copy(self::WRAPPER_EXE_PATH, self::$pharWrapperPath); \register_shutdown_function(static function () { @\unlink(self::$pharWrapperPath); }); } $wrapperPath = self::$pharWrapperPath; } $result = \sprintf( '%s --address=%s --port=%d --token-size=%d', \escapeshellarg($wrapperPath), $this->socketConnector->address, $this->socketConnector->port, SocketConnector::SECURITY_TOKEN_SIZE ); if ($workingDirectory !== '') { $result .= ' ' . \escapeshellarg('--cwd=' . \rtrim($workingDirectory, '\\')); } return $result; } public function __construct() { $this->socketConnector = new SocketConnector; } /** @inheritdoc */ public function start(string $command, string $cwd = null, array $env = [], array $options = []): ProcessHandle { if (\strpos($command, "\0") !== false) { throw new ProcessException("Can't execute commands that contain null bytes."); } $options['bypass_shell'] = true; $handle = new Handle; $handle->proc = @\proc_open($this->makeCommand($cwd ?? ''), self::FD_SPEC, $pipes, $cwd ?: null, $env ?: null, $options); if (!\is_resource($handle->proc)) { $message = "Could not start process"; if ($error = \error_get_last()) { $message .= \sprintf(" Errno: %d; %s", $error["type"], $error["message"]); } throw new ProcessException($message); } $status = \proc_get_status($handle->proc); if (!$status) { \proc_close($handle->proc); throw new ProcessException("Could not get process status"); } $securityTokens = \random_bytes(SocketConnector::SECURITY_TOKEN_SIZE * 6); $written = \fwrite($pipes[0], $securityTokens . "\0" . $command . "\0"); \fclose($pipes[0]); \fclose($pipes[1]); if ($written !== SocketConnector::SECURITY_TOKEN_SIZE * 6 + \strlen($command) + 2) { \fclose($pipes[2]); \proc_close($handle->proc); throw new ProcessException("Could not send security tokens / command to process wrapper"); } $handle->securityTokens = \str_split($securityTokens, SocketConnector::SECURITY_TOKEN_SIZE); $handle->wrapperPid = $status['pid']; $handle->wrapperStderrPipe = $pipes[2]; $stdinDeferred = new Deferred; $handle->stdioDeferreds[] = $stdinDeferred; $handle->stdin = new ProcessOutputStream($stdinDeferred->promise()); $stdoutDeferred = new Deferred; $handle->stdioDeferreds[] = $stdoutDeferred; $handle->stdout = new ProcessInputStream($stdoutDeferred->promise()); $stderrDeferred = new Deferred; $handle->stdioDeferreds[] = $stderrDeferred; $handle->stderr = new ProcessInputStream($stderrDeferred->promise()); $this->socketConnector->registerPendingProcess($handle); return $handle; } /** @inheritdoc */ public function join(ProcessHandle $handle): Promise { /** @var Handle $handle */ $handle->exitCodeRequested = true; if ($handle->exitCodeWatcher !== null) { Loop::reference($handle->exitCodeWatcher); } return $handle->joinDeferred->promise(); } /** @inheritdoc */ public function kill(ProcessHandle $handle) { /** @var Handle $handle */ // todo: send a signal to the wrapper to kill the child instead? if (!\proc_terminate($handle->proc)) { throw new ProcessException("Terminating process failed"); } $failStart = false; if ($handle->childPidWatcher !== null) { Loop::cancel($handle->childPidWatcher); $handle->childPidWatcher = null; $handle->pidDeferred->fail(new ProcessException("The process was killed")); $failStart = true; } if ($handle->exitCodeWatcher !== null) { Loop::cancel($handle->exitCodeWatcher); $handle->exitCodeWatcher = null; $handle->joinDeferred->fail(new ProcessException("The process was killed")); } $handle->status = ProcessStatus::ENDED; if ($failStart || $handle->stdioDeferreds) { $this->socketConnector->failHandleStart($handle, "The process was killed"); } $this->free($handle); } /** @inheritdoc */ public function signal(ProcessHandle $handle, int $signo) { throw new ProcessException('Signals are not supported on Windows'); } /** @inheritdoc */ public function destroy(ProcessHandle $handle) { /** @var Handle $handle */ if ($handle->status < ProcessStatus::ENDED && \is_resource($handle->proc)) { try { $this->kill($handle); return; } catch (ProcessException $e) { // ignore } } $this->free($handle); } private function free(Handle $handle) { if ($handle->childPidWatcher !== null) { Loop::cancel($handle->childPidWatcher); $handle->childPidWatcher = null; } if ($handle->exitCodeWatcher !== null) { Loop::cancel($handle->exitCodeWatcher); $handle->exitCodeWatcher = null; } $handle->stdin->close(); $handle->stdout->close(); $handle->stderr->close(); foreach ($handle->sockets as $socket) { @\fclose($socket); } @\fclose($handle->wrapperStderrPipe); if (\is_resource($handle->proc)) { \proc_close($handle->proc); } } } <?php namespace Amp\Process\Internal\Windows; use Amp\Struct; /** * @internal * @codeCoverageIgnore Windows only. */ final class PendingSocketClient { use Struct; public $readWatcher; public $timeoutWatcher; public $receivedDataBuffer = ''; public $pid; public $streamId; } <?php namespace Amp\Process\Internal\Windows; use Amp\Deferred; use Amp\Process\Internal\ProcessHandle; /** * @internal * @codeCoverageIgnore Windows only. */ final class Handle extends ProcessHandle { public function __construct() { $this->joinDeferred = new Deferred; $this->pidDeferred = new Deferred; } /** @var Deferred */ public $joinDeferred; /** @var string */ public $exitCodeWatcher; /** @var bool */ public $exitCodeRequested = false; /** @var resource */ public $proc; /** @var int */ public $wrapperPid; /** @var resource */ public $wrapperStderrPipe; /** @var resource[] */ public $sockets = []; /** @var Deferred[] */ public $stdioDeferreds; /** @var string */ public $childPidWatcher; /** @var string */ public $connectTimeoutWatcher; /** @var string[] */ public $securityTokens; } <?php namespace Amp\Process\Internal\Windows; /** * @internal * @codeCoverageIgnore Windows only. */ final class HandshakeStatus { const SUCCESS = 0; const SIGNAL_UNEXPECTED = 0x01; const INVALID_STREAM_ID = 0x02; const INVALID_PROCESS_ID = 0x03; const DUPLICATE_STREAM_ID = 0x04; const INVALID_CLIENT_TOKEN = 0x05; private function __construct() { // empty to prevent instances of this class } } <?php namespace Amp\Process\Internal\Windows; /** * @internal * @codeCoverageIgnore Windows only. */ final class SignalCode { const HANDSHAKE = 0x01; const HANDSHAKE_ACK = 0x02; const CHILD_PID = 0x03; const EXIT_CODE = 0x04; private function __construct() { // empty to prevent instances of this class } } <?php namespace Amp\Process\Internal\Windows; use Amp\ByteStream\ResourceInputStream; use Amp\ByteStream\ResourceOutputStream; use Amp\Loop; use Amp\Process\Internal\ProcessStatus; use Amp\Process\ProcessException; /** * @internal * @codeCoverageIgnore Windows only. */ final class SocketConnector { const SERVER_SOCKET_URI = 'tcp://127.0.0.1:0'; const SECURITY_TOKEN_SIZE = 16; const CONNECT_TIMEOUT = 1000; /** @var resource */ private $server; /** @var PendingSocketClient[] */ private $pendingClients = []; /** @var Handle[] */ private $pendingProcesses = []; /** @var string */ public $address; /** @var int */ public $port; public function __construct() { $flags = \STREAM_SERVER_LISTEN | \STREAM_SERVER_BIND; $this->server = \stream_socket_server(self::SERVER_SOCKET_URI, $errNo, $errStr, $flags); if (!$this->server) { throw new \Error("Failed to create TCP server socket for process wrapper: {$errNo}: {$errStr}"); } if (!\stream_set_blocking($this->server, false)) { throw new \Error("Failed to set server socket to non-blocking mode"); } list($this->address, $this->port) = \explode(':', \stream_socket_get_name($this->server, false)); $this->port = (int) $this->port; Loop::unreference(Loop::onReadable($this->server, [$this, 'onServerSocketReadable'])); } private function failClientHandshake($socket, int $code) { \fwrite($socket, \chr(SignalCode::HANDSHAKE_ACK) . \chr($code)); \fclose($socket); unset($this->pendingClients[(int) $socket]); } public function failHandleStart(Handle $handle, string $message,...$args) { Loop::cancel($handle->connectTimeoutWatcher); unset($this->pendingProcesses[$handle->wrapperPid]); foreach ($handle->sockets as $socket) { \fclose($socket); } $error = new ProcessException(\vsprintf($message, $args)); $deferreds = $handle->stdioDeferreds; $deferreds[] = $handle->joinDeferred; $handle->stdioDeferreds = []; foreach ($deferreds as $deferred) { $deferred->fail($error); } } /** * Read data from a client socket. * * This method cleans up internal state as appropriate. Returns null if the read fails or needs to be repeated. * * @param resource $socket * @param int $length * @param PendingSocketClient $state * * @return string|null */ private function readDataFromPendingClient($socket, int $length, PendingSocketClient $state) { $data = \fread($socket, $length); if ($data === false || $data === '') { return null; } $data = $state->receivedDataBuffer . $data; if (\strlen($data) < $length) { $state->receivedDataBuffer = $data; return null; } $state->receivedDataBuffer = ''; Loop::cancel($state->readWatcher); return $data; } public function onReadableHandshake($watcher, $socket) { $socketId = (int) $socket; $pendingClient = $this->pendingClients[$socketId]; if (null === $data = $this->readDataFromPendingClient($socket, self::SECURITY_TOKEN_SIZE + 6, $pendingClient)) { return; } $packet = \unpack('Csignal/Npid/Cstream_id/a*client_token', $data); // validate the client's handshake if ($packet['signal'] !== SignalCode::HANDSHAKE) { $this->failClientHandshake($socket, HandshakeStatus::SIGNAL_UNEXPECTED); return; } if ($packet['stream_id'] > 2) { $this->failClientHandshake($socket, HandshakeStatus::INVALID_STREAM_ID); return; } if (!isset($this->pendingProcesses[$packet['pid']])) { $this->failClientHandshake($socket, HandshakeStatus::INVALID_PROCESS_ID); return; } $handle = $this->pendingProcesses[$packet['pid']]; if (isset($handle->sockets[$packet['stream_id']])) { $this->failClientHandshake($socket, HandshakeStatus::DUPLICATE_STREAM_ID); \trigger_error(\sprintf( "%s: Received duplicate socket for process #%s stream #%d", self::class, $handle->pid, $packet['stream_id'] ), E_USER_WARNING); return; } if (!\hash_equals($packet['client_token'], $handle->securityTokens[$packet['stream_id']])) { $this->failClientHandshake($socket, HandshakeStatus::INVALID_CLIENT_TOKEN); $this->failHandleStart($handle, "Invalid client security token for stream #%d", $packet['stream_id']); return; } $ackData = \chr(SignalCode::HANDSHAKE_ACK) . \chr(HandshakeStatus::SUCCESS) . $handle->securityTokens[$packet['stream_id'] + 3]; // Unless we set the security token size so high that it won't fit in the // buffer, this probably shouldn't ever happen unless something has gone wrong if (\fwrite($socket, $ackData) !== self::SECURITY_TOKEN_SIZE + 2) { unset($this->pendingClients[$socketId]); return; } $pendingClient->pid = $packet['pid']; $pendingClient->streamId = $packet['stream_id']; $pendingClient->readWatcher = Loop::onReadable($socket, [$this, 'onReadableHandshakeAck']); } public function onReadableHandshakeAck($watcher, $socket) { $socketId = (int) $socket; $pendingClient = $this->pendingClients[$socketId]; // can happen if the start promise was failed if (!isset($this->pendingProcesses[$pendingClient->pid]) || $this->pendingProcesses[$pendingClient->pid]->status === ProcessStatus::ENDED) { \fclose($socket); Loop::cancel($watcher); Loop::cancel($pendingClient->timeoutWatcher); unset($this->pendingClients[$socketId]); return; } if (null === $data = $this->readDataFromPendingClient($socket, 2, $pendingClient)) { return; } Loop::cancel($pendingClient->timeoutWatcher); unset($this->pendingClients[$socketId]); $handle = $this->pendingProcesses[$pendingClient->pid]; $packet = \unpack('Csignal/Cstatus', $data); if ($packet['signal'] !== SignalCode::HANDSHAKE_ACK || $packet['status'] !== HandshakeStatus::SUCCESS) { $this->failHandleStart( $handle, "Client rejected handshake with code %d for stream #%d", $packet['status'], $pendingClient->streamId ); return; } $handle->sockets[$pendingClient->streamId] = $socket; if (\count($handle->sockets) === 3) { $handle->childPidWatcher = Loop::onReadable($handle->sockets[0], [$this, 'onReadableChildPid'], $handle); $deferreds = $handle->stdioDeferreds; $handle->stdioDeferreds = []; // clear, so there's no double resolution if process spawn fails $deferreds[0]->resolve(new ResourceOutputStream($handle->sockets[0])); $deferreds[1]->resolve(new ResourceInputStream($handle->sockets[1])); $deferreds[2]->resolve(new ResourceInputStream($handle->sockets[2])); } } public function onReadableChildPid($watcher, $socket, Handle $handle) { $data = \fread($socket, 5); if ($data === false || $data === '') { return; } Loop::cancel($handle->childPidWatcher); Loop::cancel($handle->connectTimeoutWatcher); $handle->childPidWatcher = null; if (\strlen($data) !== 5) { $this->failHandleStart( $handle, 'Failed to read PID from wrapper: Received %d of 5 expected bytes', \strlen($data) ); return; } $packet = \unpack('Csignal/Npid', $data); if ($packet['signal'] !== SignalCode::CHILD_PID) { $this->failHandleStart( $handle, "Failed to read PID from wrapper: Unexpected signal code %d", $packet['signal'] ); return; } // Required, because a process might be destroyed while starting if ($handle->status === ProcessStatus::STARTING) { $handle->status = ProcessStatus::RUNNING; $handle->exitCodeWatcher = Loop::onReadable($handle->sockets[0], [$this, 'onReadableExitCode'], $handle); if (!$handle->exitCodeRequested) { Loop::unreference($handle->exitCodeWatcher); } } $handle->pidDeferred->resolve($packet['pid']); unset($this->pendingProcesses[$handle->wrapperPid]); } public function onReadableExitCode($watcher, $socket, Handle $handle) { $data = \fread($socket, 5); if ($data === false || $data === '') { return; } Loop::cancel($handle->exitCodeWatcher); $handle->exitCodeWatcher = null; if (\strlen($data) !== 5) { $handle->status = ProcessStatus::ENDED; $handle->joinDeferred->fail(new ProcessException( \sprintf('Failed to read exit code from wrapper: Received %d of 5 expected bytes', \strlen($data)) )); return; } $packet = \unpack('Csignal/Ncode', $data); if ($packet['signal'] !== SignalCode::EXIT_CODE) { $this->failHandleStart( $handle, "Failed to read exit code from wrapper: Unexpected signal code %d", $packet['signal'] ); return; } $handle->status = ProcessStatus::ENDED; $handle->joinDeferred->resolve($packet['code']); $handle->stdin->close(); $handle->stdout->close(); $handle->stderr->close(); // Explicitly \fclose() sockets, as resource streams shut only one side down. foreach ($handle->sockets as $sock) { @\fclose($sock); } } public function onClientSocketConnectTimeout($watcher, $socket) { $id = (int) $socket; Loop::cancel($this->pendingClients[$id]->readWatcher); unset($this->pendingClients[$id]); \fclose($socket); } public function onServerSocketReadable() { $socket = \stream_socket_accept($this->server); if (!\stream_set_blocking($socket, false)) { throw new \Error("Failed to set client socket to non-blocking mode"); } $pendingClient = new PendingSocketClient; $pendingClient->readWatcher = Loop::onReadable($socket, [$this, 'onReadableHandshake']); $pendingClient->timeoutWatcher = Loop::delay(self::CONNECT_TIMEOUT, [$this, 'onClientSocketConnectTimeout'], $socket); $this->pendingClients[(int) $socket] = $pendingClient; } public function onProcessConnectTimeout($watcher, Handle $handle) { $running = \is_resource($handle->proc) && \proc_get_status($handle->proc)['running']; $error = null; if (!$running) { $error = \stream_get_contents($handle->wrapperStderrPipe); } $error = $error ?: 'Process did not connect to server before timeout elapsed'; foreach ($handle->sockets as $socket) { \fclose($socket); } $error = new ProcessException(\trim($error)); foreach ($handle->stdioDeferreds as $deferred) { $deferred->fail($error); } \fclose($handle->wrapperStderrPipe); \proc_close($handle->proc); $handle->joinDeferred->fail($error); } public function registerPendingProcess(Handle $handle) { // Use Loop::defer() to start the timeout only after the loop has ticked once. This prevents issues with many // things started at once, see https://github.com/amphp/process/issues/21. $handle->connectTimeoutWatcher = Loop::defer(function () use ($handle) { $handle->connectTimeoutWatcher = Loop::delay( self::CONNECT_TIMEOUT, [$this, 'onProcessConnectTimeout'], $handle ); }); $this->pendingProcesses[$handle->wrapperPid] = $handle; } } <?php namespace Amp\Process\Internal; use Amp\Deferred; use Amp\Process\ProcessInputStream; use Amp\Process\ProcessOutputStream; use Amp\Struct; abstract class ProcessHandle { use Struct; /** @var ProcessOutputStream */ public $stdin; /** @var ProcessInputStream */ public $stdout; /** @var ProcessInputStream */ public $stderr; /** @var Deferred */ public $pidDeferred; /** @var int */ public $status = ProcessStatus::STARTING; } <?php namespace Amp\Process\Internal; final class ProcessStatus { const STARTING = 0; const RUNNING = 1; const ENDED = 2; private function __construct() { // empty to prevent instances of this class } } <?php namespace Amp\Process; use Amp\ByteStream\ClosedException; use Amp\ByteStream\OutputStream; use Amp\ByteStream\ResourceOutputStream; use Amp\ByteStream\StreamException; use Amp\Deferred; use Amp\Failure; use Amp\Promise; final class ProcessOutputStream implements OutputStream { /** @var \SplQueue */ private $queuedWrites; /** @var bool */ private $shouldClose = false; /** @var ResourceOutputStream */ private $resourceStream; /** @var StreamException|null */ private $error; public function __construct(Promise $resourceStreamPromise) { $this->queuedWrites = new \SplQueue; $resourceStreamPromise->onResolve(function ($error, $resourceStream) { if ($error) { $this->error = new StreamException("Failed to launch process", 0, $error); while (!$this->queuedWrites->isEmpty()) { list(, $deferred) = $this->queuedWrites->shift(); $deferred->fail($this->error); } return; } while (!$this->queuedWrites->isEmpty()) { /** * @var string $data * @var \Amp\Deferred $deferred */ list($data, $deferred) = $this->queuedWrites->shift(); $deferred->resolve($resourceStream->write($data)); } $this->resourceStream = $resourceStream; if ($this->shouldClose) { $this->resourceStream->close(); } }); } /** @inheritdoc */ public function write(string $data): Promise { if ($this->resourceStream) { return $this->resourceStream->write($data); } if ($this->error) { return new Failure($this->error); } if ($this->shouldClose) { throw new ClosedException("Stream has already been closed."); } $deferred = new Deferred; $this->queuedWrites->push([$data, $deferred]); return $deferred->promise(); } /** @inheritdoc */ public function end(string $finalData = ""): Promise { if ($this->resourceStream) { return $this->resourceStream->end($finalData); } if ($this->error) { return new Failure($this->error); } if ($this->shouldClose) { throw new ClosedException("Stream has already been closed."); } $deferred = new Deferred; $this->queuedWrites->push([$finalData, $deferred]); $this->shouldClose = true; return $deferred->promise(); } public function close() { $this->shouldClose = true; if ($this->resourceStream) { $this->resourceStream->close(); } elseif (!$this->queuedWrites->isEmpty()) { $error = new ClosedException("Stream closed."); do { list(, $deferred) = $this->queuedWrites->shift(); $deferred->fail($error); } while (!$this->queuedWrites->isEmpty()); } } } <?php namespace Amp\Process; use Amp\ByteStream\InputStream; use Amp\ByteStream\PendingReadError; use Amp\ByteStream\ResourceInputStream; use Amp\ByteStream\StreamException; use Amp\Deferred; use Amp\Failure; use Amp\Promise; use Amp\Success; final class ProcessInputStream implements InputStream { /** @var Deferred */ private $initialRead; /** @var bool */ private $shouldClose = false; /** @var bool */ private $referenced = true; /** @var ResourceInputStream */ private $resourceStream; /** @var StreamException|null */ private $error; public function __construct(Promise $resourceStreamPromise) { $resourceStreamPromise->onResolve(function ($error, $resourceStream) { if ($error) { $this->error = new StreamException("Failed to launch process", 0, $error); if ($this->initialRead) { $initialRead = $this->initialRead; $this->initialRead = null; $initialRead->fail($this->error); } return; } $this->resourceStream = $resourceStream; if (!$this->referenced) { $this->resourceStream->unreference(); } if ($this->shouldClose) { $this->resourceStream->close(); } if ($this->initialRead) { $initialRead = $this->initialRead; $this->initialRead = null; $initialRead->resolve($this->shouldClose ? null : $this->resourceStream->read()); } }); } /** * Reads data from the stream. * * @return Promise Resolves with a string when new data is available or `null` if the stream has closed. * * @throws PendingReadError Thrown if another read operation is still pending. */ public function read(): Promise { if ($this->initialRead) { throw new PendingReadError; } if ($this->error) { return new Failure($this->error); } if ($this->resourceStream) { return $this->resourceStream->read(); } if ($this->shouldClose) { return new Success; // Resolve reads on closed streams with null. } $this->initialRead = new Deferred; return $this->initialRead->promise(); } public function reference() { $this->referenced = true; if ($this->resourceStream) { $this->resourceStream->reference(); } } public function unreference() { $this->referenced = false; if ($this->resourceStream) { $this->resourceStream->unreference(); } } public function close() { $this->shouldClose = true; if ($this->initialRead) { $initialRead = $this->initialRead; $this->initialRead = null; $initialRead->resolve(); } if ($this->resourceStream) { $this->resourceStream->close(); } } } <?php namespace Amp\Process; class ProcessException extends \Exception { } <?php namespace Amp\Process; use Amp\Loop; use Amp\Process\Internal\Posix\Runner as PosixProcessRunner; use Amp\Process\Internal\ProcessHandle; use Amp\Process\Internal\ProcessRunner; use Amp\Process\Internal\ProcessStatus; use Amp\Process\Internal\Windows\Runner as WindowsProcessRunner; use Amp\Promise; use function Amp\call; final class Process { /** @var ProcessRunner */ private $processRunner; /** @var string */ private $command; /** @var string */ private $cwd = ""; /** @var array */ private $env = []; /** @var array */ private $options; /** @var ProcessHandle */ private $handle; /** @var int|null */ private $pid; /** * @param string|string[] $command Command to run. * @param string|null $cwd Working directory or use an empty string to use the working directory of the * parent. * @param mixed[] $env Environment variables or use an empty array to inherit from the parent. * @param mixed[] $options Options for `proc_open()`. * * @throws \Error If the arguments are invalid. */ public function __construct($command, string $cwd = null, array $env = [], array $options = []) { $command = \is_array($command) ? \implode(" ", \array_map("escapeshellarg", $command)) : (string) $command; $cwd = $cwd ?? ""; $envVars = []; foreach ($env as $key => $value) { if (\is_array($value)) { throw new \Error("\$env cannot accept array values"); } $envVars[(string) $key] = (string) $value; } $this->command = $command; $this->cwd = $cwd; $this->env = $envVars; $this->options = $options; $this->processRunner = Loop::getState(self::class); if ($this->processRunner === null) { $this->processRunner = \strncasecmp(\PHP_OS, "WIN", 3) === 0 ? new WindowsProcessRunner : new PosixProcessRunner; Loop::setState(self::class, $this->processRunner); } } /** * Stops the process if it is still running. */ public function __destruct() { if ($this->handle !== null) { $this->processRunner->destroy($this->handle); } } public function __clone() { throw new \Error("Cloning is not allowed!"); } /** * Start the process. * * @return Promise<int> Resolves with the PID. * * @throws StatusError If the process has already been started. */ public function start(): Promise { if ($this->handle) { throw new StatusError("Process has already been started."); } return call(function () { $this->handle = $this->processRunner->start($this->command, $this->cwd, $this->env, $this->options); return $this->pid = yield $this->handle->pidDeferred->promise(); }); } /** * Wait for the process to end. * * @return Promise <int> Succeeds with process exit code or fails with a ProcessException if the process is killed. * * @throws StatusError If the process has already been started. */ public function join(): Promise { if (!$this->handle) { throw new StatusError("Process has not been started."); } return $this->processRunner->join($this->handle); } /** * Forcibly end the process. * * @throws StatusError If the process is not running. * @throws ProcessException If terminating the process fails. */ public function kill() { if (!$this->isRunning()) { throw new StatusError("Process is not running."); } $this->processRunner->kill($this->handle); } /** * Send a signal signal to the process. * * @param int $signo Signal number to send to process. * * @throws StatusError If the process is not running. * @throws ProcessException If sending the signal fails. */ public function signal(int $signo) { if (!$this->isRunning()) { throw new StatusError("Process is not running."); } $this->processRunner->signal($this->handle, $signo); } /** * Returns the PID of the child process. * * @return int * * @throws StatusError If the process has not started or has not completed starting. */ public function getPid(): int { if (!$this->pid) { throw new StatusError("Process has not been started or has not completed starting."); } return $this->pid; } /** * Returns the command to execute. * * @return string The command to execute. */ public function getCommand(): string { return $this->command; } /** * Gets the current working directory. * * @return string The current working directory an empty string if inherited from the current PHP process. */ public function getWorkingDirectory(): string { if ($this->cwd === "") { return \getcwd() ?: ""; } return $this->cwd; } /** * Gets the environment variables array. * * @return string[] Array of environment variables. */ public function getEnv(): array { return $this->env; } /** * Gets the options to pass to proc_open(). * * @return mixed[] Array of options. */ public function getOptions(): array { return $this->options; } /** * Determines if the process is still running. * * @return bool */ public function isRunning(): bool { return $this->handle && $this->handle->status !== ProcessStatus::ENDED; } /** * Gets the process input stream (STDIN). * * @return ProcessOutputStream */ public function getStdin(): ProcessOutputStream { if (!$this->handle || $this->handle->status === ProcessStatus::STARTING) { throw new StatusError("Process has not been started or has not completed starting."); } return $this->handle->stdin; } /** * Gets the process output stream (STDOUT). * * @return ProcessInputStream */ public function getStdout(): ProcessInputStream { if (!$this->handle || $this->handle->status === ProcessStatus::STARTING) { throw new StatusError("Process has not been started or has not completed starting."); } return $this->handle->stdout; } /** * Gets the process error stream (STDERR). * * @return ProcessInputStream */ public function getStderr(): ProcessInputStream { if (!$this->handle || $this->handle->status === ProcessStatus::STARTING) { throw new StatusError("Process has not been started or has not completed starting."); } return $this->handle->stderr; } public function __debugInfo(): array { return [ 'command' => $this->getCommand(), 'cwd' => $this->getWorkingDirectory(), 'env' => $this->getEnv(), 'options' => $this->getOptions(), 'pid' => $this->pid, 'status' => $this->handle ? $this->handle->status : -1, ]; } } <?php namespace Amp\Process; class StatusError extends \Error { } { "name": "amphp/windows-registry", "description": "Windows Registry Reader.", "type": "library", "license": "MIT", "authors": [ { "name": "Niklas Keller", "email": "me@kelunik.com" } ], "autoload": { "psr-4": { "Amp\\WindowsRegistry\\": "lib" } }, "require": { "amphp/amp": "^2", "amphp/byte-stream": "^1.4", "amphp/process": "^1" }, "require-dev": { "amphp/php-cs-fixer-config": "dev-master" }, "config": { "platform": { "php": "7.0.0" } } } <?php namespace Amp\WindowsRegistry; use Amp\ByteStream; use Amp\Process\Process; use Amp\Promise; use function Amp\call; class WindowsRegistry { public function read(string $key): Promise { return call(function () use ($key) { $key = \strtr($key, '/', "\\"); $parts = \explode("\\", $key); $value = \array_pop($parts); $key = \implode("\\", $parts); $lines = yield $this->query($key); $lines = \array_filter($lines, function ($line) { return '' !== $line && $line[0] === ' '; }); $values = \array_map(function ($line) { return \preg_split("(\\s+)", \ltrim($line), 3); }, $lines); foreach ($values as $v) { if ($v[0] === $value) { return $v[2]; } } throw new KeyNotFoundException("Windows registry key '{$key}\\{$value}' not found."); }); } public function listKeys(string $key): Promise { return call(function () use ($key) { $lines = yield $this->query($key); $lines = \array_filter($lines, function ($line) { return '' !== $line && $line[0] !== ' '; }); return $lines; }); } private function query(string $key): Promise { return call(function () use ($key) { if (0 !== \stripos(\PHP_OS, 'WIN')) { throw new \Error('Not running on Windows.'); } $key = \strtr($key, '/', "\\"); $cmd = \sprintf('reg query %s', \escapeshellarg($key)); $process = new Process($cmd); yield $process->start(); $stdout = yield ByteStream\buffer($process->getStdout()); $code = yield $process->join(); if ($code !== 0) { throw new KeyNotFoundException("Windows registry key '{$key}' not found."); } return \explode("\n", \str_replace("\r", '', $stdout)); }); } } <?php namespace Amp\WindowsRegistry; class KeyNotFoundException extends \Exception { } <?php use Amp\ByteStream\ResourceOutputStream; use Amp\Log\ConsoleFormatter; use Amp\Log\StreamHandler; use Monolog\Logger; require dirname(__DIR__) . '/vendor/autoload.php'; $handler = new StreamHandler(new ResourceOutputStream(\STDOUT)); $handler->setFormatter(new ConsoleFormatter); $logger = new Logger('hello-world'); $logger->pushHandler($handler); $logger->debug("Hello, world!"); $logger->info("Hello, world!"); $logger->notice("Hello, world!"); $logger->error("Hello, world!"); $logger->alert("Hello, world!"); { "name": "amphp/log", "homepage": "https://github.com/amphp/log", "description": "Non-blocking logging for PHP based on Amp and Monolog.", "keywords": [ "log", "logging", "logger", "async", "non-blocking", "amp", "amphp" ], "license": "MIT", "authors": [ { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" }, { "name": "Niklas Keller", "email": "me@kelunik.com" } ], "require": { "amphp/amp": "^2", "amphp/byte-stream": "^1.3", "monolog/monolog": "^1.23" }, "require-dev": { "amphp/file": "^0.3", "amphp/phpunit-util": "^1", "friendsofphp/php-cs-fixer": "^2.3", "phpunit/phpunit": "^6" }, "autoload": { "psr-4": { "Amp\\Log\\": "src" }, "files": [ "src/functions.php" ] }, "autoload-dev": { "psr-4": { "Amp\\Log\\Test\\": "test" } }, "config": { "platform": { "php": "7.0.13" } }, "scripts": { "test": "@php -dzend.assertions=1 -dassert.exception=1 ./vendor/bin/phpunit", "code-style": "@php ./vendor/bin/php-cs-fixer fix" } } <?php namespace Amp\Log; use Amp\ByteStream\OutputStream; use Monolog\Handler\AbstractProcessingHandler; use Psr\Log\LogLevel; final class StreamHandler extends AbstractProcessingHandler { /** @var OutputStream */ private $stream; /** @var callable */ private $onResolve; /** @var \Throwable|null */ private $exception; /** * @param OutputStream $outputStream * @param string $level * @param bool $bubble */ public function __construct(OutputStream $outputStream, string $level = LogLevel::DEBUG, bool $bubble = true) { parent::__construct($level, $bubble); $this->stream = $outputStream; $stream = &$this->stream; $exception = &$this->exception; $this->onResolve = static function (\Throwable $e = null) use (&$stream, &$exception) { if (!$stream) { return; // Prior write already failed, ignore this failure. } if ($e) { $stream = null; $exception = $e; throw $e; } }; } /** * Writes the record down to the log of the implementing handler * * @param array $record * * @return void */ protected function write(array $record) { if ($this->exception) { throw $this->exception; } $this->stream->write((string) $record['formatted'])->onResolve($this->onResolve); } } <?php namespace Amp\Log; function hasColorSupport(): bool { $os = (\stripos(\PHP_OS, "WIN") === 0) ? "win" : \strtolower(\PHP_OS); // @see https://github.com/symfony/symfony/blob/v4.0.6/src/Symfony/Component/Console/Output/StreamOutput.php#L91 // @license https://github.com/symfony/symfony/blob/v4.0.6/LICENSE if ($os === 'win') { $windowsVersion = PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD; return \function_exists('sapi_windows_vt100_support') && @\sapi_windows_vt100_support(\STDOUT) || $windowsVersion === '10.0.10586' // equals is correct here, newer versions use the above function || false !== \getenv('ANSICON') || 'ON' === \getenv('ConEmuANSI') || 'xterm' === \getenv('TERM'); } if (\function_exists('posix_isatty')) { return @\posix_isatty(\STDOUT); } return false; } <?php namespace Amp\Log; use Amp\ByteStream\OutputStream; use Amp\ByteStream\ResourceOutputStream; use Amp\Log\Handler; use Monolog\Formatter\LineFormatter; use Monolog\Formatter\NormalizerFormatter; use Psr\Log\LogLevel; use function Amp\Log\hasColorSupport; final class ConsoleFormatter extends LineFormatter { const DEFAULT_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\r\n"; /** @var bool */ private $colors; public function __construct(string $format = null, string $dateFormat = null, bool $allowInlineLineBreaks = false, bool $ignoreEmptyContextAndExtra = false) { parent::__construct($format ?? self::DEFAULT_FORMAT, $dateFormat, $allowInlineLineBreaks, $ignoreEmptyContextAndExtra); $this->setAnsiColorOption(); } public function format(array $record): string { if ($this->colors) { $record['level_name'] = $this->ansifyLevel($record['level_name']); $record['channel'] = "\033[1m{$record['channel']}\033[0m"; } return parent::format($record); } private function setAnsiColorOption() { $value = \getenv("AMP_LOG_COLOR"); if ($value === false || $value === '') { $value = "auto"; } $value = \strtolower($value); switch ($value) { case "1": case "true": case "on": $this->colors = true; break; case "0": case "false": case "off": $this->colors = false; break; default: $this->colors = hasColorSupport(); break; } } private function ansifyLevel(string $level): string { $level = \strtolower($level); switch ($level) { case LogLevel::EMERGENCY: case LogLevel::ALERT: case LogLevel::CRITICAL: case LogLevel::ERROR: return "\033[1;31m{$level}\033[0m"; // bold + red case LogLevel::WARNING: return "\033[1;33m{$level}\033[0m"; // bold + yellow case LogLevel::NOTICE: return "\033[1;32m{$level}\033[0m"; // bold + green case LogLevel::INFO: return "\033[1;35m{$level}\033[0m"; // bold + magenta case LogLevel::DEBUG: return "\033[1;36m{$level}\033[0m"; // bold + cyan default: return "\033[1m{$level}\033[0m"; // bold } } } { "name": "amphp/cache", "homepage": "https://github.com/amphp/cache", "description": "A promise-aware caching API for Amp.", "license": "MIT", "support": { "issues": "https://github.com/amphp/cache/issues", "irc": "irc://irc.freenode.org/amphp" }, "authors": [ { "name": "Niklas Keller", "email": "me@kelunik.com" }, { "name": "Daniel Lowrey", "email": "rdlowrey@php.net" } ], "require": { "amphp/amp": "^2" }, "require-dev": { "amphp/phpunit-util": "^1", "phpunit/phpunit": "^6", "friendsofphp/php-cs-fixer": "^2.3" }, "autoload": { "psr-4": { "Amp\\Cache\\": "lib" } }, "autoload-dev": { "psr-4": { "Amp\\Cache\\Test\\": "test" } } } <?php namespace Amp\Cache; /** * MUST be thrown in case a cache operation fails. */ class CacheException extends \Exception { } <?php namespace Amp\Cache; use Amp\Promise; final class PrefixCache implements Cache { private $cache; private $keyPrefix; public function __construct(Cache $cache, string $keyPrefix) { $this->cache = $cache; $this->keyPrefix = $keyPrefix; } /** * Gets the specified key prefix. * * @return string */ public function getKeyPrefix(): string { return $this->keyPrefix; } /** @inheritdoc */ public function get(string $key): Promise { return $this->cache->get($this->keyPrefix . $key); } /** @inheritdoc */ public function set(string $key, string $value, int $ttl = null): Promise { return $this->cache->set($this->keyPrefix . $key, $value, $ttl); } /** @inheritdoc */ public function delete(string $key): Promise { return $this->cache->delete($this->keyPrefix . $key); } } <?php namespace Amp\Cache; use Amp\Loop; use Amp\Promise; use Amp\Struct; use Amp\Success; final class ArrayCache implements Cache { private $sharedState; private $ttlWatcherId; private $maxSize; /** * @param int $gcInterval The frequency in milliseconds at which expired cache entries should be garbage collected. * @param int $maxSize The maximum size of cache array (number of elements). */ public function __construct(int $gcInterval = 5000, int $maxSize = null) { // By using a shared state object we're able to use `__destruct()` for "normal" garbage collection of both this // instance and the loop's watcher. Otherwise this object could only be GC'd when the TTL watcher was cancelled // at the loop layer. $this->sharedState = $sharedState = new class { use Struct; public $cache = []; public $cacheTimeouts = []; public $isSortNeeded = false; public function collectGarbage() { $now = \time(); if ($this->isSortNeeded) { \asort($this->cacheTimeouts); $this->isSortNeeded = false; } foreach ($this->cacheTimeouts as $key => $expiry) { if ($now <= $expiry) { break; } unset( $this->cache[$key], $this->cacheTimeouts[$key] ); } } }; $this->ttlWatcherId = Loop::repeat($gcInterval, [$sharedState, "collectGarbage"]); $this->maxSize = $maxSize; Loop::unreference($this->ttlWatcherId); } public function __destruct() { $this->sharedState->cache = []; $this->sharedState->cacheTimeouts = []; Loop::cancel($this->ttlWatcherId); } /** @inheritdoc */ public function get(string $key): Promise { if (!isset($this->sharedState->cache[$key])) { return new Success(null); } if (isset($this->sharedState->cacheTimeouts[$key]) && \time() > $this->sharedState->cacheTimeouts[$key]) { unset( $this->sharedState->cache[$key], $this->sharedState->cacheTimeouts[$key] ); return new Success(null); } return new Success($this->sharedState->cache[$key]); } /** @inheritdoc */ public function set(string $key, string $value, int $ttl = null): Promise { if ($ttl === null) { unset($this->sharedState->cacheTimeouts[$key]); } elseif (\is_int($ttl) && $ttl >= 0) { $expiry = \time() + $ttl; $this->sharedState->cacheTimeouts[$key] = $expiry; $this->sharedState->isSortNeeded = true; } else { throw new \Error("Invalid cache TTL ({$ttl}; integer >= 0 or null required"); } unset($this->sharedState->cache[$key]); if (count($this->sharedState->cache) === $this->maxSize) { array_shift($this->sharedState->cache); } $this->sharedState->cache[$key] = $value; return new Success; } /** @inheritdoc */ public function delete(string $key): Promise { $exists = isset($this->sharedState->cache[$key]); unset( $this->sharedState->cache[$key], $this->sharedState->cacheTimeouts[$key] ); return new Success($exists); } } <?php namespace Amp\Cache; use Amp\Promise; interface Cache { /** * Gets a value associated with the given key. * * If the specified key doesn't exist implementations MUST succeed the resulting promise with `null`. * * @param $key string Cache key. * * @return Promise Resolves to the cached value nor `null` if it doesn't exist or fails with a CacheException on * failure. */ public function get(string $key): Promise; /** * Sets a value associated with the given key. Overrides existing values (if they exist). * * The eventual resolution value of the resulting promise is unimportant. The success or failure of the promise * indicates the operation's success. * * @param $key string Cache key. * @param $value string Value to cache. * @param $ttl int Timeout in seconds. The default `null` $ttl value indicates no timeout. Values less than 0 MUST * throw an \Error. * * @return Promise Resolves either successfully or fails with a CacheException on failure. */ public function set(string $key, string $value, int $ttl = null): Promise; /** * Deletes a value associated with the given key if it exists. * * Implementations SHOULD return boolean `true` or `false` to indicate whether the specified key existed at the time * the delete operation was requested. If such information is not available, the implementation MUST resolve the * promise with `null`. * * Implementations MUST transparently succeed operations for non-existent keys. * * @param $key string Cache key. * * @return Promise Resolves to `true` / `false` / `null` to indicate whether the key existed or fails with a * CacheException on failure. */ public function delete(string $key): Promise; } <?php namespace Amp\Cache; use Amp\Promise; use Amp\Success; /** * Cache implementation that just ignores all operations and always resolves to `null`. */ class NullCache implements Cache { /** @inheritdoc */ public function get(string $key): Promise { return new Success; } /** @inheritdoc */ public function set(string $key, string $value, int $ttl = null): Promise { return new Success; } /** @inheritdoc */ public function delete(string $key): Promise { return new Success(false); } } { "name": "rollbar/rollbar", "description": "Monitors errors and exceptions and reports them to Rollbar", "type": "library", "keywords": ["logging", "debugging", "monitoring", "errors", "exceptions"], "license": "MIT", "homepage": "http://github.com/rollbar/rollbar-php", "authors": [ { "name": "Rollbar, Inc.", "email": "support@rollbar.com", "role": "Developer" } ], "support": { "email": "support@rollbar.com" }, "autoload": { "psr-4": { "Rollbar\\": "src/" } }, "autoload-dev": { "psr-4": { "Rollbar\\": "tests/" } }, "require": { "ext-curl": "*", "psr/log": "^1.0.1", "monolog/monolog": "^1.23" }, "require-dev": { "phpunit/phpunit": "4.8.*", "mockery/mockery": "0.9.*", "squizlabs/php_codesniffer": "2.*", "codeclimate/php-test-reporter": "dev-master", "monolog/monolog": "^1.23", "packfire/php5.3-compat": "*", "phpmd/phpmd" : "@stable" }, "suggest": { "packfire/php5.3-compat": "for backward compatibility with PHP 5.3", "fluent/logger": "Needed to use the 'fluent' handler for fluentd support" }, "scripts": { "test": [ "phpunit --coverage-clover build/logs/clover.xml --testsuite 'Rollbar Test Suite'", "phpcs --standard=PSR1,PSR2 src tests" ], "fix": "phpcbf --standard=PSR1,PSR2 src tests", "get-js-snippet": "curl -X GET https://raw.githubusercontent.com/rollbar/rollbar.js/v2.3.6/dist/rollbar.snippet.js > data/rollbar.snippet.js", "performance": "phpunit --coverage-clover build/logs/clover.xml --testsuite 'Rollbar Performance Test Suite'" }, "config": { "process-timeout": 600 } } <?php namespace Rollbar; use Rollbar\Payload\Level; use Rollbar\Payload\Payload; interface TransformerInterface { /** * @param Payload $payload * @param Level $level * @param \Exception | \Throwable $toLog * @param $context * @return Payload */ public function transform(Payload $payload, $level, $toLog, $context); } <?php namespace Rollbar; use Rollbar\Payload\Level; class LevelFactory { private static $values; private static function init() { if (is_null(self::$values)) { self::$values = array( Level::EMERGENCY => new Level("critical", 100000), Level::ALERT => new Level("critical", 100000), Level::CRITICAL => new Level("critical", 100000), Level::ERROR => new Level("error", 10000), Level::WARNING => new Level("warning", 1000), Level::NOTICE => new Level("info", 100), Level::INFO => new Level("info", 100), Level::DEBUG => new Level("debug", 10), Level::IGNORED => new Level("ignore", 0), Level::IGNORE => new Level("ignore", 0) ); } } /** * @param string $name level name * * @return Level */ public function fromName($name) { self::init(); $name = strtolower($name); return array_key_exists($name, self::$values) ? self::$values[$name] : null; } /** * Check if the provided level is a valid level * * @param string $level * * @return string */ public function isValidLevel($level) { return $this->fromName($level) ? true : false; } } <?php namespace Rollbar; class ErrorWrapper extends \Exception { private static $constName; private $utilities; private static function getConstName($const) { if (is_null(self::$constName)) { self::$constName = array( E_ERROR => "E_ERROR", E_WARNING => "E_WARNING", E_PARSE => "E_PARSE", E_NOTICE => "E_NOTICE", E_CORE_ERROR => "E_CORE_ERROR", E_CORE_WARNING => "E_CORE_WARNING", E_COMPILE_ERROR => "E_COMPILE_ERROR", E_COMPILE_WARNING => "E_COMPILE_WARNING", E_USER_ERROR => "E_USER_ERROR", E_USER_WARNING => "E_USER_WARNING", E_USER_NOTICE => "E_USER_NOTICE", E_STRICT => "E_STRICT", E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR", E_DEPRECATED => "E_DEPRECATED", E_USER_DEPRECATED => "E_USER_DEPRECATED" ); } return isset(self::$constName[$const]) ? self::$constName[$const] : null; } public $errorLevel; public $errorMessage; public $errorFile; public $errorLine; public $backTrace; public function __construct( $errorLevel, $errorMessage, $errorFile, $errorLine, $backTrace, $utilities ) { parent::__construct($errorMessage, $errorLevel); $this->errorLevel = $errorLevel; $this->errorMessage = $errorMessage; $this->errorFile = $errorFile; $this->errorLine = $errorLine; $this->backTrace = $backTrace; $this->utilities = $utilities; } public function getBacktrace() { return $this->backTrace; } public function getClassName() { $constName = self::getConstName($this->errorLevel) ?: "#$this->errorLevel"; return "$constName"; } } <?php namespace Rollbar; class Response { private $status; private $info; private $uuid; public function __construct($status, $info, $uuid = null) { $this->status = $status; $this->info = $info; $this->uuid = $uuid; } public function getStatus() { return $this->status; } public function getInfo() { return $this->info; } public function getUuid() { return $this->uuid; } public function wasSuccessful() { return $this->status >= 200 && $this->status < 300; } public function getOccurrenceUrl() { if (is_null($this->uuid)) { return null; } if (!$this->wasSuccessful()) { return null; } return "https://rollbar.com/occurrence/uuid/?uuid=" . $this->uuid; } public function __toString() { $url = $this->getOccurrenceUrl(); return "Status: $this->status\n" . "Body: " . json_encode($this->info) . "\n" . "URL: $url"; } } <?php namespace Rollbar; class Scrubber implements ScrubberInterface { protected static $defaults; protected $scrubFields; protected $whitelist; public function __construct($config) { self::$defaults = Defaults::get(); $this->setScrubFields($config); $this->setWhitelist($config); } protected function setScrubFields($config) { $fromConfig = isset($config['scrubFields']) ? $config['scrubFields'] : null; if (!isset($fromConfig)) { $fromConfig = isset($config['scrub_fields']) ? $config['scrub_fields'] : null; } $this->scrubFields = self::$defaults->scrubFields($fromConfig); } public function getScrubFields() { return $this->scrubFields; } protected function setWhitelist($config) { $fromConfig = isset($config['scrubWhitelist']) ? $config['scrubWhitelist'] : null; if (!isset($fromConfig)) { $fromConfig = isset($config['scrub_whitelist']) ? $config['scrub_whitelist'] : null; } $this->whitelist = $fromConfig ? $fromConfig : array(); } public function getWhitelist() { return $this->whitelist; } /** * Scrub a data structure including arrays and query strings. * * @param mixed $data Data to be scrubbed. * @param array $fields Sequence of field names to scrub. * @param string $replacement Character used for scrubbing. * @param string $path Path of traversal in the array */ public function scrub(&$data, $replacement = '********', $path = '') { $fields = $this->getScrubFields(); if (!$fields || !$data) { return $data; } $fields = array_flip($fields); return $this->internalScrub($data, $fields, $replacement, $path); } public function internalScrub(&$data, $fields, $replacement, $path) { if (is_array($data)) { // scrub arrays $data = $this->scrubArray($data, $fields, $replacement, $path); } elseif (is_string($data)) { // scrub URLs and query strings $query = parse_url($data, PHP_URL_QUERY); if ($query) { $data = str_replace( $query, $this->scrubQueryString($query, $fields), $data ); } else { parse_str($data, $parsedData); if (http_build_query($parsedData) === $data) { $data = $this->scrubQueryString($data, $fields); } } } return $data; } protected function scrubArray(&$arr, $fields, $replacement = '********', $path = '') { if (!$fields || !$arr) { return $arr; } $scrubber = $this; $scrubberFn = function ( &$val, $key ) use ( $fields, $replacement, &$scrubberFn, $scrubber, &$path ) { $parent = $path; $current = !$path ? $key : $path . '.' . $key; if (in_array($current, $scrubber->getWhitelist())) { return; } if (isset($fields[$key])) { $val = $replacement; } else { $val = $scrubber->internalScrub($val, $fields, $replacement, $current); } $current = $parent; }; array_walk($arr, $scrubberFn); return $arr; } protected function scrubQueryString($query, $fields, $replacement = 'xxxxxxxx') { parse_str($query, $parsed); $scrubbed = $this->internalScrub($parsed, $fields, $replacement, ''); return http_build_query($scrubbed); } } <?php namespace Rollbar; interface ScrubberInterface { public function scrub(&$data, $replacement); } <?php namespace Rollbar\Handlers; use Rollbar\Rollbar; use Rollbar\RollbarLogger; use Rollbar\Payload\Level; abstract class AbstractHandler { protected $registered = false; protected $logger = null; protected $previousHandler = null; public function __construct(RollbarLogger $logger) { $this->logger = $logger; } public function logger() { return $this->logger; } public function registered() { return $this->registered; } public function handle() { if (!$this->registered()) { throw new \Exception(get_class($this) . ' has not been set up.'); } } public function register() { $this->registered = true; } } <?php namespace Rollbar\Handlers; use Rollbar\Rollbar; use Rollbar\RollbarLogger; use Rollbar\Payload\Level; class ErrorHandler extends AbstractHandler { public function register() { $this->previousHandler = set_error_handler(array($this, 'handle')); parent::register(); } public function handle() { /** * Overloading methods with different parameters is not supported in PHP * through language structures. This hack allows to simulate that. */ $args = func_get_args(); if (!isset($args[0]) || !isset($args[1])) { throw new \Exception('No $errno or $errstr to be passed to the error handler.'); } $errno = $args[0]; $errstr = $args[1]; $errfile = isset($args[2]) ? $args[2] : null; $errline = isset($args[3]) ? $args[3] : null; parent::handle(); if (is_null($this->logger())) { return false; } if ($this->logger()->shouldIgnoreError($errno)) { return false; } $exception = $this->logger()-> getDataBuilder()-> generateErrorWrapper($errno, $errstr, $errfile, $errline); $this->logger()->log(Level::ERROR, $exception, array(), true); if ($this->previousHandler !== null) { call_user_func( $this->previousHandler, $errno, $errstr, $errfile, $errline ); } return false; } } <?php namespace Rollbar\Handlers; use Rollbar\Rollbar; use Rollbar\RollbarLogger; use Rollbar\Payload\Level; class ExceptionHandler extends AbstractHandler { public function register() { $this->previousHandler = set_exception_handler(array($this, 'handle')); parent::register(); } public function handle() { parent::handle(); /** * Overloading methods with different parameters is not supported in PHP * through language structures. This hack allows to simulate that. */ $args = func_get_args(); if (!isset($args[0])) { throw new \Exception('No exception to be passed to the exception handler.'); } $exception = $args[0]; $this->logger()->log(Level::ERROR, $exception, array(), true); if ($this->previousHandler) { restore_exception_handler(); call_user_func($this->previousHandler, $exception); return; } throw $exception; } } <?php namespace Rollbar\Handlers; use Rollbar\Rollbar; use Rollbar\RollbarLogger; use Rollbar\Payload\Level; /** * Previously registered shutdown functions will be called automatically by PHP. * There is no need to invoke them manually, unline with ErrorHandler class * and set_error_handler function. */ class FatalHandler extends AbstractHandler { private static $fatalErrors = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR); public function register() { \register_shutdown_function(array($this, 'handle')); parent::register(); } public function handle() { parent::handle(); if (is_null($this->logger())) { return; } $lastError = error_get_last(); if ($this->isFatal($lastError)) { $errno = $lastError['type']; $errstr = $lastError['message']; $errfile = $lastError['file']; $errline = $lastError['line']; $exception = $this->logger()-> getDataBuilder()-> generateErrorWrapper($errno, $errstr, $errfile, $errline); $this->logger()->log(Level::CRITICAL, $exception, array(), true); } } /** * Check if the error triggered is indeed a fatal error. * * @var array $lastError Information fetched from error_get_last(). * * @return bool */ protected function isFatal($lastError) { return !is_null($lastError) && in_array($lastError['type'], self::$fatalErrors, true) && // don't log uncaught exceptions as they were handled by exceptionHandler() !(isset($lastError['message']) && strpos($lastError['message'], 'Uncaught') === 0); } } <?php /* * !!! DEPRECATED AS OF 8/4/2018 !!! * * Please, do not use this class anymore to use Rollbar with Monolog anymore. * The Monolog library includes a dedicated handler now here: * https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/RollbarHandler.php * * Using Monolog's handler is the recommended approach when using Rollbar * with Monolog. */ /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Rollbar\Monolog\Handler; use Rollbar\RollbarLogger; use Throwable; use Monolog\Logger; use Monolog\Handler\AbstractProcessingHandler; /** * Sends errors to Rollbar * * If the context data contains a `payload` key, that is used as an array * of payload options to RollbarLogger's log method. * * Rollbar's context info will contain the context + extra keys from the log record * merged, and then on top of that a few keys: * * - level (rollbar level name) * - monolog_level (monolog level name, raw level, as rollbar only has 5 but monolog 8) * - channel * - datetime (unix timestamp) * * @author Paul Statezny <paulstatezny@gmail.com> */ class RollbarHandler extends AbstractProcessingHandler { /** * @var RollbarLogger */ protected $rollbarLogger; protected $levelMap = array( Logger::DEBUG => 'debug', Logger::INFO => 'info', Logger::NOTICE => 'info', Logger::WARNING => 'warning', Logger::ERROR => 'error', Logger::CRITICAL => 'critical', Logger::ALERT => 'critical', Logger::EMERGENCY => 'critical', ); /** * Records whether any log records have been added since the last flush of the rollbar notifier * * @var bool */ private $hasRecords = false; protected $initialized = false; /** * @param RollbarLogger $rollbarLogger RollbarLogger object constructed with valid token * @param int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(RollbarLogger $rollbarLogger, $level = Logger::ERROR, $bubble = true) { $this->rollbarLogger = $rollbarLogger; parent::__construct($level, $bubble); } /** * {@inheritdoc} */ protected function write(array $record) { if (!$this->initialized) { // __destructor() doesn't get called on Fatal errors register_shutdown_function(array($this, 'close')); $this->initialized = true; } $context = $record['context']; $context = array_merge($context, $record['extra'], array( 'level' => $this->levelMap[$record['level']], 'monolog_level' => $record['level_name'], 'channel' => $record['channel'], 'datetime' => $record['datetime']->format('U'), )); if (isset($context['exception']) && $context['exception'] instanceof Throwable) { $exception = $context['exception']; unset($context['exception']); $toLog = $exception; } else { $toLog = $record['message']; } $this->rollbarLogger->log($context['level'], $toLog, $context); $this->hasRecords = true; } public function flush() { if ($this->hasRecords) { $this->rollbarLogger->flush(); $this->hasRecords = false; } } /** * {@inheritdoc} */ public function close() { $this->flush(); } } <?php namespace Rollbar; interface DataBuilderInterface { public function makeData($level, $toLog, $context); } <?php namespace Rollbar; class RollbarJsHelper { protected $config; /** * @param array $config The array passed to he should have the same * available options that you can find in Rollbar.js, using symbols or * strings for the keys. */ public function __construct($config) { $this->config = $config; } /** * Shortcut method for building the RollbarJS Javascript * * @param array $config @see addJs() * @param string $nonce @see addJs() * @param string $customJs @see addJs() * * @return string */ public static function buildJs( $config, $headers = null, $nonce = null, $customJs = "" ) { $helper = new self($config); return $helper->addJs($headers, $nonce, $customJs); } /** * Build Javascript required to include RollbarJS on * an HTML page * * @param array $headers Response headers usually retrieved through * headers_list() used to verify if nonce should be added to script * tags based on Content-Security-Policy * @param string $nonce Content-Security-Policy nonce string if exists * @param strong $customJs Additional JavaScript to add at the end of * RollbarJs snippet * * @return string */ public function addJs($headers = null, $nonce = null, $customJs = "") { return $this->scriptTag( $this->configJsTag() . $this->jsSnippet() . ";" . $customJs, $headers, $nonce ); } /** * Build RollbarJS config script * * @return string */ public function configJsTag() { return "var _rollbarConfig = " . json_encode($this->config, JSON_FORCE_OBJECT) . ";"; } /** * Build rollbar.snippet.js string * * @return string */ public function jsSnippet() { return file_get_contents( $this->snippetPath() ); } /** * @return string Path to the rollbar.snippet.js */ public function snippetPath() { return realpath(__DIR__ . "/../data/rollbar.snippet.js"); } /** * Should JS snippet be added to the HTTP response * * @param int $status * @param array $headers * * @return boolean */ public function shouldAddJs($status, $headers) { return $status == 200 && $this->isHtml($headers) && !$this->hasAttachment($headers); /** * @todo not sure if below two conditions will be applicable */ /* !env[JS_IS_INJECTED_KEY] */ /* && !streaming?(env) */ } /** * Is the HTTP response a valid HTML response * * @param array $headers * * @return boolean */ public function isHtml($headers) { return in_array('Content-Type: text/html', $headers); } /** * Does the HTTP response include an attachment * * @param array $headers * * @return boolean */ public function hasAttachment($headers) { return in_array('Content-Disposition: attachment', $headers); } /** * Is `nonce` attribute on the script tag needed? * * @param array $headers * * @return boolean */ public function shouldAppendNonce($headers) { foreach ($headers as $header) { if (strpos($header, 'Content-Security-Policy') !== false && strpos($header, "'unsafe-inline'") !== false) { return true; } } return false; } /** * Build safe HTML script tag * * @param string $content * @param array $headers * @param * * @return string */ public function scriptTag($content, $headers = null, $nonce = null) { if ($headers !== null && $this->shouldAppendNonce($headers)) { if (!$nonce) { throw new \Exception( 'Content-Security-Policy is script-src '. 'inline-unsafe but nonce value not provided.' ); } return "\n<script type=\"text/javascript\" nonce=\"$nonce\">$content</script>"; } return "\n<script type=\"text/javascript\">$content</script>"; } } <?php namespace Rollbar\Senders; use Rollbar\Response; use Rollbar\Payload\Payload; use Rollbar\Payload\EncodedPayload; class AgentSender implements SenderInterface { private $utilities; private $agentLog; private $agentLogLocation; public function __construct($opts) { $this->agentLogLocation = \Rollbar\Defaults::get()->agentLogLocation(); $this->utilities = new \Rollbar\Utilities(); if (array_key_exists('agentLogLocation', $opts)) { $this->utilities->validateString($opts['agentLogLocation'], 'opts["agentLogLocation"]', null, false); $this->agentLogLocation = $opts['agentLogLocation']; } } /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function send(EncodedPayload $payload, $accessToken) { if (empty($this->agentLog)) { $this->loadAgentFile(); } fwrite($this->agentLog, $payload->encoded() . "\n"); $data = $payload->data(); $uuid = $data['data']['uuid']; return new Response(0, "Written to agent file", $uuid); } /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function sendBatch($batch, $accessToken) { if (empty($this->agentLog)) { $this->loadAgentFile(); } foreach ($batch as $payload) { fwrite($this->agentLog, $payload->encoded() . "\n"); } } /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function wait($accessToken, $max) { return; } private function loadAgentFile() { $filename = $this->agentLogLocation . '/rollbar-relay.' . getmypid() . '.' . microtime(true) . '.rollbar'; $this->agentLog = fopen($filename, 'a'); } public function toString() { return "agent log: " . $this->agentLogLocation; } } <?php namespace Rollbar\Senders; use Rollbar\Payload\Payload; use Rollbar\Payload\EncodedPayload; interface SenderInterface { public function send(EncodedPayload $payload, $accessToken); public function sendBatch($batch, $accessToken); public function wait($accessToken, $max); public function toString(); } <?php namespace Rollbar\Senders; use Fluent\Logger\FluentLogger; use Rollbar\Response; use Rollbar\Payload\EncodedPayload; class FluentSender implements SenderInterface { /** * @var Utilities */ private $utilities; /** * @var FluentLogger FluentLogger instance */ private $fluentLogger = null; /** * @var string IP of the fluentd host */ private $fluentHost; /** * @var int Port of the fluentd instance listening on */ private $fluentPort = FluentLogger::DEFAULT_LISTEN_PORT; /** * @var string Tag that will be used for filter and match sections in fluentd */ private $fluentTag = 'rollbar'; /** * FluentSender constructor. * @param $opts array containing options for the sender */ public function __construct($opts) { $this->fluentHost = \Rollbar\Defaults::get()->fluentHost(); $this->fluentPort = \Rollbar\Defaults::get()->fluentPort(); $this->fluentTag = \Rollbar\Defaults::get()->fluentTag(); $this->utilities = new \Rollbar\Utilities(); if (isset($opts['fluentHost'])) { $this->utilities->validateString($opts['fluentHost'], 'opts["fluentHost"]', null, false); $this->fluentHost = $opts['fluentHost']; } if (isset($opts['fluentPort'])) { $this->utilities->validateInteger($opts['fluentPort'], 'opts["fluentPort"]', null, null, false); $this->fluentPort = $opts['fluentPort']; } if (isset($opts['fluentTag'])) { $this->utilities->validateString($opts['fluentTag'], 'opts["fluentTag"]', null, false); $this->fluentTag = $opts['fluentTag']; } } /** * @param \Rollbar\Payload\EncodedPayload $scrubbedPayload * @param $accessToken * @return Response * * @SuppressWarnings(PHPMD.UnusedFormalParameter) Unsued parameter is * intended here to comply to SenderInterface */ public function send(EncodedPayload $payload, $accessToken) { if (empty($this->fluentLogger)) { $this->loadFluentLogger(); } $scrubbedPayload = $payload->data(); $success = $this->fluentLogger->post($this->fluentTag, $scrubbedPayload); $status = $success ? 200 : 400; $info = $success ? 'OK' : 'Bad Request'; $uuid = $scrubbedPayload['data']['uuid']; return new Response($status, $info, $uuid); } public function sendBatch($batch, $accessToken) { $responses = array(); foreach ($batch as $payload) { $responses[] = $this->send($payload, $accessToken); } return $responses; } /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function wait($accessToken, $max) { return; } /** * Loads the fluent logger */ protected function loadFluentLogger() { $this->fluentLogger = new FluentLogger($this->fluentHost, $this->fluentPort); } public function toString() { return "fluentd " . $this->fluentHost . ":" . $this->fluentPort . " tag: " . $this->fluentTag; } } <?php namespace Rollbar\Senders; /** * Adapted from: * https://github.com/segmentio/analytics-php/blob/master/lib/Segment/Consumer/Socket.php */ use Rollbar\Response; use Rollbar\Payload\Payload; use Rollbar\Payload\EncodedPayload; class CurlSender implements SenderInterface { private $utilities; private $endpoint; private $timeout; private $proxy = null; private $verifyPeer = true; private $caCertPath = null; private $multiHandle = null; private $maxBatchRequests = 75; private $batchRequests = array(); private $inflightRequests = array(); public function __construct($opts) { $this->endpoint = \Rollbar\Defaults::get()->endpoint() . 'item/'; $this->timeout = \Rollbar\Defaults::get()->timeout(); $this->utilities = new \Rollbar\Utilities(); if (isset($_ENV['ROLLBAR_ENDPOINT']) && !isset($opts['endpoint'])) { $opts['endpoint'] = $_ENV['ROLLBAR_ENDPOINT']; } if (array_key_exists('endpoint', $opts)) { $this->utilities->validateString($opts['endpoint'], 'opts["endpoint"]', null, false); $this->endpoint = $opts['endpoint']; } if (array_key_exists('timeout', $opts)) { $this->utilities->validateInteger($opts['timeout'], 'opts["timeout"]', 0, null, false); $this->timeout = $opts['timeout']; } if (array_key_exists('proxy', $opts)) { $this->proxy = $opts['proxy']; } if (array_key_exists('verifyPeer', $opts)) { $this->utilities->validateBoolean($opts['verifyPeer'], 'opts["verifyPeer"]', false); $this->verifyPeer = $opts['verifyPeer']; } if (array_key_exists('ca_cert_path', $opts)) { $this->caCertPath = $opts['ca_cert_path']; } } public function getEndpoint() { return $this->endpoint; } public function send(EncodedPayload $payload, $accessToken) { $handle = curl_init(); $this->setCurlOptions($handle, $payload, $accessToken); $result = curl_exec($handle); $statusCode = curl_getinfo($handle, CURLINFO_HTTP_CODE); $result = $result === false ? curl_error($handle) : json_decode($result, true); curl_close($handle); $data = $payload->data(); $uuid = $data['data']['uuid']; return new Response($statusCode, $result, $uuid); } public function sendBatch($batch, $accessToken) { if ($this->multiHandle === null) { $this->multiHandle = curl_multi_init(); } if ($this->maxBatchRequests > 0) { $this->wait($accessToken, $this->maxBatchRequests); } $this->batchRequests = array_merge($this->batchRequests, $batch); $this->maybeSendMoreBatchRequests($accessToken); $this->checkForCompletedRequests($accessToken); } public function wait($accessToken, $max = 0) { if (count($this->inflightRequests) <= $max) { return; } while (1) { $this->checkForCompletedRequests($accessToken); if (count($this->inflightRequests) <= $max) { break; } curl_multi_select($this->multiHandle); // or do: usleep(10000); } } private function maybeSendMoreBatchRequests($accessToken) { $max = $this->maxBatchRequests - count($this->inflightRequests); if ($max <= 0) { return; } $idx = 0; $len = count($this->batchRequests); for (; $idx < $len && $idx < $max; $idx++) { $payload = $this->batchRequests[$idx]; $handle = curl_init(); $this->setCurlOptions($handle, $payload, $accessToken); curl_multi_add_handle($this->multiHandle, $handle); $handleArrayKey = (int)$handle; $this->inflightRequests[$handleArrayKey] = true; } $this->batchRequests = array_slice($this->batchRequests, $idx); } public function setCurlOptions($handle, EncodedPayload $payload, $accessToken) { curl_setopt($handle, CURLOPT_URL, $this->endpoint); curl_setopt($handle, CURLOPT_POST, true); curl_setopt($handle, CURLOPT_POSTFIELDS, $payload->encoded()); curl_setopt($handle, CURLOPT_VERBOSE, false); curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, $this->verifyPeer); curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); curl_setopt($handle, CURLOPT_TIMEOUT, $this->timeout); curl_setopt($handle, CURLOPT_HTTPHEADER, array('X-Rollbar-Access-Token: ' . $accessToken)); curl_setopt($handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); if (!is_null($this->caCertPath)) { curl_setopt($handle, CURLOPT_CAINFO, $this->caCertPath); } if ($this->proxy) { $proxy = is_array($this->proxy) ? $this->proxy : array('address' => $this->proxy); if (isset($proxy['address'])) { curl_setopt($handle, CURLOPT_PROXY, $proxy['address']); curl_setopt($handle, CURLOPT_FOLLOWLOCATION, true); } if (isset($proxy['username']) && isset($proxy['password'])) { curl_setopt($handle, CURLOPT_PROXYUSERPWD, $proxy['username'] . ':' . $proxy['password']); } } } private function checkForCompletedRequests($accessToken) { do { $curlResponse = curl_multi_exec($this->multiHandle, $active); } while ($curlResponse == CURLM_CALL_MULTI_PERFORM); while ($active && $curlResponse == CURLM_OK) { if (curl_multi_select($this->multiHandle, 0.01) == -1) { $this->maybeSendMoreBatchRequests($accessToken); return; } do { $curlResponse = curl_multi_exec($this->multiHandle, $active); } while ($curlResponse == CURLM_CALL_MULTI_PERFORM); } $this->removeFinishedRequests($accessToken); } private function removeFinishedRequests($accessToken) { while ($info = curl_multi_info_read($this->multiHandle)) { $handle = $info['handle']; $handleArrayKey = (int)$handle; if (isset($this->inflightRequests[$handleArrayKey])) { unset($this->inflightRequests[$handleArrayKey]); curl_multi_remove_handle($this->multiHandle, $handle); } curl_close($handle); } $this->maybeSendMoreBatchRequests($accessToken); } public function toString() { return "Rollbar API endpoint: " . $this->getEndpoint(); } } <?php namespace Rollbar; use Psr\Log\AbstractLogger; use Rollbar\Payload\Payload; use Rollbar\Payload\Level; use Rollbar\Truncation\Truncation; use Monolog\Logger as MonologLogger; use Monolog\Handler\StreamHandler; use Rollbar\Payload\EncodedPayload; class RollbarLogger extends AbstractLogger { private $config; private $levelFactory; private $truncation; private $queue; private $reportCount = 0; public function __construct(array $config) { $this->config = new Config($config); $this->levelFactory = new LevelFactory(); $this->truncation = new Truncation($this->config); $this->queue = array(); } public function enable() { return $this->config->enable(); } public function disable() { return $this->config->disable(); } public function enabled() { return $this->config->enabled(); } public function disabled() { return $this->config->disabled(); } public function configure(array $config) { $this->config->configure($config); } public function scope(array $config) { return new RollbarLogger($this->extend($config)); } public function extend(array $config) { return $this->config->extend($config); } public function addCustom($key, $data) { $this->config->addCustom($key, $data); } public function removeCustom($key) { $this->config->removeCustom($key); } public function getCustom() { return $this->config->getCustom(); } public function log($level, $toLog, array $context = array(), $isUncaught = false) { if ($this->disabled()) { return new Response(0, "Disabled"); } if (!$this->levelFactory->isValidLevel($level)) { throw new \Psr\Log\InvalidArgumentException("Invalid log level '$level'."); } if ($this->config->internalCheckIgnored($level, $toLog)) { return new Response(0, "Ignored"); } $accessToken = $this->getAccessToken(); $payload = $this->getPayload($accessToken, $level, $toLog, $context); if ($this->config->checkIgnored($payload, $accessToken, $toLog, $isUncaught)) { $response = new Response(0, "Ignored"); } else { $serialized = $payload->serialize($this->config->getMaxNestingDepth()); $scrubbed = $this->scrub($serialized); $encoded = $this->encode($scrubbed); $truncated = $this->truncate($encoded); $response = $this->send($truncated, $accessToken); } $this->handleResponse($payload, $response); return $response; } public function flush() { if ($this->getQueueSize() > 0) { $batch = $this->queue; $this->queue = array(); return $this->config->sendBatch($batch, $this->getAccessToken()); } return new Response(0, "Queue empty"); } public function flushAndWait() { $this->flush(); $this->config->wait($this->getAccessToken()); } public function shouldIgnoreError($errno) { return $this->config->shouldIgnoreError($errno); } public function getQueueSize() { return count($this->queue); } protected function send(\Rollbar\Payload\EncodedPayload $payload, $accessToken) { if ($this->reportCount >= $this->config->getMaxItems()) { return new Response( 0, "Maximum number of items per request has been reached. If you " . "want to report more items, please use `max_items` " . "configuration option." ); } else { $this->reportCount++; } if ($this->config->getBatched()) { $response = new Response(0, "Pending"); if ($this->getQueueSize() >= $this->config->getBatchSize()) { $response = $this->flush(); } $this->queue[] = $payload; return $response; } return $this->config->send($payload, $accessToken); } protected function getPayload($accessToken, $level, $toLog, $context) { $data = $this->config->getRollbarData($level, $toLog, $context); $payload = new Payload($data, $accessToken); return $this->config->transform($payload, $level, $toLog, $context); } protected function getAccessToken() { return $this->config->getAccessToken(); } public function getDataBuilder() { return $this->config->getDataBuilder(); } protected function handleResponse($payload, $response) { $this->config->handleResponse($payload, $response); } /** * @param array $serializedPayload * @return array */ protected function scrub(array &$serializedPayload) { $serializedPayload['data'] = $this->config->getScrubber()->scrub($serializedPayload['data']); return $serializedPayload; } /** * @param \Rollbar\Payload\EncodedPayload $payload * @return \Rollbar\Payload\EncodedPayload */ protected function truncate(\Rollbar\Payload\EncodedPayload &$payload) { return $this->truncation->truncate($payload); } /** * @param array &$payload * @return \Rollbar\Payload\EncodedPayload */ protected function encode(array &$payload) { $encoded = new EncodedPayload($payload); $encoded->encode(); return $encoded; } } <?php namespace Rollbar; interface FilterInterface { public function shouldSend($payload, $accessToken); } <?php namespace Rollbar; use Rollbar\Utilities; use Rollbar\Payload\Notifier; use Psr\Log\LogLevel; class Defaults { public static function get() { if (is_null(self::$singleton)) { self::$singleton = new Defaults(new Utilities()); } return self::$singleton; } public function __construct($utilities) { $this->psrLevels = array( LogLevel::EMERGENCY => "critical", "emergency" => "critical", LogLevel::ALERT => "critical", "alert" => "critical", LogLevel::CRITICAL => "critical", "critical" => "critical", LogLevel::ERROR => "error", "error" => "error", LogLevel::WARNING => "warning", "warning" => "warning", LogLevel::NOTICE => "info", "notice" => "info", LogLevel::INFO => "info", "info" => "info", LogLevel::DEBUG => "debug", "debug" => "debug" ); $this->errorLevels = array( E_ERROR => "error", E_WARNING => "warning", E_PARSE => "critical", E_NOTICE => "debug", E_CORE_ERROR => "critical", E_CORE_WARNING => "warning", E_COMPILE_ERROR => "critical", E_COMPILE_WARNING => "warning", E_USER_ERROR => "error", E_USER_WARNING => "warning", E_USER_NOTICE => "debug", E_STRICT => "info", E_RECOVERABLE_ERROR => "error", E_DEPRECATED => "info", E_USER_DEPRECATED => "info" ); $this->scrubFields = array( 'passwd', 'password', 'secret', 'confirm_password', 'password_confirmation', 'auth_token', 'csrf_token', 'access_token' ); $this->serverRoot = isset($_ENV["HEROKU_APP_DIR"]) ? $_ENV["HEROKU_APP_DIR"] : null; $this->platform = php_uname('a'); $this->notifier = Notifier::defaultNotifier(); $this->baseException = version_compare(phpversion(), '7.0', '<') ? '\Exception' : '\Throwable'; $this->errorSampleRates = array(); $this->exceptionSampleRates = array(); $this->utilities = $utilities; } public function fromSnakeCase($option) { $spaced = str_replace('_', ' ', $option); $method = lcfirst(str_replace(' ', '', ucwords($spaced))); if (method_exists($this, $method)) { return $this->$method(); } else { throw new \Exception('No default value defined for property ' . $method . '.'); } } private $utilities; private $data; private static $singleton = null; public function psrLevels($value = null) { return $value !== null ? $value : $this->psrLevels; } public function errorLevels($value = null) { return $value !== null ? $value : $this->errorLevels; } public function autodetectBranch($value = null) { return $value !== null ? $value : $this->autodetectBranch; } public function branch($value = null) { return $value !== null ? $value : $this->branch; } public function serverRoot($value = null) { return $value !== null ? $value : $this->serverRoot; } public function platform($value = null) { return $value !== null ? $value : $this->platform; } public function notifier($value = null) { return $value !== null ? $value : $this->notifier; } public function baseException($value = null) { return $value !== null ? $value : $this->baseException; } public function codeVersion($value = null) { return $value !== null ? $value : $this->codeVersion; } public function sendMessageTrace($value = null) { return $value !== null ? $value : $this->sendMessageTrace; } public function includeCodeContext($value = null) { return $value !== null ? $value : $this->includeCodeContext; } public function includeExcCodeContext($value = null) { return $value !== null ? $value : $this->includeExcCodeContext; } public function rawRequestBody($value = null) { return $value !== null ? $value : $this->rawRequestBody; } public function localVarsDump($value = null) { return $value !== null ? $value : $this->localVarsDump; } public function errorSampleRates($value = null) { return $value !== null ? $value : $this->errorSampleRates; } public function exceptionSampleRates($value = null) { return $value !== null ? $value : $this->exceptionSampleRates; } public function includedErrno($value = null) { return $value !== null ? $value : $this->includedErrno; } public function includeErrorCodeContext($value = null) { return $value !== null ? $value : $this->includeErrorCodeContext; } public function includeExceptionCodeContext($value = null) { return $value !== null ? $value : $this->includeExceptionCodeContext; } public function agentLogLocation($value = null) { return $value !== null ? $value : $this->agentLogLocation; } public function allowExec($value = null) { return $value !== null ? $value : $this->allowExec; } public function messageLevel($value = null) { return $value !== null ? $value : $this->messageLevel; } public function exceptionLevel($value = null) { return $value !== null ? $value : $this->exceptionLevel; } public function endpoint($value = null) { return $value !== null ? $value : $this->endpoint; } public function captureErrorStacktraces($value = null) { return $value !== null ? $value : $this->captureErrorStacktraces; } public function checkIgnore($value = null) { return $value !== null ? $value : $this->checkIgnore; } public function custom($value = null) { return $value !== null ? $value : $this->custom; } public function customDataMethod($value = null) { return $value !== null ? $value : $this->customDataMethod; } public function enabled($value = null) { return $value !== null ? $value : $this->enabled; } public function environment($value = null) { return $value !== null ? $value : $this->environment; } public function fluentHost($value = null) { return $value !== null ? $value : $this->fluentHost; } public function fluentPort($value = null) { return $value !== null ? $value : $this->fluentPort; } public function fluentTag($value = null) { return $value !== null ? $value : $this->fluentTag; } public function handler($value = null) { return $value !== null ? $value : $this->handler; } public function host($value = null) { return $value !== null ? $value : $this->host; } public function timeout($value = null) { return $value !== null ? $value : $this->timeout; } public function reportSuppressed($value = null) { return $value !== null ? $value : $this->reportSuppressed; } public function useErrorReporting($value = null) { return $value !== null ? $value : $this->useErrorReporting; } public function captureIP($value = null) { return $value !== null ? $value : $this->captureIP; } public function captureEmail($value = null) { return $value !== null ? $value : $this->captureEmail; } public function captureUsername($value = null) { return $value !== null ? $value : $this->captureUsername; } public function scrubFields($value = null) { return $value !== null ? $value : $this->scrubFields; } public function customTruncation($value = null) { return $value !== null ? $value : $this->customTruncation; } public function maxNestingDepth($value = null) { return $value !== null ? $value : $this->maxNestingDepth; } public function maxItems($value = null) { return $value !== null ? $value : $this->maxItems; } private $psrLevels; private $errorLevels; private $autodetectBranch = false; private $branch = null; private $serverRoot; private $platform; private $notifier; private $baseException; private $codeVersion = ""; private $sendMessageTrace = false; private $includeCodeContext = false; private $includeExcCodeContext = false; private $rawRequestBody = false; private $localVarsDump = true; private $maxNestingDepth = -1; private $errorSampleRates = array(); private $exceptionSampleRates = array(); private $includedErrno = ROLLBAR_INCLUDED_ERRNO_BITMASK; private $includeErrorCodeContext = null; private $includeExceptionCodeContext = null; private $agentLogLocation = '/var/tmp'; private $allowExec = true; private $messageLevel = "warning"; private $exceptionLevel = "error"; private $endpoint = 'https://api.rollbar.com/api/1/'; private $captureErrorStacktraces = true; private $checkIgnore = null; private $custom = null; private $customDataMethod = null; private $enabled = true; private $environment = 'production'; private $fluentHost = '127.0.0.1'; private $fluentPort = 24224; private $fluentTag = 'rollbar'; private $handler = 'blocking'; private $host = null; private $timeout = 3; private $reportSuppressed = false; private $useErrorReporting = false; private $captureIP = true; private $captureEmail = false; private $captureUsername = false; private $scrubFields; private $customTruncation = null; private $maxItems = 10; } <?php namespace Rollbar\Truncation; use \Rollbar\Payload\EncodedPayload; class RawStrategy extends AbstractStrategy { public function execute(EncodedPayload $payload) { return $payload; } } <?php namespace Rollbar\Truncation; use \Rollbar\Payload\EncodedPayload; class FramesStrategy extends AbstractStrategy { const FRAMES_OPTIMIZATION_RANGE = 75; public function execute(EncodedPayload $payload) { $key = false; $data = $payload->data(); if (isset($data['data']['body']['trace_chain']['frames'])) { $key = 'trace_chain'; } elseif (isset($data['data']['body']['trace']['frames'])) { $key = 'trace'; } if ($key) { $data['data']['body'][$key]['frames'] = $this->selectFrames($data['data']['body'][$key]['frames']); $payload->encode($data); } return $payload; } public function selectFrames($frames, $range = self::FRAMES_OPTIMIZATION_RANGE) { if (count($frames) <= $range * 2) { return $frames; } return array_merge( array_splice($frames, 0, $range), array_splice($frames, -$range, $range) ); } public function applies(EncodedPayload $payload) { $payload = $payload->data(); if (isset($payload['data']['body']['trace_chain']) || isset($payload['data']['body']['trace']['frames'])) { return true; } return false; } } <?php namespace Rollbar\Truncation; use \Rollbar\Payload\EncodedPayload; class AbstractStrategy implements IStrategy { protected $truncation; public function __construct($truncation) { $this->truncation = $truncation; } public function execute(EncodedPayload $payload) { return $payload; } public function applies(EncodedPayload $payload) { return true; } } <?php namespace Rollbar\Truncation; use \Rollbar\Payload\EncodedPayload; class MinBodyStrategy extends AbstractStrategy { const EXCEPTION_MESSAGE_LIMIT = 256; const EXCEPTION_FRAMES_RANGE = 1; public function execute(EncodedPayload $payload) { $data = $payload->data(); $modified = false; $traceData = array(); if (isset($data['data']['body']['trace'])) { $traceData = &$data['data']['body']['trace']; } elseif (isset($data['data']['body']['trace_chain'])) { $traceData = &$data['data']['body']['trace_chain']; } if (isset($traceData['exception'])) { /** * Delete exception description */ unset($traceData['exception']['description']); /** * Truncate exception message */ $traceData['exception']['message'] = substr( $traceData['exception']['message'], 0, static::EXCEPTION_MESSAGE_LIMIT ); $modified = true; } /** * Limit trace frames */ if (!empty($traceData['frames'])) { $framesStrategy = new FramesStrategy($this->truncation); $traceData['frames'] = $framesStrategy->selectFrames( $traceData['frames'], static::EXCEPTION_FRAMES_RANGE ); $modified = true; } if ($modified) { $payloadClass = get_class($payload); $payload = new $payloadClass($data); $payload->encode(); } return $payload; } } <?php namespace Rollbar\Truncation; use \Rollbar\Payload\EncodedPayload; interface IStrategy { /** * @param array $payload * @return array */ public function execute(EncodedPayload $payload); /** * @param array $payload * @return array */ public function applies(EncodedPayload $payload); } <?php namespace Rollbar\Truncation; use \Rollbar\Payload\EncodedPayload; use \Rollbar\Config; class Truncation { const MAX_PAYLOAD_SIZE = 131072; // 128 * 1024 protected static $truncationStrategies = array( "Rollbar\Truncation\FramesStrategy", "Rollbar\Truncation\StringsStrategy" ); public function __construct(Config $config) { if ($custom = $config->getCustomTruncation()) { $this->registerStrategy($custom); } } public function registerStrategy($type) { if (!class_exists($type) || !is_subclass_of($type, "Rollbar\Truncation\AbstractStrategy")) { throw new \Exception( "Truncation strategy '$type' doesn't exist or is not a subclass " . "of Rollbar\Truncation\AbstractStrategy" ); } array_unshift(static::$truncationStrategies, $type); } /** * Applies truncation strategies in order to keep the payload size under * configured limit. * * @param \Rollbar\Payload\EncodedPayload $payload * @param string $strategy * * @return \Rollbar\Payload\EncodedPayload */ public function truncate(EncodedPayload $payload) { foreach (static::$truncationStrategies as $strategy) { $strategy = new $strategy($this); if (!$strategy->applies($payload)) { continue; } if (!$this->needsTruncating($payload, $strategy)) { break; } $payload = $strategy->execute($payload); } return $payload; } /** * Check if the payload is too big to be sent * * @param array $payload * * @return boolean */ public function needsTruncating(EncodedPayload $payload, $strategy) { return $payload->size() > self::MAX_PAYLOAD_SIZE; } } <?php namespace Rollbar\Truncation; use \Rollbar\Payload\EncodedPayload; class StringsStrategy extends AbstractStrategy { public static function getThresholds() { return array(1024, 512, 256); } public function execute(EncodedPayload $payload) { $data = $payload->data(); $modified = false; foreach (static::getThresholds() as $threshold) { $maxPayloadSize = \Rollbar\Truncation\Truncation::MAX_PAYLOAD_SIZE; if (!$this->truncation->needsTruncating($payload, $this)) { break; } if ($this->traverse($data, $threshold, $payload)) { $modified = true; } } if ($modified) { $payload->encode($data); } return $payload; } protected function traverse(&$data, $threshold, $payload) { $modified = false; foreach ($data as $key => &$value) { if (is_array($value)) { if ($this->traverse($value, $threshold, $payload)) { $modified = true; } } else { $strlen = strlen($value); if (is_string($value) && $strlen > $threshold) { $value = substr($value, 0, $threshold); $modified = true; $payload->decreaseSize($strlen - $threshold); } } } return $modified; } } <?php namespace Rollbar; final class Utilities { private static $ObjectHashes; public static function getObjectHashes() { return self::$ObjectHashes; } public static function isWindows() { return php_uname('s') == 'Windows NT'; } public static function validateString( $input, $name = "?", $len = null, $allowNull = true ) { if (is_null($input)) { if (!$allowNull) { throw new \InvalidArgumentException("\$$name must not be null"); } return; } if (!is_string($input)) { throw new \InvalidArgumentException("\$$name must be a string"); } if (!is_null($len) && strlen($input) != $len) { throw new \InvalidArgumentException("\$$name must be $len characters long, was '$input'"); } } public static function validateBoolean( $input, $name = "?", $allowNull = true ) { if (is_null($input)) { if (!$allowNull) { throw new \InvalidArgumentException("\$$name must not be null"); } return; } if (!is_bool($input)) { throw new \InvalidArgumentException("\$$name must be a boolean"); } } public static function validateInteger( $input, $name = "?", $minValue = null, $maxValue = null, $allowNull = true ) { if (is_null($input)) { if (!$allowNull) { throw new \InvalidArgumentException("\$$name must not be null"); } return; } if (!is_integer($input)) { throw new \InvalidArgumentException("\$$name must be an integer"); } if (!is_null($minValue) && $input < $minValue) { throw new \InvalidArgumentException("\$$name must be >= $minValue"); } if (!is_null($maxValue) && $input > $maxValue) { throw new \InvalidArgumentException("\$$name must be <= $maxValue"); } } public static function serializeForRollbar( $obj, array $customKeys = null, &$objectHashes = array(), $maxDepth = -1, $depth = 0 ) { $returnVal = array(); if (is_object($obj)) { if (self::serializedAlready($obj, $objectHashes)) { return self::circularReferenceLabel($obj); } else { self::markSerialized($obj, $objectHashes); } } if ($maxDepth > 0 && $depth > $maxDepth) { return null; } foreach ($obj as $key => $val) { if (is_object($val)) { if (self::serializedAlready($val, $objectHashes)) { $val = self::circularReferenceLabel($val); } else { if ($val instanceof \Serializable) { self::markSerialized($val, $objectHashes); $val = $val->serialize(); } else { $val = array( 'class' => get_class($val), 'value' => self::serializeForRollbar($val, $customKeys, $objectHashes, $maxDepth, $depth+1) ); } } } elseif (is_array($val)) { $val = self::serializeForRollbar($val, $customKeys, $objectHashes, $maxDepth, $depth+1); } if ($customKeys !== null && in_array($key, $customKeys)) { $returnVal[$key] = $val; } elseif (!is_null($val)) { $returnVal[$key] = $val; } } return $returnVal; } private static function serializedAlready($obj, &$objectHashes) { if (!isset($objectHashes[spl_object_hash($obj)])) { return false; } return true; } private static function markSerialized($obj, &$objectHashes) { $objectHashes[spl_object_hash($obj)] = true; self::$ObjectHashes = $objectHashes; } private static function circularReferenceLabel($obj) { return '<CircularReference type:('.get_class($obj).') ref:('.spl_object_hash($obj).')>'; } // from http://www.php.net/manual/en/function.uniqid.php#94959 public static function uuid4() { mt_srand(); return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', // 32 bits for "time_low" mt_rand(0, 0xffff), mt_rand(0, 0xffff), // 16 bits for "time_mid" mt_rand(0, 0xffff), // 16 bits for "time_hi_and_version", // four most significant bits holds version number 4 mt_rand(0, 0x0fff) | 0x4000, // 16 bits, 8 bits for "clk_seq_hi_res", // 8 bits for "clk_seq_low", // two most significant bits holds zero and one for variant DCE1.1 mt_rand(0, 0x3fff) | 0x8000, // 48 bits for "node" mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff) ); } } <?php namespace Rollbar; interface ResponseHandlerInterface { public function handleResponse($payload, $response); } <?php namespace Rollbar\Payload; /** * Suppress PHPMD.ShortVariable for this class, since using property $id is * intended. * * @SuppressWarnings(PHPMD.ShortVariable) */ class Person implements \Serializable { private $id; private $username; private $email; private $extra; private $utilities; public function __construct($id, $username = null, $email = null, array $extra = null) { $this->utilities = new \Rollbar\Utilities(); $this->setId($id); $this->setUsername($username); $this->setEmail($email); $this->extra = $extra == null ? array() : $extra; } public function getId() { return $this->id; } public function setId($id) { $this->id = $id; return $this; } public function getUsername() { return $this->username; } public function setUsername($username) { $this->username = $username; return $this; } public function getEmail() { return $this->email; } public function setEmail($email) { $this->email = $email; return $this; } public function __get($name) { return isset($this->extra[$name]) ? $this->extra[$name] : null; } public function __set($name, $val) { $this->extra[$name] = $val; } public function serialize() { $result = array( "id" => $this->id, "username" => $this->username, "email" => $this->email, ); foreach ($this->extra as $key => $val) { $result[$key] = $val; } $objectHashes = \Rollbar\Utilities::getObjectHashes(); return $this->utilities->serializeForRollbar($result, array_keys($this->extra), $objectHashes); } public function unserialize($serialized) { throw new \Exception('Not implemented yet.'); } } <?php namespace Rollbar\Payload; use Rollbar\LevelFactory; class Level implements \Serializable { /** * Those are PSR-3 compatible loggin levels. They are mapped to Rollbar * service supported levels in Level::init() */ const EMERGENCY = 'emergency'; const ALERT = 'alert'; const CRITICAL = 'critical'; const ERROR = 'error'; const WARNING = 'warning'; const NOTICE = 'notice'; const INFO = 'info'; const DEBUG = 'debug'; /** * @deprecated 1.2.0 */ const IGNORED = 'ignored'; /** * @deprecated 1.2.0 */ const IGNORE = 'ignore'; /** * @deprecated 1.2.0 * * Usage of Level::error(), Level::warning(), Level::info(), Level::notice(), * Level::debug() is no longer supported. It has been replaced with matching * class constants, i.e.: Level::ERROR */ public static function __callStatic($name, $args) { $factory = new LevelFactory(); $level = $factory->fromName($name); if (!$level) { throw new \Exception("Level '$level' doesn't exist."); } return $level; } /** * @var string */ private $level; private $val; public function __construct($level, $val) { $this->level = $level; $this->val = $val; } public function __toString() { return $this->level; } public function toInt() { return $this->val; } public function serialize() { return $this->level; } public function unserialize($serialized) { throw new \Exception('Not implemented yet.'); } } <?php namespace Rollbar\Payload; class Trace implements ContentInterface { private $frames; private $exception; private $utilities; public function __construct(array $frames, ExceptionInfo $exception) { $this->utilities = new \Rollbar\Utilities(); $this->setFrames($frames); $this->setException($exception); } public function getKey() { return 'trace'; } public function getFrames() { return $this->frames; } public function setFrames(array $frames) { $this->frames = $frames; return $this; } public function getException() { return $this->exception; } public function setException(ExceptionInfo $exception) { $this->exception = $exception; return $this; } public function serialize() { $result = array( "frames" => $this->frames, "exception" => $this->exception, ); return $this->utilities->serializeForRollbar($result); } public function unserialize($serialized) { throw new \Exception('Not implemented yet.'); } } <?php namespace Rollbar\Payload; use Rollbar\Defaults; class Data implements \Serializable { private $environment; private $body; private $level; private $timestamp; private $codeVersion; private $platform; private $language; private $framework; private $context; private $request; private $person; private $server; private $custom; private $fingerprint; private $title; private $uuid; private $notifier; private $utilities; public function __construct($environment, Body $body) { $this->utilities = new \Rollbar\Utilities(); $this->setEnvironment($environment); $this->setBody($body); } public function getEnvironment() { return $this->environment; } public function setEnvironment($environment) { $this->environment = $environment; return $this; } public function getBody() { return $this->body; } public function setBody(Body $body) { $this->body = $body; return $this; } /** * @return Level */ public function getLevel() { return $this->level; } public function setLevel($level) { $this->level = $level; return $this; } public function getTimestamp() { return $this->timestamp; } public function setTimestamp($timestamp) { $this->timestamp = $timestamp; return $this; } public function getCodeVersion() { return $this->codeVersion; } public function setCodeVersion($codeVersion) { $this->codeVersion = $codeVersion; return $this; } public function getPlatform() { return $this->platform; } public function setPlatform($platform) { $this->platform = $platform; return $this; } public function getLanguage() { return $this->language; } public function setLanguage($language) { $this->language = $language; return $this; } public function getFramework() { return $this->framework; } public function setFramework($framework) { $this->framework = $framework; return $this; } public function getContext() { return $this->context; } public function setContext($context) { $this->context = $context; return $this; } /** * @return Request */ public function getRequest() { return $this->request; } public function setRequest(Request $request = null) { $this->request = $request; return $this; } /** * @return Person */ public function getPerson() { return $this->person; } public function setPerson(Person $person = null) { $this->person = $person; return $this; } /** * @return Server */ public function getServer() { return $this->server; } public function setServer(Server $server = null) { $this->server = $server; return $this; } public function getCustom() { return $this->custom; } public function setCustom(array $custom = null) { $this->custom = $custom; return $this; } public function getFingerprint() { return $this->fingerprint; } public function setFingerprint($fingerprint) { $this->fingerprint = $fingerprint; return $this; } public function getTitle() { return $this->title; } public function setTitle($title) { $this->title = $title; return $this; } public function getUuid() { return $this->uuid; } public function setUuid($uuid) { $this->uuid = $uuid; return $this; } public function getNotifier() { return $this->notifier; } public function setNotifier(Notifier $notifier) { $this->notifier = $notifier; return $this; } public function serialize() { $result = array( "environment" => $this->environment, "body" => $this->body, "level" => $this->level, "timestamp" => $this->timestamp, "code_version" => $this->codeVersion, "platform" => $this->platform, "language" => $this->language, "framework" => $this->framework, "context" => $this->context, "request" => $this->request, "person" => $this->person, "server" => $this->server, "custom" => $this->custom, "fingerprint" => $this->fingerprint, "title" => $this->title, "uuid" => $this->uuid, "notifier" => $this->notifier, ); $objectHashes = \Rollbar\Utilities::getObjectHashes(); return $this->utilities->serializeForRollbar($result, null, $objectHashes); } public function unserialize($serialized) { throw new \Exception('Not implemented yet.'); } } <?php namespace Rollbar\Payload; class Body implements \Serializable { /** * @var ContentInterface */ private $value; private $utilities; public function __construct(ContentInterface $value) { $this->utilities = new \Rollbar\Utilities(); $this->setValue($value); } public function getValue() { return $this->value; } public function setValue(ContentInterface $value) { $this->value = $value; return $this; } public function serialize() { $result = array(); $result[$this->value->getKey()] = $this->value; $objectHashes = \Rollbar\Utilities::getObjectHashes(); return $this->utilities->serializeForRollbar($result, null, $objectHashes); } public function unserialize($serialized) { throw new \Exception('Not implemented yet.'); } } <?php namespace Rollbar\Payload; class TraceChain implements ContentInterface { private $traces; public function __construct(array $traces) { $this->setTraces($traces); } public function getKey() { return 'trace_chain'; } public function getTraces() { return $this->traces; } public function setTraces($traces) { $this->traces = $traces; return $this; } public function serialize() { $mapValue = function ($value) { if ($value instanceof \Serializable) { return $value->serialize(); } return $value; }; return array_map($mapValue, $this->traces); } public function unserialize($serialized) { throw new \Exception('Not implemented yet.'); } } <?php namespace Rollbar\Payload; class Notifier implements \Serializable { const NAME = "rollbar-php"; const VERSION = "1.7.1"; public static function defaultNotifier() { return new Notifier(self::NAME, self::VERSION); } private $name; private $version; private $utilities; public function __construct($name, $version) { $this->utilities = new \Rollbar\Utilities(); $this->setName($name); $this->setVersion($version); } public function getName() { return $this->name; } public function setName($name) { $this->name = $name; return $this; } public function getVersion() { return $this->version; } public function setVersion($version) { $this->version = $version; return $this; } public function serialize() { $result = array( "name" => $this->name, "version" => $this->version, ); $objectHashes = \Rollbar\Utilities::getObjectHashes(); return $this->utilities->serializeForRollbar($result, null, $objectHashes); } public function unserialize($serialized) { throw new \Exception('Not implemented yet.'); } } <?php namespace Rollbar\Payload; class Context implements \Serializable { private $pre; private $post; private $utilities; public function __construct($pre, $post) { $this->utilities = new \Rollbar\Utilities(); $this->setPre($pre); $this->setPost($post); } public function getPre() { return $this->pre; } public function setPre($pre) { $this->pre = $pre; return $this; } public function getPost() { return $this->post; } public function setPost($post) { $this->post = $post; return $this; } public function serialize() { $result = array( "pre" => $this->pre, "post" => $this->post, ); $objectHashes = \Rollbar\Utilities::getObjectHashes(); return $this->utilities->serializeForRollbar($result, null, $objectHashes); } public function unserialize($serialized) { throw new \Exception('Not implemented yet.'); } } <?php namespace Rollbar\Payload; class Message implements ContentInterface { private $body; private $extra; private $backtrace; private $utilities; public function __construct( $body, array $extra = null, $backtrace = null ) { $this->utilities = new \Rollbar\Utilities(); $this->setBody($body); $this->setBacktrace($backtrace); $this->extra = $extra == null ? array() : $extra; } public function getKey() { return 'message'; } public function getBody() { return $this->body; } public function setBody($body) { $this->body = $body; return $this; } public function getBacktrace() { return $this->backtrace; } public function setBacktrace($backtrace) { $this->backtrace = $backtrace; return $this; } public function __set($key, $val) { $this->extra[$key] = $val; } public function __get($key) { return isset($this->extra[$key]) ? $this->extra[$key] : null; } public function serialize() { $toSerialize = array( "body" => $this->getBody(), "backtrace" => $this->getBacktrace() ); foreach ($this->extra as $key => $value) { $toSerialize[$key] = $value; } return $this->utilities->serializeForRollbar($toSerialize, array_keys($this->extra)); } public function unserialize($serialized) { throw new \Exception('Not implemented yet.'); } } <?php namespace Rollbar\Payload; class Request implements \Serializable { private $url; private $method; private $headers; private $params; private $get; private $queryString; private $post; private $body; private $userIp; private $extra = array(); private $utilities; public function __construct() { $this->utilities = new \Rollbar\Utilities(); } public function getUrl() { return $this->url; } public function setUrl($url) { $this->url = $url; return $this; } public function getMethod() { return $this->method; } public function setMethod($method) { $this->method = $method; return $this; } public function getHeaders() { return $this->headers; } public function setHeaders(array $headers = null) { $this->headers = $headers; return $this; } public function getParams() { return $this->params; } public function setParams(array $params = null) { $this->params = $params; return $this; } public function getGet() { return $this->get; } public function setGet(array $get = null) { $this->get = $get; return $this; } public function getQueryString() { return $this->queryString; } public function setQueryString($queryString) { $this->queryString = $queryString; return $this; } public function getPost() { return $this->post; } public function setPost(array $post = null) { $this->post = $post; return $this; } public function getBody() { return $this->body; } public function setBody($body) { $this->body = $body; return $this; } public function getUserIp() { return $this->userIp; } public function setUserIp($userIp) { $this->userIp = $userIp; return $this; } public function getExtras() { return $this->extra; } public function setExtras($extras) { $this->extra = $extras; } public function setSession($session) { $this->extra['session'] = $session; } public function serialize() { $result = array( "url" => $this->url, "method" => $this->method, "headers" => $this->headers, "params" => $this->params, "GET" => $this->get, "query_string" => $this->queryString, "POST" => $this->post, "body" => $this->body, "user_ip" => $this->userIp, ); foreach ($this->extra as $key => $val) { $result[$key] = $val; } $objectHashes = \Rollbar\Utilities::getObjectHashes(); return $this->utilities->serializeForRollbar($result, array_keys($this->extra), $objectHashes); } public function unserialize($serialized) { throw new \Exception('Not implemented yet.'); } } <?php namespace Rollbar\Payload; use Rollbar\DataBuilder; use Rollbar\Config; class Payload implements \Serializable { private $data; private $accessToken; private $utilities; public function __construct(Data $data, $accessToken) { $this->utilities = new \Rollbar\Utilities(); $this->setData($data); $this->setAccessToken($accessToken); } /** * @return Data */ public function getData() { return $this->data; } public function setData(Data $data) { $this->data = $data; return $this; } public function getAccessToken() { return $this->accessToken; } public function setAccessToken($accessToken) { $this->accessToken = $accessToken; return $this; } public function serialize($maxDepth = -1) { $objectHashes = array(); $result = array( "data" => $this->data, "access_token" => $this->accessToken, ); return $this->utilities->serializeForRollbar($result, null, $objectHashes, $maxDepth); } public function unserialize($serialized) { throw new \Exception('Not implemented yet.'); } } <?php namespace Rollbar\Payload; interface ContentInterface extends \Serializable { public function getKey(); } <?php namespace Rollbar\Payload; class Frame implements \Serializable { private $filename; private $lineno; private $colno; private $method; private $code; private $context; private $args; private $utilities; public function __construct($filename) { $this->utilities = new \Rollbar\Utilities(); $this->setFilename($filename); } public function getFilename() { return $this->filename; } public function setFilename($filename) { $this->filename = $filename; return $this; } public function getLineno() { return $this->lineno; } public function setLineno($lineno) { $this->lineno = $lineno; return $this; } public function getColno() { return $this->colno; } public function setColno($colno) { $this->colno = $colno; return $this; } public function getMethod() { return $this->method; } public function setMethod($method) { $this->method = $method; return $this; } public function getCode() { return $this->code; } public function setCode($code) { $this->code = $code; return $this; } public function getContext() { return $this->context; } public function setContext(Context $context) { $this->context = $context; return $this; } public function getArgs() { return $this->args; } public function setArgs(array $args) { $this->args = $args; return $this; } public function serialize() { $result = array( "filename" => $this->filename, "lineno" => $this->lineno, "colno" => $this->colno, "method" => $this->method, "code" => $this->code, "context" => $this->context, "args" => $this->args ); $objectHashes = \Rollbar\Utilities::getObjectHashes(); return $this->utilities->serializeForRollbar($result, null, $objectHashes); } public function unserialize($serialized) { throw new \Exception('Not implemented yet.'); } } <?php namespace Rollbar\Payload; class Server implements \Serializable { private $host; private $root; private $branch; private $codeVersion; private $extra = array(); private $utilities; public function __construct() { $this->utilities = new \Rollbar\Utilities(); } public function getHost() { return $this->host; } public function setHost($host) { $this->host = $host; return $this; } public function getRoot() { return $this->root; } public function setRoot($root) { $this->root = $root; return $this; } public function getBranch() { return $this->branch; } public function setBranch($branch) { $this->branch = $branch; return $this; } public function getCodeVersion() { return $this->codeVersion; } public function setCodeVersion($codeVersion) { $this->codeVersion = $codeVersion; return $this; } public function setExtras($extras) { $this->extra = $extras; } public function getExtras() { return $this->extra; } public function setArgv($argv) { $this->extra['argv'] = $argv; } public function serialize() { $result = array( "host" => $this->host, "root" => $this->root, "branch" => $this->branch, "code_version" => $this->codeVersion, ); foreach ($this->extra as $key => $val) { $result[$key] = $val; } $objectHashes = \Rollbar\Utilities::getObjectHashes(); return $this->utilities->serializeForRollbar($result, array_keys($this->extra), $objectHashes); } public function unserialize($serialized) { throw new \Exception('Not implemented yet.'); } } <?php namespace Rollbar\Payload; class ExceptionInfo implements \Serializable { private $class; private $message; private $description; private $utilities; public function __construct($class, $message, $description = null) { $this->utilities = new \Rollbar\Utilities(); $this->setClass($class); $this->setMessage($message); $this->setDescription($description); } public function getClass() { return $this->class; } public function setClass($class) { $this->class = $class; return $this; } public function getMessage() { return $this->message; } public function setMessage($message) { $this->message = $message; return $this; } public function getDescription() { return $this->description; } public function setDescription($description) { $this->description = $description; return $this; } public function serialize() { $result = array( "class" => $this->class, "message" => $this->message, "description" => $this->description, ); $objectHashes = \Rollbar\Utilities::getObjectHashes(); return $this->utilities->serializeForRollbar($result, null, $objectHashes); } public function unserialize($serialized) { throw new \Exception('Not implemented yet.'); } } <?php namespace Rollbar\Payload; class EncodedPayload { protected $data = null; protected $encoded = null; protected $size = 0; public function __construct(array $data) { $this->data = $data; } public function data() { return $this->data; } public function size() { return $this->size; } public function decreaseSize($amount) { $this->size -= $amount; } public function encode($data = null) { if ($data !== null) { $this->data = $data; } $this->encoded = json_encode( $this->data, defined('JSON_PARTIAL_OUTPUT_ON_ERROR') ? JSON_PARTIAL_OUTPUT_ON_ERROR : 0 ); if ($this->encoded === false) { throw new \Exception("Payload data could not be encoded to JSON format."); } $this->size = strlen($this->encoded); } public function __toString() { return $this->encoded(); } public function encoded() { return $this->encoded; } } <?php namespace Rollbar; use Rollbar\Payload\Level; use Rollbar\Payload\Payload; use \Rollbar\Payload\EncodedPayload; if (!defined('ROLLBAR_INCLUDED_ERRNO_BITMASK')) { define( 'ROLLBAR_INCLUDED_ERRNO_BITMASK', E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR ); } class Config { private static $options = array( 'access_token', 'agent_log_location', 'allow_exec', 'endpoint', 'base_api_url', 'autodetect_branch', 'branch', 'capture_error_stacktraces', 'check_ignore', 'code_version', 'custom', 'custom_data_method', 'enabled', 'environment', 'error_sample_rates', 'exception_sample_rates', 'fluent_host', 'fluent_port', 'fluent_tag', 'handler', 'host', 'include_error_code_context', 'include_exception_code_context', 'included_errno', 'logger', 'person', 'person_fn', 'capture_ip', 'capture_username', 'capture_email', 'root', 'scrub_fields', 'scrub_whitelist', 'timeout', 'custom_truncation', 'report_suppressed', 'use_error_reporting', 'proxy', 'send_message_trace', 'include_raw_request_body', 'local_vars_dump', 'max_nesting_depth', 'max_items' ); private $accessToken; /** * @var string $enabled Enable / disable Rollbar SDK. */ private $enabled = true; /** * @var DataBuilder */ private $dataBuilder; private $configArray; /** * @var LevelFactory */ private $levelFactory; /** * @var Utilities */ private $utilities; /** * @var TransformerInterface */ private $transformer; /** * @var FilterInterface */ private $filter; private $minimumLevel; /** * @var ResponseHandlerInterface */ private $responseHandler; /** * @var \Rollbar\Senders\SenderInterface */ private $sender; private $reportSuppressed; /** * @var Scrubber */ private $scrubber; private $batched = false; private $batchSize = 50; private $maxNestingDepth = 10; private $custom = array(); /** * @var callable with parameters $toLog, $contextDataMethodContext. The return * value of the callable will be appended to the custom field of the item. */ private $customDataMethod; /** * @var callable */ private $checkIgnore; private $errorSampleRates; private $exceptionSampleRates; private $mtRandmax; private $includedErrno; private $useErrorReporting = false; /** * @var boolean Should debug_backtrace() data be sent with string messages * sent through RollbarLogger::log(). */ private $sendMessageTrace = false; /** * @var string (fully qualified class name) The name of the your custom * truncation strategy class. The class should inherit from * Rollbar\Truncation\AbstractStrategy. */ private $customTruncation; /** * @var int The maximum number of items reported to Rollbar within one * request. */ private $maxItems; public function __construct(array $configArray) { $this->includedErrno = \Rollbar\Defaults::get()->includedErrno(); $this->levelFactory = new LevelFactory(); $this->utilities = new Utilities(); $this->updateConfig($configArray); $this->errorSampleRates = \Rollbar\Defaults::get()->errorSampleRates(); if (isset($configArray['error_sample_rates'])) { $this->errorSampleRates = $configArray['error_sample_rates']; } $this->exceptionSampleRates = \Rollbar\Defaults::get()->exceptionSampleRates(); if (isset($configArray['exception_sample_rates'])) { $this->exceptionSampleRates = $configArray['exception_sample_rates']; } $levels = array(E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, E_STRICT, E_RECOVERABLE_ERROR); // PHP 5.3.0 if (defined('E_DEPRECATED')) { $levels = array_merge($levels, array(E_DEPRECATED, E_USER_DEPRECATED)); } $curr = 1; for ($i = 0, $num = count($levels); $i < $num; $i++) { $level = $levels[$i]; if (!isset($this->errorSampleRates[$level])) { $this->errorSampleRates[$level] = $curr; } } $this->mtRandmax = mt_getrandmax(); } public static function listOptions() { return self::$options; } public function configure($config) { $this->updateConfig($this->extend($config)); } public function extend($config) { return array_replace_recursive(array(), $this->configArray, $config); } public function getConfigArray() { return $this->configArray; } protected function updateConfig($config) { $this->configArray = $config; $this->setEnabled($config); $this->setAccessToken($config); $this->setDataBuilder($config); $this->setTransformer($config); $this->setMinimumLevel($config); $this->setReportSuppressed($config); $this->setFilters($config); $this->setSender($config); $this->setScrubber($config); $this->setBatched($config); $this->setBatchSize($config); $this->setMaxNestingDepth($config); $this->setCustom($config); $this->setResponseHandler($config); $this->setCheckIgnoreFunction($config); $this->setSendMessageTrace($config); if (isset($config['included_errno'])) { $this->includedErrno = $config['included_errno']; } $this->useErrorReporting = \Rollbar\Defaults::get()->useErrorReporting(); if (isset($config['use_error_reporting'])) { $this->useErrorReporting = $config['use_error_reporting']; } $this->maxItems = \Rollbar\Defaults::get()->maxItems(); if (isset($config['max_items'])) { $this->maxItems = $config['max_items']; } if (isset($config['custom_truncation'])) { $this->customTruncation = $config['custom_truncation']; } $this->customDataMethod = \Rollbar\Defaults::get()->customDataMethod(); if (isset($config['custom_data_method'])) { $this->customDataMethod = $config['custom_data_method']; } } private function setAccessToken($config) { if (isset($_ENV['ROLLBAR_ACCESS_TOKEN']) && !isset($config['access_token'])) { $config['access_token'] = $_ENV['ROLLBAR_ACCESS_TOKEN']; } $this->utilities->validateString($config['access_token'], "config['access_token']", 32, false); $this->accessToken = $config['access_token']; } private function setEnabled($config) { if (array_key_exists('enabled', $config) && $config['enabled'] === false) { $this->disable(); } else { if (\Rollbar\Defaults::get()->enabled() === false) { $this->disable(); } else { $this->enable(); } } } public function enable() { $this->enabled = true; } public function disable() { $this->enabled = false; } private function setDataBuilder($config) { if (!isset($config['levelFactory'])) { $config['levelFactory'] = $this->levelFactory; } if (!isset($config['utilities'])) { $config['utilities'] = $this->utilities; } $exp = "Rollbar\DataBuilderInterface"; $def = "Rollbar\DataBuilder"; $this->setupWithOptions($config, "dataBuilder", $exp, $def, true); } private function setTransformer($config) { $expected = "Rollbar\TransformerInterface"; $this->setupWithOptions($config, "transformer", $expected); } private function setMinimumLevel($config) { $this->minimumLevel = 0; if (empty($config['minimumLevel'])) { $this->minimumLevel = 0; } elseif ($config['minimumLevel'] instanceof Level) { $this->minimumLevel = $config['minimumLevel']->toInt(); } elseif (is_string($config['minimumLevel'])) { $level = $this->levelFactory->fromName($config['minimumLevel']); if ($level !== null) { $this->minimumLevel = $level->toInt(); } } elseif (is_int($config['minimumLevel'])) { $this->minimumLevel = $config['minimumLevel']; } } private function setReportSuppressed($config) { $this->reportSuppressed = isset($config['reportSuppressed']) && $config['reportSuppressed']; if (!isset($this->reportSuppressed)) { $this->reportSuppressed = isset($config['report_suppressed']) && $config['report_suppressed']; } if (!isset($this->reportSuppressed)) { $this->reportSuppressed = \Rollbar\Defaults::get()->reportSuppressed(); } } private function setFilters($config) { $this->setupWithOptions($config, "filter", "Rollbar\FilterInterface"); } private function setSender($config) { $expected = "Rollbar\Senders\SenderInterface"; $default = "Rollbar\Senders\CurlSender"; $this->setTransportOptions($config); $default = $this->setAgentSenderOptions($config, $default); $default = $this->setFluentSenderOptions($config, $default); $this->setupWithOptions($config, "sender", $expected, $default); } private function setScrubber($config) { $exp = "Rollbar\ScrubberInterface"; $def = "Rollbar\Scrubber"; $this->setupWithOptions($config, "scrubber", $exp, $def, true); } private function setBatched($config) { if (array_key_exists('batched', $config)) { $this->batched = $config['batched']; } } private function setBatchSize($config) { if (array_key_exists('batch_size', $config)) { $this->batchSize = $config['batch_size']; } } private function setMaxNestingDepth($config) { if (array_key_exists('max_nesting_depth', $config)) { $this->maxNestingDepth = $config['max_nesting_depth']; } } public function setCustom($config) { $this->dataBuilder->setCustom($config); } public function addCustom($key, $data) { $this->dataBuilder->addCustom($key, $data); } public function removeCustom($key) { $this->dataBuilder->removeCustom($key); } public function getCustom() { return $this->dataBuilder->getCustom(); } public function getAllowedCircularReferenceTypes() { return $this->allowedCircularReferenceTypes; } public function setCustomTruncation($type) { $this->customTruncation = $type; } public function getCustomTruncation() { return $this->customTruncation; } private function setTransportOptions(&$config) { if (array_key_exists('base_api_url', $config)) { $config['senderOptions']['endpoint'] = $config['base_api_url'] . 'item/'; } if (array_key_exists('endpoint', $config)) { $config['senderOptions']['endpoint'] = $config['endpoint'] . 'item/'; } if (array_key_exists('timeout', $config)) { $config['senderOptions']['timeout'] = $config['timeout']; } if (array_key_exists('proxy', $config)) { $config['senderOptions']['proxy'] = $config['proxy']; } if (array_key_exists('ca_cert_path', $config)) { $config['senderOptions']['ca_cert_path'] = $config['ca_cert_path']; } } private function setAgentSenderOptions(&$config, $default) { if (!array_key_exists('handler', $config) || $config['handler'] != 'agent') { return $default; } $default = "Rollbar\Senders\AgentSender"; if (array_key_exists('agent_log_location', $config)) { $config['senderOptions'] = array( 'agentLogLocation' => $config['agent_log_location'] ); } return $default; } private function setFluentSenderOptions(&$config, $default) { if (!isset($config['handler']) || $config['handler'] != 'fluent') { return $default; } $default = "Rollbar\Senders\FluentSender"; if (isset($config['fluent_host'])) { $config['senderOptions']['fluentHost'] = $config['fluent_host']; } if (isset($config['fluent_port'])) { $config['senderOptions']['fluentPort'] = $config['fluent_port']; } if (isset($config['fluent_tag'])) { $config['senderOptions']['fluentTag'] = $config['fluent_tag']; } return $default; } private function setResponseHandler($config) { $this->setupWithOptions($config, "responseHandler", "Rollbar\ResponseHandlerInterface"); } private function setCheckIgnoreFunction($config) { // Remain backwards compatible if (isset($config['checkIgnore'])) { $this->checkIgnore = $config['checkIgnore']; } if (isset($config['check_ignore'])) { $this->checkIgnore = $config['check_ignore']; } } private function setSendMessageTrace($config) { if (!isset($config['send_message_trace'])) { return; } $this->sendMessageTrace = $config['send_message_trace']; } /** * Allows setting up configuration options that might be specified by class * name. Any interface used with `setupWithOptions` should be constructed * with a single parameter: an associative array with the config options. * It is assumed that it will be in the configuration as a sibling to the * key the class is named in. The options should have the same key as the * classname, but with 'Options' appended. E.g: * ```array( * "sender" => "MySender", * "senderOptions" => array( * "speed" => 11, * "protocol" => "First Contact" * ) * );``` * Will be initialized as if you'd used: * `new MySender(array("speed"=>11,"protocol"=>"First Contact"));` * You can also just pass an instance in directly. (In which case options * are ignored) * @param $config * @param $keyName * @param $expectedType * @param mixed $defaultClass * @param bool $passWholeConfig */ protected function setupWithOptions( $config, $keyName, $expectedType, $defaultClass = null, $passWholeConfig = false ) { $class = isset($config[$keyName]) ? $config[$keyName] : null; if (is_null($defaultClass) && is_null($class)) { return; } if (is_null($class)) { $class = $defaultClass; } if (is_string($class)) { if ($passWholeConfig) { $options = $config; } else { $options = isset($config[$keyName . "Options"]) ? $config[$keyName . "Options"] : array(); } $this->$keyName = new $class($options); } else { $this->$keyName = $class; } if (!$this->$keyName instanceof $expectedType) { throw new \InvalidArgumentException( "$keyName must be a $expectedType" ); } } public function getRollbarData($level, $toLog, $context) { return $this->dataBuilder->makeData($level, $toLog, $context); } public function getDataBuilder() { return $this->dataBuilder; } public function getLevelFactory() { return $this->levelFactory; } public function getSender() { return $this->sender; } public function getScrubber() { return $this->scrubber; } public function getBatched() { return $this->batched; } public function getBatchSize() { return $this->batchSize; } public function getMaxNestingDepth() { return $this->maxNestingDepth; } public function getMaxItems() { return $this->maxItems; } /** * @param Payload $payload * @param Level $level * @param \Exception | \Throwable $toLog * @param array $context * @return Payload */ public function transform($payload, $level, $toLog, $context) { if (count($this->custom) > 0) { $data = $payload->getData(); $custom = $data->getCustom(); $custom = array_merge(array(), $this->custom, (array)$custom); $data->setCustom($custom); $payload->setData($data); } if (is_null($this->transformer)) { return $payload; } return $this->transformer->transform($payload, $level, $toLog, $context); } public function getAccessToken() { return $this->accessToken; } public function enabled() { return $this->enabled === true; } public function disabled() { return !$this->enabled(); } public function getSendMessageTrace() { return $this->sendMessageTrace; } public function checkIgnored($payload, $accessToken, $toLog, $isUncaught) { if (isset($this->checkIgnore)) { try { if (call_user_func($this->checkIgnore, $isUncaught, $toLog, $payload)) { return true; } } catch (Exception $exception) { // We should log that we are removing the custom checkIgnore $this->checkIgnore = null; } } if ($this->payloadLevelTooLow($payload)) { return true; } if (!is_null($this->filter)) { return $this->filter->shouldSend($payload, $accessToken); } return false; } public function internalCheckIgnored($level, $toLog) { if ($this->shouldSuppress()) { return true; } if ($this->levelTooLow($this->levelFactory->fromName($level))) { return true; } if ($toLog instanceof ErrorWrapper) { return $this->shouldIgnoreErrorWrapper($toLog); } if ($toLog instanceof \Exception) { return $this->shouldIgnoreException($toLog); } return false; } /** * Check if the error should be ignored due to `included_errno` config, * `use_error_reporting` config or `error_sample_rates` config. * * @param errno * * @return bool */ public function shouldIgnoreError($errno) { if ($this->useErrorReporting && ($errno & error_reporting()) === 0) { // ignore due to error_reporting level return true; } if ($this->includedErrno != -1 && ($errno & $this->includedErrno) != $errno) { // ignore return true; } if (isset($this->errorSampleRates[$errno])) { // get a float in the range [0, 1) // mt_rand() is inclusive, so add 1 to mt_randmax $float_rand = mt_rand() / ($this->mtRandmax + 1); if ($float_rand > $this->errorSampleRates[$errno]) { // skip return true; } } return false; } /** * Check if the error should be ignored due to `included_errno` config, * `use_error_reporting` config or `error_sample_rates` config. * * @param \Rollbar\ErrorWrapper $toLog * * @return bool */ protected function shouldIgnoreErrorWrapper(ErrorWrapper $toLog) { return $this->shouldIgnoreError($toLog->errorLevel); } /** * Check if the exception should be ignored due to configured exception * sample rates. * * @param \Exception $toLog * * @return bool */ protected function shouldIgnoreException(\Exception $toLog) { // get a float in the range [0, 1) // mt_rand() is inclusive, so add 1 to mt_randmax $floatRand = mt_rand() / ($this->mtRandmax + 1); if ($floatRand > $this->exceptionSampleRate($toLog)) { // skip return true; } return false; } /** * Calculate what's the chance of logging this exception according to * exception sampling. * * @param \Exception $toLog * * @return float */ public function exceptionSampleRate(\Exception $toLog) { $sampleRate = 1.0; if (count($this->exceptionSampleRates) == 0) { return $sampleRate; } $exceptionClasses = array(); $class = get_class($toLog); while ($class) { $exceptionClasses []= $class; $class = get_parent_class($class); } $exceptionClasses = array_reverse($exceptionClasses); foreach ($exceptionClasses as $exceptionClass) { if (isset($this->exceptionSampleRates["$exceptionClass"])) { $sampleRate = $this->exceptionSampleRates["$exceptionClass"]; } } return $sampleRate; } /** * @param Payload $payload * @return bool */ private function payloadLevelTooLow($payload) { return $this->levelTooLow($payload->getData()->getLevel()); } /** * @param Level $level * @return bool */ private function levelTooLow($level) { return $level->toInt() < $this->minimumLevel; } private function shouldSuppress() { return error_reporting() === 0 && !$this->reportSuppressed; } public function send(EncodedPayload $payload, $accessToken) { return $this->sender->send($payload, $accessToken); } public function sendBatch(&$batch, $accessToken) { return $this->sender->sendBatch($batch, $accessToken); } public function wait($accessToken, $max = 0) { $this->sender->wait($accessToken, $max); } public function handleResponse($payload, $response) { if (!is_null($this->responseHandler)) { $this->responseHandler->handleResponse($payload, $response); } } } <?php namespace Rollbar; use Rollbar\Payload\Context; use Rollbar\Payload\Message; use Rollbar\Payload\Body; use Rollbar\Payload\Level; use Rollbar\Payload\Person; use Rollbar\Payload\Server; use Rollbar\Payload\Request; use Rollbar\Payload\Data; use Rollbar\Payload\Trace; use Rollbar\Payload\Frame; use Rollbar\Payload\TraceChain; use Rollbar\Payload\ExceptionInfo; use Rollbar\Rollbar; use Rollbar\Exceptions\PersonFuncException; class DataBuilder implements DataBuilderInterface { const ANONYMIZE_IP = 'anonymize'; protected static $defaults; protected $environment; protected $messageLevel; protected $exceptionLevel; protected $psrLevels; protected $errorLevels; protected $codeVersion; protected $platform; protected $framework; protected $context; protected $requestParams; protected $requestBody; protected $requestExtras; protected $host; protected $person; protected $personFunc; protected $serverRoot; protected $serverBranch; protected $serverCodeVersion; protected $serverExtras; protected $custom; protected $customDataMethod; protected $fingerprint; protected $title; protected $notifier; protected $baseException; protected $includeCodeContext; protected $includeExcCodeContext; protected $sendMessageTrace; protected $rawRequestBody; protected $localVarsDump; protected $captureErrorStacktraces; protected $captureIP; protected $captureEmail; protected $captureUsername; /** * @var LevelFactory */ protected $levelFactory; /** * @var Utilities */ protected $utilities; public function __construct($config) { self::$defaults = Defaults::get(); $this->setUtilities($config); $this->setEnvironment($config); $this->setRawRequestBody($config); $this->setDefaultMessageLevel($config); $this->setDefaultExceptionLevel($config); $this->setDefaultPsrLevels($config); $this->setErrorLevels($config); $this->setCodeVersion($config); $this->setPlatform($config); $this->setFramework($config); $this->setContext($config); $this->setRequestParams($config); $this->setRequestBody($config); $this->setRequestExtras($config); $this->setHost($config); $this->setPerson($config); $this->setPersonFunc($config); $this->setServerRoot($config); $this->setServerBranch($config); $this->setServerCodeVersion($config); $this->setServerExtras($config); $this->setCustom($config); $this->setFingerprint($config); $this->setTitle($config); $this->setNotifier($config); $this->setBaseException($config); $this->setIncludeCodeContext($config); $this->setIncludeExcCodeContext($config); $this->setSendMessageTrace($config); $this->setLocalVarsDump($config); $this->setCaptureErrorStacktraces($config); $this->setLevelFactory($config); $this->setCaptureEmail($config); $this->setCaptureUsername($config); $this->setCaptureIP($config); $this->setCustomDataMethod($config); } protected function setCaptureIP($config) { $fromConfig = isset($config['capture_ip']) ? $config['capture_ip'] : null; $this->captureIP = self::$defaults->captureIP($fromConfig); } protected function setCaptureEmail($config) { $fromConfig = isset($config['capture_email']) ? $config['capture_email'] : null; $this->captureEmail = self::$defaults->captureEmail($fromConfig); } protected function setCaptureUsername($config) { $fromConfig = isset($config['capture_username']) ? $config['capture_username'] : null; $this->captureUsername = self::$defaults->captureUsername($fromConfig); } protected function setEnvironment($config) { $fromConfig = isset($config['environment']) ? $config['environment'] : self::$defaults->get()->environment(); $this->utilities->validateString($fromConfig, "config['environment']", null, false); $this->environment = $fromConfig; } protected function setDefaultMessageLevel($config) { $fromConfig = isset($config['messageLevel']) ? $config['messageLevel'] : null; $this->messageLevel = self::$defaults->messageLevel($fromConfig); } protected function setDefaultExceptionLevel($config) { $fromConfig = isset($config['exceptionLevel']) ? $config['exceptionLevel'] : null; $this->exceptionLevel = self::$defaults->exceptionLevel($fromConfig); } protected function setDefaultPsrLevels($config) { $fromConfig = isset($config['psrLevels']) ? $config['psrLevels'] : null; $this->psrLevels = self::$defaults->psrLevels($fromConfig); } protected function setErrorLevels($config) { $fromConfig = isset($config['errorLevels']) ? $config['errorLevels'] : null; $this->errorLevels = self::$defaults->errorLevels($fromConfig); } protected function setSendMessageTrace($config) { $fromConfig = isset($config['send_message_trace']) ? $config['send_message_trace'] : null; $this->sendMessageTrace = self::$defaults->sendMessageTrace($fromConfig); } protected function setRawRequestBody($config) { $fromConfig = isset($config['include_raw_request_body']) ? $config['include_raw_request_body'] : null; $this->rawRequestBody = self::$defaults->rawRequestBody($fromConfig); } protected function setLocalVarsDump($config) { $fromConfig = isset($config['local_vars_dump']) ? $config['local_vars_dump'] : null; $this->localVarsDump = self::$defaults->localVarsDump($fromConfig); } protected function setCaptureErrorStacktraces($config) { $fromConfig = isset($config['capture_error_stacktraces']) ? $config['capture_error_stacktraces'] : null; $this->captureErrorStacktraces = self::$defaults->captureErrorStacktraces($fromConfig); } protected function setCodeVersion($config) { $fromConfig = isset($config['codeVersion']) ? $config['codeVersion'] : null; if (!isset($fromConfig)) { $fromConfig = isset($config['code_version']) ? $config['code_version'] : null; } $this->codeVersion = self::$defaults->codeVersion($fromConfig); } protected function setPlatform($config) { $fromConfig = isset($config['platform']) ? $config['platform'] : null; $this->platform = self::$defaults->platform($fromConfig); } protected function setFramework($config) { $this->framework = isset($config['framework']) ? $config['framework'] : null; } protected function setContext($config) { $this->context = isset($config['context']) ? $config['context'] : null; } protected function setRequestParams($config) { $this->requestParams = isset($config['requestParams']) ? $config['requestParams'] : null; } /* * @SuppressWarnings(PHPMD.Superglobals) */ protected function setRequestBody($config) { $this->requestBody = isset($config['requestBody']) ? $config['requestBody'] : null; if (!$this->requestBody && $this->rawRequestBody) { $this->requestBody = file_get_contents("php://input"); if (version_compare(PHP_VERSION, '5.6.0') < 0) { $_SERVER['php://input'] = $this->requestBody; } } } protected function setRequestExtras($config) { $this->requestExtras = isset($config["requestExtras"]) ? $config["requestExtras"] : null; } protected function setPerson($config) { $this->person = isset($config['person']) ? $config['person'] : null; } protected function setPersonFunc($config) { $this->personFunc = isset($config['person_fn']) ? $config['person_fn'] : null; } protected function setServerRoot($config) { $fromConfig = isset($config['serverRoot']) ? $config['serverRoot'] : null; if (!isset($fromConfig)) { $fromConfig = isset($config['root']) ? $config['root'] : null; } $this->serverRoot = self::$defaults->serverRoot($fromConfig); } protected function setServerBranch($config) { $fromConfig = isset($config['serverBranch']) ? $config['serverBranch'] : null; if (!isset($fromConfig)) { $fromConfig = isset($config['branch']) ? $config['branch'] : null; } $this->serverBranch = self::$defaults->branch($fromConfig); if ($this->serverBranch === null) { $autodetectBranch = isset($config['autodetect_branch']) ? $config['autodetect_branch'] : self::$defaults->autodetectBranch(); if ($autodetectBranch) { $allowExec = isset($config['allow_exec']) ? $config['allow_exec'] : self::$defaults->allowExec(); $this->serverBranch = $this->detectGitBranch($allowExec); } } } protected function setServerCodeVersion($config) { $this->serverCodeVersion = isset($config['serverCodeVersion']) ? $config['serverCodeVersion'] : null; } protected function setServerExtras($config) { $this->serverExtras = isset($config['serverExtras']) ? $config['serverExtras'] : null; } public function setCustom($config) { $this->custom = isset($config['custom']) ? $config['custom'] : \Rollbar\Defaults::get()->custom(); } public function setCustomDataMethod($config) { $this->customDataMethod = isset($config['custom_data_method']) ? $config['custom_data_method'] : \Rollbar\Defaults::get()->customDataMethod(); } protected function setFingerprint($config) { $this->fingerprint = isset($config['fingerprint']) ? $config['fingerprint'] : null; } protected function setTitle($config) { $this->title = isset($config['title']) ? $config['title'] : null; } protected function setNotifier($config) { $fromConfig = isset($config['notifier']) ? $config['notifier'] : null; $this->notifier = self::$defaults->notifier($fromConfig); } protected function setBaseException($config) { $fromConfig = isset($config['baseException']) ? $config['baseException'] : null; $this->baseException = self::$defaults->baseException($fromConfig); } protected function setIncludeCodeContext($config) { $fromConfig = isset($config['include_error_code_context']) ? $config['include_error_code_context'] : null; $this->includeCodeContext = self::$defaults->includeCodeContext($fromConfig); } protected function setIncludeExcCodeContext($config) { $fromConfig = isset($config['include_exception_code_context']) ? $config['include_exception_code_context'] : null; $this->includeExcCodeContext = self::$defaults->includeExcCodeContext($fromConfig); } protected function setLevelFactory($config) { $this->levelFactory = isset($config['levelFactory']) ? $config['levelFactory'] : null; if (!$this->levelFactory) { throw new \InvalidArgumentException( 'Missing dependency: LevelFactory not provided to the DataBuilder.' ); } } protected function setUtilities($config) { $this->utilities = isset($config['utilities']) ? $config['utilities'] : null; if (!$this->utilities) { throw new \InvalidArgumentException( 'Missing dependency: Utilities not provided to the DataBuilder.' ); } } protected function setHost($config) { $this->host = isset($config['host']) ? $config['host'] : self::$defaults->host(); } /** * @param string $level * @param \Exception | \Throwable | string $toLog * @param $context * @return Data */ public function makeData($level, $toLog, $context) { $env = $this->getEnvironment(); $body = $this->getBody($toLog, $context); $data = new Data($env, $body); $data->setLevel($this->getLevel($level, $toLog)) ->setTimestamp($this->getTimestamp()) ->setCodeVersion($this->getCodeVersion()) ->setPlatform($this->getPlatform()) ->setLanguage($this->getLanguage()) ->setFramework($this->getFramework()) ->setContext($this->getContext()) ->setRequest($this->getRequest()) ->setPerson($this->getPerson()) ->setServer($this->getServer()) ->setCustom($this->getCustomForPayload($toLog, $context)) ->setFingerprint($this->getFingerprint($context)) ->setTitle($this->getTitle()) ->setUuid($this->getUuid()) ->setNotifier($this->getNotifier()); return $data; } protected function getEnvironment() { return $this->environment; } protected function getBody($toLog, $context) { $baseException = $this->getBaseException(); if ($toLog instanceof ErrorWrapper) { $content = $this->getErrorTrace($toLog); } elseif ($toLog instanceof $baseException) { $content = $this->getExceptionTrace($toLog); } else { $content = $this->getMessage($toLog, $context); } return new Body($content); } public function getErrorTrace(ErrorWrapper $error) { return $this->makeTrace($error, $this->includeCodeContext, $error->getClassName()); } /** * @param \Throwable|\Exception $exc * @return Trace|TraceChain */ public function getExceptionTrace($exc) { $chain = array(); $chain[] = $this->makeTrace($exc, $this->includeExcCodeContext); $previous = $exc->getPrevious(); $baseException = $this->getBaseException(); while ($previous instanceof $baseException) { $chain[] = $this->makeTrace($previous, $this->includeExcCodeContext); if ($previous->getPrevious() === $previous) { break; } $previous = $previous->getPrevious(); } if (count($chain) > 1) { return new TraceChain($chain); } return $chain[0]; } /** * @param \Throwable|\Exception $exception * @param Boolean $includeContext whether or not to include context * @param string $classOverride * @return Trace */ public function makeTrace($exception, $includeContext, $classOverride = null) { if ($this->captureErrorStacktraces) { $frames = $this->makeFrames($exception, $includeContext); } else { $frames = array(); } $excInfo = new ExceptionInfo( $classOverride ?: get_class($exception), $exception->getMessage() ); return new Trace($frames, $excInfo); } public function makeFrames($exception, $includeContext) { $frames = array(); foreach ($this->getTrace($exception) as $frameInfo) { $filename = isset($frameInfo['file']) ? $frameInfo['file'] : null; $lineno = isset($frameInfo['line']) ? $frameInfo['line'] : null; $method = isset($frameInfo['function']) ? $frameInfo['function'] : null; if (isset($frameInfo['class'])) { $method = $frameInfo['class'] . "::" . $method; } $args = isset($frameInfo['args']) ? $frameInfo['args'] : null; $frame = new Frame($filename); $frame->setLineno($lineno) ->setMethod($method); if ($this->localVarsDump && $args !== null) { $frame->setArgs($args); } if ($includeContext) { $this->addCodeContextToFrame($frame, $filename, $lineno); } $frames[] = $frame; } $frames = array_reverse($frames); return $frames; } private function addCodeContextToFrame(Frame $frame, $filename, $line) { if (!file_exists($filename)) { return; } $source = $this->getSourceLines($filename); $total = count($source); $line = max($line - 1, 0); $frame->setCode($source[$line]); $offset = 6; $min = max($line - $offset, 0); $pre = null; $post = null; if ($min !== $line) { $pre = array_slice($source, $min, $line - $min); } $max = min($line + $offset, $total); if ($max !== $line) { $post = array_slice($source, $line + 1, $max - $line); } $frame->setContext(new Context($pre, $post)); } private function getTrace($exc) { if ($exc instanceof ErrorWrapper) { return $exc->getBacktrace(); } else { $trace = $exc->getTrace(); // Add the Exception's file and line as the last frame of the trace array_unshift($trace, array('file' => $exc->getFile(), 'line' => $exc->getLine())); return $trace; } } protected function getMessage($toLog, $context) { return new Message( (string)$toLog, $context, $this->sendMessageTrace ? debug_backtrace($this->localVarsDump ? 0 : DEBUG_BACKTRACE_IGNORE_ARGS) : null ); } protected function getLevel($level, $toLog) { if (is_null($level)) { if ($toLog instanceof ErrorWrapper) { $level = isset($this->errorLevels[$toLog->errorLevel]) ? $this->errorLevels[$toLog->errorLevel] : null; } elseif ($toLog instanceof \Exception) { $level = $this->exceptionLevel; } else { $level = $this->messageLevel; } } $level = strtolower($level); $level = isset($this->psrLevels[$level]) ? $this->psrLevels[$level] : null; return $this->levelFactory->fromName($level); } protected function getTimestamp() { return time(); } protected function getCodeVersion() { return $this->codeVersion; } protected function getPlatform() { return $this->platform; } protected function getLanguage() { return "php"; // TODO: once the backend understands a more informative language value // return "PHP " . phpversion(); } protected function getFramework() { return $this->framework; } protected function getContext() { return $this->context; } /* * @SuppressWarnings(PHPMD.Superglobals) */ protected function getRequest() { $request = new Request(); $request->setUrl($this->getUrl()) ->setHeaders($this->getHeaders()) ->setParams($this->getRequestParams()) ->setBody($this->getRequestBody()) ->setUserIp($this->getUserIp()); if (isset($_SERVER)) { $request->setMethod(isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null) ->setQueryString(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null); } if (isset($_GET)) { $request->setGet($_GET); } if (isset($_POST)) { $request->setPost($_POST); } if ($request->getMethod() === 'PUT') { $postData = array(); parse_str($request->getBody(), $postData); $request->setPost($postData); } $extras = $this->getRequestExtras(); if (!$extras) { $extras = array(); } $request->setExtras($extras); if (isset($_SESSION) && is_array($_SESSION) && count($_SESSION) > 0) { $request->setSession($_SESSION); } return $request; } public function parseForwardedString($forwarded) { $result = array(); // Remove Forwarded = 1#forwarded-element header prefix $parts = trim(str_replace('Forwarded:', '', $forwarded)); /** * Break up the forwarded-element = * [ forwarded-pair ] *( ";" [ forwarded-pair ] ) */ $parts = explode(';', $parts); /** * Parse forwarded pairs */ foreach ($parts as $forwardedPair) { $forwardedPair = trim($forwardedPair); if (stripos($forwardedPair, 'host=') !== false) { // Parse 'host' forwarded pair $result['host'] = substr($forwardedPair, strlen('host=')); } elseif (stripos($forwardedPair, 'proto=') !== false) { // Parse 'proto' forwarded pair $result['proto'] = substr($forwardedPair, strlen('proto=')); } else { // Parse 'for' and 'by' forwarded pairs which are comma separated $fpParts = explode(',', $forwardedPair); foreach ($fpParts as $fpPart) { $fpPart = trim($fpPart); if (stripos($fpPart, 'for=') !== false) { // Parse 'for' forwarded pair $result['for'] = isset($result['for']) ? $result['for'] : array(); $result['for'][] = substr($fpPart, strlen('for=')); } elseif (stripos($fpPart, 'by=') !== false) { // Parse 'by' forwarded pair $result['by'] = isset($result['by']) ? $result['by'] : array(); $result['by'][] = substr($fpPart, strlen('by=')); } } } } return $result; } /* * @SuppressWarnings(PHPMD.Superglobals) */ public function getUrlProto() { $proto = ''; if (!empty($_SERVER['HTTP_FORWARDED'])) { extract($this->parseForwardedString($_SERVER['HTTP_FORWARDED'])); } if (empty($proto)) { if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) { $proto = explode(',', strtolower($_SERVER['HTTP_X_FORWARDED_PROTO'])); $proto = $proto[0]; } elseif (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { $proto = 'https'; } else { $proto = 'http'; } } return $proto; } /* * @SuppressWarnings(PHPMD.Superglobals) */ public function getUrlHost() { $host = ''; if (!empty($_SERVER['HTTP_FORWARDED'])) { extract($this->parseForwardedString($_SERVER['HTTP_FORWARDED'])); } if (empty($host)) { if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) { $host = $_SERVER['HTTP_X_FORWARDED_HOST']; } elseif (!empty($_SERVER['HTTP_HOST'])) { $parts = explode(':', $_SERVER['HTTP_HOST']); $host = $parts[0]; } elseif (!empty($_SERVER['SERVER_NAME'])) { $host = $_SERVER['SERVER_NAME']; } else { $host = 'unknown'; } } return $host; } /* * @SuppressWarnings(PHPMD.Superglobals) */ public function getUrlPort($proto) { $port = ''; if (!empty($_SERVER['HTTP_X_FORWARDED_PORT'])) { $port = $_SERVER['HTTP_X_FORWARDED_PORT']; } elseif (!empty($_SERVER['SERVER_PORT'])) { $port = $_SERVER['SERVER_PORT']; } elseif ($proto === 'https') { $port = 443; } else { $port = 80; } return $port; } /* * @SuppressWarnings(PHPMD.Superglobals) */ public function getUrl() { $proto = $this->getUrlProto(); $host = $this->getUrlHost(); $port = $this->getUrlPort($proto); $url = $proto . '://' . $host; if (($proto == 'https' && $port != 443) || ($proto == 'http' && $port != 80)) { $url .= ':' . $port; } if (isset($_SERVER)) { $path = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/'; $url .= $path; } if ($host == 'unknown') { $url = null; } return $url; } /* * @SuppressWarnings(PHPMD.Superglobals) */ public function getHeaders() { $headers = array(); if (isset($_SERVER)) { foreach ($_SERVER as $key => $val) { if (substr($key, 0, 5) == 'HTTP_') { // convert HTTP_CONTENT_TYPE to Content-Type, HTTP_HOST to Host, etc. $name = strtolower(substr($key, 5)); $name = str_replace(' ', '-', ucwords(str_replace('_', ' ', $name))); $headers[$name] = $val; } } } if (count($headers) > 0) { return $headers; } else { return null; } } protected function getRequestParams() { return $this->requestParams; } protected function getRequestBody() { return $this->requestBody; } /* * @SuppressWarnings(PHPMD.Superglobals) */ protected function getUserIp() { if (!isset($_SERVER) || $this->captureIP === false) { return null; } $ipAddress = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null; $forwardFor = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : null; if ($forwardFor) { // return everything until the first comma $parts = explode(',', $forwardFor); $ipAddress = $parts[0]; } $realIp = isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : null; if ($realIp) { $ipAddress = $realIp; } if ($this->captureIP === DataBuilder::ANONYMIZE_IP) { if (filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { $parts = explode('.', $ipAddress); $ipAddress = $parts[0] . '.' . $parts[1] . '.' . $parts[2] . '.0'; } elseif (filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { $parts = explode(':', $ipAddress); $ipAddress = $parts[0] . ':' . $parts[1] . ':' . $parts[2] . ':' . '0000:0000:0000:0000:0000'; } } return $ipAddress; } protected function getRequestExtras() { return $this->requestExtras; } /** * @return Person */ protected function getPerson() { $personData = $this->person; if (!isset($personData) && is_callable($this->personFunc)) { try { $personData = call_user_func($this->personFunc); } catch (\Exception $exception) { Rollbar::scope(array('person_fn' => null))-> log(Level::ERROR, $exception); } } if (!isset($personData['id'])) { return null; } $identifier = $personData['id']; $email = null; if ($this->captureEmail && isset($personData['email'])) { $email = $personData['email']; } $username = null; if ($this->captureUsername && isset($personData['username'])) { $username = $personData['username']; } unset($personData['id'], $personData['email'], $personData['username']); return new Person($identifier, $username, $email, $personData); } /* * @SuppressWarnings(PHPMD.Superglobals) */ protected function getServer() { $server = new Server(); $server->setHost($this->getHost()) ->setRoot($this->getServerRoot()) ->setBranch($this->getServerBranch()) ->setCodeVersion($this->getServerCodeVersion()); $extras = $this->getServerExtras(); if (!$extras) { $extras = array(); } $server->setExtras($extras); if (isset($_SERVER) && array_key_exists('argv', $_SERVER)) { $server->setArgv($_SERVER['argv']); } return $server; } protected function getHost() { if (isset($this->host)) { return $this->host; } return gethostname(); } protected function getServerRoot() { return $this->serverRoot; } protected function getServerBranch() { return $this->serverBranch; } protected function getServerCodeVersion() { return $this->serverCodeVersion; } protected function getServerExtras() { return $this->serverExtras; } public function getCustom() { return $this->custom; } public function getCustomDataMethod() { return $this->customDataMethod; } protected function getCustomForPayload($toLog, $context) { $custom = $this->getCustom(); // Make this an array if possible: if ($custom instanceof \Serializable) { $custom = $custom->serialize(); } elseif (is_null($custom)) { $custom = array(); } elseif (!is_array($custom)) { $custom = get_object_vars($custom); } if ($customDataMethod = $this->getCustomDataMethod()) { $customDataMethodContext = isset($context['custom_data_method_context']) ? $context['custom_data_method_context'] : null; $customDataMethodResult = $customDataMethod($toLog, $customDataMethodContext); $custom = array_merge($custom, $customDataMethodResult); } unset($context['custom_data_method_context']); return $custom; } public function addCustom($key, $data) { if ($this->custom === null) { $this->custom = array(); } if (!is_array($this->custom)) { throw new \Exception( "Custom data configured in Rollbar::init() is not an array." ); } $this->custom[$key] = $data; } public function removeCustom($key) { unset($this->custom[$key]); } protected function getFingerprint($context) { return isset($context['fingerprint']) ? $context['fingerprint'] : $this->fingerprint; } protected function getTitle() { return $this->title; } protected function getUuid() { return $this->utilities->uuid4(); } protected function getNotifier() { return $this->notifier; } protected function getBaseException() { return $this->baseException; } /** * Parses an array of code lines from source file with given filename. * * Attempts to automatically detect the line break character used in the file. * * @param string $filename * @return string[] An array of lines of code from the given source file. */ private function getSourceLines($filename) { $rawSource = file_get_contents($filename); $source = explode(PHP_EOL, $rawSource); if (count($source) === 1) { if (substr_count($rawSource, "\n") > substr_count($rawSource, "\r")) { $source = explode("\n", $rawSource); } else { $source = explode("\r", $rawSource); } } $source = str_replace(array("\n", "\t", "\r"), '', $source); return $source; } /** * Wrap a PHP error in an ErrorWrapper class and add backtrace information * * @param string $errno * @param string $errstr * @param string $errfile * @param string $errline * * @return ErrorWrapper */ public function generateErrorWrapper($errno, $errstr, $errfile, $errline) { return new ErrorWrapper( $errno, $errstr, $errfile, $errline, $this->buildErrorTrace($errfile, $errline), $this->utilities ); } /** * Fetches the stack trace for fatal and regular errors. * * @var string $errfile * @var string $errline * * @return Rollbar\ErrorWrapper */ protected function buildErrorTrace($errfile, $errline) { if ($this->captureErrorStacktraces) { $backTrace = $this->fetchErrorTrace(); $backTrace = $this->stripShutdownFrames($backTrace); // Add the final frame array_unshift( $backTrace, array('file' => $errfile, 'line' => $errline) ); } else { $backTrace = array(); } return $backTrace; } private function fetchErrorTrace() { if (function_exists('xdebug_get_function_stack')) { return array_reverse(\xdebug_get_function_stack()); } else { return debug_backtrace($this->localVarsDump ? 0 : DEBUG_BACKTRACE_IGNORE_ARGS); } } private function stripShutdownFrames($backTrace) { foreach ($backTrace as $index => $frame) { extract($frame); $fatalHandlerMethod = (isset($method) && $method === 'Rollbar\\Handlers\\FatalHandler::handle'); $fatalHandlerClassAndFunction = (isset($class) && $class === 'Rollbar\\Handlers\\FatalHandler' && isset($function) && $function === 'handle'); $errorHandlerMethod = (isset($method) && $method === 'Rollbar\\Handlers\\ErrorHandler::handle'); $errorHandlerClassAndFunction = (isset($class) && $class === 'Rollbar\\Handlers\\ErrorHandler' && isset($function) && $function === 'handle'); if ($fatalHandlerMethod || $fatalHandlerClassAndFunction || $errorHandlerMethod || $errorHandlerClassAndFunction ) { return array_slice($backTrace, $index+1); } } return $backTrace; } public function detectGitBranch($allowExec = true) { if ($allowExec) { static $cachedValue; static $hasExecuted = false; if (!$hasExecuted) { $cachedValue = self::getGitBranch(); $hasExecuted = true; } return $cachedValue; } return null; } private static function getGitBranch() { try { if (function_exists('shell_exec')) { $stdRedirCmd = Utilities::isWindows() ? " > NUL" : " 2> /dev/null"; $output = rtrim(shell_exec('git rev-parse --abbrev-ref HEAD' . $stdRedirCmd)); if ($output) { return $output; } } return null; } catch (\Exception $e) { return null; } } } <?php namespace Rollbar; use Rollbar\Payload\Level; use Rollbar\Handlers\FatalHandler; use Rollbar\Handlers\ErrorHandler; use Rollbar\Handlers\ExceptionHandler; class Rollbar { /** * @var RollbarLogger */ private static $logger = null; private static $fatalHandler = null; private static $errorHandler = null; private static $exceptionHandler = null; public static function init( $configOrLogger, $handleException = true, $handleError = true, $handleFatal = true ) { $setupHandlers = is_null(self::$logger); self::setLogger($configOrLogger); if ($setupHandlers) { if ($handleException) { self::setupExceptionHandling(); } if ($handleError) { self::setupErrorHandling(); } if ($handleFatal) { self::setupFatalHandling(); } self::setupBatchHandling(); } } private static function setLogger($configOrLogger) { if ($configOrLogger instanceof RollbarLogger) { $logger = $configOrLogger; } // Replacing the logger rather than configuring the existing logger breaks BC if (self::$logger && !isset($logger)) { self::$logger->configure($configOrLogger); return; } self::$logger = isset($logger) ? $logger : new RollbarLogger($configOrLogger); } public static function enable() { return self::logger()->enable(); } public static function disable() { return self::logger()->disable(); } public static function enabled() { return self::logger()->enabled(); } public static function disabled() { return self::logger()->disabled(); } public static function logger() { return self::$logger; } public static function scope($config) { if (is_null(self::$logger)) { return new RollbarLogger($config); } return self::$logger->scope($config); } public static function log($level, $toLog, $extra = array(), $isUncaught = false) { if (is_null(self::$logger)) { return self::getNotInitializedResponse(); } return self::$logger->log($level, $toLog, (array)$extra, $isUncaught); } public static function debug($toLog, $extra = array()) { return self::log(Level::DEBUG, $toLog, $extra); } public static function info($toLog, $extra = array()) { return self::log(Level::INFO, $toLog, $extra); } public static function notice($toLog, $extra = array()) { return self::log(Level::NOTICE, $toLog, $extra); } public static function warning($toLog, $extra = array()) { return self::log(Level::WARNING, $toLog, $extra); } public static function error($toLog, $extra = array()) { return self::log(Level::ERROR, $toLog, $extra); } public static function critical($toLog, $extra = array()) { return self::log(Level::CRITICAL, $toLog, $extra); } public static function alert($toLog, $extra = array()) { return self::log(Level::ALERT, $toLog, $extra); } public static function emergency($toLog, $extra = array()) { return self::log(Level::EMERGENCY, $toLog, $extra); } public static function setupExceptionHandling() { self::$exceptionHandler = new ExceptionHandler(self::$logger); self::$exceptionHandler->register(); } public static function setupErrorHandling() { self::$errorHandler = new ErrorHandler(self::$logger); self::$errorHandler->register(); } public static function setupFatalHandling() { self::$fatalHandler = new FatalHandler(self::$logger); self::$fatalHandler->register(); } private static function getNotInitializedResponse() { return new Response(0, "Rollbar Not Initialized"); } public static function setupBatchHandling() { register_shutdown_function('Rollbar\Rollbar::flushAndWait'); } public static function flush() { if (is_null(self::$logger)) { return; } self::$logger->flush(); } public static function flushAndWait() { if (is_null(self::$logger)) { return; } self::$logger->flushAndWait(); } public static function addCustom($key, $value) { self::$logger->addCustom($key, $value); } public static function removeCustom($key) { self::$logger->removeCustom($key); } public static function getCustom() { self::$logger->getCustom(); } public static function configure($config) { self::$logger->configure($config); } /** * Destroys the currently stored $logger allowing for a fresh configuration. * This is especially used in testing scenarios. */ public static function destroy() { self::$logger = null; } // @codingStandardsIgnoreStart /** * Below methods are deprecated and still available only for backwards * compatibility. If you're still using them in your application, please * transition to using the ::log method as soon as possible. */ /** * @param \Exception $exc Exception to be logged * @param array $extra_data Additional data to be logged with the exception * @param array $payload_data This is deprecated as of v1.0.0 and remains for * backwards compatibility. The content fo this array will be merged with * $extra_data. * * @return string uuid * * @deprecated 1.0.0 This method has been replaced by ::log */ public static function report_exception($exc, $extra_data = null, $payload_data = null) { if ($payload_data) { $extra_data = array_merge($extra_data, $payload_data); } return self::log(Level::ERROR, $exc, $extra_data)->getUuid(); } /** * @param string $message Message to be logged * @param string $level One of the values in \Rollbar\Payload\Level::$values * @param array $extra_data Additional data to be logged with the exception * @param array $payload_data This is deprecated as of v1.0.0 and remains for * backwards compatibility. The content fo this array will be merged with * $extra_data. * * @return string uuid * * @deprecated 1.0.0 This method has been replaced by ::log */ public static function report_message($message, $level = null, $extra_data = null, $payload_data = null) { $level = $level ? $level : Level::ERROR; if ($payload_data) { $extra_data = array_merge($extra_data, $payload_data); } return self::log($level, $message, $extra_data)->getUuid(); } /** * Catch any fatal errors that are causing the shutdown * * @deprecated 1.0.0 This method has been replaced by ::fatalHandler */ public static function report_fatal_error() { self::$fatalHandler->handle(); } /** * This function must return false so that the default php error handler runs * * @deprecated 1.0.0 This method has been replaced by ::log */ public static function report_php_error($errno, $errstr, $errfile, $errline) { self::$errorHandler->handle($errno, $errstr, $errfile, $errline); return false; } // @codingStandardsIgnoreEnd } <?php /** * Pure-PHP implementation of Twofish. * * Uses mcrypt, if available, and an internal implementation, otherwise. * * PHP version 5 * * Useful resources are as follows: * * - {@link http://en.wikipedia.org/wiki/Twofish Wikipedia description of Twofish} * * Here's a short example of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * $twofish = new \phpseclib\Crypt\Twofish(); * * $twofish->setKey('12345678901234567890123456789012'); * * $plaintext = str_repeat('a', 1024); * * echo $twofish->decrypt($twofish->encrypt($plaintext)); * ?> * </code> * * @category Crypt * @package Twofish * @author Jim Wigginton <terrafrost@php.net> * @author Hans-Juergen Petrich <petrich@tronic-media.com> * @copyright 2007 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt; use phpseclib\Crypt\Common\BlockCipher; /** * Pure-PHP implementation of Twofish. * * @package Twofish * @author Jim Wigginton <terrafrost@php.net> * @author Hans-Juergen Petrich <petrich@tronic-media.com> * @access public */ class Twofish extends BlockCipher { /** * The mcrypt specific name of the cipher * * @see \phpseclib\Crypt\Common\SymmetricKey::cipher_name_mcrypt * @var string * @access private */ protected $cipher_name_mcrypt = 'twofish'; /** * Optimizing value while CFB-encrypting * * @see \phpseclib\Crypt\Common\SymmetricKey::cfb_init_len * @var int * @access private */ protected $cfb_init_len = 800; /** * Q-Table * * @var array * @access private */ private $q0 = [ 0xA9, 0x67, 0xB3, 0xE8, 0x04, 0xFD, 0xA3, 0x76, 0x9A, 0x92, 0x80, 0x78, 0xE4, 0xDD, 0xD1, 0x38, 0x0D, 0xC6, 0x35, 0x98, 0x18, 0xF7, 0xEC, 0x6C, 0x43, 0x75, 0x37, 0x26, 0xFA, 0x13, 0x94, 0x48, 0xF2, 0xD0, 0x8B, 0x30, 0x84, 0x54, 0xDF, 0x23, 0x19, 0x5B, 0x3D, 0x59, 0xF3, 0xAE, 0xA2, 0x82, 0x63, 0x01, 0x83, 0x2E, 0xD9, 0x51, 0x9B, 0x7C, 0xA6, 0xEB, 0xA5, 0xBE, 0x16, 0x0C, 0xE3, 0x61, 0xC0, 0x8C, 0x3A, 0xF5, 0x73, 0x2C, 0x25, 0x0B, 0xBB, 0x4E, 0x89, 0x6B, 0x53, 0x6A, 0xB4, 0xF1, 0xE1, 0xE6, 0xBD, 0x45, 0xE2, 0xF4, 0xB6, 0x66, 0xCC, 0x95, 0x03, 0x56, 0xD4, 0x1C, 0x1E, 0xD7, 0xFB, 0xC3, 0x8E, 0xB5, 0xE9, 0xCF, 0xBF, 0xBA, 0xEA, 0x77, 0x39, 0xAF, 0x33, 0xC9, 0x62, 0x71, 0x81, 0x79, 0x09, 0xAD, 0x24, 0xCD, 0xF9, 0xD8, 0xE5, 0xC5, 0xB9, 0x4D, 0x44, 0x08, 0x86, 0xE7, 0xA1, 0x1D, 0xAA, 0xED, 0x06, 0x70, 0xB2, 0xD2, 0x41, 0x7B, 0xA0, 0x11, 0x31, 0xC2, 0x27, 0x90, 0x20, 0xF6, 0x60, 0xFF, 0x96, 0x5C, 0xB1, 0xAB, 0x9E, 0x9C, 0x52, 0x1B, 0x5F, 0x93, 0x0A, 0xEF, 0x91, 0x85, 0x49, 0xEE, 0x2D, 0x4F, 0x8F, 0x3B, 0x47, 0x87, 0x6D, 0x46, 0xD6, 0x3E, 0x69, 0x64, 0x2A, 0xCE, 0xCB, 0x2F, 0xFC, 0x97, 0x05, 0x7A, 0xAC, 0x7F, 0xD5, 0x1A, 0x4B, 0x0E, 0xA7, 0x5A, 0x28, 0x14, 0x3F, 0x29, 0x88, 0x3C, 0x4C, 0x02, 0xB8, 0xDA, 0xB0, 0x17, 0x55, 0x1F, 0x8A, 0x7D, 0x57, 0xC7, 0x8D, 0x74, 0xB7, 0xC4, 0x9F, 0x72, 0x7E, 0x15, 0x22, 0x12, 0x58, 0x07, 0x99, 0x34, 0x6E, 0x50, 0xDE, 0x68, 0x65, 0xBC, 0xDB, 0xF8, 0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4, 0xCA, 0x10, 0x21, 0xF0, 0xD3, 0x5D, 0x0F, 0x00, 0x6F, 0x9D, 0x36, 0x42, 0x4A, 0x5E, 0xC1, 0xE0 ]; /** * Q-Table * * @var array * @access private */ private $q1 = [ 0x75, 0xF3, 0xC6, 0xF4, 0xDB, 0x7B, 0xFB, 0xC8, 0x4A, 0xD3, 0xE6, 0x6B, 0x45, 0x7D, 0xE8, 0x4B, 0xD6, 0x32, 0xD8, 0xFD, 0x37, 0x71, 0xF1, 0xE1, 0x30, 0x0F, 0xF8, 0x1B, 0x87, 0xFA, 0x06, 0x3F, 0x5E, 0xBA, 0xAE, 0x5B, 0x8A, 0x00, 0xBC, 0x9D, 0x6D, 0xC1, 0xB1, 0x0E, 0x80, 0x5D, 0xD2, 0xD5, 0xA0, 0x84, 0x07, 0x14, 0xB5, 0x90, 0x2C, 0xA3, 0xB2, 0x73, 0x4C, 0x54, 0x92, 0x74, 0x36, 0x51, 0x38, 0xB0, 0xBD, 0x5A, 0xFC, 0x60, 0x62, 0x96, 0x6C, 0x42, 0xF7, 0x10, 0x7C, 0x28, 0x27, 0x8C, 0x13, 0x95, 0x9C, 0xC7, 0x24, 0x46, 0x3B, 0x70, 0xCA, 0xE3, 0x85, 0xCB, 0x11, 0xD0, 0x93, 0xB8, 0xA6, 0x83, 0x20, 0xFF, 0x9F, 0x77, 0xC3, 0xCC, 0x03, 0x6F, 0x08, 0xBF, 0x40, 0xE7, 0x2B, 0xE2, 0x79, 0x0C, 0xAA, 0x82, 0x41, 0x3A, 0xEA, 0xB9, 0xE4, 0x9A, 0xA4, 0x97, 0x7E, 0xDA, 0x7A, 0x17, 0x66, 0x94, 0xA1, 0x1D, 0x3D, 0xF0, 0xDE, 0xB3, 0x0B, 0x72, 0xA7, 0x1C, 0xEF, 0xD1, 0x53, 0x3E, 0x8F, 0x33, 0x26, 0x5F, 0xEC, 0x76, 0x2A, 0x49, 0x81, 0x88, 0xEE, 0x21, 0xC4, 0x1A, 0xEB, 0xD9, 0xC5, 0x39, 0x99, 0xCD, 0xAD, 0x31, 0x8B, 0x01, 0x18, 0x23, 0xDD, 0x1F, 0x4E, 0x2D, 0xF9, 0x48, 0x4F, 0xF2, 0x65, 0x8E, 0x78, 0x5C, 0x58, 0x19, 0x8D, 0xE5, 0x98, 0x57, 0x67, 0x7F, 0x05, 0x64, 0xAF, 0x63, 0xB6, 0xFE, 0xF5, 0xB7, 0x3C, 0xA5, 0xCE, 0xE9, 0x68, 0x44, 0xE0, 0x4D, 0x43, 0x69, 0x29, 0x2E, 0xAC, 0x15, 0x59, 0xA8, 0x0A, 0x9E, 0x6E, 0x47, 0xDF, 0x34, 0x35, 0x6A, 0xCF, 0xDC, 0x22, 0xC9, 0xC0, 0x9B, 0x89, 0xD4, 0xED, 0xAB, 0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9, 0xD7, 0x61, 0x1E, 0xB4, 0x50, 0x04, 0xF6, 0xC2, 0x16, 0x25, 0x86, 0x56, 0x55, 0x09, 0xBE, 0x91 ]; /** * M-Table * * @var array * @access private */ private $m0 = [ 0xBCBC3275, 0xECEC21F3, 0x202043C6, 0xB3B3C9F4, 0xDADA03DB, 0x02028B7B, 0xE2E22BFB, 0x9E9EFAC8, 0xC9C9EC4A, 0xD4D409D3, 0x18186BE6, 0x1E1E9F6B, 0x98980E45, 0xB2B2387D, 0xA6A6D2E8, 0x2626B74B, 0x3C3C57D6, 0x93938A32, 0x8282EED8, 0x525298FD, 0x7B7BD437, 0xBBBB3771, 0x5B5B97F1, 0x474783E1, 0x24243C30, 0x5151E20F, 0xBABAC6F8, 0x4A4AF31B, 0xBFBF4887, 0x0D0D70FA, 0xB0B0B306, 0x7575DE3F, 0xD2D2FD5E, 0x7D7D20BA, 0x666631AE, 0x3A3AA35B, 0x59591C8A, 0x00000000, 0xCDCD93BC, 0x1A1AE09D, 0xAEAE2C6D, 0x7F7FABC1, 0x2B2BC7B1, 0xBEBEB90E, 0xE0E0A080, 0x8A8A105D, 0x3B3B52D2, 0x6464BAD5, 0xD8D888A0, 0xE7E7A584, 0x5F5FE807, 0x1B1B1114, 0x2C2CC2B5, 0xFCFCB490, 0x3131272C, 0x808065A3, 0x73732AB2, 0x0C0C8173, 0x79795F4C, 0x6B6B4154, 0x4B4B0292, 0x53536974, 0x94948F36, 0x83831F51, 0x2A2A3638, 0xC4C49CB0, 0x2222C8BD, 0xD5D5F85A, 0xBDBDC3FC, 0x48487860, 0xFFFFCE62, 0x4C4C0796, 0x4141776C, 0xC7C7E642, 0xEBEB24F7, 0x1C1C1410, 0x5D5D637C, 0x36362228, 0x6767C027, 0xE9E9AF8C, 0x4444F913, 0x1414EA95, 0xF5F5BB9C, 0xCFCF18C7, 0x3F3F2D24, 0xC0C0E346, 0x7272DB3B, 0x54546C70, 0x29294CCA, 0xF0F035E3, 0x0808FE85, 0xC6C617CB, 0xF3F34F11, 0x8C8CE4D0, 0xA4A45993, 0xCACA96B8, 0x68683BA6, 0xB8B84D83, 0x38382820, 0xE5E52EFF, 0xADAD569F, 0x0B0B8477, 0xC8C81DC3, 0x9999FFCC, 0x5858ED03, 0x19199A6F, 0x0E0E0A08, 0x95957EBF, 0x70705040, 0xF7F730E7, 0x6E6ECF2B, 0x1F1F6EE2, 0xB5B53D79, 0x09090F0C, 0x616134AA, 0x57571682, 0x9F9F0B41, 0x9D9D803A, 0x111164EA, 0x2525CDB9, 0xAFAFDDE4, 0x4545089A, 0xDFDF8DA4, 0xA3A35C97, 0xEAEAD57E, 0x353558DA, 0xEDEDD07A, 0x4343FC17, 0xF8F8CB66, 0xFBFBB194, 0x3737D3A1, 0xFAFA401D, 0xC2C2683D, 0xB4B4CCF0, 0x32325DDE, 0x9C9C71B3, 0x5656E70B, 0xE3E3DA72, 0x878760A7, 0x15151B1C, 0xF9F93AEF, 0x6363BFD1, 0x3434A953, 0x9A9A853E, 0xB1B1428F, 0x7C7CD133, 0x88889B26, 0x3D3DA65F, 0xA1A1D7EC, 0xE4E4DF76, 0x8181942A, 0x91910149, 0x0F0FFB81, 0xEEEEAA88, 0x161661EE, 0xD7D77321, 0x9797F5C4, 0xA5A5A81A, 0xFEFE3FEB, 0x6D6DB5D9, 0x7878AEC5, 0xC5C56D39, 0x1D1DE599, 0x7676A4CD, 0x3E3EDCAD, 0xCBCB6731, 0xB6B6478B, 0xEFEF5B01, 0x12121E18, 0x6060C523, 0x6A6AB0DD, 0x4D4DF61F, 0xCECEE94E, 0xDEDE7C2D, 0x55559DF9, 0x7E7E5A48, 0x2121B24F, 0x03037AF2, 0xA0A02665, 0x5E5E198E, 0x5A5A6678, 0x65654B5C, 0x62624E58, 0xFDFD4519, 0x0606F48D, 0x404086E5, 0xF2F2BE98, 0x3333AC57, 0x17179067, 0x05058E7F, 0xE8E85E05, 0x4F4F7D64, 0x89896AAF, 0x10109563, 0x74742FB6, 0x0A0A75FE, 0x5C5C92F5, 0x9B9B74B7, 0x2D2D333C, 0x3030D6A5, 0x2E2E49CE, 0x494989E9, 0x46467268, 0x77775544, 0xA8A8D8E0, 0x9696044D, 0x2828BD43, 0xA9A92969, 0xD9D97929, 0x8686912E, 0xD1D187AC, 0xF4F44A15, 0x8D8D1559, 0xD6D682A8, 0xB9B9BC0A, 0x42420D9E, 0xF6F6C16E, 0x2F2FB847, 0xDDDD06DF, 0x23233934, 0xCCCC6235, 0xF1F1C46A, 0xC1C112CF, 0x8585EBDC, 0x8F8F9E22, 0x7171A1C9, 0x9090F0C0, 0xAAAA539B, 0x0101F189, 0x8B8BE1D4, 0x4E4E8CED, 0x8E8E6FAB, 0xABABA212, 0x6F6F3EA2, 0xE6E6540D, 0xDBDBF252, 0x92927BBB, 0xB7B7B602, 0x6969CA2F, 0x3939D9A9, 0xD3D30CD7, 0xA7A72361, 0xA2A2AD1E, 0xC3C399B4, 0x6C6C4450, 0x07070504, 0x04047FF6, 0x272746C2, 0xACACA716, 0xD0D07625, 0x50501386, 0xDCDCF756, 0x84841A55, 0xE1E15109, 0x7A7A25BE, 0x1313EF91 ]; /** * M-Table * * @var array * @access private */ private $m1 = [ 0xA9D93939, 0x67901717, 0xB3719C9C, 0xE8D2A6A6, 0x04050707, 0xFD985252, 0xA3658080, 0x76DFE4E4, 0x9A084545, 0x92024B4B, 0x80A0E0E0, 0x78665A5A, 0xE4DDAFAF, 0xDDB06A6A, 0xD1BF6363, 0x38362A2A, 0x0D54E6E6, 0xC6432020, 0x3562CCCC, 0x98BEF2F2, 0x181E1212, 0xF724EBEB, 0xECD7A1A1, 0x6C774141, 0x43BD2828, 0x7532BCBC, 0x37D47B7B, 0x269B8888, 0xFA700D0D, 0x13F94444, 0x94B1FBFB, 0x485A7E7E, 0xF27A0303, 0xD0E48C8C, 0x8B47B6B6, 0x303C2424, 0x84A5E7E7, 0x54416B6B, 0xDF06DDDD, 0x23C56060, 0x1945FDFD, 0x5BA33A3A, 0x3D68C2C2, 0x59158D8D, 0xF321ECEC, 0xAE316666, 0xA23E6F6F, 0x82165757, 0x63951010, 0x015BEFEF, 0x834DB8B8, 0x2E918686, 0xD9B56D6D, 0x511F8383, 0x9B53AAAA, 0x7C635D5D, 0xA63B6868, 0xEB3FFEFE, 0xA5D63030, 0xBE257A7A, 0x16A7ACAC, 0x0C0F0909, 0xE335F0F0, 0x6123A7A7, 0xC0F09090, 0x8CAFE9E9, 0x3A809D9D, 0xF5925C5C, 0x73810C0C, 0x2C273131, 0x2576D0D0, 0x0BE75656, 0xBB7B9292, 0x4EE9CECE, 0x89F10101, 0x6B9F1E1E, 0x53A93434, 0x6AC4F1F1, 0xB499C3C3, 0xF1975B5B, 0xE1834747, 0xE66B1818, 0xBDC82222, 0x450E9898, 0xE26E1F1F, 0xF4C9B3B3, 0xB62F7474, 0x66CBF8F8, 0xCCFF9999, 0x95EA1414, 0x03ED5858, 0x56F7DCDC, 0xD4E18B8B, 0x1C1B1515, 0x1EADA2A2, 0xD70CD3D3, 0xFB2BE2E2, 0xC31DC8C8, 0x8E195E5E, 0xB5C22C2C, 0xE9894949, 0xCF12C1C1, 0xBF7E9595, 0xBA207D7D, 0xEA641111, 0x77840B0B, 0x396DC5C5, 0xAF6A8989, 0x33D17C7C, 0xC9A17171, 0x62CEFFFF, 0x7137BBBB, 0x81FB0F0F, 0x793DB5B5, 0x0951E1E1, 0xADDC3E3E, 0x242D3F3F, 0xCDA47676, 0xF99D5555, 0xD8EE8282, 0xE5864040, 0xC5AE7878, 0xB9CD2525, 0x4D049696, 0x44557777, 0x080A0E0E, 0x86135050, 0xE730F7F7, 0xA1D33737, 0x1D40FAFA, 0xAA346161, 0xED8C4E4E, 0x06B3B0B0, 0x706C5454, 0xB22A7373, 0xD2523B3B, 0x410B9F9F, 0x7B8B0202, 0xA088D8D8, 0x114FF3F3, 0x3167CBCB, 0xC2462727, 0x27C06767, 0x90B4FCFC, 0x20283838, 0xF67F0404, 0x60784848, 0xFF2EE5E5, 0x96074C4C, 0x5C4B6565, 0xB1C72B2B, 0xAB6F8E8E, 0x9E0D4242, 0x9CBBF5F5, 0x52F2DBDB, 0x1BF34A4A, 0x5FA63D3D, 0x9359A4A4, 0x0ABCB9B9, 0xEF3AF9F9, 0x91EF1313, 0x85FE0808, 0x49019191, 0xEE611616, 0x2D7CDEDE, 0x4FB22121, 0x8F42B1B1, 0x3BDB7272, 0x47B82F2F, 0x8748BFBF, 0x6D2CAEAE, 0x46E3C0C0, 0xD6573C3C, 0x3E859A9A, 0x6929A9A9, 0x647D4F4F, 0x2A948181, 0xCE492E2E, 0xCB17C6C6, 0x2FCA6969, 0xFCC3BDBD, 0x975CA3A3, 0x055EE8E8, 0x7AD0EDED, 0xAC87D1D1, 0x7F8E0505, 0xD5BA6464, 0x1AA8A5A5, 0x4BB72626, 0x0EB9BEBE, 0xA7608787, 0x5AF8D5D5, 0x28223636, 0x14111B1B, 0x3FDE7575, 0x2979D9D9, 0x88AAEEEE, 0x3C332D2D, 0x4C5F7979, 0x02B6B7B7, 0xB896CACA, 0xDA583535, 0xB09CC4C4, 0x17FC4343, 0x551A8484, 0x1FF64D4D, 0x8A1C5959, 0x7D38B2B2, 0x57AC3333, 0xC718CFCF, 0x8DF40606, 0x74695353, 0xB7749B9B, 0xC4F59797, 0x9F56ADAD, 0x72DAE3E3, 0x7ED5EAEA, 0x154AF4F4, 0x229E8F8F, 0x12A2ABAB, 0x584E6262, 0x07E85F5F, 0x99E51D1D, 0x34392323, 0x6EC1F6F6, 0x50446C6C, 0xDE5D3232, 0x68724646, 0x6526A0A0, 0xBC93CDCD, 0xDB03DADA, 0xF8C6BABA, 0xC8FA9E9E, 0xA882D6D6, 0x2BCF6E6E, 0x40507070, 0xDCEB8585, 0xFE750A0A, 0x328A9393, 0xA48DDFDF, 0xCA4C2929, 0x10141C1C, 0x2173D7D7, 0xF0CCB4B4, 0xD309D4D4, 0x5D108A8A, 0x0FE25151, 0x00000000, 0x6F9A1919, 0x9DE01A1A, 0x368F9494, 0x42E6C7C7, 0x4AECC9C9, 0x5EFDD2D2, 0xC1AB7F7F, 0xE0D8A8A8 ]; /** * M-Table * * @var array * @access private */ private $m2 = [ 0xBC75BC32, 0xECF3EC21, 0x20C62043, 0xB3F4B3C9, 0xDADBDA03, 0x027B028B, 0xE2FBE22B, 0x9EC89EFA, 0xC94AC9EC, 0xD4D3D409, 0x18E6186B, 0x1E6B1E9F, 0x9845980E, 0xB27DB238, 0xA6E8A6D2, 0x264B26B7, 0x3CD63C57, 0x9332938A, 0x82D882EE, 0x52FD5298, 0x7B377BD4, 0xBB71BB37, 0x5BF15B97, 0x47E14783, 0x2430243C, 0x510F51E2, 0xBAF8BAC6, 0x4A1B4AF3, 0xBF87BF48, 0x0DFA0D70, 0xB006B0B3, 0x753F75DE, 0xD25ED2FD, 0x7DBA7D20, 0x66AE6631, 0x3A5B3AA3, 0x598A591C, 0x00000000, 0xCDBCCD93, 0x1A9D1AE0, 0xAE6DAE2C, 0x7FC17FAB, 0x2BB12BC7, 0xBE0EBEB9, 0xE080E0A0, 0x8A5D8A10, 0x3BD23B52, 0x64D564BA, 0xD8A0D888, 0xE784E7A5, 0x5F075FE8, 0x1B141B11, 0x2CB52CC2, 0xFC90FCB4, 0x312C3127, 0x80A38065, 0x73B2732A, 0x0C730C81, 0x794C795F, 0x6B546B41, 0x4B924B02, 0x53745369, 0x9436948F, 0x8351831F, 0x2A382A36, 0xC4B0C49C, 0x22BD22C8, 0xD55AD5F8, 0xBDFCBDC3, 0x48604878, 0xFF62FFCE, 0x4C964C07, 0x416C4177, 0xC742C7E6, 0xEBF7EB24, 0x1C101C14, 0x5D7C5D63, 0x36283622, 0x672767C0, 0xE98CE9AF, 0x441344F9, 0x149514EA, 0xF59CF5BB, 0xCFC7CF18, 0x3F243F2D, 0xC046C0E3, 0x723B72DB, 0x5470546C, 0x29CA294C, 0xF0E3F035, 0x088508FE, 0xC6CBC617, 0xF311F34F, 0x8CD08CE4, 0xA493A459, 0xCAB8CA96, 0x68A6683B, 0xB883B84D, 0x38203828, 0xE5FFE52E, 0xAD9FAD56, 0x0B770B84, 0xC8C3C81D, 0x99CC99FF, 0x580358ED, 0x196F199A, 0x0E080E0A, 0x95BF957E, 0x70407050, 0xF7E7F730, 0x6E2B6ECF, 0x1FE21F6E, 0xB579B53D, 0x090C090F, 0x61AA6134, 0x57825716, 0x9F419F0B, 0x9D3A9D80, 0x11EA1164, 0x25B925CD, 0xAFE4AFDD, 0x459A4508, 0xDFA4DF8D, 0xA397A35C, 0xEA7EEAD5, 0x35DA3558, 0xED7AEDD0, 0x431743FC, 0xF866F8CB, 0xFB94FBB1, 0x37A137D3, 0xFA1DFA40, 0xC23DC268, 0xB4F0B4CC, 0x32DE325D, 0x9CB39C71, 0x560B56E7, 0xE372E3DA, 0x87A78760, 0x151C151B, 0xF9EFF93A, 0x63D163BF, 0x345334A9, 0x9A3E9A85, 0xB18FB142, 0x7C337CD1, 0x8826889B, 0x3D5F3DA6, 0xA1ECA1D7, 0xE476E4DF, 0x812A8194, 0x91499101, 0x0F810FFB, 0xEE88EEAA, 0x16EE1661, 0xD721D773, 0x97C497F5, 0xA51AA5A8, 0xFEEBFE3F, 0x6DD96DB5, 0x78C578AE, 0xC539C56D, 0x1D991DE5, 0x76CD76A4, 0x3EAD3EDC, 0xCB31CB67, 0xB68BB647, 0xEF01EF5B, 0x1218121E, 0x602360C5, 0x6ADD6AB0, 0x4D1F4DF6, 0xCE4ECEE9, 0xDE2DDE7C, 0x55F9559D, 0x7E487E5A, 0x214F21B2, 0x03F2037A, 0xA065A026, 0x5E8E5E19, 0x5A785A66, 0x655C654B, 0x6258624E, 0xFD19FD45, 0x068D06F4, 0x40E54086, 0xF298F2BE, 0x335733AC, 0x17671790, 0x057F058E, 0xE805E85E, 0x4F644F7D, 0x89AF896A, 0x10631095, 0x74B6742F, 0x0AFE0A75, 0x5CF55C92, 0x9BB79B74, 0x2D3C2D33, 0x30A530D6, 0x2ECE2E49, 0x49E94989, 0x46684672, 0x77447755, 0xA8E0A8D8, 0x964D9604, 0x284328BD, 0xA969A929, 0xD929D979, 0x862E8691, 0xD1ACD187, 0xF415F44A, 0x8D598D15, 0xD6A8D682, 0xB90AB9BC, 0x429E420D, 0xF66EF6C1, 0x2F472FB8, 0xDDDFDD06, 0x23342339, 0xCC35CC62, 0xF16AF1C4, 0xC1CFC112, 0x85DC85EB, 0x8F228F9E, 0x71C971A1, 0x90C090F0, 0xAA9BAA53, 0x018901F1, 0x8BD48BE1, 0x4EED4E8C, 0x8EAB8E6F, 0xAB12ABA2, 0x6FA26F3E, 0xE60DE654, 0xDB52DBF2, 0x92BB927B, 0xB702B7B6, 0x692F69CA, 0x39A939D9, 0xD3D7D30C, 0xA761A723, 0xA21EA2AD, 0xC3B4C399, 0x6C506C44, 0x07040705, 0x04F6047F, 0x27C22746, 0xAC16ACA7, 0xD025D076, 0x50865013, 0xDC56DCF7, 0x8455841A, 0xE109E151, 0x7ABE7A25, 0x139113EF ]; /** * M-Table * * @var array * @access private */ private $m3 = [ 0xD939A9D9, 0x90176790, 0x719CB371, 0xD2A6E8D2, 0x05070405, 0x9852FD98, 0x6580A365, 0xDFE476DF, 0x08459A08, 0x024B9202, 0xA0E080A0, 0x665A7866, 0xDDAFE4DD, 0xB06ADDB0, 0xBF63D1BF, 0x362A3836, 0x54E60D54, 0x4320C643, 0x62CC3562, 0xBEF298BE, 0x1E12181E, 0x24EBF724, 0xD7A1ECD7, 0x77416C77, 0xBD2843BD, 0x32BC7532, 0xD47B37D4, 0x9B88269B, 0x700DFA70, 0xF94413F9, 0xB1FB94B1, 0x5A7E485A, 0x7A03F27A, 0xE48CD0E4, 0x47B68B47, 0x3C24303C, 0xA5E784A5, 0x416B5441, 0x06DDDF06, 0xC56023C5, 0x45FD1945, 0xA33A5BA3, 0x68C23D68, 0x158D5915, 0x21ECF321, 0x3166AE31, 0x3E6FA23E, 0x16578216, 0x95106395, 0x5BEF015B, 0x4DB8834D, 0x91862E91, 0xB56DD9B5, 0x1F83511F, 0x53AA9B53, 0x635D7C63, 0x3B68A63B, 0x3FFEEB3F, 0xD630A5D6, 0x257ABE25, 0xA7AC16A7, 0x0F090C0F, 0x35F0E335, 0x23A76123, 0xF090C0F0, 0xAFE98CAF, 0x809D3A80, 0x925CF592, 0x810C7381, 0x27312C27, 0x76D02576, 0xE7560BE7, 0x7B92BB7B, 0xE9CE4EE9, 0xF10189F1, 0x9F1E6B9F, 0xA93453A9, 0xC4F16AC4, 0x99C3B499, 0x975BF197, 0x8347E183, 0x6B18E66B, 0xC822BDC8, 0x0E98450E, 0x6E1FE26E, 0xC9B3F4C9, 0x2F74B62F, 0xCBF866CB, 0xFF99CCFF, 0xEA1495EA, 0xED5803ED, 0xF7DC56F7, 0xE18BD4E1, 0x1B151C1B, 0xADA21EAD, 0x0CD3D70C, 0x2BE2FB2B, 0x1DC8C31D, 0x195E8E19, 0xC22CB5C2, 0x8949E989, 0x12C1CF12, 0x7E95BF7E, 0x207DBA20, 0x6411EA64, 0x840B7784, 0x6DC5396D, 0x6A89AF6A, 0xD17C33D1, 0xA171C9A1, 0xCEFF62CE, 0x37BB7137, 0xFB0F81FB, 0x3DB5793D, 0x51E10951, 0xDC3EADDC, 0x2D3F242D, 0xA476CDA4, 0x9D55F99D, 0xEE82D8EE, 0x8640E586, 0xAE78C5AE, 0xCD25B9CD, 0x04964D04, 0x55774455, 0x0A0E080A, 0x13508613, 0x30F7E730, 0xD337A1D3, 0x40FA1D40, 0x3461AA34, 0x8C4EED8C, 0xB3B006B3, 0x6C54706C, 0x2A73B22A, 0x523BD252, 0x0B9F410B, 0x8B027B8B, 0x88D8A088, 0x4FF3114F, 0x67CB3167, 0x4627C246, 0xC06727C0, 0xB4FC90B4, 0x28382028, 0x7F04F67F, 0x78486078, 0x2EE5FF2E, 0x074C9607, 0x4B655C4B, 0xC72BB1C7, 0x6F8EAB6F, 0x0D429E0D, 0xBBF59CBB, 0xF2DB52F2, 0xF34A1BF3, 0xA63D5FA6, 0x59A49359, 0xBCB90ABC, 0x3AF9EF3A, 0xEF1391EF, 0xFE0885FE, 0x01914901, 0x6116EE61, 0x7CDE2D7C, 0xB2214FB2, 0x42B18F42, 0xDB723BDB, 0xB82F47B8, 0x48BF8748, 0x2CAE6D2C, 0xE3C046E3, 0x573CD657, 0x859A3E85, 0x29A96929, 0x7D4F647D, 0x94812A94, 0x492ECE49, 0x17C6CB17, 0xCA692FCA, 0xC3BDFCC3, 0x5CA3975C, 0x5EE8055E, 0xD0ED7AD0, 0x87D1AC87, 0x8E057F8E, 0xBA64D5BA, 0xA8A51AA8, 0xB7264BB7, 0xB9BE0EB9, 0x6087A760, 0xF8D55AF8, 0x22362822, 0x111B1411, 0xDE753FDE, 0x79D92979, 0xAAEE88AA, 0x332D3C33, 0x5F794C5F, 0xB6B702B6, 0x96CAB896, 0x5835DA58, 0x9CC4B09C, 0xFC4317FC, 0x1A84551A, 0xF64D1FF6, 0x1C598A1C, 0x38B27D38, 0xAC3357AC, 0x18CFC718, 0xF4068DF4, 0x69537469, 0x749BB774, 0xF597C4F5, 0x56AD9F56, 0xDAE372DA, 0xD5EA7ED5, 0x4AF4154A, 0x9E8F229E, 0xA2AB12A2, 0x4E62584E, 0xE85F07E8, 0xE51D99E5, 0x39233439, 0xC1F66EC1, 0x446C5044, 0x5D32DE5D, 0x72466872, 0x26A06526, 0x93CDBC93, 0x03DADB03, 0xC6BAF8C6, 0xFA9EC8FA, 0x82D6A882, 0xCF6E2BCF, 0x50704050, 0xEB85DCEB, 0x750AFE75, 0x8A93328A, 0x8DDFA48D, 0x4C29CA4C, 0x141C1014, 0x73D72173, 0xCCB4F0CC, 0x09D4D309, 0x108A5D10, 0xE2510FE2, 0x00000000, 0x9A196F9A, 0xE01A9DE0, 0x8F94368F, 0xE6C742E6, 0xECC94AEC, 0xFDD25EFD, 0xAB7FC1AB, 0xD8A8E0D8 ]; /** * The Key Schedule Array * * @var array * @access private */ private $K = []; /** * The Key depended S-Table 0 * * @var array * @access private */ private $S0 = []; /** * The Key depended S-Table 1 * * @var array * @access private */ private $S1 = []; /** * The Key depended S-Table 2 * * @var array * @access private */ private $S2 = []; /** * The Key depended S-Table 3 * * @var array * @access private */ private $S3 = []; /** * Holds the last used key * * @var array * @access private */ private $kl; /** * The Key Length (in bytes) * * @see Crypt_Twofish::setKeyLength() * @var int * @access private */ protected $key_length = 16; /** * Default Constructor. * * @param int $mode * @access public * @throws \InvalidArgumentException if an invalid / unsupported mode is provided */ public function __construct($mode) { if ($mode == self::MODE_STREAM) { throw new \InvalidArgumentException('Block ciphers cannot be ran in stream mode'); } parent::__construct($mode); } /** * Sets the key length. * * Valid key lengths are 128, 192 or 256 bits * * @access public * @param int $length */ public function setKeyLength($length) { switch ($length) { case 128: case 192: case 256: break; default: throw new \LengthException('Key of size ' . $length . ' not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported'); } parent::setKeyLength($length); } /** * Sets the key. * * Rijndael supports five different key lengths * * @see setKeyLength() * @access public * @param string $key * @throws \LengthException if the key length isn't supported */ public function setKey($key) { switch (strlen($key)) { case 16: case 24: case 32: break; default: throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported'); } parent::setKey($key); } /** * Setup the key (expansion) * * @see \phpseclib\Crypt\Common\SymmetricKey::_setupKey() * @access private */ protected function setupKey() { if (isset($this->kl['key']) && $this->key === $this->kl['key']) { // already expanded return; } $this->kl = ['key' => $this->key]; /* Key expanding and generating the key-depended s-boxes */ $le_longs = unpack('V*', $this->key); $key = unpack('C*', $this->key); $m0 = $this->m0; $m1 = $this->m1; $m2 = $this->m2; $m3 = $this->m3; $q0 = $this->q0; $q1 = $this->q1; $K = $S0 = $S1 = $S2 = $S3 = []; switch (strlen($this->key)) { case 16: list($s7, $s6, $s5, $s4) = $this->mdsrem($le_longs[1], $le_longs[2]); list($s3, $s2, $s1, $s0) = $this->mdsrem($le_longs[3], $le_longs[4]); for ($i = 0, $j = 1; $i < 40; $i+= 2, $j+= 2) { $A = $m0[$q0[$q0[$i] ^ $key[ 9]] ^ $key[1]] ^ $m1[$q0[$q1[$i] ^ $key[10]] ^ $key[2]] ^ $m2[$q1[$q0[$i] ^ $key[11]] ^ $key[3]] ^ $m3[$q1[$q1[$i] ^ $key[12]] ^ $key[4]]; $B = $m0[$q0[$q0[$j] ^ $key[13]] ^ $key[5]] ^ $m1[$q0[$q1[$j] ^ $key[14]] ^ $key[6]] ^ $m2[$q1[$q0[$j] ^ $key[15]] ^ $key[7]] ^ $m3[$q1[$q1[$j] ^ $key[16]] ^ $key[8]]; $B = ($B << 8) | ($B >> 24 & 0xff); $A = self::safe_intval($A + $B); $K[] = $A; $A = self::safe_intval($A + $B); $K[] = ($A << 9 | $A >> 23 & 0x1ff); } for ($i = 0; $i < 256; ++$i) { $S0[$i] = $m0[$q0[$q0[$i] ^ $s4] ^ $s0]; $S1[$i] = $m1[$q0[$q1[$i] ^ $s5] ^ $s1]; $S2[$i] = $m2[$q1[$q0[$i] ^ $s6] ^ $s2]; $S3[$i] = $m3[$q1[$q1[$i] ^ $s7] ^ $s3]; } break; case 24: list($sb, $sa, $s9, $s8) = $this->mdsrem($le_longs[1], $le_longs[2]); list($s7, $s6, $s5, $s4) = $this->mdsrem($le_longs[3], $le_longs[4]); list($s3, $s2, $s1, $s0) = $this->mdsrem($le_longs[5], $le_longs[6]); for ($i = 0, $j = 1; $i < 40; $i+= 2, $j+= 2) { $A = $m0[$q0[$q0[$q1[$i] ^ $key[17]] ^ $key[ 9]] ^ $key[1]] ^ $m1[$q0[$q1[$q1[$i] ^ $key[18]] ^ $key[10]] ^ $key[2]] ^ $m2[$q1[$q0[$q0[$i] ^ $key[19]] ^ $key[11]] ^ $key[3]] ^ $m3[$q1[$q1[$q0[$i] ^ $key[20]] ^ $key[12]] ^ $key[4]]; $B = $m0[$q0[$q0[$q1[$j] ^ $key[21]] ^ $key[13]] ^ $key[5]] ^ $m1[$q0[$q1[$q1[$j] ^ $key[22]] ^ $key[14]] ^ $key[6]] ^ $m2[$q1[$q0[$q0[$j] ^ $key[23]] ^ $key[15]] ^ $key[7]] ^ $m3[$q1[$q1[$q0[$j] ^ $key[24]] ^ $key[16]] ^ $key[8]]; $B = ($B << 8) | ($B >> 24 & 0xff); $A = self::safe_intval($A + $B); $K[] = $A; $A = self::safe_intval($A + $B); $K[] = ($A << 9 | $A >> 23 & 0x1ff); } for ($i = 0; $i < 256; ++$i) { $S0[$i] = $m0[$q0[$q0[$q1[$i] ^ $s8] ^ $s4] ^ $s0]; $S1[$i] = $m1[$q0[$q1[$q1[$i] ^ $s9] ^ $s5] ^ $s1]; $S2[$i] = $m2[$q1[$q0[$q0[$i] ^ $sa] ^ $s6] ^ $s2]; $S3[$i] = $m3[$q1[$q1[$q0[$i] ^ $sb] ^ $s7] ^ $s3]; } break; default: // 32 list($sf, $se, $sd, $sc) = $this->mdsrem($le_longs[1], $le_longs[2]); list($sb, $sa, $s9, $s8) = $this->mdsrem($le_longs[3], $le_longs[4]); list($s7, $s6, $s5, $s4) = $this->mdsrem($le_longs[5], $le_longs[6]); list($s3, $s2, $s1, $s0) = $this->mdsrem($le_longs[7], $le_longs[8]); for ($i = 0, $j = 1; $i < 40; $i+= 2, $j+= 2) { $A = $m0[$q0[$q0[$q1[$q1[$i] ^ $key[25]] ^ $key[17]] ^ $key[ 9]] ^ $key[1]] ^ $m1[$q0[$q1[$q1[$q0[$i] ^ $key[26]] ^ $key[18]] ^ $key[10]] ^ $key[2]] ^ $m2[$q1[$q0[$q0[$q0[$i] ^ $key[27]] ^ $key[19]] ^ $key[11]] ^ $key[3]] ^ $m3[$q1[$q1[$q0[$q1[$i] ^ $key[28]] ^ $key[20]] ^ $key[12]] ^ $key[4]]; $B = $m0[$q0[$q0[$q1[$q1[$j] ^ $key[29]] ^ $key[21]] ^ $key[13]] ^ $key[5]] ^ $m1[$q0[$q1[$q1[$q0[$j] ^ $key[30]] ^ $key[22]] ^ $key[14]] ^ $key[6]] ^ $m2[$q1[$q0[$q0[$q0[$j] ^ $key[31]] ^ $key[23]] ^ $key[15]] ^ $key[7]] ^ $m3[$q1[$q1[$q0[$q1[$j] ^ $key[32]] ^ $key[24]] ^ $key[16]] ^ $key[8]]; $B = ($B << 8) | ($B >> 24 & 0xff); $A = self::safe_intval($A + $B); $K[] = $A; $A = self::safe_intval($A + $B); $K[] = ($A << 9 | $A >> 23 & 0x1ff); } for ($i = 0; $i < 256; ++$i) { $S0[$i] = $m0[$q0[$q0[$q1[$q1[$i] ^ $sc] ^ $s8] ^ $s4] ^ $s0]; $S1[$i] = $m1[$q0[$q1[$q1[$q0[$i] ^ $sd] ^ $s9] ^ $s5] ^ $s1]; $S2[$i] = $m2[$q1[$q0[$q0[$q0[$i] ^ $se] ^ $sa] ^ $s6] ^ $s2]; $S3[$i] = $m3[$q1[$q1[$q0[$q1[$i] ^ $sf] ^ $sb] ^ $s7] ^ $s3]; } } $this->K = $K; $this->S0 = $S0; $this->S1 = $S1; $this->S2 = $S2; $this->S3 = $S3; } /** * _mdsrem function using by the twofish cipher algorithm * * @access private * @param string $A * @param string $B * @return array */ private function mdsrem($A, $B) { // No gain by unrolling this loop. for ($i = 0; $i < 8; ++$i) { // Get most significant coefficient. $t = 0xff & ($B >> 24); // Shift the others up. $B = ($B << 8) | (0xff & ($A >> 24)); $A<<= 8; $u = $t << 1; // Subtract the modular polynomial on overflow. if ($t & 0x80) { $u^= 0x14d; } // Remove t * (a * x^2 + 1). $B ^= $t ^ ($u << 16); // Form u = a*t + t/a = t*(a + 1/a). $u^= 0x7fffffff & ($t >> 1); // Add the modular polynomial on underflow. if ($t & 0x01) { $u^= 0xa6 ; } // Remove t * (a + 1/a) * (x^3 + x). $B^= ($u << 24) | ($u << 8); } return [ 0xff & $B >> 24, 0xff & $B >> 16, 0xff & $B >> 8, 0xff & $B]; } /** * Encrypts a block * * @access private * @param string $in * @return string */ protected function encryptBlock($in) { $S0 = $this->S0; $S1 = $this->S1; $S2 = $this->S2; $S3 = $this->S3; $K = $this->K; $in = unpack("V4", $in); $R0 = $K[0] ^ $in[1]; $R1 = $K[1] ^ $in[2]; $R2 = $K[2] ^ $in[3]; $R3 = $K[3] ^ $in[4]; $ki = 7; while ($ki < 39) { $t0 = $S0[ $R0 & 0xff] ^ $S1[($R0 >> 8) & 0xff] ^ $S2[($R0 >> 16) & 0xff] ^ $S3[($R0 >> 24) & 0xff]; $t1 = $S0[($R1 >> 24) & 0xff] ^ $S1[ $R1 & 0xff] ^ $S2[($R1 >> 8) & 0xff] ^ $S3[($R1 >> 16) & 0xff]; $R2^= self::safe_intval($t0 + $t1 + $K[++$ki]); $R2 = ($R2 >> 1 & 0x7fffffff) | ($R2 << 31); $R3 = ((($R3 >> 31) & 1) | ($R3 << 1)) ^ self::safe_intval($t0 + ($t1 << 1) + $K[++$ki]); $t0 = $S0[ $R2 & 0xff] ^ $S1[($R2 >> 8) & 0xff] ^ $S2[($R2 >> 16) & 0xff] ^ $S3[($R2 >> 24) & 0xff]; $t1 = $S0[($R3 >> 24) & 0xff] ^ $S1[ $R3 & 0xff] ^ $S2[($R3 >> 8) & 0xff] ^ $S3[($R3 >> 16) & 0xff]; $R0^= self::safe_intval($t0 + $t1 + $K[++$ki]); $R0 = ($R0 >> 1 & 0x7fffffff) | ($R0 << 31); $R1 = ((($R1 >> 31) & 1) | ($R1 << 1)) ^ self::safe_intval($t0 + ($t1 << 1) + $K[++$ki]); } // @codingStandardsIgnoreStart return pack("V4", $K[4] ^ $R2, $K[5] ^ $R3, $K[6] ^ $R0, $K[7] ^ $R1); // @codingStandardsIgnoreEnd } /** * Decrypts a block * * @access private * @param string $in * @return string */ protected function decryptBlock($in) { $S0 = $this->S0; $S1 = $this->S1; $S2 = $this->S2; $S3 = $this->S3; $K = $this->K; $in = unpack("V4", $in); $R0 = $K[4] ^ $in[1]; $R1 = $K[5] ^ $in[2]; $R2 = $K[6] ^ $in[3]; $R3 = $K[7] ^ $in[4]; $ki = 40; while ($ki > 8) { $t0 = $S0[$R0 & 0xff] ^ $S1[$R0 >> 8 & 0xff] ^ $S2[$R0 >> 16 & 0xff] ^ $S3[$R0 >> 24 & 0xff]; $t1 = $S0[$R1 >> 24 & 0xff] ^ $S1[$R1 & 0xff] ^ $S2[$R1 >> 8 & 0xff] ^ $S3[$R1 >> 16 & 0xff]; $R3^= self::safe_intval($t0 + ($t1 << 1) + $K[--$ki]); $R3 = $R3 >> 1 & 0x7fffffff | $R3 << 31; $R2 = ($R2 >> 31 & 0x1 | $R2 << 1) ^ self::safe_intval($t0 + $t1 + $K[--$ki]); $t0 = $S0[$R2 & 0xff] ^ $S1[$R2 >> 8 & 0xff] ^ $S2[$R2 >> 16 & 0xff] ^ $S3[$R2 >> 24 & 0xff]; $t1 = $S0[$R3 >> 24 & 0xff] ^ $S1[$R3 & 0xff] ^ $S2[$R3 >> 8 & 0xff] ^ $S3[$R3 >> 16 & 0xff]; $R1^= self::safe_intval($t0 + ($t1 << 1) + $K[--$ki]); $R1 = $R1 >> 1 & 0x7fffffff | $R1 << 31; $R0 = ($R0 >> 31 & 0x1 | $R0 << 1) ^ self::safe_intval($t0 + $t1 + $K[--$ki]); } // @codingStandardsIgnoreStart return pack("V4", $K[0] ^ $R2, $K[1] ^ $R3, $K[2] ^ $R0, $K[3] ^ $R1); // @codingStandardsIgnoreEnd } /** * Setup the performance-optimized function for de/encrypt() * * @see \phpseclib\Crypt\Common\SymmetricKey::_setupInlineCrypt() * @access private */ protected function setupInlineCrypt() { $K = $this->K; $init_crypt = ' static $S0, $S1, $S2, $S3; if (!$S0) { for ($i = 0; $i < 256; ++$i) { $S0[] = (int)$this->S0[$i]; $S1[] = (int)$this->S1[$i]; $S2[] = (int)$this->S2[$i]; $S3[] = (int)$this->S3[$i]; } } '; $safeint = self::safe_intval_inline(); // Generating encrypt code: $encrypt_block = ' $in = unpack("V4", $in); $R0 = '.$K[0].' ^ $in[1]; $R1 = '.$K[1].' ^ $in[2]; $R2 = '.$K[2].' ^ $in[3]; $R3 = '.$K[3].' ^ $in[4]; '; for ($ki = 7, $i = 0; $i < 8; ++$i) { $encrypt_block.= ' $t0 = $S0[ $R0 & 0xff] ^ $S1[($R0 >> 8) & 0xff] ^ $S2[($R0 >> 16) & 0xff] ^ $S3[($R0 >> 24) & 0xff]; $t1 = $S0[($R1 >> 24) & 0xff] ^ $S1[ $R1 & 0xff] ^ $S2[($R1 >> 8) & 0xff] ^ $S3[($R1 >> 16) & 0xff]; $R2^= ' . sprintf($safeint, '$t0 + $t1 + ' . $K[++$ki]) . '; $R2 = ($R2 >> 1 & 0x7fffffff) | ($R2 << 31); $R3 = ((($R3 >> 31) & 1) | ($R3 << 1)) ^ ' . sprintf($safeint, '($t0 + ($t1 << 1) + ' . $K[++$ki] . ')') . '; $t0 = $S0[ $R2 & 0xff] ^ $S1[($R2 >> 8) & 0xff] ^ $S2[($R2 >> 16) & 0xff] ^ $S3[($R2 >> 24) & 0xff]; $t1 = $S0[($R3 >> 24) & 0xff] ^ $S1[ $R3 & 0xff] ^ $S2[($R3 >> 8) & 0xff] ^ $S3[($R3 >> 16) & 0xff]; $R0^= ' . sprintf($safeint, '($t0 + $t1 + ' . $K[++$ki] . ')') . '; $R0 = ($R0 >> 1 & 0x7fffffff) | ($R0 << 31); $R1 = ((($R1 >> 31) & 1) | ($R1 << 1)) ^ ' . sprintf($safeint, '($t0 + ($t1 << 1) + ' . $K[++$ki] . ')') . '; '; } $encrypt_block.= ' $in = pack("V4", '.$K[4].' ^ $R2, '.$K[5].' ^ $R3, '.$K[6].' ^ $R0, '.$K[7].' ^ $R1); '; // Generating decrypt code: $decrypt_block = ' $in = unpack("V4", $in); $R0 = '.$K[4].' ^ $in[1]; $R1 = '.$K[5].' ^ $in[2]; $R2 = '.$K[6].' ^ $in[3]; $R3 = '.$K[7].' ^ $in[4]; '; for ($ki = 40, $i = 0; $i < 8; ++$i) { $decrypt_block.= ' $t0 = $S0[$R0 & 0xff] ^ $S1[$R0 >> 8 & 0xff] ^ $S2[$R0 >> 16 & 0xff] ^ $S3[$R0 >> 24 & 0xff]; $t1 = $S0[$R1 >> 24 & 0xff] ^ $S1[$R1 & 0xff] ^ $S2[$R1 >> 8 & 0xff] ^ $S3[$R1 >> 16 & 0xff]; $R3^= ' . sprintf($safeint, '$t0 + ($t1 << 1) + ' . $K[--$ki]) . '; $R3 = $R3 >> 1 & 0x7fffffff | $R3 << 31; $R2 = ($R2 >> 31 & 0x1 | $R2 << 1) ^ ' . sprintf($safeint, '($t0 + $t1 + '.$K[--$ki] . ')') . '; $t0 = $S0[$R2 & 0xff] ^ $S1[$R2 >> 8 & 0xff] ^ $S2[$R2 >> 16 & 0xff] ^ $S3[$R2 >> 24 & 0xff]; $t1 = $S0[$R3 >> 24 & 0xff] ^ $S1[$R3 & 0xff] ^ $S2[$R3 >> 8 & 0xff] ^ $S3[$R3 >> 16 & 0xff]; $R1^= ' . sprintf($safeint, '$t0 + ($t1 << 1) + ' . $K[--$ki]) . '; $R1 = $R1 >> 1 & 0x7fffffff | $R1 << 31; $R0 = ($R0 >> 31 & 0x1 | $R0 << 1) ^ ' . sprintf($safeint, '($t0 + $t1 + '.$K[--$ki] . ')') . '; '; } $decrypt_block.= ' $in = pack("V4", '.$K[0].' ^ $R2, '.$K[1].' ^ $R3, '.$K[2].' ^ $R0, '.$K[3].' ^ $R1); '; $this->inline_crypt = $this->createInlineCryptFunction( [ 'init_crypt' => $init_crypt, 'init_encrypt' => '', 'init_decrypt' => '', 'encrypt_block' => $encrypt_block, 'decrypt_block' => $decrypt_block ] ); } } <?php /** * Pure-PHP implementation of AES. * * Uses mcrypt, if available/possible, and an internal implementation, otherwise. * * PHP version 5 * * NOTE: Since AES.php is (for compatibility and phpseclib-historical reasons) virtually * just a wrapper to Rijndael.php you may consider using Rijndael.php instead of * to save one include_once(). * * If {@link self::setKeyLength() setKeyLength()} isn't called, it'll be calculated from * {@link self::setKey() setKey()}. ie. if the key is 128-bits, the key length will be 128-bits. If it's 136-bits * it'll be null-padded to 192-bits and 192 bits will be the key length until {@link self::setKey() setKey()} * is called, again, at which point, it'll be recalculated. * * Since \phpseclib\Crypt\AES extends \phpseclib\Crypt\Rijndael, some functions are available to be called that, in the context of AES, don't * make a whole lot of sense. {@link self::setBlockLength() setBlockLength()}, for instance. Calling that function, * however possible, won't do anything (AES has a fixed block length whereas Rijndael has a variable one). * * Here's a short example of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * $aes = new \phpseclib\Crypt\AES(); * * $aes->setKey('abcdefghijklmnop'); * * $size = 10 * 1024; * $plaintext = ''; * for ($i = 0; $i < $size; $i++) { * $plaintext.= 'a'; * } * * echo $aes->decrypt($aes->encrypt($plaintext)); * ?> * </code> * * @category Crypt * @package AES * @author Jim Wigginton <terrafrost@php.net> * @copyright 2008 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt; /** * Pure-PHP implementation of AES. * * @package AES * @author Jim Wigginton <terrafrost@php.net> * @access public */ class AES extends Rijndael { /** * Dummy function * * Since \phpseclib\Crypt\AES extends \phpseclib\Crypt\Rijndael, this function is, technically, available, but it doesn't do anything. * * @see \phpseclib\Crypt\Rijndael::setBlockLength() * @access public * @param int $length * @throws \BadMethodCallException anytime it's called */ public function setBlockLength($length) { throw new \BadMethodCallException('The block length cannot be set for AES.'); } /** * Sets the key length * * Valid key lengths are 128, 192, and 256. Set the link to bool(false) to disable a fixed key length * * @see \phpseclib\Crypt\Rijndael:setKeyLength() * @access public * @param int $length * @throws \LengthException if the key length isn't supported */ public function setKeyLength($length) { switch ($length) { case 128: case 192: case 256: break; default: throw new \LengthException('Key of size ' . $length . ' not supported by this algorithm. Only keys of sizes 128, 192 or 256 supported'); } parent::setKeyLength($length); } /** * Sets the key. * * Rijndael supports five different key lengths, AES only supports three. * * @see \phpseclib\Crypt\Rijndael:setKey() * @see setKeyLength() * @access public * @param string $key * @throws \LengthException if the key length isn't supported */ public function setKey($key) { switch (strlen($key)) { case 16: case 24: case 32: break; default: throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported'); } parent::setKey($key); } } <?php /** * Pure-PHP implementation of Triple DES. * * Uses mcrypt, if available, and an internal implementation, otherwise. Operates in the EDE3 mode (encrypt-decrypt-encrypt). * * PHP version 5 * * Here's a short example of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * $des = new \phpseclib\Crypt\TripleDES(); * * $des->setKey('abcdefghijklmnopqrstuvwx'); * * $size = 10 * 1024; * $plaintext = ''; * for ($i = 0; $i < $size; $i++) { * $plaintext.= 'a'; * } * * echo $des->decrypt($des->encrypt($plaintext)); * ?> * </code> * * @category Crypt * @package TripleDES * @author Jim Wigginton <terrafrost@php.net> * @copyright 2007 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt; /** * Pure-PHP implementation of Triple DES. * * @package TripleDES * @author Jim Wigginton <terrafrost@php.net> * @access public */ class TripleDES extends DES { /** * Encrypt / decrypt using inner chaining * * Inner chaining is used by SSH-1 and is generally considered to be less secure then outer chaining (self::MODE_CBC3). */ const MODE_3CBC = -2; /** * Encrypt / decrypt using outer chaining * * Outer chaining is used by SSH-2 and when the mode is set to \phpseclib\Crypt\Common\BlockCipher::MODE_CBC. */ const MODE_CBC3 = self::MODE_CBC; /** * Key Length (in bytes) * * @see \phpseclib\Crypt\TripleDES::setKeyLength() * @var int * @access private */ protected $key_length = 24; /** * The mcrypt specific name of the cipher * * @see \phpseclib\Crypt\DES::cipher_name_mcrypt * @see \phpseclib\Crypt\Common\SymmetricKey::cipher_name_mcrypt * @var string * @access private */ protected $cipher_name_mcrypt = 'tripledes'; /** * Optimizing value while CFB-encrypting * * @see \phpseclib\Crypt\Common\SymmetricKey::cfb_init_len * @var int * @access private */ protected $cfb_init_len = 750; /** * max possible size of $key * * @see self::setKey() * @see \phpseclib\Crypt\DES::setKey() * @var string * @access private */ protected $key_length_max = 24; /** * Internal flag whether using self::MODE_3CBC or not * * @var bool * @access private */ private $mode_3cbc; /** * The \phpseclib\Crypt\DES objects * * Used only if $mode_3cbc === true * * @var array * @access private */ private $des; /** * Default Constructor. * * Determines whether or not the mcrypt or OpenSSL extensions should be used. * * $mode could be: * * - ecb * * - cbc * * - ctr * * - cfb * * - ofb * * - 3cbc * * - cbc3 (same as cbc) * * @see \phpseclib\Crypt\DES::__construct() * @see \phpseclib\Crypt\Common\SymmetricKey::__construct() * @param int $mode * @access public */ public function __construct($mode) { switch (strtolower($mode)) { // In case of self::MODE_3CBC, we init as CRYPT_DES_MODE_CBC // and additional flag us internally as 3CBC case '3cbc': $mode = self::MODE_3CBC; parent::__construct('cbc'); $this->mode_3cbc = true; // This three $des'es will do the 3CBC work (if $key > 64bits) $this->des = [ new DES('cbc'), new DES('cbc'), new DES('cbc'), ]; // we're going to be doing the padding, ourselves, so disable it in the \phpseclib\Crypt\DES objects $this->des[0]->disablePadding(); $this->des[1]->disablePadding(); $this->des[2]->disablePadding(); break; case 'cbc3': $mode = 'cbc'; // If not 3CBC, we init as usual default: parent::__construct($mode); } } /** * Test for engine validity * * This is mainly just a wrapper to set things up for \phpseclib\Crypt\Common\SymmetricKey::isValidEngine() * * @see \phpseclib\Crypt\Common\SymmetricKey::__construct() * @param int $engine * @access protected * @return bool */ protected function isValidEngineHelper($engine) { if ($engine == self::ENGINE_OPENSSL) { $this->cipher_name_openssl_ecb = 'des-ede3'; $mode = $this->openssl_translate_mode(); $this->cipher_name_openssl = $mode == 'ecb' ? 'des-ede3' : 'des-ede3-' . $mode; } return parent::isValidEngineHelper($engine); } /** * Sets the initialization vector. * * SetIV is not required when \phpseclib\Crypt\Common\SymmetricKey::MODE_ECB is being used. * * @see \phpseclib\Crypt\Common\SymmetricKey::setIV() * @access public * @param string $iv */ public function setIV($iv) { parent::setIV($iv); if ($this->mode_3cbc) { $this->des[0]->setIV($iv); $this->des[1]->setIV($iv); $this->des[2]->setIV($iv); } } /** * Sets the key length. * * Valid key lengths are 128 and 192 bits. * * If you want to use a 64-bit key use DES.php * * @see \phpseclib\Crypt\Common\SymmetricKey:setKeyLength() * @access public * @throws \LengthException if the key length is invalid * @param int $length */ public function setKeyLength($length) { switch ($length) { case 128: case 192: break; default: throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys of sizes 128 or 192 bits are supported'); } parent::setKeyLength($length); } /** * Sets the key. * * Triple DES can use 128-bit (eg. strlen($key) == 16) or 192-bit (eg. strlen($key) == 24) keys. * * DES also requires that every eighth bit be a parity bit, however, we'll ignore that. * * @access public * @see \phpseclib\Crypt\DES::setKey() * @see \phpseclib\Crypt\Common\SymmetricKey::setKey() * @throws \LengthException if the key length is invalid * @param string $key */ public function setKey($key) { if ($this->explicit_key_length !== false && strlen($key) != $this->explicit_key_length) { throw new \LengthException('Key length has already been set to ' . $this->explicit_key_length . ' bytes and this key is ' . strlen($key) . ' bytes'); } switch (strlen($key)) { case 16: $key.= substr($key, 0, 8); break; case 24: break; default: throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes 16 or 24 are supported'); } // copied from self::setKey() $this->key = $key; $this->key_length = strlen($key); $this->changed = true; $this->setEngine(); if ($this->mode_3cbc) { $this->des[0]->setKey(substr($key, 0, 8)); $this->des[1]->setKey(substr($key, 8, 8)); $this->des[2]->setKey(substr($key, 16, 8)); } } /** * Encrypts a message. * * @see \phpseclib\Crypt\Common\SymmetricKey::encrypt() * @access public * @param string $plaintext * @return string $cipertext */ public function encrypt($plaintext) { // parent::en/decrypt() is able to do all the work for all modes and keylengths, // except for: self::MODE_3CBC (inner chaining CBC) with a key > 64bits // if the key is smaller then 8, do what we'd normally do if ($this->mode_3cbc && strlen($this->key) > 8) { return $this->des[2]->encrypt( $this->des[1]->decrypt( $this->des[0]->encrypt( $this->pad($plaintext) ) ) ); } return parent::encrypt($plaintext); } /** * Decrypts a message. * * @see \phpseclib\Crypt\Common\SymmetricKey::decrypt() * @access public * @param string $ciphertext * @return string $plaintext */ public function decrypt($ciphertext) { if ($this->mode_3cbc && strlen($this->key) > 8) { return $this->unpad( $this->des[0]->decrypt( $this->des[1]->encrypt( $this->des[2]->decrypt( str_pad($ciphertext, (strlen($ciphertext) + 7) & 0xFFFFFFF8, "\0") ) ) ) ); } return parent::decrypt($ciphertext); } /** * Treat consecutive "packets" as if they are a continuous buffer. * * Say you have a 16-byte plaintext $plaintext. Using the default behavior, the two following code snippets * will yield different outputs: * * <code> * echo $des->encrypt(substr($plaintext, 0, 8)); * echo $des->encrypt(substr($plaintext, 8, 8)); * </code> * <code> * echo $des->encrypt($plaintext); * </code> * * The solution is to enable the continuous buffer. Although this will resolve the above discrepancy, it creates * another, as demonstrated with the following: * * <code> * $des->encrypt(substr($plaintext, 0, 8)); * echo $des->decrypt($des->encrypt(substr($plaintext, 8, 8))); * </code> * <code> * echo $des->decrypt($des->encrypt(substr($plaintext, 8, 8))); * </code> * * With the continuous buffer disabled, these would yield the same output. With it enabled, they yield different * outputs. The reason is due to the fact that the initialization vector's change after every encryption / * decryption round when the continuous buffer is enabled. When it's disabled, they remain constant. * * Put another way, when the continuous buffer is enabled, the state of the \phpseclib\Crypt\DES() object changes after each * encryption / decryption round, whereas otherwise, it'd remain constant. For this reason, it's recommended that * continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them), * however, they are also less intuitive and more likely to cause you problems. * * @see \phpseclib\Crypt\Common\SymmetricKey::enableContinuousBuffer() * @see self::disableContinuousBuffer() * @access public */ public function enableContinuousBuffer() { parent::enableContinuousBuffer(); if ($this->mode_3cbc) { $this->des[0]->enableContinuousBuffer(); $this->des[1]->enableContinuousBuffer(); $this->des[2]->enableContinuousBuffer(); } } /** * Treat consecutive packets as if they are a discontinuous buffer. * * The default behavior. * * @see \phpseclib\Crypt\Common\SymmetricKey::disableContinuousBuffer() * @see self::enableContinuousBuffer() * @access public */ public function disableContinuousBuffer() { parent::disableContinuousBuffer(); if ($this->mode_3cbc) { $this->des[0]->disableContinuousBuffer(); $this->des[1]->disableContinuousBuffer(); $this->des[2]->disableContinuousBuffer(); } } /** * Creates the key schedule * * @see \phpseclib\Crypt\DES::setupKey() * @see \phpseclib\Crypt\Common\SymmetricKey::setupKey() * @access private */ protected function setupKey() { switch (true) { // if $key <= 64bits we configure our internal pure-php cipher engine // to act as regular [1]DES, not as 3DES. mcrypt.so::tripledes does the same. case strlen($this->key) <= 8: $this->des_rounds = 1; break; // otherwise, if $key > 64bits, we configure our engine to work as 3DES. default: $this->des_rounds = 3; // (only) if 3CBC is used we have, of course, to setup the $des[0-2] keys also separately. if ($this->mode_3cbc) { $this->des[0]->setupKey(); $this->des[1]->setupKey(); $this->des[2]->setupKey(); // because $des[0-2] will, now, do all the work we can return here // not need unnecessary stress parent::setupKey() with our, now unused, $key. return; } } // setup our key parent::setupKey(); } /** * Sets the internal crypt engine * * @see \phpseclib\Crypt\Common\SymmetricKey::__construct() * @see \phpseclib\Crypt\Common\SymmetricKey::setPreferredEngine() * @param int $engine * @access public */ public function setPreferredEngine($engine) { if ($this->mode_3cbc) { $this->des[0]->setPreferredEngine($engine); $this->des[1]->setPreferredEngine($engine); $this->des[2]->setPreferredEngine($engine); } parent::setPreferredEngine($engine); } } <?php /** * Miccrosoft BLOB Formatted RSA Key Handler * * More info: * * https://msdn.microsoft.com/en-us/library/windows/desktop/aa375601(v=vs.85).aspx * * PHP version 5 * * @category Crypt * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\RSA\Keys; use ParagonIE\ConstantTime\Base64; use phpseclib\Math\BigInteger; use phpseclib\Common\Functions\Strings; /** * Microsoft BLOB Formatted RSA Key Handler * * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class MSBLOB { /**#@+ * @access private */ /** * Public/Private Key Pair */ const PRIVATEKEYBLOB = 0x7; /** * Public Key */ const PUBLICKEYBLOB = 0x6; /** * Public Key */ const PUBLICKEYBLOBEX = 0xA; /** * RSA public key exchange algorithm */ const CALG_RSA_KEYX = 0x0000A400; /** * RSA public key exchange algorithm */ const CALG_RSA_SIGN = 0x00002400; /** * Public Key */ const RSA1 = 0x31415352; /** * Private Key */ const RSA2 = 0x32415352; /**#@-*/ /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array|bool */ public static function load($key, $password = '') { if (!is_string($key)) { return false; } $key = Base64::decode($key); if (!is_string($key) || strlen($key) < 20) { return false; } // PUBLICKEYSTRUC publickeystruc // https://msdn.microsoft.com/en-us/library/windows/desktop/aa387453(v=vs.85).aspx extract(unpack('atype/aversion/vreserved/Valgo', Strings::shift($key, 8))); /** * @var string $type * @var string $version * @var integer $reserved * @var integer $algo */ switch (ord($type)) { case self::PUBLICKEYBLOB: case self::PUBLICKEYBLOBEX: $publickey = true; break; case self::PRIVATEKEYBLOB: $publickey = false; break; default: return false; } $components = ['isPublicKey' => $publickey]; // https://msdn.microsoft.com/en-us/library/windows/desktop/aa375549(v=vs.85).aspx switch ($algo) { case self::CALG_RSA_KEYX: case self::CALG_RSA_SIGN: break; default: return false; } // RSAPUBKEY rsapubkey // https://msdn.microsoft.com/en-us/library/windows/desktop/aa387685(v=vs.85).aspx // could do V for pubexp but that's unsigned 32-bit whereas some PHP installs only do signed 32-bit extract(unpack('Vmagic/Vbitlen/a4pubexp', Strings::shift($key, 12))); /** * @var integer $magic * @var integer $bitlen * @var string $pubexp */ switch ($magic) { case self::RSA2: $components['isPublicKey'] = false; case self::RSA1: break; default: return false; } $baseLength = $bitlen / 16; if (strlen($key) != 2 * $baseLength && strlen($key) != 9 * $baseLength) { return false; } $components[$components['isPublicKey'] ? 'publicExponent' : 'privateExponent'] = new BigInteger(strrev($pubexp), 256); // BYTE modulus[rsapubkey.bitlen/8] $components['modulus'] = new BigInteger(strrev(Strings::shift($key, $bitlen / 8)), 256); if ($publickey) { return $components; } $components['isPublicKey'] = false; // BYTE prime1[rsapubkey.bitlen/16] $components['primes'] = [1 => new BigInteger(strrev(Strings::shift($key, $bitlen / 16)), 256)]; // BYTE prime2[rsapubkey.bitlen/16] $components['primes'][] = new BigInteger(strrev(Strings::shift($key, $bitlen / 16)), 256); // BYTE exponent1[rsapubkey.bitlen/16] $components['exponents'] = [1 => new BigInteger(strrev(Strings::shift($key, $bitlen / 16)), 256)]; // BYTE exponent2[rsapubkey.bitlen/16] $components['exponents'][] = new BigInteger(strrev(Strings::shift($key, $bitlen / 16)), 256); // BYTE coefficient[rsapubkey.bitlen/16] $components['coefficients'] = [2 => new BigInteger(strrev(Strings::shift($key, $bitlen / 16)), 256)]; if (isset($components['privateExponent'])) { $components['publicExponent'] = $components['privateExponent']; } // BYTE privateExponent[rsapubkey.bitlen/8] $components['privateExponent'] = new BigInteger(strrev(Strings::shift($key, $bitlen / 8)), 256); return $components; } /** * Convert a private key to the appropriate format. * * @access public * @param \phpseclib\Math\BigInteger $n * @param \phpseclib\Math\BigInteger $e * @param \phpseclib\Math\BigInteger $d * @param array $primes * @param array $exponents * @param array $coefficients * @param string $password optional * @return string */ public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, $primes, $exponents, $coefficients, $password = '') { if (count($primes) != 2) { throw new \InvalidArgumentException('MSBLOB does not support multi-prime RSA keys'); } $n = strrev($n->toBytes()); $e = str_pad(strrev($e->toBytes()), 4, "\0"); $key = pack('aavV', chr(self::PRIVATEKEYBLOB), chr(2), 0, self::CALG_RSA_KEYX); $key.= pack('VVa*', self::RSA2, 8 * strlen($n), $e); $key.= $n; $key.= strrev($primes[1]->toBytes()); $key.= strrev($primes[2]->toBytes()); $key.= strrev($exponents[1]->toBytes()); $key.= strrev($exponents[2]->toBytes()); $key.= strrev($coefficients[1]->toBytes()); $key.= strrev($d->toBytes()); return Base64::encode($key); } /** * Convert a public key to the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $n * @param \phpseclib\Math\BigInteger $e * @return string */ public static function savePublicKey(BigInteger $n, BigInteger $e) { $n = strrev($n->toBytes()); $e = str_pad(strrev($e->toBytes()), 4, "\0"); $key = pack('aavV', chr(self::PUBLICKEYBLOB), chr(2), 0, self::CALG_RSA_KEYX); $key.= pack('VVa*', self::RSA1, 8 * strlen($n), $e); $key.= $n; return Base64::encode($key); } } <?php /** * Raw RSA Key Handler * * PHP version 5 * * An array containing two \phpseclib\Math\BigInteger objects. * * The exponent can be indexed with any of the following: * * 0, e, exponent, publicExponent * * The modulus can be indexed with any of the following: * * 1, n, modulo, modulus * * @category Crypt * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\RSA\Keys; use phpseclib\Math\BigInteger; /** * Raw RSA Key Handler * * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Raw { /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array|bool */ public static function load($key, $password = '') { if (!is_array($key)) { return false; } if (isset($key['isPublicKey']) && isset($key['modulus'])) { if (isset($key['privateExponent']) || isset($key['publicExponent'])) { if (!isset($key['primes'])) { return $key; } if (isset($key['exponents']) && isset($key['coefficients']) && isset($key['publicExponent']) && isset($key['privateExponent'])) { return $key; } } } $components = ['isPublicKey' => true]; switch (true) { case isset($key['e']): $components['publicExponent'] = $key['e']; break; case isset($key['exponent']): $components['publicExponent'] = $key['exponent']; break; case isset($key['publicExponent']): $components['publicExponent'] = $key['publicExponent']; break; case isset($key[0]): $components['publicExponent'] = $key[0]; } switch (true) { case isset($key['n']): $components['modulus'] = $key['n']; break; case isset($key['modulo']): $components['modulus'] = $key['modulo']; break; case isset($key['modulus']): $components['modulus'] = $key['modulus']; break; case isset($key[1]): $components['modulus'] = $key[1]; } return isset($components['modulus']) && isset($components['publicExponent']) ? $components : false; } /** * Convert a public key to the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $n * @param \phpseclib\Math\BigInteger $e * @return array */ public static function savePublicKey(BigInteger $n, BigInteger $e) { return ['e' => clone $e, 'n' => clone $n]; } } <?php /** * XML Formatted RSA Key Handler * * More info: * * http://www.w3.org/TR/xmldsig-core/#sec-RSAKeyValue * http://www.w3.org/TR/xkms2/#XKMS_2_0_Paragraph_269 * http://en.wikipedia.org/wiki/XML_Signature * http://en.wikipedia.org/wiki/XKMS * * PHP version 5 * * @category Crypt * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\RSA\Keys; use ParagonIE\ConstantTime\Base64; use phpseclib\Math\BigInteger; /** * XML Formatted RSA Key Handler * * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class XML { /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array|bool */ public static function load($key, $password = '') { if (!is_string($key)) { return false; } $components = [ 'isPublicKey' => false, 'primes' => [], 'exponents' => [], 'coefficients' => [] ]; $use_errors = libxml_use_internal_errors(true); $dom = new \DOMDocument(); if (substr($key, 0, 5) != '<?xml') { $key = '<xml>' . $key . '</xml>'; } if (!$dom->loadXML($key)) { return false; } $xpath = new \DOMXPath($dom); $keys = ['modulus', 'exponent', 'p', 'q', 'dp', 'dq', 'inverseq', 'd']; foreach ($keys as $key) { // $dom->getElementsByTagName($key) is case-sensitive $temp = $xpath->query("//*[translate(local-name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='$key']"); if (!$temp->length) { continue; } $value = new BigInteger(Base64::decode($temp->item(0)->nodeValue), 256); switch ($key) { case 'modulus': $components['modulus'] = $value; break; case 'exponent': $components['publicExponent'] = $value; break; case 'p': $components['primes'][1] = $value; break; case 'q': $components['primes'][2] = $value; break; case 'dp': $components['exponents'][1] = $value; break; case 'dq': $components['exponents'][2] = $value; break; case 'inverseq': $components['coefficients'][2] = $value; break; case 'd': $components['privateExponent'] = $value; } } libxml_use_internal_errors($use_errors); return isset($components['modulus']) && isset($components['publicExponent']) ? $components : false; } /** * Convert a private key to the appropriate format. * * @access public * @param \phpseclib\Math\BigInteger $n * @param \phpseclib\Math\BigInteger $e * @param \phpseclib\Math\BigInteger $d * @param array $primes * @param array $exponents * @param array $coefficients * @param string $password optional * @return string */ public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, $primes, $exponents, $coefficients, $password = '') { if (count($primes) != 2) { throw new \InvalidArgumentException('XML does not support multi-prime RSA keys'); } return "<RSAKeyPair>\r\n" . ' <Modulus>' . Base64::encode($n->toBytes()) . "</Modulus>\r\n" . ' <Exponent>' . Base64::encode($e->toBytes()) . "</Exponent>\r\n" . ' <P>' . Base64::encode($primes[1]->toBytes()) . "</P>\r\n" . ' <Q>' . Base64::encode($primes[2]->toBytes()) . "</Q>\r\n" . ' <DP>' . Base64::encode($exponents[1]->toBytes()) . "</DP>\r\n" . ' <DQ>' . Base64::encode($exponents[2]->toBytes()) . "</DQ>\r\n" . ' <InverseQ>' . Base64::encode($coefficients[2]->toBytes()) . "</InverseQ>\r\n" . ' <D>' . Base64::encode($d->toBytes()) . "</D>\r\n" . '</RSAKeyPair>'; } /** * Convert a public key to the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $n * @param \phpseclib\Math\BigInteger $e * @return string */ public static function savePublicKey(BigInteger $n, BigInteger $e) { return "<RSAKeyValue>\r\n" . ' <Modulus>' . Base64::encode($n->toBytes()) . "</Modulus>\r\n" . ' <Exponent>' . Base64::encode($e->toBytes()) . "</Exponent>\r\n" . '</RSAKeyValue>'; } } <?php /** * OpenSSH Formatted RSA Key Handler * * PHP version 5 * * Place in $HOME/.ssh/authorized_keys * * @category Crypt * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\RSA\Keys; use ParagonIE\ConstantTime\Base64; use phpseclib\Math\BigInteger; use phpseclib\Common\Functions\Strings; use phpseclib\Crypt\Common\Keys\OpenSSH as Progenitor; /** * OpenSSH Formatted RSA Key Handler * * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class OpenSSH extends Progenitor { /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array|bool */ public static function load($key, $password = '') { $key = parent::load($key, 'ssh-rsa'); if ($key === false) { return false; } $result = Strings::unpackSSH2('ii', $key); if ($result === false) { return false; } list($publicExponent, $modulus) = $result; return [ 'isPublicKey' => true, 'modulus' => $modulus, 'publicExponent' => $publicExponent, 'comment' => parent::getComment($key) ]; } /** * Convert a public key to the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $n * @param \phpseclib\Math\BigInteger $e * @return string */ public static function savePublicKey(BigInteger $n, BigInteger $e) { $RSAPublicKey = Strings::packSSH2('sii', 'ssh-rsa', $e, $n); if (self::$binary) { return $RSAPublicKey; } $RSAPublicKey = 'ssh-rsa ' . Base64::encode($RSAPublicKey) . ' ' . self::$comment; return $RSAPublicKey; } } <?php /** * PKCS#8 Formatted RSA Key Handler * * PHP version 5 * * Used by PHP's openssl_public_encrypt() and openssl's rsautl (when -pubin is set) * * Processes keys with the following headers: * * -----BEGIN ENCRYPTED PRIVATE KEY----- * -----BEGIN PRIVATE KEY----- * -----BEGIN PUBLIC KEY----- * * Analogous to ssh-keygen's pkcs8 format (as specified by -m). Although PKCS8 * is specific to private keys it's basically creating a DER-encoded wrapper * for keys. This just extends that same concept to public keys (much like ssh-keygen) * * @category Crypt * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\RSA\Keys; use phpseclib\Math\BigInteger; use phpseclib\Crypt\Common\Keys\PKCS8 as Progenitor; use phpseclib\File\ASN1; /** * PKCS#1 Formatted RSA Key Handler * * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PKCS8 extends Progenitor { /** * OID Name * * @var string * @access private */ const OID_NAME = 'rsaEncryption'; /** * OID Value * * @var string * @access private */ const OID_VALUE = '1.2.840.113549.1.1.1'; /** * Child OIDs loaded * * @var bool * @access private */ protected static $childOIDsLoaded = false; /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array|bool */ public static function load($key, $password = '') { if (!is_string($key)) { return false; } $components = ['isPublicKey' => strpos($key, 'PUBLIC') !== false]; $key = parent::load($key, $password); if ($key === false) { return false; } $type = isset($key['privateKey']) ? 'private' : 'public'; $result = $components + PKCS1::load($key[$type . 'Key']); if (isset($key['meta'])) { $result['meta'] = $key['meta']; } return $result; } /** * Convert a private key to the appropriate format. * * @access public * @param \phpseclib\Math\BigInteger $n * @param \phpseclib\Math\BigInteger $e * @param \phpseclib\Math\BigInteger $d * @param array $primes * @param array $exponents * @param array $coefficients * @param string $password optional * @return string */ public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, $primes, $exponents, $coefficients, $password = '') { $key = PKCS1::savePrivateKey($n, $e, $d, $primes, $exponents, $coefficients); $key = ASN1::extractBER($key); return self::wrapPrivateKey($key, [], null, $password); } /** * Convert a public key to the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $n * @param \phpseclib\Math\BigInteger $e * @return string */ public static function savePublicKey(BigInteger $n, BigInteger $e) { $key = PKCS1::savePublicKey($n, $e); $key = ASN1::extractBER($key); return self::wrapPublicKey($key, null); } } <?php /** * PKCS#1 Formatted RSA Key Handler * * PHP version 5 * * Used by File/X509.php * * Processes keys with the following headers: * * -----BEGIN RSA PRIVATE KEY----- * -----BEGIN RSA PUBLIC KEY----- * * Analogous to ssh-keygen's pem format (as specified by -m) * * @category Crypt * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\RSA\Keys; use phpseclib\Math\BigInteger; use phpseclib\Crypt\Common\Keys\PKCS1 as Progenitor; use phpseclib\File\ASN1; use phpseclib\File\ASN1\Maps; /** * PKCS#1 Formatted RSA Key Handler * * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PKCS1 extends Progenitor { /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array|bool */ public static function load($key, $password = '') { if (!is_string($key)) { return false; } $components = ['isPublicKey' => strpos($key, 'PUBLIC') !== false]; $key = parent::load($key, $password); if ($key === false) { return false; } $decoded = ASN1::decodeBER($key); if (empty($decoded)) { return false; } $key = ASN1::asn1map($decoded[0], Maps\RSAPrivateKey::MAP); if (is_array($key)) { $components+= [ 'modulus' => $key['modulus'], 'publicExponent' => $key['publicExponent'], 'privateExponent' => $key['privateExponent'], 'primes' => [1 => $key['prime1'], $key['prime2']], 'exponents' => [1 => $key['exponent1'], $key['exponent2']], 'coefficients' => [2 => $key['coefficient']] ]; if ($key['version'] == 'multi') { foreach ($key['otherPrimeInfos'] as $primeInfo) { $components['primes'][] = $primeInfo['prime']; $components['exponents'][] = $primeInfo['exponent']; $components['coefficients'][] = $primeInfo['coefficient']; } } return $components; } $key = ASN1::asn1map($decoded[0], Maps\RSAPublicKey::MAP); return is_array($key) ? $components + $key : false; } /** * Convert a private key to the appropriate format. * * @access public * @param \phpseclib\Math\BigInteger $n * @param \phpseclib\Math\BigInteger $e * @param \phpseclib\Math\BigInteger $d * @param array $primes * @param array $exponents * @param array $coefficients * @param string $password optional * @return string */ public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, $primes, $exponents, $coefficients, $password = '') { $num_primes = count($primes); $key = [ 'version' => $num_primes == 2 ? 'two-prime' : 'multi', 'modulus' => $n, 'publicExponent' => $e, 'privateExponent' => $d, 'prime1' => $primes[1], 'prime2' => $primes[2], 'exponent1' => $exponents[1], 'exponent2' => $exponents[2], 'coefficient' => $coefficients[2] ]; for ($i = 3; $i <= $num_primes; $i++) { $key['otherPrimeInfos'][] = [ 'prime' => $primes[$i], 'exponent' => $exponents[$i], 'coefficient' => $coefficients[$i] ]; } $key = ASN1::encodeDER($key, Maps\RSAPrivateKey::MAP); return self::wrapPrivateKey($key, 'RSA', $password); } /** * Convert a public key to the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $n * @param \phpseclib\Math\BigInteger $e * @return string */ public static function savePublicKey(BigInteger $n, BigInteger $e) { $key = [ 'modulus' => $n, 'publicExponent' => $e ]; $key = ASN1::encodeDER($key, Maps\RSAPublicKey::MAP); return self::wrapPublicKey($key, 'RSA'); } } <?php /** * PuTTY Formatted RSA Key Handler * * PHP version 5 * * @category Crypt * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\RSA\Keys; use phpseclib\Math\BigInteger; use phpseclib\Common\Functions\Strings; use phpseclib\Crypt\Common\Keys\PuTTY as Progenitor; /** * PuTTY Formatted RSA Key Handler * * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PuTTY extends Progenitor { /** * Public Handler * * @var string * @access private */ const PUBLIC_HANDLER = 'phpseclib\Crypt\RSA\Keys\OpenSSH'; /** * Algorithm Identifier * * @var string * @access private */ const TYPE = 'ssh-rsa'; /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array|bool */ public static function load($key, $password = '') { static $one; if (!isset($one)) { $one = new BigInteger(1); } $components = parent::load($key, $password); if ($components === false || !isset($components['private'])) { return $components; } $isPublicKey = false; $result = Strings::unpackSSH2('ii', $components['public']); if ($result === false) { return false; } list($publicExponent, $modulus) = $result; $result = Strings::unpackSSH2('iiii', $components['private']); if ($result === false) { return false; } $primes = $coefficients = []; list($privateExponent, $primes[1], $primes[2], $coefficients[2]) = $result; $temp = $primes[1]->subtract($one); $exponents = [1 => $publicExponent->modInverse($temp)]; $temp = $primes[2]->subtract($one); $exponents[] = $publicExponent->modInverse($temp); if (isset($components['comment'])) { $comment = $components['comment']; } return compact('publicExponent', 'modulus', 'privateExponent', 'primes', 'coefficients', 'exponents', 'comment', 'isPublicKey'); } /** * Convert a private key to the appropriate format. * * @access public * @param \phpseclib\Math\BigInteger $n * @param \phpseclib\Math\BigInteger $e * @param \phpseclib\Math\BigInteger $d * @param array $primes * @param array $exponents * @param array $coefficients * @param string $password optional * @return string */ public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, $primes, $exponents, $coefficients, $password = '') { if (count($primes) != 2) { throw new \InvalidArgumentException('PuTTY does not support multi-prime RSA keys'); } $public = Strings::packSSH2('ii', $e, $n); $private = Strings::packSSH2('iiii', $d, $primes[1], $primes[2], $coefficients[2]); return self::wrapPrivateKey($public, $private, $password); } /** * Convert a public key to the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $n * @param \phpseclib\Math\BigInteger $e * @return string */ public static function savePublicKey(BigInteger $n, BigInteger $e) { return self::wrapPublicKey(Strings::packSSH2($e, $n)); } } <?php /** * Wrapper around hash() and hash_hmac() functions supporting truncated hashes * such as sha256-96. Any hash algorithm returned by hash_algos() (and * truncated versions thereof) are supported. * * If {@link self::setKey() setKey()} is called, {@link self::hash() hash()} will * return the HMAC as opposed to the hash. * * Here's a short example of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * $hash = new \phpseclib\Crypt\Hash('sha512'); * * $hash->setKey('abcdefg'); * * echo base64_encode($hash->hash('abcdefg')); * ?> * </code> * * @category Crypt * @package Hash * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @author Andreas Fischer <bantu@phpbb.com> * @copyright 2015 Andreas Fischer * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt; use phpseclib\Math\BigInteger; use phpseclib\Exception\UnsupportedAlgorithmException; use phpseclib\Common\Functions\Strings; /** * @package Hash * @author Jim Wigginton <terrafrost@php.net> * @author Andreas Fischer <bantu@phpbb.com> * @access public */ class Hash { /** * Hash Parameter * * @see self::setHash() * @var int * @access private */ private $hashParam; /** * Byte-length of hash output (Internal HMAC) * * @see self::setHash() * @var int * @access private */ private $length; /** * Hash Algorithm * * @see self::setHash() * @var string * @access private */ private $hash; /** * Key * * @see self::setKey() * @var string * @access private */ private $key = false; /** * Initial Hash * * Used only for sha512/* * * @see self::sha512() * @var array * @access private */ private $initial = false; /** * Outer XOR (Internal HMAC) * * Used only for sha512/* * * @see self::hash() * @var string * @access private */ private $opad; /** * Inner XOR (Internal HMAC) * * Used only for sha512/* * * @see self::hash() * @var string * @access private */ private $ipad; /** * Default Constructor. * * @param string $hash * @access public */ public function __construct($hash = 'sha256') { $this->setHash($hash); $this->ipad = str_repeat(chr(0x36), 128); $this->opad = str_repeat(chr(0x5C), 128); } /** * Sets the key for HMACs * * Keys can be of any length. * * @access public * @param string|bool $key */ public function setKey($key = false) { $this->key = $key; } /** * Gets the hash function. * * As set by the constructor or by the setHash() method. * * @access public * @return string */ public function getHash() { return $this->hashParam; } /** * Sets the hash function. * * @access public * @param string $hash */ public function setHash($hash) { $this->hashParam = $hash = strtolower($hash); switch ($hash) { case 'md2-96': case 'md5-96': case 'sha1-96': case 'sha224-96': case 'sha256-96': case 'sha384-96': case 'sha512-96': case 'sha512/224-96': case 'sha512/256-96': $hash = substr($hash, 0, -3); $this->length = 12; // 96 / 8 = 12 break; case 'md2': case 'md5': $this->length = 16; break; case 'sha1': $this->length = 20; break; case 'sha224': case 'sha512/224': $this->length = 28; break; case 'sha256': case 'sha512/256': $this->length = 32; break; case 'sha384': $this->length = 48; break; case 'sha512': $this->length = 64; break; default: throw new UnsupportedAlgorithmException( "$hash is not a supported algorithm" ); } switch ($hash) { case 'md2-96': case 'md5-96': case 'sha1-96': case 'sha224-96': case 'sha256-96': case 'md2': case 'md5': case 'sha1': case 'sha224': case 'sha256': $this->blockSize = 512; break; default: $this->blockSize = 1024; } if ($hash == 'sha512/224' || $hash == 'sha512/256') { // from http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf#page=24 $this->initial = $hash == 'sha512/256' ? [ '22312194FC2BF72C', '9F555FA3C84C64C2', '2393B86B6F53B151', '963877195940EABD', '96283EE2A88EFFE3', 'BE5E1E2553863992', '2B0199FC2C85B8AA', '0EB72DDC81C52CA2' ] : [ '8C3D37C819544DA2', '73E1996689DCD4D6', '1DFAB7AE32FF9C82', '679DD514582F9FCF', '0F6D2B697BD44DA8', '77E36F7304C48942', '3F9D85A86A1D36C8', '1112E6AD91D692A1' ]; for ($i = 0; $i < 8; $i++) { $this->initial[$i] = new BigInteger($this->initial[$i], 16); $this->initial[$i]->setPrecision(64); } } $this->hash = $hash; } /** * Compute the HMAC. * * @access public * @param string $text * @return string */ public function hash($text) { switch ($this->hash) { case 'sha512/224': case 'sha512/256': // PHP 7.1.0 introduced sha512/224 and sha512/256 support: // http://php.net/ChangeLog-7.php#7.1.0 if (version_compare(PHP_VERSION, '7.1.0') >= 0) { break; } if (empty($this->key) || !is_string($this->key)) { return substr(self::sha512($text, $this->initial), 0, $this->length); } /* "Applications that use keys longer than B bytes will first hash the key using H and then use the resultant L byte string as the actual key to HMAC." -- http://tools.ietf.org/html/rfc2104#section-2 */ $key = strlen($this->key) > $this->b ? self::_sha512($this->key, $this->initial) : $this->key; $key = str_pad($this->key, 128, chr(0)); // step 1 $temp = $this->ipad ^ $this->key; // step 2 $temp .= $text; // step 3 $temp = self::sha512($temp, $this->initial); // step 4 $output = $this->opad ^ $this->key; // step 5 $output.= $temp; // step 6 $output = self::sha512($output, $this->initial); // step 7 return substr($output, 0, $this->length); } $output = !empty($this->key) || is_string($this->key) ? hash_hmac($this->hash, $text, $this->key, true) : hash($this->hash, $text, true); return strlen($output) > $this->length ? substr($output, 0, $this->length) : $output; } /** * Returns the hash length (in bits) * * @access public * @return int */ public function getLength() { return $this->length << 3; } /** * Returns the hash length (in bytes) * * @access public * @return int */ public function getLengthInBytes() { return $this->length; } /** * Returns the block length (in bits) * * @access public * @return int */ public function getBlockLength() { return $this->blockSize; } /** * Returns the block length (in bytes) * * @access public * @return int */ public function getBlockLengthInBytes() { return $this->blockSize >> 3; } /** * Pure-PHP implementation of SHA512 * @access private * @param string $m * @param array $hash * @return string */ private static function sha512($m, $hash) { static $k; if (!isset($k)) { // Initialize table of round constants // (first 64 bits of the fractional parts of the cube roots of the first 80 primes 2..409) $k = [ '428a2f98d728ae22', '7137449123ef65cd', 'b5c0fbcfec4d3b2f', 'e9b5dba58189dbbc', '3956c25bf348b538', '59f111f1b605d019', '923f82a4af194f9b', 'ab1c5ed5da6d8118', 'd807aa98a3030242', '12835b0145706fbe', '243185be4ee4b28c', '550c7dc3d5ffb4e2', '72be5d74f27b896f', '80deb1fe3b1696b1', '9bdc06a725c71235', 'c19bf174cf692694', 'e49b69c19ef14ad2', 'efbe4786384f25e3', '0fc19dc68b8cd5b5', '240ca1cc77ac9c65', '2de92c6f592b0275', '4a7484aa6ea6e483', '5cb0a9dcbd41fbd4', '76f988da831153b5', '983e5152ee66dfab', 'a831c66d2db43210', 'b00327c898fb213f', 'bf597fc7beef0ee4', 'c6e00bf33da88fc2', 'd5a79147930aa725', '06ca6351e003826f', '142929670a0e6e70', '27b70a8546d22ffc', '2e1b21385c26c926', '4d2c6dfc5ac42aed', '53380d139d95b3df', '650a73548baf63de', '766a0abb3c77b2a8', '81c2c92e47edaee6', '92722c851482353b', 'a2bfe8a14cf10364', 'a81a664bbc423001', 'c24b8b70d0f89791', 'c76c51a30654be30', 'd192e819d6ef5218', 'd69906245565a910', 'f40e35855771202a', '106aa07032bbd1b8', '19a4c116b8d2d0c8', '1e376c085141ab53', '2748774cdf8eeb99', '34b0bcb5e19b48a8', '391c0cb3c5c95a63', '4ed8aa4ae3418acb', '5b9cca4f7763e373', '682e6ff3d6b2b8a3', '748f82ee5defb2fc', '78a5636f43172f60', '84c87814a1f0ab72', '8cc702081a6439ec', '90befffa23631e28', 'a4506cebde82bde9', 'bef9a3f7b2c67915', 'c67178f2e372532b', 'ca273eceea26619c', 'd186b8c721c0c207', 'eada7dd6cde0eb1e', 'f57d4f7fee6ed178', '06f067aa72176fba', '0a637dc5a2c898a6', '113f9804bef90dae', '1b710b35131c471b', '28db77f523047d84', '32caab7b40c72493', '3c9ebe0a15c9bebc', '431d67c49c100d4c', '4cc5d4becb3e42b6', '597f299cfc657e2a', '5fcb6fab3ad6faec', '6c44198c4a475817' ]; for ($i = 0; $i < 80; $i++) { $k[$i] = new BigInteger($k[$i], 16); } } // Pre-processing $length = strlen($m); // to round to nearest 112 mod 128, we'll add 128 - (length + (128 - 112)) % 128 $m.= str_repeat(chr(0), 128 - (($length + 16) & 0x7F)); $m[$length] = chr(0x80); // we don't support hashing strings 512MB long $m.= pack('N4', 0, 0, 0, $length << 3); // Process the message in successive 1024-bit chunks $chunks = str_split($m, 128); foreach ($chunks as $chunk) { $w = []; for ($i = 0; $i < 16; $i++) { $temp = new BigInteger(Strings::shift($chunk, 8), 256); $temp->setPrecision(64); $w[] = $temp; } // Extend the sixteen 32-bit words into eighty 32-bit words for ($i = 16; $i < 80; $i++) { $temp = [ $w[$i - 15]->bitwise_rightRotate(1), $w[$i - 15]->bitwise_rightRotate(8), $w[$i - 15]->bitwise_rightShift(7) ]; $s0 = $temp[0]->bitwise_xor($temp[1]); $s0 = $s0->bitwise_xor($temp[2]); $temp = [ $w[$i - 2]->bitwise_rightRotate(19), $w[$i - 2]->bitwise_rightRotate(61), $w[$i - 2]->bitwise_rightShift(6) ]; $s1 = $temp[0]->bitwise_xor($temp[1]); $s1 = $s1->bitwise_xor($temp[2]); $w[$i] = clone $w[$i - 16]; $w[$i] = $w[$i]->add($s0); $w[$i] = $w[$i]->add($w[$i - 7]); $w[$i] = $w[$i]->add($s1); } // Initialize hash value for this chunk $a = clone $hash[0]; $b = clone $hash[1]; $c = clone $hash[2]; $d = clone $hash[3]; $e = clone $hash[4]; $f = clone $hash[5]; $g = clone $hash[6]; $h = clone $hash[7]; // Main loop for ($i = 0; $i < 80; $i++) { $temp = [ $a->bitwise_rightRotate(28), $a->bitwise_rightRotate(34), $a->bitwise_rightRotate(39) ]; $s0 = $temp[0]->bitwise_xor($temp[1]); $s0 = $s0->bitwise_xor($temp[2]); $temp = [ $a->bitwise_and($b), $a->bitwise_and($c), $b->bitwise_and($c) ]; $maj = $temp[0]->bitwise_xor($temp[1]); $maj = $maj->bitwise_xor($temp[2]); $t2 = $s0->add($maj); $temp = [ $e->bitwise_rightRotate(14), $e->bitwise_rightRotate(18), $e->bitwise_rightRotate(41) ]; $s1 = $temp[0]->bitwise_xor($temp[1]); $s1 = $s1->bitwise_xor($temp[2]); $temp = [ $e->bitwise_and($f), $g->bitwise_and($e->bitwise_not()) ]; $ch = $temp[0]->bitwise_xor($temp[1]); $t1 = $h->add($s1); $t1 = $t1->add($ch); $t1 = $t1->add($k[$i]); $t1 = $t1->add($w[$i]); $h = clone $g; $g = clone $f; $f = clone $e; $e = $d->add($t1); $d = clone $c; $c = clone $b; $b = clone $a; $a = $t1->add($t2); } // Add this chunk's hash to result so far $hash = [ $hash[0]->add($a), $hash[1]->add($b), $hash[2]->add($c), $hash[3]->add($d), $hash[4]->add($e), $hash[5]->add($f), $hash[6]->add($g), $hash[7]->add($h) ]; } // Produce the final hash value (big-endian) // (\phpseclib\Crypt\Hash::hash() trims the output for hashes but not for HMACs. as such, we trim the output here) $temp = $hash[0]->toBytes() . $hash[1]->toBytes() . $hash[2]->toBytes() . $hash[3]->toBytes() . $hash[4]->toBytes() . $hash[5]->toBytes() . $hash[6]->toBytes() . $hash[7]->toBytes(); return $temp; } } <?php /** * Pure-PHP implementation of DES. * * Uses mcrypt, if available, and an internal implementation, otherwise. * * PHP version 5 * * Useful resources are as follows: * * - {@link http://en.wikipedia.org/wiki/DES_supplementary_material Wikipedia: DES supplementary material} * - {@link http://www.itl.nist.gov/fipspubs/fip46-2.htm FIPS 46-2 - (DES), Data Encryption Standard} * - {@link http://www.cs.eku.edu/faculty/styer/460/Encrypt/JS-DES.html JavaScript DES Example} * * Here's a short example of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * $des = new \phpseclib\Crypt\DES(); * * $des->setKey('abcdefgh'); * * $size = 10 * 1024; * $plaintext = ''; * for ($i = 0; $i < $size; $i++) { * $plaintext.= 'a'; * } * * echo $des->decrypt($des->encrypt($plaintext)); * ?> * </code> * * @category Crypt * @package DES * @author Jim Wigginton <terrafrost@php.net> * @copyright 2007 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt; use phpseclib\Crypt\Common\BlockCipher; /** * Pure-PHP implementation of DES. * * @package DES * @author Jim Wigginton <terrafrost@php.net> * @access public */ class DES extends BlockCipher { /**#@+ * @access private * @see \phpseclib\Crypt\DES::setupKey() * @see \phpseclib\Crypt\DES::processBlock() */ /** * Contains $keys[self::ENCRYPT] */ const ENCRYPT = 0; /** * Contains $keys[self::DECRYPT] */ const DECRYPT = 1; /**#@-*/ /** * Block Length of the cipher * * @see \phpseclib\Crypt\Common\SymmetricKey::block_size * @var int * @access private */ protected $block_size = 8; /** * Key Length (in bytes) * * @see \phpseclib\Crypt\Common\SymmetricKey::setKeyLength() * @var int * @access private */ protected $key_length = 8; /** * The mcrypt specific name of the cipher * * @see \phpseclib\Crypt\Common\SymmetricKey::cipher_name_mcrypt * @var string * @access private */ protected $cipher_name_mcrypt = 'des'; /** * The OpenSSL names of the cipher / modes * * @see \phpseclib\Crypt\Common\SymmetricKey::openssl_mode_names * @var array * @access private */ protected $openssl_mode_names = [ self::MODE_ECB => 'des-ecb', self::MODE_CBC => 'des-cbc', self::MODE_CFB => 'des-cfb', self::MODE_OFB => 'des-ofb' // self::MODE_CTR is undefined for DES ]; /** * Optimizing value while CFB-encrypting * * @see \phpseclib\Crypt\Common\SymmetricKey::cfb_init_len * @var int * @access private */ protected $cfb_init_len = 500; /** * Switch for DES/3DES encryption * * Used only if $engine == self::ENGINE_INTERNAL * * @see self::setupKey() * @see self::processBlock() * @var int * @access private */ protected $des_rounds = 1; /** * max possible size of $key * * @see self::setKey() * @var string * @access private */ protected $key_length_max = 8; /** * The Key Schedule * * @see self::setupKey() * @var array * @access private */ private $keys; /** * Shuffle table. * * For each byte value index, the entry holds an 8-byte string * with each byte containing all bits in the same state as the * corresponding bit in the index value. * * @see self::processBlock() * @see self::setupKey() * @var array * @access private */ protected $shuffle = [ "\x00\x00\x00\x00\x00\x00\x00\x00", "\x00\x00\x00\x00\x00\x00\x00\xFF", "\x00\x00\x00\x00\x00\x00\xFF\x00", "\x00\x00\x00\x00\x00\x00\xFF\xFF", "\x00\x00\x00\x00\x00\xFF\x00\x00", "\x00\x00\x00\x00\x00\xFF\x00\xFF", "\x00\x00\x00\x00\x00\xFF\xFF\x00", "\x00\x00\x00\x00\x00\xFF\xFF\xFF", "\x00\x00\x00\x00\xFF\x00\x00\x00", "\x00\x00\x00\x00\xFF\x00\x00\xFF", "\x00\x00\x00\x00\xFF\x00\xFF\x00", "\x00\x00\x00\x00\xFF\x00\xFF\xFF", "\x00\x00\x00\x00\xFF\xFF\x00\x00", "\x00\x00\x00\x00\xFF\xFF\x00\xFF", "\x00\x00\x00\x00\xFF\xFF\xFF\x00", "\x00\x00\x00\x00\xFF\xFF\xFF\xFF", "\x00\x00\x00\xFF\x00\x00\x00\x00", "\x00\x00\x00\xFF\x00\x00\x00\xFF", "\x00\x00\x00\xFF\x00\x00\xFF\x00", "\x00\x00\x00\xFF\x00\x00\xFF\xFF", "\x00\x00\x00\xFF\x00\xFF\x00\x00", "\x00\x00\x00\xFF\x00\xFF\x00\xFF", "\x00\x00\x00\xFF\x00\xFF\xFF\x00", "\x00\x00\x00\xFF\x00\xFF\xFF\xFF", "\x00\x00\x00\xFF\xFF\x00\x00\x00", "\x00\x00\x00\xFF\xFF\x00\x00\xFF", "\x00\x00\x00\xFF\xFF\x00\xFF\x00", "\x00\x00\x00\xFF\xFF\x00\xFF\xFF", "\x00\x00\x00\xFF\xFF\xFF\x00\x00", "\x00\x00\x00\xFF\xFF\xFF\x00\xFF", "\x00\x00\x00\xFF\xFF\xFF\xFF\x00", "\x00\x00\x00\xFF\xFF\xFF\xFF\xFF", "\x00\x00\xFF\x00\x00\x00\x00\x00", "\x00\x00\xFF\x00\x00\x00\x00\xFF", "\x00\x00\xFF\x00\x00\x00\xFF\x00", "\x00\x00\xFF\x00\x00\x00\xFF\xFF", "\x00\x00\xFF\x00\x00\xFF\x00\x00", "\x00\x00\xFF\x00\x00\xFF\x00\xFF", "\x00\x00\xFF\x00\x00\xFF\xFF\x00", "\x00\x00\xFF\x00\x00\xFF\xFF\xFF", "\x00\x00\xFF\x00\xFF\x00\x00\x00", "\x00\x00\xFF\x00\xFF\x00\x00\xFF", "\x00\x00\xFF\x00\xFF\x00\xFF\x00", "\x00\x00\xFF\x00\xFF\x00\xFF\xFF", "\x00\x00\xFF\x00\xFF\xFF\x00\x00", "\x00\x00\xFF\x00\xFF\xFF\x00\xFF", "\x00\x00\xFF\x00\xFF\xFF\xFF\x00", "\x00\x00\xFF\x00\xFF\xFF\xFF\xFF", "\x00\x00\xFF\xFF\x00\x00\x00\x00", "\x00\x00\xFF\xFF\x00\x00\x00\xFF", "\x00\x00\xFF\xFF\x00\x00\xFF\x00", "\x00\x00\xFF\xFF\x00\x00\xFF\xFF", "\x00\x00\xFF\xFF\x00\xFF\x00\x00", "\x00\x00\xFF\xFF\x00\xFF\x00\xFF", "\x00\x00\xFF\xFF\x00\xFF\xFF\x00", "\x00\x00\xFF\xFF\x00\xFF\xFF\xFF", "\x00\x00\xFF\xFF\xFF\x00\x00\x00", "\x00\x00\xFF\xFF\xFF\x00\x00\xFF", "\x00\x00\xFF\xFF\xFF\x00\xFF\x00", "\x00\x00\xFF\xFF\xFF\x00\xFF\xFF", "\x00\x00\xFF\xFF\xFF\xFF\x00\x00", "\x00\x00\xFF\xFF\xFF\xFF\x00\xFF", "\x00\x00\xFF\xFF\xFF\xFF\xFF\x00", "\x00\x00\xFF\xFF\xFF\xFF\xFF\xFF", "\x00\xFF\x00\x00\x00\x00\x00\x00", "\x00\xFF\x00\x00\x00\x00\x00\xFF", "\x00\xFF\x00\x00\x00\x00\xFF\x00", "\x00\xFF\x00\x00\x00\x00\xFF\xFF", "\x00\xFF\x00\x00\x00\xFF\x00\x00", "\x00\xFF\x00\x00\x00\xFF\x00\xFF", "\x00\xFF\x00\x00\x00\xFF\xFF\x00", "\x00\xFF\x00\x00\x00\xFF\xFF\xFF", "\x00\xFF\x00\x00\xFF\x00\x00\x00", "\x00\xFF\x00\x00\xFF\x00\x00\xFF", "\x00\xFF\x00\x00\xFF\x00\xFF\x00", "\x00\xFF\x00\x00\xFF\x00\xFF\xFF", "\x00\xFF\x00\x00\xFF\xFF\x00\x00", "\x00\xFF\x00\x00\xFF\xFF\x00\xFF", "\x00\xFF\x00\x00\xFF\xFF\xFF\x00", "\x00\xFF\x00\x00\xFF\xFF\xFF\xFF", "\x00\xFF\x00\xFF\x00\x00\x00\x00", "\x00\xFF\x00\xFF\x00\x00\x00\xFF", "\x00\xFF\x00\xFF\x00\x00\xFF\x00", "\x00\xFF\x00\xFF\x00\x00\xFF\xFF", "\x00\xFF\x00\xFF\x00\xFF\x00\x00", "\x00\xFF\x00\xFF\x00\xFF\x00\xFF", "\x00\xFF\x00\xFF\x00\xFF\xFF\x00", "\x00\xFF\x00\xFF\x00\xFF\xFF\xFF", "\x00\xFF\x00\xFF\xFF\x00\x00\x00", "\x00\xFF\x00\xFF\xFF\x00\x00\xFF", "\x00\xFF\x00\xFF\xFF\x00\xFF\x00", "\x00\xFF\x00\xFF\xFF\x00\xFF\xFF", "\x00\xFF\x00\xFF\xFF\xFF\x00\x00", "\x00\xFF\x00\xFF\xFF\xFF\x00\xFF", "\x00\xFF\x00\xFF\xFF\xFF\xFF\x00", "\x00\xFF\x00\xFF\xFF\xFF\xFF\xFF", "\x00\xFF\xFF\x00\x00\x00\x00\x00", "\x00\xFF\xFF\x00\x00\x00\x00\xFF", "\x00\xFF\xFF\x00\x00\x00\xFF\x00", "\x00\xFF\xFF\x00\x00\x00\xFF\xFF", "\x00\xFF\xFF\x00\x00\xFF\x00\x00", "\x00\xFF\xFF\x00\x00\xFF\x00\xFF", "\x00\xFF\xFF\x00\x00\xFF\xFF\x00", "\x00\xFF\xFF\x00\x00\xFF\xFF\xFF", "\x00\xFF\xFF\x00\xFF\x00\x00\x00", "\x00\xFF\xFF\x00\xFF\x00\x00\xFF", "\x00\xFF\xFF\x00\xFF\x00\xFF\x00", "\x00\xFF\xFF\x00\xFF\x00\xFF\xFF", "\x00\xFF\xFF\x00\xFF\xFF\x00\x00", "\x00\xFF\xFF\x00\xFF\xFF\x00\xFF", "\x00\xFF\xFF\x00\xFF\xFF\xFF\x00", "\x00\xFF\xFF\x00\xFF\xFF\xFF\xFF", "\x00\xFF\xFF\xFF\x00\x00\x00\x00", "\x00\xFF\xFF\xFF\x00\x00\x00\xFF", "\x00\xFF\xFF\xFF\x00\x00\xFF\x00", "\x00\xFF\xFF\xFF\x00\x00\xFF\xFF", "\x00\xFF\xFF\xFF\x00\xFF\x00\x00", "\x00\xFF\xFF\xFF\x00\xFF\x00\xFF", "\x00\xFF\xFF\xFF\x00\xFF\xFF\x00", "\x00\xFF\xFF\xFF\x00\xFF\xFF\xFF", "\x00\xFF\xFF\xFF\xFF\x00\x00\x00", "\x00\xFF\xFF\xFF\xFF\x00\x00\xFF", "\x00\xFF\xFF\xFF\xFF\x00\xFF\x00", "\x00\xFF\xFF\xFF\xFF\x00\xFF\xFF", "\x00\xFF\xFF\xFF\xFF\xFF\x00\x00", "\x00\xFF\xFF\xFF\xFF\xFF\x00\xFF", "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00", "\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF", "\xFF\x00\x00\x00\x00\x00\x00\x00", "\xFF\x00\x00\x00\x00\x00\x00\xFF", "\xFF\x00\x00\x00\x00\x00\xFF\x00", "\xFF\x00\x00\x00\x00\x00\xFF\xFF", "\xFF\x00\x00\x00\x00\xFF\x00\x00", "\xFF\x00\x00\x00\x00\xFF\x00\xFF", "\xFF\x00\x00\x00\x00\xFF\xFF\x00", "\xFF\x00\x00\x00\x00\xFF\xFF\xFF", "\xFF\x00\x00\x00\xFF\x00\x00\x00", "\xFF\x00\x00\x00\xFF\x00\x00\xFF", "\xFF\x00\x00\x00\xFF\x00\xFF\x00", "\xFF\x00\x00\x00\xFF\x00\xFF\xFF", "\xFF\x00\x00\x00\xFF\xFF\x00\x00", "\xFF\x00\x00\x00\xFF\xFF\x00\xFF", "\xFF\x00\x00\x00\xFF\xFF\xFF\x00", "\xFF\x00\x00\x00\xFF\xFF\xFF\xFF", "\xFF\x00\x00\xFF\x00\x00\x00\x00", "\xFF\x00\x00\xFF\x00\x00\x00\xFF", "\xFF\x00\x00\xFF\x00\x00\xFF\x00", "\xFF\x00\x00\xFF\x00\x00\xFF\xFF", "\xFF\x00\x00\xFF\x00\xFF\x00\x00", "\xFF\x00\x00\xFF\x00\xFF\x00\xFF", "\xFF\x00\x00\xFF\x00\xFF\xFF\x00", "\xFF\x00\x00\xFF\x00\xFF\xFF\xFF", "\xFF\x00\x00\xFF\xFF\x00\x00\x00", "\xFF\x00\x00\xFF\xFF\x00\x00\xFF", "\xFF\x00\x00\xFF\xFF\x00\xFF\x00", "\xFF\x00\x00\xFF\xFF\x00\xFF\xFF", "\xFF\x00\x00\xFF\xFF\xFF\x00\x00", "\xFF\x00\x00\xFF\xFF\xFF\x00\xFF", "\xFF\x00\x00\xFF\xFF\xFF\xFF\x00", "\xFF\x00\x00\xFF\xFF\xFF\xFF\xFF", "\xFF\x00\xFF\x00\x00\x00\x00\x00", "\xFF\x00\xFF\x00\x00\x00\x00\xFF", "\xFF\x00\xFF\x00\x00\x00\xFF\x00", "\xFF\x00\xFF\x00\x00\x00\xFF\xFF", "\xFF\x00\xFF\x00\x00\xFF\x00\x00", "\xFF\x00\xFF\x00\x00\xFF\x00\xFF", "\xFF\x00\xFF\x00\x00\xFF\xFF\x00", "\xFF\x00\xFF\x00\x00\xFF\xFF\xFF", "\xFF\x00\xFF\x00\xFF\x00\x00\x00", "\xFF\x00\xFF\x00\xFF\x00\x00\xFF", "\xFF\x00\xFF\x00\xFF\x00\xFF\x00", "\xFF\x00\xFF\x00\xFF\x00\xFF\xFF", "\xFF\x00\xFF\x00\xFF\xFF\x00\x00", "\xFF\x00\xFF\x00\xFF\xFF\x00\xFF", "\xFF\x00\xFF\x00\xFF\xFF\xFF\x00", "\xFF\x00\xFF\x00\xFF\xFF\xFF\xFF", "\xFF\x00\xFF\xFF\x00\x00\x00\x00", "\xFF\x00\xFF\xFF\x00\x00\x00\xFF", "\xFF\x00\xFF\xFF\x00\x00\xFF\x00", "\xFF\x00\xFF\xFF\x00\x00\xFF\xFF", "\xFF\x00\xFF\xFF\x00\xFF\x00\x00", "\xFF\x00\xFF\xFF\x00\xFF\x00\xFF", "\xFF\x00\xFF\xFF\x00\xFF\xFF\x00", "\xFF\x00\xFF\xFF\x00\xFF\xFF\xFF", "\xFF\x00\xFF\xFF\xFF\x00\x00\x00", "\xFF\x00\xFF\xFF\xFF\x00\x00\xFF", "\xFF\x00\xFF\xFF\xFF\x00\xFF\x00", "\xFF\x00\xFF\xFF\xFF\x00\xFF\xFF", "\xFF\x00\xFF\xFF\xFF\xFF\x00\x00", "\xFF\x00\xFF\xFF\xFF\xFF\x00\xFF", "\xFF\x00\xFF\xFF\xFF\xFF\xFF\x00", "\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF", "\xFF\xFF\x00\x00\x00\x00\x00\x00", "\xFF\xFF\x00\x00\x00\x00\x00\xFF", "\xFF\xFF\x00\x00\x00\x00\xFF\x00", "\xFF\xFF\x00\x00\x00\x00\xFF\xFF", "\xFF\xFF\x00\x00\x00\xFF\x00\x00", "\xFF\xFF\x00\x00\x00\xFF\x00\xFF", "\xFF\xFF\x00\x00\x00\xFF\xFF\x00", "\xFF\xFF\x00\x00\x00\xFF\xFF\xFF", "\xFF\xFF\x00\x00\xFF\x00\x00\x00", "\xFF\xFF\x00\x00\xFF\x00\x00\xFF", "\xFF\xFF\x00\x00\xFF\x00\xFF\x00", "\xFF\xFF\x00\x00\xFF\x00\xFF\xFF", "\xFF\xFF\x00\x00\xFF\xFF\x00\x00", "\xFF\xFF\x00\x00\xFF\xFF\x00\xFF", "\xFF\xFF\x00\x00\xFF\xFF\xFF\x00", "\xFF\xFF\x00\x00\xFF\xFF\xFF\xFF", "\xFF\xFF\x00\xFF\x00\x00\x00\x00", "\xFF\xFF\x00\xFF\x00\x00\x00\xFF", "\xFF\xFF\x00\xFF\x00\x00\xFF\x00", "\xFF\xFF\x00\xFF\x00\x00\xFF\xFF", "\xFF\xFF\x00\xFF\x00\xFF\x00\x00", "\xFF\xFF\x00\xFF\x00\xFF\x00\xFF", "\xFF\xFF\x00\xFF\x00\xFF\xFF\x00", "\xFF\xFF\x00\xFF\x00\xFF\xFF\xFF", "\xFF\xFF\x00\xFF\xFF\x00\x00\x00", "\xFF\xFF\x00\xFF\xFF\x00\x00\xFF", "\xFF\xFF\x00\xFF\xFF\x00\xFF\x00", "\xFF\xFF\x00\xFF\xFF\x00\xFF\xFF", "\xFF\xFF\x00\xFF\xFF\xFF\x00\x00", "\xFF\xFF\x00\xFF\xFF\xFF\x00\xFF", "\xFF\xFF\x00\xFF\xFF\xFF\xFF\x00", "\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF", "\xFF\xFF\xFF\x00\x00\x00\x00\x00", "\xFF\xFF\xFF\x00\x00\x00\x00\xFF", "\xFF\xFF\xFF\x00\x00\x00\xFF\x00", "\xFF\xFF\xFF\x00\x00\x00\xFF\xFF", "\xFF\xFF\xFF\x00\x00\xFF\x00\x00", "\xFF\xFF\xFF\x00\x00\xFF\x00\xFF", "\xFF\xFF\xFF\x00\x00\xFF\xFF\x00", "\xFF\xFF\xFF\x00\x00\xFF\xFF\xFF", "\xFF\xFF\xFF\x00\xFF\x00\x00\x00", "\xFF\xFF\xFF\x00\xFF\x00\x00\xFF", "\xFF\xFF\xFF\x00\xFF\x00\xFF\x00", "\xFF\xFF\xFF\x00\xFF\x00\xFF\xFF", "\xFF\xFF\xFF\x00\xFF\xFF\x00\x00", "\xFF\xFF\xFF\x00\xFF\xFF\x00\xFF", "\xFF\xFF\xFF\x00\xFF\xFF\xFF\x00", "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF", "\xFF\xFF\xFF\xFF\x00\x00\x00\x00", "\xFF\xFF\xFF\xFF\x00\x00\x00\xFF", "\xFF\xFF\xFF\xFF\x00\x00\xFF\x00", "\xFF\xFF\xFF\xFF\x00\x00\xFF\xFF", "\xFF\xFF\xFF\xFF\x00\xFF\x00\x00", "\xFF\xFF\xFF\xFF\x00\xFF\x00\xFF", "\xFF\xFF\xFF\xFF\x00\xFF\xFF\x00", "\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF", "\xFF\xFF\xFF\xFF\xFF\x00\x00\x00", "\xFF\xFF\xFF\xFF\xFF\x00\x00\xFF", "\xFF\xFF\xFF\xFF\xFF\x00\xFF\x00", "\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF", "\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00", "\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF", "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00", "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" ]; /** * IP mapping helper table. * * Indexing this table with each source byte performs the initial bit permutation. * * @var array * @access private */ protected $ipmap = [ 0x00, 0x10, 0x01, 0x11, 0x20, 0x30, 0x21, 0x31, 0x02, 0x12, 0x03, 0x13, 0x22, 0x32, 0x23, 0x33, 0x40, 0x50, 0x41, 0x51, 0x60, 0x70, 0x61, 0x71, 0x42, 0x52, 0x43, 0x53, 0x62, 0x72, 0x63, 0x73, 0x04, 0x14, 0x05, 0x15, 0x24, 0x34, 0x25, 0x35, 0x06, 0x16, 0x07, 0x17, 0x26, 0x36, 0x27, 0x37, 0x44, 0x54, 0x45, 0x55, 0x64, 0x74, 0x65, 0x75, 0x46, 0x56, 0x47, 0x57, 0x66, 0x76, 0x67, 0x77, 0x80, 0x90, 0x81, 0x91, 0xA0, 0xB0, 0xA1, 0xB1, 0x82, 0x92, 0x83, 0x93, 0xA2, 0xB2, 0xA3, 0xB3, 0xC0, 0xD0, 0xC1, 0xD1, 0xE0, 0xF0, 0xE1, 0xF1, 0xC2, 0xD2, 0xC3, 0xD3, 0xE2, 0xF2, 0xE3, 0xF3, 0x84, 0x94, 0x85, 0x95, 0xA4, 0xB4, 0xA5, 0xB5, 0x86, 0x96, 0x87, 0x97, 0xA6, 0xB6, 0xA7, 0xB7, 0xC4, 0xD4, 0xC5, 0xD5, 0xE4, 0xF4, 0xE5, 0xF5, 0xC6, 0xD6, 0xC7, 0xD7, 0xE6, 0xF6, 0xE7, 0xF7, 0x08, 0x18, 0x09, 0x19, 0x28, 0x38, 0x29, 0x39, 0x0A, 0x1A, 0x0B, 0x1B, 0x2A, 0x3A, 0x2B, 0x3B, 0x48, 0x58, 0x49, 0x59, 0x68, 0x78, 0x69, 0x79, 0x4A, 0x5A, 0x4B, 0x5B, 0x6A, 0x7A, 0x6B, 0x7B, 0x0C, 0x1C, 0x0D, 0x1D, 0x2C, 0x3C, 0x2D, 0x3D, 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, 0x4C, 0x5C, 0x4D, 0x5D, 0x6C, 0x7C, 0x6D, 0x7D, 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, 0x88, 0x98, 0x89, 0x99, 0xA8, 0xB8, 0xA9, 0xB9, 0x8A, 0x9A, 0x8B, 0x9B, 0xAA, 0xBA, 0xAB, 0xBB, 0xC8, 0xD8, 0xC9, 0xD9, 0xE8, 0xF8, 0xE9, 0xF9, 0xCA, 0xDA, 0xCB, 0xDB, 0xEA, 0xFA, 0xEB, 0xFB, 0x8C, 0x9C, 0x8D, 0x9D, 0xAC, 0xBC, 0xAD, 0xBD, 0x8E, 0x9E, 0x8F, 0x9F, 0xAE, 0xBE, 0xAF, 0xBF, 0xCC, 0xDC, 0xCD, 0xDD, 0xEC, 0xFC, 0xED, 0xFD, 0xCE, 0xDE, 0xCF, 0xDF, 0xEE, 0xFE, 0xEF, 0xFF ]; /** * Inverse IP mapping helper table. * Indexing this table with a byte value reverses the bit order. * * @var array * @access private */ protected $invipmap = [ 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8, 0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4, 0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC, 0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2, 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2, 0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA, 0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6, 0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE, 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE, 0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1, 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1, 0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9, 0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5, 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5, 0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED, 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD, 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3, 0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB, 0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7, 0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF ]; /** * Pre-permuted S-box1 * * Each box ($sbox1-$sbox8) has been vectorized, then each value pre-permuted using the * P table: concatenation can then be replaced by exclusive ORs. * * @var array * @access private */ protected $sbox1 = [ 0x00808200, 0x00000000, 0x00008000, 0x00808202, 0x00808002, 0x00008202, 0x00000002, 0x00008000, 0x00000200, 0x00808200, 0x00808202, 0x00000200, 0x00800202, 0x00808002, 0x00800000, 0x00000002, 0x00000202, 0x00800200, 0x00800200, 0x00008200, 0x00008200, 0x00808000, 0x00808000, 0x00800202, 0x00008002, 0x00800002, 0x00800002, 0x00008002, 0x00000000, 0x00000202, 0x00008202, 0x00800000, 0x00008000, 0x00808202, 0x00000002, 0x00808000, 0x00808200, 0x00800000, 0x00800000, 0x00000200, 0x00808002, 0x00008000, 0x00008200, 0x00800002, 0x00000200, 0x00000002, 0x00800202, 0x00008202, 0x00808202, 0x00008002, 0x00808000, 0x00800202, 0x00800002, 0x00000202, 0x00008202, 0x00808200, 0x00000202, 0x00800200, 0x00800200, 0x00000000, 0x00008002, 0x00008200, 0x00000000, 0x00808002 ]; /** * Pre-permuted S-box2 * * @var array * @access private */ protected $sbox2 = [ 0x40084010, 0x40004000, 0x00004000, 0x00084010, 0x00080000, 0x00000010, 0x40080010, 0x40004010, 0x40000010, 0x40084010, 0x40084000, 0x40000000, 0x40004000, 0x00080000, 0x00000010, 0x40080010, 0x00084000, 0x00080010, 0x40004010, 0x00000000, 0x40000000, 0x00004000, 0x00084010, 0x40080000, 0x00080010, 0x40000010, 0x00000000, 0x00084000, 0x00004010, 0x40084000, 0x40080000, 0x00004010, 0x00000000, 0x00084010, 0x40080010, 0x00080000, 0x40004010, 0x40080000, 0x40084000, 0x00004000, 0x40080000, 0x40004000, 0x00000010, 0x40084010, 0x00084010, 0x00000010, 0x00004000, 0x40000000, 0x00004010, 0x40084000, 0x00080000, 0x40000010, 0x00080010, 0x40004010, 0x40000010, 0x00080010, 0x00084000, 0x00000000, 0x40004000, 0x00004010, 0x40000000, 0x40080010, 0x40084010, 0x00084000 ]; /** * Pre-permuted S-box3 * * @var array * @access private */ protected $sbox3 = [ 0x00000104, 0x04010100, 0x00000000, 0x04010004, 0x04000100, 0x00000000, 0x00010104, 0x04000100, 0x00010004, 0x04000004, 0x04000004, 0x00010000, 0x04010104, 0x00010004, 0x04010000, 0x00000104, 0x04000000, 0x00000004, 0x04010100, 0x00000100, 0x00010100, 0x04010000, 0x04010004, 0x00010104, 0x04000104, 0x00010100, 0x00010000, 0x04000104, 0x00000004, 0x04010104, 0x00000100, 0x04000000, 0x04010100, 0x04000000, 0x00010004, 0x00000104, 0x00010000, 0x04010100, 0x04000100, 0x00000000, 0x00000100, 0x00010004, 0x04010104, 0x04000100, 0x04000004, 0x00000100, 0x00000000, 0x04010004, 0x04000104, 0x00010000, 0x04000000, 0x04010104, 0x00000004, 0x00010104, 0x00010100, 0x04000004, 0x04010000, 0x04000104, 0x00000104, 0x04010000, 0x00010104, 0x00000004, 0x04010004, 0x00010100 ]; /** * Pre-permuted S-box4 * * @var array * @access private */ protected $sbox4 = [ 0x80401000, 0x80001040, 0x80001040, 0x00000040, 0x00401040, 0x80400040, 0x80400000, 0x80001000, 0x00000000, 0x00401000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00400040, 0x80400000, 0x80000000, 0x00001000, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x80001000, 0x00001040, 0x80400040, 0x80000000, 0x00001040, 0x00400040, 0x00001000, 0x00401040, 0x80401040, 0x80000040, 0x00400040, 0x80400000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00000000, 0x00401000, 0x00001040, 0x00400040, 0x80400040, 0x80000000, 0x80401000, 0x80001040, 0x80001040, 0x00000040, 0x80401040, 0x80000040, 0x80000000, 0x00001000, 0x80400000, 0x80001000, 0x00401040, 0x80400040, 0x80001000, 0x00001040, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x00001000, 0x00401040 ]; /** * Pre-permuted S-box5 * * @var array * @access private */ protected $sbox5 = [ 0x00000080, 0x01040080, 0x01040000, 0x21000080, 0x00040000, 0x00000080, 0x20000000, 0x01040000, 0x20040080, 0x00040000, 0x01000080, 0x20040080, 0x21000080, 0x21040000, 0x00040080, 0x20000000, 0x01000000, 0x20040000, 0x20040000, 0x00000000, 0x20000080, 0x21040080, 0x21040080, 0x01000080, 0x21040000, 0x20000080, 0x00000000, 0x21000000, 0x01040080, 0x01000000, 0x21000000, 0x00040080, 0x00040000, 0x21000080, 0x00000080, 0x01000000, 0x20000000, 0x01040000, 0x21000080, 0x20040080, 0x01000080, 0x20000000, 0x21040000, 0x01040080, 0x20040080, 0x00000080, 0x01000000, 0x21040000, 0x21040080, 0x00040080, 0x21000000, 0x21040080, 0x01040000, 0x00000000, 0x20040000, 0x21000000, 0x00040080, 0x01000080, 0x20000080, 0x00040000, 0x00000000, 0x20040000, 0x01040080, 0x20000080 ]; /** * Pre-permuted S-box6 * * @var array * @access private */ protected $sbox6 = [ 0x10000008, 0x10200000, 0x00002000, 0x10202008, 0x10200000, 0x00000008, 0x10202008, 0x00200000, 0x10002000, 0x00202008, 0x00200000, 0x10000008, 0x00200008, 0x10002000, 0x10000000, 0x00002008, 0x00000000, 0x00200008, 0x10002008, 0x00002000, 0x00202000, 0x10002008, 0x00000008, 0x10200008, 0x10200008, 0x00000000, 0x00202008, 0x10202000, 0x00002008, 0x00202000, 0x10202000, 0x10000000, 0x10002000, 0x00000008, 0x10200008, 0x00202000, 0x10202008, 0x00200000, 0x00002008, 0x10000008, 0x00200000, 0x10002000, 0x10000000, 0x00002008, 0x10000008, 0x10202008, 0x00202000, 0x10200000, 0x00202008, 0x10202000, 0x00000000, 0x10200008, 0x00000008, 0x00002000, 0x10200000, 0x00202008, 0x00002000, 0x00200008, 0x10002008, 0x00000000, 0x10202000, 0x10000000, 0x00200008, 0x10002008 ]; /** * Pre-permuted S-box7 * * @var array * @access private */ protected $sbox7 = [ 0x00100000, 0x02100001, 0x02000401, 0x00000000, 0x00000400, 0x02000401, 0x00100401, 0x02100400, 0x02100401, 0x00100000, 0x00000000, 0x02000001, 0x00000001, 0x02000000, 0x02100001, 0x00000401, 0x02000400, 0x00100401, 0x00100001, 0x02000400, 0x02000001, 0x02100000, 0x02100400, 0x00100001, 0x02100000, 0x00000400, 0x00000401, 0x02100401, 0x00100400, 0x00000001, 0x02000000, 0x00100400, 0x02000000, 0x00100400, 0x00100000, 0x02000401, 0x02000401, 0x02100001, 0x02100001, 0x00000001, 0x00100001, 0x02000000, 0x02000400, 0x00100000, 0x02100400, 0x00000401, 0x00100401, 0x02100400, 0x00000401, 0x02000001, 0x02100401, 0x02100000, 0x00100400, 0x00000000, 0x00000001, 0x02100401, 0x00000000, 0x00100401, 0x02100000, 0x00000400, 0x02000001, 0x02000400, 0x00000400, 0x00100001 ]; /** * Pre-permuted S-box8 * * @var array * @access private */ protected $sbox8 = [ 0x08000820, 0x00000800, 0x00020000, 0x08020820, 0x08000000, 0x08000820, 0x00000020, 0x08000000, 0x00020020, 0x08020000, 0x08020820, 0x00020800, 0x08020800, 0x00020820, 0x00000800, 0x00000020, 0x08020000, 0x08000020, 0x08000800, 0x00000820, 0x00020800, 0x00020020, 0x08020020, 0x08020800, 0x00000820, 0x00000000, 0x00000000, 0x08020020, 0x08000020, 0x08000800, 0x00020820, 0x00020000, 0x00020820, 0x00020000, 0x08020800, 0x00000800, 0x00000020, 0x08020020, 0x00000800, 0x00020820, 0x08000800, 0x00000020, 0x08000020, 0x08020000, 0x08020020, 0x08000000, 0x00020000, 0x08000820, 0x00000000, 0x08020820, 0x00020020, 0x08000020, 0x08020000, 0x08000800, 0x08000820, 0x00000000, 0x08020820, 0x00020800, 0x00020800, 0x00000820, 0x00000820, 0x00020020, 0x08000000, 0x08020800 ]; /** * Default Constructor. * * @param int $mode * @access public * @throws \InvalidArgumentException if an invalid / unsupported mode is provided */ public function __construct($mode) { if ($mode == self::MODE_STREAM) { throw new \InvalidArgumentException('Block ciphers cannot be ran in stream mode'); } parent::__construct($mode); } /** * Test for engine validity * * This is mainly just a wrapper to set things up for \phpseclib\Crypt\Common\SymmetricKey::isValidEngine() * * @see \phpseclib\Crypt\Common\SymmetricKey::isValidEngine() * @param int $engine * @access protected * @return bool */ protected function isValidEngineHelper($engine) { if ($this->key_length_max == 8) { if ($engine == self::ENGINE_OPENSSL) { $this->cipher_name_openssl_ecb = 'des-ecb'; $this->cipher_name_openssl = 'des-' . $this->openssl_translate_mode(); } } return parent::isValidEngineHelper($engine); } /** * Sets the key. * * Keys must be 64-bits long or 8 bytes long. * * DES also requires that every eighth bit be a parity bit, however, we'll ignore that. * * @see \phpseclib\Crypt\Common\SymmetricKey::setKey() * @access public * @param string $key */ public function setKey($key) { if (!($this instanceof TripleDES) && strlen($key) != 8) { throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of size 8 are supported'); } // Sets the key parent::setKey($key); } /** * Encrypts a block * * @see \phpseclib\Crypt\Common\SymmetricKey::encryptBlock() * @see \phpseclib\Crypt\Common\SymmetricKey::encrypt() * @see self::encrypt() * @access private * @param string $in * @return string */ protected function encryptBlock($in) { return $this->processBlock($in, self::ENCRYPT); } /** * Decrypts a block * * @see \phpseclib\Crypt\Common\SymmetricKey::decryptBlock() * @see \phpseclib\Crypt\Common\SymmetricKey::decrypt() * @see self::decrypt() * @access private * @param string $in * @return string */ protected function decryptBlock($in) { return $this->processBlock($in, self::DECRYPT); } /** * Encrypts or decrypts a 64-bit block * * $mode should be either self::ENCRYPT or self::DECRYPT. See * {@link http://en.wikipedia.org/wiki/Image:Feistel.png Feistel.png} to get a general * idea of what this function does. * * @see self::encryptBlock() * @see self::decryptBlock() * @access private * @param string $block * @param int $mode * @return string */ private function processBlock($block, $mode) { static $sbox1, $sbox2, $sbox3, $sbox4, $sbox5, $sbox6, $sbox7, $sbox8, $shuffleip, $shuffleinvip; if (!$sbox1) { $sbox1 = array_map("intval", $this->sbox1); $sbox2 = array_map("intval", $this->sbox2); $sbox3 = array_map("intval", $this->sbox3); $sbox4 = array_map("intval", $this->sbox4); $sbox5 = array_map("intval", $this->sbox5); $sbox6 = array_map("intval", $this->sbox6); $sbox7 = array_map("intval", $this->sbox7); $sbox8 = array_map("intval", $this->sbox8); /* Merge $shuffle with $[inv]ipmap */ for ($i = 0; $i < 256; ++$i) { $shuffleip[] = $this->shuffle[$this->ipmap[$i]]; $shuffleinvip[] = $this->shuffle[$this->invipmap[$i]]; } } $keys = $this->keys[$mode]; $ki = -1; // Do the initial IP permutation. $t = unpack('Nl/Nr', $block); list($l, $r) = [$t['l'], $t['r']]; $block = ($shuffleip[ $r & 0xFF] & "\x80\x80\x80\x80\x80\x80\x80\x80") | ($shuffleip[($r >> 8) & 0xFF] & "\x40\x40\x40\x40\x40\x40\x40\x40") | ($shuffleip[($r >> 16) & 0xFF] & "\x20\x20\x20\x20\x20\x20\x20\x20") | ($shuffleip[($r >> 24) & 0xFF] & "\x10\x10\x10\x10\x10\x10\x10\x10") | ($shuffleip[ $l & 0xFF] & "\x08\x08\x08\x08\x08\x08\x08\x08") | ($shuffleip[($l >> 8) & 0xFF] & "\x04\x04\x04\x04\x04\x04\x04\x04") | ($shuffleip[($l >> 16) & 0xFF] & "\x02\x02\x02\x02\x02\x02\x02\x02") | ($shuffleip[($l >> 24) & 0xFF] & "\x01\x01\x01\x01\x01\x01\x01\x01"); // Extract L0 and R0. $t = unpack('Nl/Nr', $block); list($l, $r) = [$t['l'], $t['r']]; for ($des_round = 0; $des_round < $this->des_rounds; ++$des_round) { // Perform the 16 steps. for ($i = 0; $i < 16; $i++) { // start of "the Feistel (F) function" - see the following URL: // http://en.wikipedia.org/wiki/Image:Data_Encryption_Standard_InfoBox_Diagram.png // Merge key schedule. $b1 = (($r >> 3) & 0x1FFFFFFF) ^ ($r << 29) ^ $keys[++$ki]; $b2 = (($r >> 31) & 0x00000001) ^ ($r << 1) ^ $keys[++$ki]; // S-box indexing. $t = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^ $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^ $sbox5[($b1 >> 8) & 0x3F] ^ $sbox6[($b2 >> 8) & 0x3F] ^ $sbox7[ $b1 & 0x3F] ^ $sbox8[ $b2 & 0x3F] ^ $l; // end of "the Feistel (F) function" $l = $r; $r = $t; } // Last step should not permute L & R. $t = $l; $l = $r; $r = $t; } // Perform the inverse IP permutation. return ($shuffleinvip[($r >> 24) & 0xFF] & "\x80\x80\x80\x80\x80\x80\x80\x80") | ($shuffleinvip[($l >> 24) & 0xFF] & "\x40\x40\x40\x40\x40\x40\x40\x40") | ($shuffleinvip[($r >> 16) & 0xFF] & "\x20\x20\x20\x20\x20\x20\x20\x20") | ($shuffleinvip[($l >> 16) & 0xFF] & "\x10\x10\x10\x10\x10\x10\x10\x10") | ($shuffleinvip[($r >> 8) & 0xFF] & "\x08\x08\x08\x08\x08\x08\x08\x08") | ($shuffleinvip[($l >> 8) & 0xFF] & "\x04\x04\x04\x04\x04\x04\x04\x04") | ($shuffleinvip[ $r & 0xFF] & "\x02\x02\x02\x02\x02\x02\x02\x02") | ($shuffleinvip[ $l & 0xFF] & "\x01\x01\x01\x01\x01\x01\x01\x01"); } /** * Creates the key schedule * * @see \phpseclib\Crypt\Common\SymmetricKey::setupKey() * @access private */ protected function setupKey() { if (isset($this->kl['key']) && $this->key === $this->kl['key'] && $this->des_rounds === $this->kl['des_rounds']) { // already expanded return; } $this->kl = ['key' => $this->key, 'des_rounds' => $this->des_rounds]; static $shifts = [ // number of key bits shifted per round 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 ]; static $pc1map = [ 0x00, 0x00, 0x08, 0x08, 0x04, 0x04, 0x0C, 0x0C, 0x02, 0x02, 0x0A, 0x0A, 0x06, 0x06, 0x0E, 0x0E, 0x10, 0x10, 0x18, 0x18, 0x14, 0x14, 0x1C, 0x1C, 0x12, 0x12, 0x1A, 0x1A, 0x16, 0x16, 0x1E, 0x1E, 0x20, 0x20, 0x28, 0x28, 0x24, 0x24, 0x2C, 0x2C, 0x22, 0x22, 0x2A, 0x2A, 0x26, 0x26, 0x2E, 0x2E, 0x30, 0x30, 0x38, 0x38, 0x34, 0x34, 0x3C, 0x3C, 0x32, 0x32, 0x3A, 0x3A, 0x36, 0x36, 0x3E, 0x3E, 0x40, 0x40, 0x48, 0x48, 0x44, 0x44, 0x4C, 0x4C, 0x42, 0x42, 0x4A, 0x4A, 0x46, 0x46, 0x4E, 0x4E, 0x50, 0x50, 0x58, 0x58, 0x54, 0x54, 0x5C, 0x5C, 0x52, 0x52, 0x5A, 0x5A, 0x56, 0x56, 0x5E, 0x5E, 0x60, 0x60, 0x68, 0x68, 0x64, 0x64, 0x6C, 0x6C, 0x62, 0x62, 0x6A, 0x6A, 0x66, 0x66, 0x6E, 0x6E, 0x70, 0x70, 0x78, 0x78, 0x74, 0x74, 0x7C, 0x7C, 0x72, 0x72, 0x7A, 0x7A, 0x76, 0x76, 0x7E, 0x7E, 0x80, 0x80, 0x88, 0x88, 0x84, 0x84, 0x8C, 0x8C, 0x82, 0x82, 0x8A, 0x8A, 0x86, 0x86, 0x8E, 0x8E, 0x90, 0x90, 0x98, 0x98, 0x94, 0x94, 0x9C, 0x9C, 0x92, 0x92, 0x9A, 0x9A, 0x96, 0x96, 0x9E, 0x9E, 0xA0, 0xA0, 0xA8, 0xA8, 0xA4, 0xA4, 0xAC, 0xAC, 0xA2, 0xA2, 0xAA, 0xAA, 0xA6, 0xA6, 0xAE, 0xAE, 0xB0, 0xB0, 0xB8, 0xB8, 0xB4, 0xB4, 0xBC, 0xBC, 0xB2, 0xB2, 0xBA, 0xBA, 0xB6, 0xB6, 0xBE, 0xBE, 0xC0, 0xC0, 0xC8, 0xC8, 0xC4, 0xC4, 0xCC, 0xCC, 0xC2, 0xC2, 0xCA, 0xCA, 0xC6, 0xC6, 0xCE, 0xCE, 0xD0, 0xD0, 0xD8, 0xD8, 0xD4, 0xD4, 0xDC, 0xDC, 0xD2, 0xD2, 0xDA, 0xDA, 0xD6, 0xD6, 0xDE, 0xDE, 0xE0, 0xE0, 0xE8, 0xE8, 0xE4, 0xE4, 0xEC, 0xEC, 0xE2, 0xE2, 0xEA, 0xEA, 0xE6, 0xE6, 0xEE, 0xEE, 0xF0, 0xF0, 0xF8, 0xF8, 0xF4, 0xF4, 0xFC, 0xFC, 0xF2, 0xF2, 0xFA, 0xFA, 0xF6, 0xF6, 0xFE, 0xFE ]; // Mapping tables for the PC-2 transformation. static $pc2mapc1 = [ 0x00000000, 0x00000400, 0x00200000, 0x00200400, 0x00000001, 0x00000401, 0x00200001, 0x00200401, 0x02000000, 0x02000400, 0x02200000, 0x02200400, 0x02000001, 0x02000401, 0x02200001, 0x02200401 ]; static $pc2mapc2 = [ 0x00000000, 0x00000800, 0x08000000, 0x08000800, 0x00010000, 0x00010800, 0x08010000, 0x08010800, 0x00000000, 0x00000800, 0x08000000, 0x08000800, 0x00010000, 0x00010800, 0x08010000, 0x08010800, 0x00000100, 0x00000900, 0x08000100, 0x08000900, 0x00010100, 0x00010900, 0x08010100, 0x08010900, 0x00000100, 0x00000900, 0x08000100, 0x08000900, 0x00010100, 0x00010900, 0x08010100, 0x08010900, 0x00000010, 0x00000810, 0x08000010, 0x08000810, 0x00010010, 0x00010810, 0x08010010, 0x08010810, 0x00000010, 0x00000810, 0x08000010, 0x08000810, 0x00010010, 0x00010810, 0x08010010, 0x08010810, 0x00000110, 0x00000910, 0x08000110, 0x08000910, 0x00010110, 0x00010910, 0x08010110, 0x08010910, 0x00000110, 0x00000910, 0x08000110, 0x08000910, 0x00010110, 0x00010910, 0x08010110, 0x08010910, 0x00040000, 0x00040800, 0x08040000, 0x08040800, 0x00050000, 0x00050800, 0x08050000, 0x08050800, 0x00040000, 0x00040800, 0x08040000, 0x08040800, 0x00050000, 0x00050800, 0x08050000, 0x08050800, 0x00040100, 0x00040900, 0x08040100, 0x08040900, 0x00050100, 0x00050900, 0x08050100, 0x08050900, 0x00040100, 0x00040900, 0x08040100, 0x08040900, 0x00050100, 0x00050900, 0x08050100, 0x08050900, 0x00040010, 0x00040810, 0x08040010, 0x08040810, 0x00050010, 0x00050810, 0x08050010, 0x08050810, 0x00040010, 0x00040810, 0x08040010, 0x08040810, 0x00050010, 0x00050810, 0x08050010, 0x08050810, 0x00040110, 0x00040910, 0x08040110, 0x08040910, 0x00050110, 0x00050910, 0x08050110, 0x08050910, 0x00040110, 0x00040910, 0x08040110, 0x08040910, 0x00050110, 0x00050910, 0x08050110, 0x08050910, 0x01000000, 0x01000800, 0x09000000, 0x09000800, 0x01010000, 0x01010800, 0x09010000, 0x09010800, 0x01000000, 0x01000800, 0x09000000, 0x09000800, 0x01010000, 0x01010800, 0x09010000, 0x09010800, 0x01000100, 0x01000900, 0x09000100, 0x09000900, 0x01010100, 0x01010900, 0x09010100, 0x09010900, 0x01000100, 0x01000900, 0x09000100, 0x09000900, 0x01010100, 0x01010900, 0x09010100, 0x09010900, 0x01000010, 0x01000810, 0x09000010, 0x09000810, 0x01010010, 0x01010810, 0x09010010, 0x09010810, 0x01000010, 0x01000810, 0x09000010, 0x09000810, 0x01010010, 0x01010810, 0x09010010, 0x09010810, 0x01000110, 0x01000910, 0x09000110, 0x09000910, 0x01010110, 0x01010910, 0x09010110, 0x09010910, 0x01000110, 0x01000910, 0x09000110, 0x09000910, 0x01010110, 0x01010910, 0x09010110, 0x09010910, 0x01040000, 0x01040800, 0x09040000, 0x09040800, 0x01050000, 0x01050800, 0x09050000, 0x09050800, 0x01040000, 0x01040800, 0x09040000, 0x09040800, 0x01050000, 0x01050800, 0x09050000, 0x09050800, 0x01040100, 0x01040900, 0x09040100, 0x09040900, 0x01050100, 0x01050900, 0x09050100, 0x09050900, 0x01040100, 0x01040900, 0x09040100, 0x09040900, 0x01050100, 0x01050900, 0x09050100, 0x09050900, 0x01040010, 0x01040810, 0x09040010, 0x09040810, 0x01050010, 0x01050810, 0x09050010, 0x09050810, 0x01040010, 0x01040810, 0x09040010, 0x09040810, 0x01050010, 0x01050810, 0x09050010, 0x09050810, 0x01040110, 0x01040910, 0x09040110, 0x09040910, 0x01050110, 0x01050910, 0x09050110, 0x09050910, 0x01040110, 0x01040910, 0x09040110, 0x09040910, 0x01050110, 0x01050910, 0x09050110, 0x09050910 ]; static $pc2mapc3 = [ 0x00000000, 0x00000004, 0x00001000, 0x00001004, 0x00000000, 0x00000004, 0x00001000, 0x00001004, 0x10000000, 0x10000004, 0x10001000, 0x10001004, 0x10000000, 0x10000004, 0x10001000, 0x10001004, 0x00000020, 0x00000024, 0x00001020, 0x00001024, 0x00000020, 0x00000024, 0x00001020, 0x00001024, 0x10000020, 0x10000024, 0x10001020, 0x10001024, 0x10000020, 0x10000024, 0x10001020, 0x10001024, 0x00080000, 0x00080004, 0x00081000, 0x00081004, 0x00080000, 0x00080004, 0x00081000, 0x00081004, 0x10080000, 0x10080004, 0x10081000, 0x10081004, 0x10080000, 0x10080004, 0x10081000, 0x10081004, 0x00080020, 0x00080024, 0x00081020, 0x00081024, 0x00080020, 0x00080024, 0x00081020, 0x00081024, 0x10080020, 0x10080024, 0x10081020, 0x10081024, 0x10080020, 0x10080024, 0x10081020, 0x10081024, 0x20000000, 0x20000004, 0x20001000, 0x20001004, 0x20000000, 0x20000004, 0x20001000, 0x20001004, 0x30000000, 0x30000004, 0x30001000, 0x30001004, 0x30000000, 0x30000004, 0x30001000, 0x30001004, 0x20000020, 0x20000024, 0x20001020, 0x20001024, 0x20000020, 0x20000024, 0x20001020, 0x20001024, 0x30000020, 0x30000024, 0x30001020, 0x30001024, 0x30000020, 0x30000024, 0x30001020, 0x30001024, 0x20080000, 0x20080004, 0x20081000, 0x20081004, 0x20080000, 0x20080004, 0x20081000, 0x20081004, 0x30080000, 0x30080004, 0x30081000, 0x30081004, 0x30080000, 0x30080004, 0x30081000, 0x30081004, 0x20080020, 0x20080024, 0x20081020, 0x20081024, 0x20080020, 0x20080024, 0x20081020, 0x20081024, 0x30080020, 0x30080024, 0x30081020, 0x30081024, 0x30080020, 0x30080024, 0x30081020, 0x30081024, 0x00000002, 0x00000006, 0x00001002, 0x00001006, 0x00000002, 0x00000006, 0x00001002, 0x00001006, 0x10000002, 0x10000006, 0x10001002, 0x10001006, 0x10000002, 0x10000006, 0x10001002, 0x10001006, 0x00000022, 0x00000026, 0x00001022, 0x00001026, 0x00000022, 0x00000026, 0x00001022, 0x00001026, 0x10000022, 0x10000026, 0x10001022, 0x10001026, 0x10000022, 0x10000026, 0x10001022, 0x10001026, 0x00080002, 0x00080006, 0x00081002, 0x00081006, 0x00080002, 0x00080006, 0x00081002, 0x00081006, 0x10080002, 0x10080006, 0x10081002, 0x10081006, 0x10080002, 0x10080006, 0x10081002, 0x10081006, 0x00080022, 0x00080026, 0x00081022, 0x00081026, 0x00080022, 0x00080026, 0x00081022, 0x00081026, 0x10080022, 0x10080026, 0x10081022, 0x10081026, 0x10080022, 0x10080026, 0x10081022, 0x10081026, 0x20000002, 0x20000006, 0x20001002, 0x20001006, 0x20000002, 0x20000006, 0x20001002, 0x20001006, 0x30000002, 0x30000006, 0x30001002, 0x30001006, 0x30000002, 0x30000006, 0x30001002, 0x30001006, 0x20000022, 0x20000026, 0x20001022, 0x20001026, 0x20000022, 0x20000026, 0x20001022, 0x20001026, 0x30000022, 0x30000026, 0x30001022, 0x30001026, 0x30000022, 0x30000026, 0x30001022, 0x30001026, 0x20080002, 0x20080006, 0x20081002, 0x20081006, 0x20080002, 0x20080006, 0x20081002, 0x20081006, 0x30080002, 0x30080006, 0x30081002, 0x30081006, 0x30080002, 0x30080006, 0x30081002, 0x30081006, 0x20080022, 0x20080026, 0x20081022, 0x20081026, 0x20080022, 0x20080026, 0x20081022, 0x20081026, 0x30080022, 0x30080026, 0x30081022, 0x30081026, 0x30080022, 0x30080026, 0x30081022, 0x30081026 ]; static $pc2mapc4 = [ 0x00000000, 0x00100000, 0x00000008, 0x00100008, 0x00000200, 0x00100200, 0x00000208, 0x00100208, 0x00000000, 0x00100000, 0x00000008, 0x00100008, 0x00000200, 0x00100200, 0x00000208, 0x00100208, 0x04000000, 0x04100000, 0x04000008, 0x04100008, 0x04000200, 0x04100200, 0x04000208, 0x04100208, 0x04000000, 0x04100000, 0x04000008, 0x04100008, 0x04000200, 0x04100200, 0x04000208, 0x04100208, 0x00002000, 0x00102000, 0x00002008, 0x00102008, 0x00002200, 0x00102200, 0x00002208, 0x00102208, 0x00002000, 0x00102000, 0x00002008, 0x00102008, 0x00002200, 0x00102200, 0x00002208, 0x00102208, 0x04002000, 0x04102000, 0x04002008, 0x04102008, 0x04002200, 0x04102200, 0x04002208, 0x04102208, 0x04002000, 0x04102000, 0x04002008, 0x04102008, 0x04002200, 0x04102200, 0x04002208, 0x04102208, 0x00000000, 0x00100000, 0x00000008, 0x00100008, 0x00000200, 0x00100200, 0x00000208, 0x00100208, 0x00000000, 0x00100000, 0x00000008, 0x00100008, 0x00000200, 0x00100200, 0x00000208, 0x00100208, 0x04000000, 0x04100000, 0x04000008, 0x04100008, 0x04000200, 0x04100200, 0x04000208, 0x04100208, 0x04000000, 0x04100000, 0x04000008, 0x04100008, 0x04000200, 0x04100200, 0x04000208, 0x04100208, 0x00002000, 0x00102000, 0x00002008, 0x00102008, 0x00002200, 0x00102200, 0x00002208, 0x00102208, 0x00002000, 0x00102000, 0x00002008, 0x00102008, 0x00002200, 0x00102200, 0x00002208, 0x00102208, 0x04002000, 0x04102000, 0x04002008, 0x04102008, 0x04002200, 0x04102200, 0x04002208, 0x04102208, 0x04002000, 0x04102000, 0x04002008, 0x04102008, 0x04002200, 0x04102200, 0x04002208, 0x04102208, 0x00020000, 0x00120000, 0x00020008, 0x00120008, 0x00020200, 0x00120200, 0x00020208, 0x00120208, 0x00020000, 0x00120000, 0x00020008, 0x00120008, 0x00020200, 0x00120200, 0x00020208, 0x00120208, 0x04020000, 0x04120000, 0x04020008, 0x04120008, 0x04020200, 0x04120200, 0x04020208, 0x04120208, 0x04020000, 0x04120000, 0x04020008, 0x04120008, 0x04020200, 0x04120200, 0x04020208, 0x04120208, 0x00022000, 0x00122000, 0x00022008, 0x00122008, 0x00022200, 0x00122200, 0x00022208, 0x00122208, 0x00022000, 0x00122000, 0x00022008, 0x00122008, 0x00022200, 0x00122200, 0x00022208, 0x00122208, 0x04022000, 0x04122000, 0x04022008, 0x04122008, 0x04022200, 0x04122200, 0x04022208, 0x04122208, 0x04022000, 0x04122000, 0x04022008, 0x04122008, 0x04022200, 0x04122200, 0x04022208, 0x04122208, 0x00020000, 0x00120000, 0x00020008, 0x00120008, 0x00020200, 0x00120200, 0x00020208, 0x00120208, 0x00020000, 0x00120000, 0x00020008, 0x00120008, 0x00020200, 0x00120200, 0x00020208, 0x00120208, 0x04020000, 0x04120000, 0x04020008, 0x04120008, 0x04020200, 0x04120200, 0x04020208, 0x04120208, 0x04020000, 0x04120000, 0x04020008, 0x04120008, 0x04020200, 0x04120200, 0x04020208, 0x04120208, 0x00022000, 0x00122000, 0x00022008, 0x00122008, 0x00022200, 0x00122200, 0x00022208, 0x00122208, 0x00022000, 0x00122000, 0x00022008, 0x00122008, 0x00022200, 0x00122200, 0x00022208, 0x00122208, 0x04022000, 0x04122000, 0x04022008, 0x04122008, 0x04022200, 0x04122200, 0x04022208, 0x04122208, 0x04022000, 0x04122000, 0x04022008, 0x04122008, 0x04022200, 0x04122200, 0x04022208, 0x04122208 ]; static $pc2mapd1 = [ 0x00000000, 0x00000001, 0x08000000, 0x08000001, 0x00200000, 0x00200001, 0x08200000, 0x08200001, 0x00000002, 0x00000003, 0x08000002, 0x08000003, 0x00200002, 0x00200003, 0x08200002, 0x08200003 ]; static $pc2mapd2 = [ 0x00000000, 0x00100000, 0x00000800, 0x00100800, 0x00000000, 0x00100000, 0x00000800, 0x00100800, 0x04000000, 0x04100000, 0x04000800, 0x04100800, 0x04000000, 0x04100000, 0x04000800, 0x04100800, 0x00000004, 0x00100004, 0x00000804, 0x00100804, 0x00000004, 0x00100004, 0x00000804, 0x00100804, 0x04000004, 0x04100004, 0x04000804, 0x04100804, 0x04000004, 0x04100004, 0x04000804, 0x04100804, 0x00000000, 0x00100000, 0x00000800, 0x00100800, 0x00000000, 0x00100000, 0x00000800, 0x00100800, 0x04000000, 0x04100000, 0x04000800, 0x04100800, 0x04000000, 0x04100000, 0x04000800, 0x04100800, 0x00000004, 0x00100004, 0x00000804, 0x00100804, 0x00000004, 0x00100004, 0x00000804, 0x00100804, 0x04000004, 0x04100004, 0x04000804, 0x04100804, 0x04000004, 0x04100004, 0x04000804, 0x04100804, 0x00000200, 0x00100200, 0x00000A00, 0x00100A00, 0x00000200, 0x00100200, 0x00000A00, 0x00100A00, 0x04000200, 0x04100200, 0x04000A00, 0x04100A00, 0x04000200, 0x04100200, 0x04000A00, 0x04100A00, 0x00000204, 0x00100204, 0x00000A04, 0x00100A04, 0x00000204, 0x00100204, 0x00000A04, 0x00100A04, 0x04000204, 0x04100204, 0x04000A04, 0x04100A04, 0x04000204, 0x04100204, 0x04000A04, 0x04100A04, 0x00000200, 0x00100200, 0x00000A00, 0x00100A00, 0x00000200, 0x00100200, 0x00000A00, 0x00100A00, 0x04000200, 0x04100200, 0x04000A00, 0x04100A00, 0x04000200, 0x04100200, 0x04000A00, 0x04100A00, 0x00000204, 0x00100204, 0x00000A04, 0x00100A04, 0x00000204, 0x00100204, 0x00000A04, 0x00100A04, 0x04000204, 0x04100204, 0x04000A04, 0x04100A04, 0x04000204, 0x04100204, 0x04000A04, 0x04100A04, 0x00020000, 0x00120000, 0x00020800, 0x00120800, 0x00020000, 0x00120000, 0x00020800, 0x00120800, 0x04020000, 0x04120000, 0x04020800, 0x04120800, 0x04020000, 0x04120000, 0x04020800, 0x04120800, 0x00020004, 0x00120004, 0x00020804, 0x00120804, 0x00020004, 0x00120004, 0x00020804, 0x00120804, 0x04020004, 0x04120004, 0x04020804, 0x04120804, 0x04020004, 0x04120004, 0x04020804, 0x04120804, 0x00020000, 0x00120000, 0x00020800, 0x00120800, 0x00020000, 0x00120000, 0x00020800, 0x00120800, 0x04020000, 0x04120000, 0x04020800, 0x04120800, 0x04020000, 0x04120000, 0x04020800, 0x04120800, 0x00020004, 0x00120004, 0x00020804, 0x00120804, 0x00020004, 0x00120004, 0x00020804, 0x00120804, 0x04020004, 0x04120004, 0x04020804, 0x04120804, 0x04020004, 0x04120004, 0x04020804, 0x04120804, 0x00020200, 0x00120200, 0x00020A00, 0x00120A00, 0x00020200, 0x00120200, 0x00020A00, 0x00120A00, 0x04020200, 0x04120200, 0x04020A00, 0x04120A00, 0x04020200, 0x04120200, 0x04020A00, 0x04120A00, 0x00020204, 0x00120204, 0x00020A04, 0x00120A04, 0x00020204, 0x00120204, 0x00020A04, 0x00120A04, 0x04020204, 0x04120204, 0x04020A04, 0x04120A04, 0x04020204, 0x04120204, 0x04020A04, 0x04120A04, 0x00020200, 0x00120200, 0x00020A00, 0x00120A00, 0x00020200, 0x00120200, 0x00020A00, 0x00120A00, 0x04020200, 0x04120200, 0x04020A00, 0x04120A00, 0x04020200, 0x04120200, 0x04020A00, 0x04120A00, 0x00020204, 0x00120204, 0x00020A04, 0x00120A04, 0x00020204, 0x00120204, 0x00020A04, 0x00120A04, 0x04020204, 0x04120204, 0x04020A04, 0x04120A04, 0x04020204, 0x04120204, 0x04020A04, 0x04120A04 ]; static $pc2mapd3 = [ 0x00000000, 0x00010000, 0x02000000, 0x02010000, 0x00000020, 0x00010020, 0x02000020, 0x02010020, 0x00040000, 0x00050000, 0x02040000, 0x02050000, 0x00040020, 0x00050020, 0x02040020, 0x02050020, 0x00002000, 0x00012000, 0x02002000, 0x02012000, 0x00002020, 0x00012020, 0x02002020, 0x02012020, 0x00042000, 0x00052000, 0x02042000, 0x02052000, 0x00042020, 0x00052020, 0x02042020, 0x02052020, 0x00000000, 0x00010000, 0x02000000, 0x02010000, 0x00000020, 0x00010020, 0x02000020, 0x02010020, 0x00040000, 0x00050000, 0x02040000, 0x02050000, 0x00040020, 0x00050020, 0x02040020, 0x02050020, 0x00002000, 0x00012000, 0x02002000, 0x02012000, 0x00002020, 0x00012020, 0x02002020, 0x02012020, 0x00042000, 0x00052000, 0x02042000, 0x02052000, 0x00042020, 0x00052020, 0x02042020, 0x02052020, 0x00000010, 0x00010010, 0x02000010, 0x02010010, 0x00000030, 0x00010030, 0x02000030, 0x02010030, 0x00040010, 0x00050010, 0x02040010, 0x02050010, 0x00040030, 0x00050030, 0x02040030, 0x02050030, 0x00002010, 0x00012010, 0x02002010, 0x02012010, 0x00002030, 0x00012030, 0x02002030, 0x02012030, 0x00042010, 0x00052010, 0x02042010, 0x02052010, 0x00042030, 0x00052030, 0x02042030, 0x02052030, 0x00000010, 0x00010010, 0x02000010, 0x02010010, 0x00000030, 0x00010030, 0x02000030, 0x02010030, 0x00040010, 0x00050010, 0x02040010, 0x02050010, 0x00040030, 0x00050030, 0x02040030, 0x02050030, 0x00002010, 0x00012010, 0x02002010, 0x02012010, 0x00002030, 0x00012030, 0x02002030, 0x02012030, 0x00042010, 0x00052010, 0x02042010, 0x02052010, 0x00042030, 0x00052030, 0x02042030, 0x02052030, 0x20000000, 0x20010000, 0x22000000, 0x22010000, 0x20000020, 0x20010020, 0x22000020, 0x22010020, 0x20040000, 0x20050000, 0x22040000, 0x22050000, 0x20040020, 0x20050020, 0x22040020, 0x22050020, 0x20002000, 0x20012000, 0x22002000, 0x22012000, 0x20002020, 0x20012020, 0x22002020, 0x22012020, 0x20042000, 0x20052000, 0x22042000, 0x22052000, 0x20042020, 0x20052020, 0x22042020, 0x22052020, 0x20000000, 0x20010000, 0x22000000, 0x22010000, 0x20000020, 0x20010020, 0x22000020, 0x22010020, 0x20040000, 0x20050000, 0x22040000, 0x22050000, 0x20040020, 0x20050020, 0x22040020, 0x22050020, 0x20002000, 0x20012000, 0x22002000, 0x22012000, 0x20002020, 0x20012020, 0x22002020, 0x22012020, 0x20042000, 0x20052000, 0x22042000, 0x22052000, 0x20042020, 0x20052020, 0x22042020, 0x22052020, 0x20000010, 0x20010010, 0x22000010, 0x22010010, 0x20000030, 0x20010030, 0x22000030, 0x22010030, 0x20040010, 0x20050010, 0x22040010, 0x22050010, 0x20040030, 0x20050030, 0x22040030, 0x22050030, 0x20002010, 0x20012010, 0x22002010, 0x22012010, 0x20002030, 0x20012030, 0x22002030, 0x22012030, 0x20042010, 0x20052010, 0x22042010, 0x22052010, 0x20042030, 0x20052030, 0x22042030, 0x22052030, 0x20000010, 0x20010010, 0x22000010, 0x22010010, 0x20000030, 0x20010030, 0x22000030, 0x22010030, 0x20040010, 0x20050010, 0x22040010, 0x22050010, 0x20040030, 0x20050030, 0x22040030, 0x22050030, 0x20002010, 0x20012010, 0x22002010, 0x22012010, 0x20002030, 0x20012030, 0x22002030, 0x22012030, 0x20042010, 0x20052010, 0x22042010, 0x22052010, 0x20042030, 0x20052030, 0x22042030, 0x22052030 ]; static $pc2mapd4 = [ 0x00000000, 0x00000400, 0x01000000, 0x01000400, 0x00000000, 0x00000400, 0x01000000, 0x01000400, 0x00000100, 0x00000500, 0x01000100, 0x01000500, 0x00000100, 0x00000500, 0x01000100, 0x01000500, 0x10000000, 0x10000400, 0x11000000, 0x11000400, 0x10000000, 0x10000400, 0x11000000, 0x11000400, 0x10000100, 0x10000500, 0x11000100, 0x11000500, 0x10000100, 0x10000500, 0x11000100, 0x11000500, 0x00080000, 0x00080400, 0x01080000, 0x01080400, 0x00080000, 0x00080400, 0x01080000, 0x01080400, 0x00080100, 0x00080500, 0x01080100, 0x01080500, 0x00080100, 0x00080500, 0x01080100, 0x01080500, 0x10080000, 0x10080400, 0x11080000, 0x11080400, 0x10080000, 0x10080400, 0x11080000, 0x11080400, 0x10080100, 0x10080500, 0x11080100, 0x11080500, 0x10080100, 0x10080500, 0x11080100, 0x11080500, 0x00000008, 0x00000408, 0x01000008, 0x01000408, 0x00000008, 0x00000408, 0x01000008, 0x01000408, 0x00000108, 0x00000508, 0x01000108, 0x01000508, 0x00000108, 0x00000508, 0x01000108, 0x01000508, 0x10000008, 0x10000408, 0x11000008, 0x11000408, 0x10000008, 0x10000408, 0x11000008, 0x11000408, 0x10000108, 0x10000508, 0x11000108, 0x11000508, 0x10000108, 0x10000508, 0x11000108, 0x11000508, 0x00080008, 0x00080408, 0x01080008, 0x01080408, 0x00080008, 0x00080408, 0x01080008, 0x01080408, 0x00080108, 0x00080508, 0x01080108, 0x01080508, 0x00080108, 0x00080508, 0x01080108, 0x01080508, 0x10080008, 0x10080408, 0x11080008, 0x11080408, 0x10080008, 0x10080408, 0x11080008, 0x11080408, 0x10080108, 0x10080508, 0x11080108, 0x11080508, 0x10080108, 0x10080508, 0x11080108, 0x11080508, 0x00001000, 0x00001400, 0x01001000, 0x01001400, 0x00001000, 0x00001400, 0x01001000, 0x01001400, 0x00001100, 0x00001500, 0x01001100, 0x01001500, 0x00001100, 0x00001500, 0x01001100, 0x01001500, 0x10001000, 0x10001400, 0x11001000, 0x11001400, 0x10001000, 0x10001400, 0x11001000, 0x11001400, 0x10001100, 0x10001500, 0x11001100, 0x11001500, 0x10001100, 0x10001500, 0x11001100, 0x11001500, 0x00081000, 0x00081400, 0x01081000, 0x01081400, 0x00081000, 0x00081400, 0x01081000, 0x01081400, 0x00081100, 0x00081500, 0x01081100, 0x01081500, 0x00081100, 0x00081500, 0x01081100, 0x01081500, 0x10081000, 0x10081400, 0x11081000, 0x11081400, 0x10081000, 0x10081400, 0x11081000, 0x11081400, 0x10081100, 0x10081500, 0x11081100, 0x11081500, 0x10081100, 0x10081500, 0x11081100, 0x11081500, 0x00001008, 0x00001408, 0x01001008, 0x01001408, 0x00001008, 0x00001408, 0x01001008, 0x01001408, 0x00001108, 0x00001508, 0x01001108, 0x01001508, 0x00001108, 0x00001508, 0x01001108, 0x01001508, 0x10001008, 0x10001408, 0x11001008, 0x11001408, 0x10001008, 0x10001408, 0x11001008, 0x11001408, 0x10001108, 0x10001508, 0x11001108, 0x11001508, 0x10001108, 0x10001508, 0x11001108, 0x11001508, 0x00081008, 0x00081408, 0x01081008, 0x01081408, 0x00081008, 0x00081408, 0x01081008, 0x01081408, 0x00081108, 0x00081508, 0x01081108, 0x01081508, 0x00081108, 0x00081508, 0x01081108, 0x01081508, 0x10081008, 0x10081408, 0x11081008, 0x11081408, 0x10081008, 0x10081408, 0x11081008, 0x11081408, 0x10081108, 0x10081508, 0x11081108, 0x11081508, 0x10081108, 0x10081508, 0x11081108, 0x11081508 ]; $keys = []; for ($des_round = 0; $des_round < $this->des_rounds; ++$des_round) { // pad the key and remove extra characters as appropriate. $key = str_pad(substr($this->key, $des_round * 8, 8), 8, "\0"); // Perform the PC/1 transformation and compute C and D. $t = unpack('Nl/Nr', $key); list($l, $r) = [$t['l'], $t['r']]; $key = ($this->shuffle[$pc1map[ $r & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x00") | ($this->shuffle[$pc1map[($r >> 8) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x00") | ($this->shuffle[$pc1map[($r >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x00") | ($this->shuffle[$pc1map[($r >> 24) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x00") | ($this->shuffle[$pc1map[ $l & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x00") | ($this->shuffle[$pc1map[($l >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x00") | ($this->shuffle[$pc1map[($l >> 16) & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x00") | ($this->shuffle[$pc1map[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x00"); $key = unpack('Nc/Nd', $key); $c = ( $key['c'] >> 4) & 0x0FFFFFFF; $d = (($key['d'] >> 4) & 0x0FFFFFF0) | ($key['c'] & 0x0F); $keys[$des_round] = [ self::ENCRYPT => [], self::DECRYPT => array_fill(0, 32, 0) ]; for ($i = 0, $ki = 31; $i < 16; ++$i, $ki-= 2) { $c <<= $shifts[$i]; $c = ($c | ($c >> 28)) & 0x0FFFFFFF; $d <<= $shifts[$i]; $d = ($d | ($d >> 28)) & 0x0FFFFFFF; // Perform the PC-2 transformation. $cp = $pc2mapc1[ $c >> 24 ] | $pc2mapc2[($c >> 16) & 0xFF] | $pc2mapc3[($c >> 8) & 0xFF] | $pc2mapc4[ $c & 0xFF]; $dp = $pc2mapd1[ $d >> 24 ] | $pc2mapd2[($d >> 16) & 0xFF] | $pc2mapd3[($d >> 8) & 0xFF] | $pc2mapd4[ $d & 0xFF]; // Reorder: odd bytes/even bytes. Push the result in key schedule. $val1 = ( $cp & 0xFF000000) | (($cp << 8) & 0x00FF0000) | (($dp >> 16) & 0x0000FF00) | (($dp >> 8) & 0x000000FF); $val2 = (($cp << 8) & 0xFF000000) | (($cp << 16) & 0x00FF0000) | (($dp >> 8) & 0x0000FF00) | ( $dp & 0x000000FF); $keys[$des_round][self::ENCRYPT][ ] = $val1; $keys[$des_round][self::DECRYPT][$ki - 1] = $val1; $keys[$des_round][self::ENCRYPT][ ] = $val2; $keys[$des_round][self::DECRYPT][$ki ] = $val2; } } switch ($this->des_rounds) { case 3: // 3DES keys $this->keys = [ self::ENCRYPT => array_merge( $keys[0][self::ENCRYPT], $keys[1][self::DECRYPT], $keys[2][self::ENCRYPT] ), self::DECRYPT => array_merge( $keys[2][self::DECRYPT], $keys[1][self::ENCRYPT], $keys[0][self::DECRYPT] ) ]; break; // case 1: // DES keys default: $this->keys = [ self::ENCRYPT => $keys[0][self::ENCRYPT], self::DECRYPT => $keys[0][self::DECRYPT] ]; } } /** * Setup the performance-optimized function for de/encrypt() * * @see \phpseclib\Crypt\Common\SymmetricKey::setupInlineCrypt() * @access private */ protected function setupInlineCrypt() { // Engine configuration for: // - DES ($des_rounds == 1) or // - 3DES ($des_rounds == 3) $des_rounds = $this->des_rounds; $init_crypt = 'static $sbox1, $sbox2, $sbox3, $sbox4, $sbox5, $sbox6, $sbox7, $sbox8, $shuffleip, $shuffleinvip; if (!$sbox1) { $sbox1 = array_map("intval", $this->sbox1); $sbox2 = array_map("intval", $this->sbox2); $sbox3 = array_map("intval", $this->sbox3); $sbox4 = array_map("intval", $this->sbox4); $sbox5 = array_map("intval", $this->sbox5); $sbox6 = array_map("intval", $this->sbox6); $sbox7 = array_map("intval", $this->sbox7); $sbox8 = array_map("intval", $this->sbox8);' /* Merge $shuffle with $[inv]ipmap */ . ' for ($i = 0; $i < 256; ++$i) { $shuffleip[] = $this->shuffle[$this->ipmap[$i]]; $shuffleinvip[] = $this->shuffle[$this->invipmap[$i]]; } } '; $k = [ self::ENCRYPT => $this->keys[self::ENCRYPT], self::DECRYPT => $this->keys[self::DECRYPT] ]; $init_encrypt = ''; $init_decrypt = ''; // Creating code for en- and decryption. $crypt_block = []; foreach ([self::ENCRYPT, self::DECRYPT] as $c) { /* Do the initial IP permutation. */ $crypt_block[$c] = ' $in = unpack("N*", $in); $l = $in[1]; $r = $in[2]; $in = unpack("N*", ($shuffleip[ $r & 0xFF] & "\x80\x80\x80\x80\x80\x80\x80\x80") | ($shuffleip[($r >> 8) & 0xFF] & "\x40\x40\x40\x40\x40\x40\x40\x40") | ($shuffleip[($r >> 16) & 0xFF] & "\x20\x20\x20\x20\x20\x20\x20\x20") | ($shuffleip[($r >> 24) & 0xFF] & "\x10\x10\x10\x10\x10\x10\x10\x10") | ($shuffleip[ $l & 0xFF] & "\x08\x08\x08\x08\x08\x08\x08\x08") | ($shuffleip[($l >> 8) & 0xFF] & "\x04\x04\x04\x04\x04\x04\x04\x04") | ($shuffleip[($l >> 16) & 0xFF] & "\x02\x02\x02\x02\x02\x02\x02\x02") | ($shuffleip[($l >> 24) & 0xFF] & "\x01\x01\x01\x01\x01\x01\x01\x01") ); ' . /* Extract L0 and R0 */ ' $l = $in[1]; $r = $in[2]; '; $l = '$l'; $r = '$r'; // Perform DES or 3DES. for ($ki = -1, $des_round = 0; $des_round < $des_rounds; ++$des_round) { // Perform the 16 steps. for ($i = 0; $i < 16; ++$i) { // start of "the Feistel (F) function" - see the following URL: // http://en.wikipedia.org/wiki/Image:Data_Encryption_Standard_InfoBox_Diagram.png // Merge key schedule. $crypt_block[$c].= ' $b1 = ((' . $r . ' >> 3) & 0x1FFFFFFF) ^ (' . $r . ' << 29) ^ ' . $k[$c][++$ki] . '; $b2 = ((' . $r . ' >> 31) & 0x00000001) ^ (' . $r . ' << 1) ^ ' . $k[$c][++$ki] . ';' . /* S-box indexing. */ $l . ' = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^ $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^ $sbox5[($b1 >> 8) & 0x3F] ^ $sbox6[($b2 >> 8) & 0x3F] ^ $sbox7[ $b1 & 0x3F] ^ $sbox8[ $b2 & 0x3F] ^ ' . $l . '; '; // end of "the Feistel (F) function" // swap L & R list($l, $r) = [$r, $l]; } list($l, $r) = [$r, $l]; } // Perform the inverse IP permutation. $crypt_block[$c].= '$in = ($shuffleinvip[($l >> 24) & 0xFF] & "\x80\x80\x80\x80\x80\x80\x80\x80") | ($shuffleinvip[($r >> 24) & 0xFF] & "\x40\x40\x40\x40\x40\x40\x40\x40") | ($shuffleinvip[($l >> 16) & 0xFF] & "\x20\x20\x20\x20\x20\x20\x20\x20") | ($shuffleinvip[($r >> 16) & 0xFF] & "\x10\x10\x10\x10\x10\x10\x10\x10") | ($shuffleinvip[($l >> 8) & 0xFF] & "\x08\x08\x08\x08\x08\x08\x08\x08") | ($shuffleinvip[($r >> 8) & 0xFF] & "\x04\x04\x04\x04\x04\x04\x04\x04") | ($shuffleinvip[ $l & 0xFF] & "\x02\x02\x02\x02\x02\x02\x02\x02") | ($shuffleinvip[ $r & 0xFF] & "\x01\x01\x01\x01\x01\x01\x01\x01"); '; } // Creates the inline-crypt function $this->inline_crypt = $this->createInlineCryptFunction( [ 'init_crypt' => $init_crypt, 'init_encrypt' => $init_encrypt, 'init_decrypt' => $init_decrypt, 'encrypt_block' => $crypt_block[self::ENCRYPT], 'decrypt_block' => $crypt_block[self::DECRYPT] ] ); } } <?php /** * Pure-PHP implementation of RC2. * * Uses mcrypt, if available, and an internal implementation, otherwise. * * PHP version 5 * * Useful resources are as follows: * * - {@link http://tools.ietf.org/html/rfc2268} * * Here's a short example of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * $rc2 = new \phpseclib\Crypt\RC2(); * * $rc2->setKey('abcdefgh'); * * $plaintext = str_repeat('a', 1024); * * echo $rc2->decrypt($rc2->encrypt($plaintext)); * ?> * </code> * * @category Crypt * @package RC2 * @author Patrick Monnerat <pm@datasphere.ch> * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt; use phpseclib\Crypt\Common\BlockCipher; /** * Pure-PHP implementation of RC2. * * @package RC2 * @access public */ class RC2 extends BlockCipher { /** * Block Length of the cipher * * @see \phpseclib\Crypt\Common\SymmetricKey::block_size * @var int * @access private */ protected $block_size = 8; /** * The Key * * @see \phpseclib\Crypt\Common\SymmetricKey::key * @see self::setKey() * @var string * @access private */ protected $key; /** * The Original (unpadded) Key * * @see \phpseclib\Crypt\Common\SymmetricKey::key * @see self::setKey() * @see self::encrypt() * @see self::decrypt() * @var string * @access private */ private $orig_key; /** * Don't truncate / null pad key * * @see \phpseclib\Crypt\Common\SymmetricKey::clearBuffers() * @var bool * @access private */ private $skip_key_adjustment = true; /** * Key Length (in bytes) * * @see \phpseclib\Crypt\RC2::setKeyLength() * @var int * @access private */ protected $key_length = 16; // = 128 bits /** * The mcrypt specific name of the cipher * * @see \phpseclib\Crypt\Common\SymmetricKey::cipher_name_mcrypt * @var string * @access private */ protected $cipher_name_mcrypt = 'rc2'; /** * Optimizing value while CFB-encrypting * * @see \phpseclib\Crypt\Common\SymmetricKey::cfb_init_len * @var int * @access private */ protected $cfb_init_len = 500; /** * The key length in bits. * * @see self::setKeyLength() * @see self::setKey() * @var int * @access private * @internal Should be in range [1..1024]. * @internal Changing this value after setting the key has no effect. */ private $default_key_length = 1024; /** * The key length in bits. * * @see self::isValidEnine() * @see self::setKey() * @var int * @access private * @internal Should be in range [1..1024]. */ private $current_key_length; /** * The Key Schedule * * @see self::setupKey() * @var array * @access private */ private $keys; /** * Key expansion randomization table. * Twice the same 256-value sequence to save a modulus in key expansion. * * @see self::setKey() * @var array * @access private */ private $pitable = [ 0xD9, 0x78, 0xF9, 0xC4, 0x19, 0xDD, 0xB5, 0xED, 0x28, 0xE9, 0xFD, 0x79, 0x4A, 0xA0, 0xD8, 0x9D, 0xC6, 0x7E, 0x37, 0x83, 0x2B, 0x76, 0x53, 0x8E, 0x62, 0x4C, 0x64, 0x88, 0x44, 0x8B, 0xFB, 0xA2, 0x17, 0x9A, 0x59, 0xF5, 0x87, 0xB3, 0x4F, 0x13, 0x61, 0x45, 0x6D, 0x8D, 0x09, 0x81, 0x7D, 0x32, 0xBD, 0x8F, 0x40, 0xEB, 0x86, 0xB7, 0x7B, 0x0B, 0xF0, 0x95, 0x21, 0x22, 0x5C, 0x6B, 0x4E, 0x82, 0x54, 0xD6, 0x65, 0x93, 0xCE, 0x60, 0xB2, 0x1C, 0x73, 0x56, 0xC0, 0x14, 0xA7, 0x8C, 0xF1, 0xDC, 0x12, 0x75, 0xCA, 0x1F, 0x3B, 0xBE, 0xE4, 0xD1, 0x42, 0x3D, 0xD4, 0x30, 0xA3, 0x3C, 0xB6, 0x26, 0x6F, 0xBF, 0x0E, 0xDA, 0x46, 0x69, 0x07, 0x57, 0x27, 0xF2, 0x1D, 0x9B, 0xBC, 0x94, 0x43, 0x03, 0xF8, 0x11, 0xC7, 0xF6, 0x90, 0xEF, 0x3E, 0xE7, 0x06, 0xC3, 0xD5, 0x2F, 0xC8, 0x66, 0x1E, 0xD7, 0x08, 0xE8, 0xEA, 0xDE, 0x80, 0x52, 0xEE, 0xF7, 0x84, 0xAA, 0x72, 0xAC, 0x35, 0x4D, 0x6A, 0x2A, 0x96, 0x1A, 0xD2, 0x71, 0x5A, 0x15, 0x49, 0x74, 0x4B, 0x9F, 0xD0, 0x5E, 0x04, 0x18, 0xA4, 0xEC, 0xC2, 0xE0, 0x41, 0x6E, 0x0F, 0x51, 0xCB, 0xCC, 0x24, 0x91, 0xAF, 0x50, 0xA1, 0xF4, 0x70, 0x39, 0x99, 0x7C, 0x3A, 0x85, 0x23, 0xB8, 0xB4, 0x7A, 0xFC, 0x02, 0x36, 0x5B, 0x25, 0x55, 0x97, 0x31, 0x2D, 0x5D, 0xFA, 0x98, 0xE3, 0x8A, 0x92, 0xAE, 0x05, 0xDF, 0x29, 0x10, 0x67, 0x6C, 0xBA, 0xC9, 0xD3, 0x00, 0xE6, 0xCF, 0xE1, 0x9E, 0xA8, 0x2C, 0x63, 0x16, 0x01, 0x3F, 0x58, 0xE2, 0x89, 0xA9, 0x0D, 0x38, 0x34, 0x1B, 0xAB, 0x33, 0xFF, 0xB0, 0xBB, 0x48, 0x0C, 0x5F, 0xB9, 0xB1, 0xCD, 0x2E, 0xC5, 0xF3, 0xDB, 0x47, 0xE5, 0xA5, 0x9C, 0x77, 0x0A, 0xA6, 0x20, 0x68, 0xFE, 0x7F, 0xC1, 0xAD, 0xD9, 0x78, 0xF9, 0xC4, 0x19, 0xDD, 0xB5, 0xED, 0x28, 0xE9, 0xFD, 0x79, 0x4A, 0xA0, 0xD8, 0x9D, 0xC6, 0x7E, 0x37, 0x83, 0x2B, 0x76, 0x53, 0x8E, 0x62, 0x4C, 0x64, 0x88, 0x44, 0x8B, 0xFB, 0xA2, 0x17, 0x9A, 0x59, 0xF5, 0x87, 0xB3, 0x4F, 0x13, 0x61, 0x45, 0x6D, 0x8D, 0x09, 0x81, 0x7D, 0x32, 0xBD, 0x8F, 0x40, 0xEB, 0x86, 0xB7, 0x7B, 0x0B, 0xF0, 0x95, 0x21, 0x22, 0x5C, 0x6B, 0x4E, 0x82, 0x54, 0xD6, 0x65, 0x93, 0xCE, 0x60, 0xB2, 0x1C, 0x73, 0x56, 0xC0, 0x14, 0xA7, 0x8C, 0xF1, 0xDC, 0x12, 0x75, 0xCA, 0x1F, 0x3B, 0xBE, 0xE4, 0xD1, 0x42, 0x3D, 0xD4, 0x30, 0xA3, 0x3C, 0xB6, 0x26, 0x6F, 0xBF, 0x0E, 0xDA, 0x46, 0x69, 0x07, 0x57, 0x27, 0xF2, 0x1D, 0x9B, 0xBC, 0x94, 0x43, 0x03, 0xF8, 0x11, 0xC7, 0xF6, 0x90, 0xEF, 0x3E, 0xE7, 0x06, 0xC3, 0xD5, 0x2F, 0xC8, 0x66, 0x1E, 0xD7, 0x08, 0xE8, 0xEA, 0xDE, 0x80, 0x52, 0xEE, 0xF7, 0x84, 0xAA, 0x72, 0xAC, 0x35, 0x4D, 0x6A, 0x2A, 0x96, 0x1A, 0xD2, 0x71, 0x5A, 0x15, 0x49, 0x74, 0x4B, 0x9F, 0xD0, 0x5E, 0x04, 0x18, 0xA4, 0xEC, 0xC2, 0xE0, 0x41, 0x6E, 0x0F, 0x51, 0xCB, 0xCC, 0x24, 0x91, 0xAF, 0x50, 0xA1, 0xF4, 0x70, 0x39, 0x99, 0x7C, 0x3A, 0x85, 0x23, 0xB8, 0xB4, 0x7A, 0xFC, 0x02, 0x36, 0x5B, 0x25, 0x55, 0x97, 0x31, 0x2D, 0x5D, 0xFA, 0x98, 0xE3, 0x8A, 0x92, 0xAE, 0x05, 0xDF, 0x29, 0x10, 0x67, 0x6C, 0xBA, 0xC9, 0xD3, 0x00, 0xE6, 0xCF, 0xE1, 0x9E, 0xA8, 0x2C, 0x63, 0x16, 0x01, 0x3F, 0x58, 0xE2, 0x89, 0xA9, 0x0D, 0x38, 0x34, 0x1B, 0xAB, 0x33, 0xFF, 0xB0, 0xBB, 0x48, 0x0C, 0x5F, 0xB9, 0xB1, 0xCD, 0x2E, 0xC5, 0xF3, 0xDB, 0x47, 0xE5, 0xA5, 0x9C, 0x77, 0x0A, 0xA6, 0x20, 0x68, 0xFE, 0x7F, 0xC1, 0xAD ]; /** * Inverse key expansion randomization table. * * @see self::setKey() * @var array * @access private */ private $invpitable = [ 0xD1, 0xDA, 0xB9, 0x6F, 0x9C, 0xC8, 0x78, 0x66, 0x80, 0x2C, 0xF8, 0x37, 0xEA, 0xE0, 0x62, 0xA4, 0xCB, 0x71, 0x50, 0x27, 0x4B, 0x95, 0xD9, 0x20, 0x9D, 0x04, 0x91, 0xE3, 0x47, 0x6A, 0x7E, 0x53, 0xFA, 0x3A, 0x3B, 0xB4, 0xA8, 0xBC, 0x5F, 0x68, 0x08, 0xCA, 0x8F, 0x14, 0xD7, 0xC0, 0xEF, 0x7B, 0x5B, 0xBF, 0x2F, 0xE5, 0xE2, 0x8C, 0xBA, 0x12, 0xE1, 0xAF, 0xB2, 0x54, 0x5D, 0x59, 0x76, 0xDB, 0x32, 0xA2, 0x58, 0x6E, 0x1C, 0x29, 0x64, 0xF3, 0xE9, 0x96, 0x0C, 0x98, 0x19, 0x8D, 0x3E, 0x26, 0xAB, 0xA5, 0x85, 0x16, 0x40, 0xBD, 0x49, 0x67, 0xDC, 0x22, 0x94, 0xBB, 0x3C, 0xC1, 0x9B, 0xEB, 0x45, 0x28, 0x18, 0xD8, 0x1A, 0x42, 0x7D, 0xCC, 0xFB, 0x65, 0x8E, 0x3D, 0xCD, 0x2A, 0xA3, 0x60, 0xAE, 0x93, 0x8A, 0x48, 0x97, 0x51, 0x15, 0xF7, 0x01, 0x0B, 0xB7, 0x36, 0xB1, 0x2E, 0x11, 0xFD, 0x84, 0x2D, 0x3F, 0x13, 0x88, 0xB3, 0x34, 0x24, 0x1B, 0xDE, 0xC5, 0x1D, 0x4D, 0x2B, 0x17, 0x31, 0x74, 0xA9, 0xC6, 0x43, 0x6D, 0x39, 0x90, 0xBE, 0xC3, 0xB0, 0x21, 0x6B, 0xF6, 0x0F, 0xD5, 0x99, 0x0D, 0xAC, 0x1F, 0x5C, 0x9E, 0xF5, 0xF9, 0x4C, 0xD6, 0xDF, 0x89, 0xE4, 0x8B, 0xFF, 0xC7, 0xAA, 0xE7, 0xED, 0x46, 0x25, 0xB6, 0x06, 0x5E, 0x35, 0xB5, 0xEC, 0xCE, 0xE8, 0x6C, 0x30, 0x55, 0x61, 0x4A, 0xFE, 0xA0, 0x79, 0x03, 0xF0, 0x10, 0x72, 0x7C, 0xCF, 0x52, 0xA6, 0xA7, 0xEE, 0x44, 0xD3, 0x9A, 0x57, 0x92, 0xD0, 0x5A, 0x7A, 0x41, 0x7F, 0x0E, 0x00, 0x63, 0xF2, 0x4F, 0x05, 0x83, 0xC9, 0xA1, 0xD4, 0xDD, 0xC4, 0x56, 0xF4, 0xD2, 0x77, 0x81, 0x09, 0x82, 0x33, 0x9F, 0x07, 0x86, 0x75, 0x38, 0x4E, 0x69, 0xF1, 0xAD, 0x23, 0x73, 0x87, 0x70, 0x02, 0xC2, 0x1E, 0xB8, 0x0A, 0xFC, 0xE6 ]; /** * Default Constructor. * * @param int $mode * @access public * @throws \InvalidArgumentException if an invalid / unsupported mode is provided */ public function __construct($mode) { if ($mode == self::MODE_STREAM) { throw new \InvalidArgumentException('Block ciphers cannot be ran in stream mode'); } parent::__construct($mode); } /** * Test for engine validity * * This is mainly just a wrapper to set things up for \phpseclib\Crypt\Common\SymmetricKey::isValidEngine() * * @see \phpseclib\Crypt\Common\SymmetricKey::__construct() * @param int $engine * @access protected * @return bool */ protected function isValidEngineHelper($engine) { switch ($engine) { case self::ENGINE_OPENSSL: if ($this->current_key_length != 128 || strlen($this->orig_key) < 16) { return false; } $this->cipher_name_openssl_ecb = 'rc2-ecb'; $this->cipher_name_openssl = 'rc2-' . $this->openssl_translate_mode(); } return parent::isValidEngineHelper($engine); } /** * Sets the key length. * * Valid key lengths are 8 to 1024. * Calling this function after setting the key has no effect until the next * \phpseclib\Crypt\RC2::setKey() call. * * @access public * @param int $length in bits * @throws \LengthException if the key length isn't supported */ public function setKeyLength($length) { if ($length < 8 || $length > 1024) { throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys between 1 and 1024 bits, inclusive, are supported'); } $this->default_key_length = $this->current_key_length = $length; $this->explicit_key_length = $length >> 3; } /** * Returns the current key length * * @access public * @return int */ public function getKeyLength() { return $this->current_key_length; } /** * Sets the key. * * Keys can be of any length. RC2, itself, uses 8 to 1024 bit keys (eg. * strlen($key) <= 128), however, we only use the first 128 bytes if $key * has more then 128 bytes in it, and set $key to a single null byte if * it is empty. * * @see \phpseclib\Crypt\Common\SymmetricKey::setKey() * @access public * @param string $key * @param int|boolean $t1 optional Effective key length in bits. * @throws \LengthException if the key length isn't supported */ public function setKey($key, $t1 = false) { $this->orig_key = $key; if ($t1 === false) { $t1 = $this->default_key_length; } if ($t1 < 1 || $t1 > 1024) { throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys between 1 and 1024 bits, inclusive, are supported'); } $this->current_key_length = $t1; if (strlen($key) < 1 || strlen($key) > 128) { throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes between 8 and 1024 bits, inclusive, are supported'); } $t = strlen($key); // The mcrypt RC2 implementation only supports effective key length // of 1024 bits. It is however possible to handle effective key // lengths in range 1..1024 by expanding the key and applying // inverse pitable mapping to the first byte before submitting it // to mcrypt. // Key expansion. $l = array_values(unpack('C*', $key)); $t8 = ($t1 + 7) >> 3; $tm = 0xFF >> (8 * $t8 - $t1); // Expand key. $pitable = $this->pitable; for ($i = $t; $i < 128; $i++) { $l[$i] = $pitable[$l[$i - 1] + $l[$i - $t]]; } $i = 128 - $t8; $l[$i] = $pitable[$l[$i] & $tm]; while ($i--) { $l[$i] = $pitable[$l[$i + 1] ^ $l[$i + $t8]]; } // Prepare the key for mcrypt. $l[0] = $this->invpitable[$l[0]]; array_unshift($l, 'C*'); $this->key = call_user_func_array('pack', $l); $this->key_length = strlen($this->key); $this->changed = true; $this->setEngine(); } /** * Encrypts a message. * * Mostly a wrapper for \phpseclib\Crypt\Common\SymmetricKey::encrypt, with some additional OpenSSL handling code * * @see self::decrypt() * @access public * @param string $plaintext * @return string $ciphertext */ public function encrypt($plaintext) { if ($this->engine == self::ENGINE_OPENSSL) { $temp = $this->key; $this->key = $this->orig_key; $result = parent::encrypt($plaintext); $this->key = $temp; return $result; } return parent::encrypt($plaintext); } /** * Decrypts a message. * * Mostly a wrapper for \phpseclib\Crypt\Common\SymmetricKey::decrypt, with some additional OpenSSL handling code * * @see self::encrypt() * @access public * @param string $ciphertext * @return string $plaintext */ public function decrypt($ciphertext) { if ($this->engine == self::ENGINE_OPENSSL) { $temp = $this->key; $this->key = $this->orig_key; $result = parent::decrypt($ciphertext); $this->key = $temp; return $result; } return parent::decrypt($ciphertext); } /** * Encrypts a block * * @see \phpseclib\Crypt\Common\SymmetricKey::encryptBlock() * @see \phpseclib\Crypt\Common\SymmetricKey::encrypt() * @access private * @param string $in * @return string */ protected function encryptBlock($in) { list($r0, $r1, $r2, $r3) = array_values(unpack('v*', $in)); $keys = $this->keys; $limit = 20; $actions = [$limit => 44, 44 => 64]; $j = 0; for (;;) { // Mixing round. $r0 = (($r0 + $keys[$j++] + ((($r1 ^ $r2) & $r3) ^ $r1)) & 0xFFFF) << 1; $r0 |= $r0 >> 16; $r1 = (($r1 + $keys[$j++] + ((($r2 ^ $r3) & $r0) ^ $r2)) & 0xFFFF) << 2; $r1 |= $r1 >> 16; $r2 = (($r2 + $keys[$j++] + ((($r3 ^ $r0) & $r1) ^ $r3)) & 0xFFFF) << 3; $r2 |= $r2 >> 16; $r3 = (($r3 + $keys[$j++] + ((($r0 ^ $r1) & $r2) ^ $r0)) & 0xFFFF) << 5; $r3 |= $r3 >> 16; if ($j === $limit) { if ($limit === 64) { break; } // Mashing round. $r0 += $keys[$r3 & 0x3F]; $r1 += $keys[$r0 & 0x3F]; $r2 += $keys[$r1 & 0x3F]; $r3 += $keys[$r2 & 0x3F]; $limit = $actions[$limit]; } } return pack('vvvv', $r0, $r1, $r2, $r3); } /** * Decrypts a block * * @see \phpseclib\Crypt\Common\SymmetricKey::decryptBlock() * @see \phpseclib\Crypt\Common\SymmetricKey::decrypt() * @access private * @param string $in * @return string */ protected function decryptBlock($in) { list($r0, $r1, $r2, $r3) = array_values(unpack('v*', $in)); $keys = $this->keys; $limit = 44; $actions = [$limit => 20, 20 => 0]; $j = 64; for (;;) { // R-mixing round. $r3 = ($r3 | ($r3 << 16)) >> 5; $r3 = ($r3 - $keys[--$j] - ((($r0 ^ $r1) & $r2) ^ $r0)) & 0xFFFF; $r2 = ($r2 | ($r2 << 16)) >> 3; $r2 = ($r2 - $keys[--$j] - ((($r3 ^ $r0) & $r1) ^ $r3)) & 0xFFFF; $r1 = ($r1 | ($r1 << 16)) >> 2; $r1 = ($r1 - $keys[--$j] - ((($r2 ^ $r3) & $r0) ^ $r2)) & 0xFFFF; $r0 = ($r0 | ($r0 << 16)) >> 1; $r0 = ($r0 - $keys[--$j] - ((($r1 ^ $r2) & $r3) ^ $r1)) & 0xFFFF; if ($j === $limit) { if ($limit === 0) { break; } // R-mashing round. $r3 = ($r3 - $keys[$r2 & 0x3F]) & 0xFFFF; $r2 = ($r2 - $keys[$r1 & 0x3F]) & 0xFFFF; $r1 = ($r1 - $keys[$r0 & 0x3F]) & 0xFFFF; $r0 = ($r0 - $keys[$r3 & 0x3F]) & 0xFFFF; $limit = $actions[$limit]; } } return pack('vvvv', $r0, $r1, $r2, $r3); } /** * Creates the key schedule * * @see \phpseclib\Crypt\Common\SymmetricKey::setupKey() * @access private */ protected function setupKey() { if (!isset($this->key)) { $this->setKey(''); } // Key has already been expanded in \phpseclib\Crypt\RC2::setKey(): // Only the first value must be altered. $l = unpack('Ca/Cb/v*', $this->key); array_unshift($l, $this->pitable[$l['a']] | ($l['b'] << 8)); unset($l['a']); unset($l['b']); $this->keys = $l; } /** * Setup the performance-optimized function for de/encrypt() * * @see \phpseclib\Crypt\Common\SymmetricKey::setupInlineCrypt() * @access private */ protected function setupInlineCrypt() { // Init code for both, encrypt and decrypt. $init_crypt = '$keys = $this->keys;'; $keys = $this->keys; // $in is the current 8 bytes block which has to be en/decrypt $encrypt_block = $decrypt_block = ' $in = unpack("v4", $in); $r0 = $in[1]; $r1 = $in[2]; $r2 = $in[3]; $r3 = $in[4]; '; // Create code for encryption. $limit = 20; $actions = [$limit => 44, 44 => 64]; $j = 0; for (;;) { // Mixing round. $encrypt_block .= ' $r0 = (($r0 + ' . $keys[$j++] . ' + ((($r1 ^ $r2) & $r3) ^ $r1)) & 0xFFFF) << 1; $r0 |= $r0 >> 16; $r1 = (($r1 + ' . $keys[$j++] . ' + ((($r2 ^ $r3) & $r0) ^ $r2)) & 0xFFFF) << 2; $r1 |= $r1 >> 16; $r2 = (($r2 + ' . $keys[$j++] . ' + ((($r3 ^ $r0) & $r1) ^ $r3)) & 0xFFFF) << 3; $r2 |= $r2 >> 16; $r3 = (($r3 + ' . $keys[$j++] . ' + ((($r0 ^ $r1) & $r2) ^ $r0)) & 0xFFFF) << 5; $r3 |= $r3 >> 16;'; if ($j === $limit) { if ($limit === 64) { break; } // Mashing round. $encrypt_block .= ' $r0 += $keys[$r3 & 0x3F]; $r1 += $keys[$r0 & 0x3F]; $r2 += $keys[$r1 & 0x3F]; $r3 += $keys[$r2 & 0x3F];'; $limit = $actions[$limit]; } } $encrypt_block .= '$in = pack("v4", $r0, $r1, $r2, $r3);'; // Create code for decryption. $limit = 44; $actions = [$limit => 20, 20 => 0]; $j = 64; for (;;) { // R-mixing round. $decrypt_block .= ' $r3 = ($r3 | ($r3 << 16)) >> 5; $r3 = ($r3 - ' . $keys[--$j] . ' - ((($r0 ^ $r1) & $r2) ^ $r0)) & 0xFFFF; $r2 = ($r2 | ($r2 << 16)) >> 3; $r2 = ($r2 - ' . $keys[--$j] . ' - ((($r3 ^ $r0) & $r1) ^ $r3)) & 0xFFFF; $r1 = ($r1 | ($r1 << 16)) >> 2; $r1 = ($r1 - ' . $keys[--$j] . ' - ((($r2 ^ $r3) & $r0) ^ $r2)) & 0xFFFF; $r0 = ($r0 | ($r0 << 16)) >> 1; $r0 = ($r0 - ' . $keys[--$j] . ' - ((($r1 ^ $r2) & $r3) ^ $r1)) & 0xFFFF;'; if ($j === $limit) { if ($limit === 0) { break; } // R-mashing round. $decrypt_block .= ' $r3 = ($r3 - $keys[$r2 & 0x3F]) & 0xFFFF; $r2 = ($r2 - $keys[$r1 & 0x3F]) & 0xFFFF; $r1 = ($r1 - $keys[$r0 & 0x3F]) & 0xFFFF; $r0 = ($r0 - $keys[$r3 & 0x3F]) & 0xFFFF;'; $limit = $actions[$limit]; } } $decrypt_block .= '$in = pack("v4", $r0, $r1, $r2, $r3);'; // Creates the inline-crypt function $this->inline_crypt = $this->createInlineCryptFunction( [ 'init_crypt' => $init_crypt, 'encrypt_block' => $encrypt_block, 'decrypt_block' => $decrypt_block ] ); } } <?php /** * Random Number Generator * * PHP version 5 * * Here's a short example of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * echo bin2hex(\phpseclib\Crypt\Random::string(8)); * ?> * </code> * * @category Crypt * @package Random * @author Jim Wigginton <terrafrost@php.net> * @copyright 2007 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt; /** * Pure-PHP Random Number Generator * * @package Random * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Random { /** * Generate a random string. * * Although microoptimizations are generally discouraged as they impair readability this function is ripe with * microoptimizations because this function has the potential of being called a huge number of times. * eg. for RSA key generation. * * @param int $length * @throws \RuntimeException if a symmetric cipher is needed but not loaded * @return string */ public static function string($length) { if (!$length) { return ''; } try { return \random_bytes($length); } catch (\Exception $e) { // random_compat will throw an Exception, which in PHP 5 does not implement Throwable } catch (\Throwable $e) { // If a sufficient source of randomness is unavailable, random_bytes() will throw an // object that implements the Throwable interface (Exception, TypeError, Error). // We don't actually need to do anything here. The string() method should just continue // as normal. Note, however, that if we don't have a sufficient source of randomness for // random_bytes(), most of the other calls here will fail too, so we'll end up using // the PHP implementation. } // at this point we have no choice but to use a pure-PHP CSPRNG // cascade entropy across multiple PHP instances by fixing the session and collecting all // environmental variables, including the previous session data and the current session // data. // // mt_rand seeds itself by looking at the PID and the time, both of which are (relatively) // easy to guess at. linux uses mouse clicks, keyboard timings, etc, as entropy sources, but // PHP isn't low level to be able to use those as sources and on a web server there's not likely // going to be a ton of keyboard or mouse action. web servers do have one thing that we can use // however, a ton of people visiting the website. obviously you don't want to base your seeding // soley on parameters a potential attacker sends but (1) not everything in $_SERVER is controlled // by the user and (2) this isn't just looking at the data sent by the current user - it's based // on the data sent by all users. one user requests the page and a hash of their info is saved. // another user visits the page and the serialization of their data is utilized along with the // server envirnment stuff and a hash of the previous http request data (which itself utilizes // a hash of the session data before that). certainly an attacker should be assumed to have // full control over his own http requests. he, however, is not going to have control over // everyone's http requests. static $crypto = false, $v; if ($crypto === false) { // save old session data $old_session_id = session_id(); $old_use_cookies = ini_get('session.use_cookies'); $old_session_cache_limiter = session_cache_limiter(); $_OLD_SESSION = isset($_SESSION) ? $_SESSION : false; if ($old_session_id != '') { session_write_close(); } session_id(1); ini_set('session.use_cookies', 0); session_cache_limiter(''); session_start(); $v = (isset($_SERVER) ? self::safe_serialize($_SERVER) : '') . (isset($_POST) ? self::safe_serialize($_POST) : '') . (isset($_GET) ? self::safe_serialize($_GET) : '') . (isset($_COOKIE) ? self::safe_serialize($_COOKIE) : '') . self::safe_serialize($GLOBALS) . self::safe_serialize($_SESSION) . self::safe_serialize($_OLD_SESSION); $v = $seed = $_SESSION['seed'] = sha1($v, true); if (!isset($_SESSION['count'])) { $_SESSION['count'] = 0; } $_SESSION['count']++; session_write_close(); // restore old session data if ($old_session_id != '') { session_id($old_session_id); session_start(); ini_set('session.use_cookies', $old_use_cookies); session_cache_limiter($old_session_cache_limiter); } else { if ($_OLD_SESSION !== false) { $_SESSION = $_OLD_SESSION; unset($_OLD_SESSION); } else { unset($_SESSION); } } // in SSH2 a shared secret and an exchange hash are generated through the key exchange process. // the IV client to server is the hash of that "nonce" with the letter A and for the encryption key it's the letter C. // if the hash doesn't produce enough a key or an IV that's long enough concat successive hashes of the // original hash and the current hash. we'll be emulating that. for more info see the following URL: // // http://tools.ietf.org/html/rfc4253#section-7.2 // // see the is_string($crypto) part for an example of how to expand the keys $key = sha1($seed . 'A', true); $iv = sha1($seed . 'C', true); // ciphers are used as per the nist.gov link below. also, see this link: // // http://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator#Designs_based_on_cryptographic_primitives switch (true) { case class_exists('\phpseclib\Crypt\AES'): $crypto = new AES('ctr'); break; case class_exists('\phpseclib\Crypt\Twofish'): $crypto = new Twofish('ctr'); break; case class_exists('\phpseclib\Crypt\Blowfish'): $crypto = new Blowfish('ctr'); break; case class_exists('\phpseclib\Crypt\TripleDES'): $crypto = new TripleDES('ctr'); break; case class_exists('\phpseclib\Crypt\DES'): $crypto = new DES('ctr'); break; case class_exists('\phpseclib\Crypt\RC4'): $crypto = new RC4(); break; default: throw new \RuntimeException(__CLASS__ . ' requires at least one symmetric cipher be loaded'); } $crypto->setKey(substr($key, 0, $crypto->getKeyLength() >> 3)); $crypto->setIV(substr($iv, 0, $crypto->getBlockLength() >> 3)); $crypto->enableContinuousBuffer(); } //return $crypto->encrypt(str_repeat("\0", $length)); // the following is based off of ANSI X9.31: // // http://csrc.nist.gov/groups/STM/cavp/documents/rng/931rngext.pdf // // OpenSSL uses that same standard for it's random numbers: // // http://www.opensource.apple.com/source/OpenSSL/OpenSSL-38/openssl/fips-1.0/rand/fips_rand.c // (do a search for "ANS X9.31 A.2.4") $result = ''; while (strlen($result) < $length) { $i = $crypto->encrypt(microtime()); // strlen(microtime()) == 21 $r = $crypto->encrypt($i ^ $v); // strlen($v) == 20 $v = $crypto->encrypt($r ^ $i); // strlen($r) == 20 $result.= $r; } return substr($result, 0, $length); } /** * Safely serialize variables * * If a class has a private __sleep() it'll emit a warning * @return mixed * @param mixed $arr */ private static function safe_serialize(&$arr) { if (is_object($arr)) { return ''; } if (!is_array($arr)) { return serialize($arr); } // prevent circular array recursion if (isset($arr['__phpseclib_marker'])) { return ''; } $safearr = []; $arr['__phpseclib_marker'] = true; foreach (array_keys($arr) as $key) { // do not recurse on the '__phpseclib_marker' key itself, for smaller memory usage if ($key !== '__phpseclib_marker') { $safearr[$key] = self::safe_serialize($arr[$key]); } } unset($arr['__phpseclib_marker']); return serialize($safearr); } } <?php /** * Base Class for all \phpseclib\Crypt\* cipher classes * * PHP version 5 * * Internally for phpseclib developers: * If you plan to add a new cipher class, please note following rules: * * - The new \phpseclib\Crypt\* cipher class should extend \phpseclib\Crypt\Common\SymmetricKey * * - Following methods are then required to be overridden/overloaded: * * - encryptBlock() * * - decryptBlock() * * - setupKey() * * - All other methods are optional to be overridden/overloaded * * - Look at the source code of the current ciphers how they extend \phpseclib\Crypt\Common\SymmetricKey * and take one of them as a start up for the new cipher class. * * - Please read all the other comments/notes/hints here also for each class var/method * * @category Crypt * @package Base * @author Jim Wigginton <terrafrost@php.net> * @author Hans-Juergen Petrich <petrich@tronic-media.com> * @copyright 2007 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\Common; use phpseclib\Crypt\Hash; use phpseclib\Common\Functions\Strings; use phpseclib\Math\BigInteger; /** * Base Class for all \phpseclib\Crypt\* cipher classes * * @package Base * @author Jim Wigginton <terrafrost@php.net> * @author Hans-Juergen Petrich <petrich@tronic-media.com> */ abstract class SymmetricKey { /**#@+ * @access public * @see \phpseclib\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib\Crypt\Common\SymmetricKey::decrypt() */ /** * Encrypt / decrypt using the Counter mode. * * Set to -1 since that's what Crypt/Random.php uses to index the CTR mode. * * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29 */ const MODE_CTR = -1; /** * Encrypt / decrypt using the Electronic Code Book mode. * * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29 */ const MODE_ECB = 1; /** * Encrypt / decrypt using the Code Book Chaining mode. * * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29 */ const MODE_CBC = 2; /** * Encrypt / decrypt using the Cipher Feedback mode. * * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29 */ const MODE_CFB = 3; /** * Encrypt / decrypt using the Cipher Feedback mode (8bit) */ const MODE_CFB8 = 38; /** * Encrypt / decrypt using the Output Feedback mode. * * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29 */ const MODE_OFB = 4; /** * Encrypt / decrypt using streaming mode. */ const MODE_STREAM = 5; /** * Encrypt / decrypt using the Infinite Garble Extension mode. */ const MODE_IGE = 6; /**#@-*/ /** * Mode Map * * @access private * @see \phpseclib\Crypt\Common\SymmetricKey::__construct() */ const MODE_MAP = [ 'ctr' => self::MODE_CTR, 'ecb' => self::MODE_ECB, 'cbc' => self::MODE_CBC, 'cfb' => self::MODE_CFB, 'cfb8' => self::MODE_CFB8, 'ofb' => self::MODE_OFB, 'ige' => self::MODE_IGE, 'stream' => self::MODE_STREAM ]; /**#@+ * @access private * @see \phpseclib\Crypt\Common\SymmetricKey::__construct() */ /** * Base value for the internal implementation $engine switch */ const ENGINE_INTERNAL = 1; /** * Base value for the eval() implementation $engine switch */ const ENGINE_EVAL = 2; /** * Base value for the mcrypt implementation $engine switch */ const ENGINE_MCRYPT = 3; /** * Base value for the mcrypt implementation $engine switch */ const ENGINE_OPENSSL = 4; /**#@-*/ /** * Engine Reverse Map * * @access private * @see \phpseclib\Crypt\Common\SymmetricKey::getEngine() */ const ENGINE_MAP = [ self::ENGINE_INTERNAL => 'PHP', self::ENGINE_EVAL => 'Eval', self::ENGINE_MCRYPT => 'mcrypt', self::ENGINE_OPENSSL => 'OpenSSL' ]; /** * The Encryption Mode * * @see self::__construct() * @var int * @access private */ protected $mode; /** * The Block Length of the block cipher * * @var int * @access private */ protected $block_size = 16; /** * The IV Length of the block cipher * * @var int * @access private */ protected $iv_size = 16; /** * The Key * * @see self::setKey() * @var string * @access private */ protected $key = false; /** * The Initialization Vector * * @see self::setIV() * @var string * @access private */ private $iv = false; /** * A "sliding" Initialization Vector * * @see self::enableContinuousBuffer() * @see self::clearBuffers() * @var string * @access private */ protected $encryptIV; /** * A "sliding" Initialization Vector * * @see self::enableContinuousBuffer() * @see self::clearBuffers() * @var string * @access private */ protected $decryptIV; /** * Continuous Buffer status * * @see self::enableContinuousBuffer() * @var bool * @access private */ protected $continuousBuffer = false; /** * Encryption buffer for CTR, OFB and CFB modes * * @see self::encrypt() * @see self::clearBuffers() * @var array * @access private */ private $enbuffer; /** * Decryption buffer for CTR, OFB and CFB modes * * @see self::decrypt() * @see self::clearBuffers() * @var array * @access private */ private $debuffer; /** * mcrypt resource for encryption * * The mcrypt resource can be recreated every time something needs to be created or it can be created just once. * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode. * * @see self::encrypt() * @var resource * @access private */ private $enmcrypt; /** * mcrypt resource for decryption * * The mcrypt resource can be recreated every time something needs to be created or it can be created just once. * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode. * * @see self::decrypt() * @var resource * @access private */ private $demcrypt; /** * Does the enmcrypt resource need to be (re)initialized? * * @see \phpseclib\Crypt\Twofish::setKey() * @see \phpseclib\Crypt\Twofish::setIV() * @var bool * @access private */ private $enchanged = true; /** * Does the demcrypt resource need to be (re)initialized? * * @see \phpseclib\Crypt\Twofish::setKey() * @see \phpseclib\Crypt\Twofish::setIV() * @var bool * @access private */ private $dechanged = true; /** * mcrypt resource for CFB mode * * mcrypt's CFB mode, in (and only in) buffered context, * is broken, so phpseclib implements the CFB mode by it self, * even when the mcrypt php extension is available. * * In order to do the CFB-mode work (fast) phpseclib * use a separate ECB-mode mcrypt resource. * * @link http://phpseclib.sourceforge.net/cfb-demo.phps * @see self::encrypt() * @see self::decrypt() * @see self::setupMcrypt() * @var resource * @access private */ private $ecb; /** * Optimizing value while CFB-encrypting * * Only relevant if $continuousBuffer enabled * and $engine == self::ENGINE_MCRYPT * * It's faster to re-init $enmcrypt if * $buffer bytes > $cfb_init_len than * using the $ecb resource furthermore. * * This value depends of the chosen cipher * and the time it would be needed for it's * initialization [by mcrypt_generic_init()] * which, typically, depends on the complexity * on its internaly Key-expanding algorithm. * * @see self::encrypt() * @var int * @access private */ protected $cfb_init_len = 600; /** * Does internal cipher state need to be (re)initialized? * * @see self::setKey() * @see self::setIV() * @see self::disableContinuousBuffer() * @var bool * @access private */ protected $changed = true; /** * Padding status * * @see self::enablePadding() * @var bool * @access private */ private $padding = true; /** * Is the mode one that is paddable? * * @see self::__construct() * @var bool * @access private */ private $paddable = false; /** * Holds which crypt engine internaly should be use, * which will be determined automatically on __construct() * * Currently available $engines are: * - self::ENGINE_OPENSSL (very fast, php-extension: openssl, extension_loaded('openssl') required) * - self::ENGINE_MCRYPT (fast, php-extension: mcrypt, extension_loaded('mcrypt') required) * - self::ENGINE_EVAL (medium, pure php-engine, no php-extension required) * - self::ENGINE_INTERNAL (slower, pure php-engine, no php-extension required) * * @see self::setEngine() * @see self::encrypt() * @see self::decrypt() * @var int * @access private */ protected $engine; /** * Holds the preferred crypt engine * * @see self::setEngine() * @see self::setPreferredEngine() * @var int * @access private */ private $preferredEngine; /** * The mcrypt specific name of the cipher * * Only used if $engine == self::ENGINE_MCRYPT * * @link http://www.php.net/mcrypt_module_open * @link http://www.php.net/mcrypt_list_algorithms * @see self::setupMcrypt() * @var string * @access private */ protected $cipher_name_mcrypt; /** * The openssl specific name of the cipher * * Only used if $engine == self::ENGINE_OPENSSL * * @link http://www.php.net/openssl-get-cipher-methods * @var string * @access private */ protected $cipher_name_openssl; /** * The openssl specific name of the cipher in ECB mode * * If OpenSSL does not support the mode we're trying to use (CTR) * it can still be emulated with ECB mode. * * @link http://www.php.net/openssl-get-cipher-methods * @var string * @access private */ protected $cipher_name_openssl_ecb; /** * The default salt used by setPassword() * * @see self::setPassword() * @var string * @access private */ private $password_default_salt = 'phpseclib/salt'; /** * The name of the performance-optimized callback function * * Used by encrypt() / decrypt() * only if $engine == self::ENGINE_INTERNAL * * @see self::encrypt() * @see self::decrypt() * @see self::setupInlineCrypt() * @see self::$use_inline_crypt * @var Callback * @access private */ protected $inline_crypt; /** * Holds whether performance-optimized $inline_crypt() can/should be used. * * @see self::encrypt() * @see self::decrypt() * @see self::inline_crypt * @var mixed * @access private */ protected $use_inline_crypt; /** * If OpenSSL can be used in ECB but not in CTR we can emulate CTR * * @see self::openssl_ctr_process() * @var bool * @access private */ private $openssl_emulate_ctr = false; /** * Don't truncate / null pad key * * @see self::clearBuffers() * @var bool * @access private */ private $skip_key_adjustment = false; /** * Has the key length explicitly been set or should it be derived from the key, itself? * * @see self::setKeyLength() * @var bool * @access private */ protected $explicit_key_length = false; /** * Default Constructor. * * $mode could be: * * - ecb * * - cbc * * - ctr * * - cfb * * - ofb * * - ige * * @param string $mode * @access public * @throws \InvalidArgumentException if an invalid / unsupported mode is provided */ public function __construct($mode) { $mode = strtolower($mode); // necessary because of 5.6 compatability; we can't do isset(self::MODE_MAP[$mode]) in 5.6 $map = self::MODE_MAP; if (!isset($map[$mode])) { throw new \InvalidArgumentException('No valid mode has been specified'); } $mode = self::MODE_MAP[$mode]; // $mode dependent settings switch ($mode) { case self::MODE_ECB: case self::MODE_CBC: $this->paddable = true; break; case self::MODE_IGE: $this->iv_size = $this->block_size*2; case self::MODE_CTR: case self::MODE_CFB: case self::MODE_CFB8: case self::MODE_OFB: case self::MODE_STREAM: $this->paddable = false; break; default: throw new \InvalidArgumentException('No valid mode has been specified'); } $this->mode = $mode; } /** * Sets the initialization vector. * * setIV() is not required when self::MODE_ECB (or ie for AES: \phpseclib\Crypt\AES::MODE_ECB) is being used. * * @access public * @param string $iv * @throws \LengthException if the IV length isn't equal to the block size * @throws \InvalidArgumentException if an IV is provided when one shouldn't be * @internal Can be overwritten by a sub class, but does not have to be */ public function setIV($iv) { if ($this->mode == self::MODE_ECB) { throw new \InvalidArgumentException('This mode does not require an IV.'); } if (!$this->usesIV()) { throw new \InvalidArgumentException('This algorithm does not use an IV.'); } if (strlen($iv) != $this->iv_size) { throw new \LengthException('Received initialization vector of size ' . strlen($iv) . ', but size ' . $this->iv_size. ' is required'); } $this->iv = $iv; $this->changed = true; } /** * Returns whether or not the algorithm uses an IV * * @access public * @return bool */ public function usesIV() { return true; } /** * Returns the current key length in bits * * @access public * @return int */ public function getKeyLength() { return $this->key_length << 3; } /** * Returns the current block length in bits * * @access public * @return int */ public function getBlockLength() { return $this->block_size << 3; } /** * Returns the current block length in bytes * * @access public * @return int */ public function getBlockLengthInBytes() { return $this->block_size; } /** * Sets the key length. * * Keys with explicitly set lengths need to be treated accordingly * * @access public * @param int $length */ public function setKeyLength($length) { $this->explicit_key_length = $length >> 3; if (is_string($this->key) && strlen($this->key) != $this->explicit_key_length) { $this->key = false; throw new \LengthException('Key has already been set and is not ' .$this->explicit_key_length . ' bytes long'); } } /** * Sets the key. * * The min/max length(s) of the key depends on the cipher which is used. * If the key not fits the length(s) of the cipher it will paded with null bytes * up to the closest valid key length. If the key is more than max length, * we trim the excess bits. * * If the key is not explicitly set, it'll be assumed to be all null bytes. * * @access public * @param string $key * @internal Could, but not must, extend by the child Crypt_* class */ public function setKey($key) { if ($this->explicit_key_length !== false && strlen($key) != $this->explicit_key_length) { throw new \LengthException('Key length has already been set to ' . $this->explicit_key_length . ' bytes and this key is ' . strlen($key) . ' bytes'); } $this->key = $key; $this->key_length = strlen($key); $this->changed = true; $this->setEngine(); } /** * Sets the password. * * Depending on what $method is set to, setPassword()'s (optional) parameters are as follows: * {@link http://en.wikipedia.org/wiki/PBKDF2 pbkdf2} or pbkdf1: * $hash, $salt, $count, $dkLen * * Where $hash (default = sha1) currently supports the following hashes: see: Crypt/Hash.php * * @see Crypt/Hash.php * @param string $password * @param string $method * @param $func_args[] * @throws \LengthException if pbkdf1 is being used and the derived key length exceeds the hash length * @return bool * @access public * @internal Could, but not must, extend by the child Crypt_* class */ public function setPassword($password, $method = 'pbkdf2',...$func_args) { $key = ''; $method = strtolower($method); switch ($method) { case 'pkcs12': // from https://tools.ietf.org/html/rfc7292#appendix-B.2 case 'pbkdf1': case 'pbkdf2': // Hash function $hash = isset($func_args[0]) ? strtolower($func_args[0]) : 'sha1'; $hashObj = new Hash(); $hashObj->setHash($hash); // WPA and WPA2 use the SSID as the salt $salt = isset($func_args[1]) ? $func_args[1] : $this->password_default_salt; // RFC2898#section-4.2 uses 1,000 iterations by default // WPA and WPA2 use 4,096. $count = isset($func_args[2]) ? $func_args[2] : 1000; // Keylength if (isset($func_args[3])) { $dkLen = $func_args[3]; } else { $key_length = $this->explicit_key_length !== false ? $this->explicit_key_length : $this->key_length; $dkLen = $method == 'pbkdf1' ? 2 * $key_length : $key_length; } switch (true) { case $method == 'pkcs12': /* In this specification, however, all passwords are created from BMPStrings with a NULL terminator. This means that each character in the original BMPString is encoded in 2 bytes in big-endian format (most-significant byte first). There are no Unicode byte order marks. The 2 bytes produced from the last character in the BMPString are followed by 2 additional bytes with the value 0x00. -- https://tools.ietf.org/html/rfc7292#appendix-B.1 */ $password = "\0". chunk_split($password, 1, "\0") . "\0"; /* This standard specifies 3 different values for the ID byte mentioned above: 1. If ID=1, then the pseudorandom bits being produced are to be used as key material for performing encryption or decryption. 2. If ID=2, then the pseudorandom bits being produced are to be used as an IV (Initial Value) for encryption or decryption. 3. If ID=3, then the pseudorandom bits being produced are to be used as an integrity key for MACing. */ // Construct a string, D (the "diversifier"), by concatenating v/8 // copies of ID. $blockLength = $hashObj->getBlockLengthInBytes(); $d1 = str_repeat(chr(1), $blockLength); $d2 = str_repeat(chr(2), $blockLength); $s = ''; if (strlen($salt)) { while (strlen($s) < $blockLength) { $s.= $salt; } } $s = substr($s, 0, $blockLength); $p = ''; if (strlen($password)) { while (strlen($p) < $blockLength) { $p.= $password; } } $p = substr($p, 0, $blockLength); $i = $s . $p; $this->setKey(self::pkcs12helper($dkLen, $hashObj, $i, $d1, $count)); if ($this->usesIV()) { $this->setIV(self::pkcs12helper($this->block_size, $hashObj, $i, $d2, $count)); } return true; case $method == 'pbkdf1': if ($dkLen > $hashObj->getLengthInBytes()) { throw new \LengthException('Derived key length cannot be longer than the hash length'); } $t = $password . $salt; for ($i = 0; $i < $count; ++$i) { $t = $hashObj->hash($t); } $key = substr($t, 0, $dkLen); $this->setKey(substr($key, 0, $dkLen >> 1)); if ($this->usesIV()) { $this->setIV(substr($key, $dkLen >> 1)); } return true; case !function_exists('hash_pbkdf2'): case !function_exists('hash_algos'): case !in_array($hash, hash_algos()): $i = 1; $hashObj->setKey($password); while (strlen($key) < $dkLen) { $f = $u = $hashObj->hash($salt . pack('N', $i++)); for ($j = 2; $j <= $count; ++$j) { $u = $hashObj->hash($u); $f^= $u; } $key.= $f; } $key = substr($key, 0, $dkLen); break; default: $key = hash_pbkdf2($hash, $password, $salt, $count, $dkLen, true); } break; default: throw new \InvalidArgumentException($method . ' is not a supported password hashing method'); } $this->setKey($key); return true; } /** * PKCS#12 KDF Helper Function * * As discussed here: * * {@link https://tools.ietf.org/html/rfc7292#appendix-B} * * @see self::setPassword() * @access private * @param int $n * @param \phpseclib\Crypt\Hash $hashObj * @param string $i * @param string $d * @param int $count * @return string $a */ private static function pkcs12helper($n, $hashObj, $i, $d, $count) { static $one; if (!isset($one)) { $one = new BigInteger(1); } $blockLength = $hashObj->getBlockLength() >> 3; $c = ceil($n / $hashObj->getLengthInBytes()); $a = ''; for ($j = 1; $j <= $c; $j++) { $ai = $d . $i; for ($k = 0; $k < $count; $k++) { $ai = $hashObj->hash($ai); } $b = ''; while (strlen($b) < $blockLength) { $b.= $ai; } $b = substr($b, 0, $blockLength); $b = new BigInteger($b, 256); $newi = ''; for ($k = 0; $k < strlen($i); $k+= $blockLength) { $temp = substr($i, $k, $blockLength); $temp = new BigInteger($temp, 256); $temp->setPrecision($blockLength << 3); $temp = $temp->add($b); $temp = $temp->add($one); $newi.= $temp->toBytes(false); } $i = $newi; $a.= $ai; } return substr($a, 0, $n); } /** * Encrypts a message. * * $plaintext will be padded with additional bytes such that it's length is a multiple of the block size. Other cipher * implementations may or may not pad in the same manner. Other common approaches to padding and the reasons why it's * necessary are discussed in the following * URL: * * {@link http://www.di-mgt.com.au/cryptopad.html http://www.di-mgt.com.au/cryptopad.html} * * An alternative to padding is to, separately, send the length of the file. This is what SSH, in fact, does. * strlen($plaintext) will still need to be a multiple of the block size, however, arbitrary values can be added to make it that * length. * * @see self::decrypt() * @access public * @param string $plaintext * @return string $ciphertext * @internal Could, but not must, extend by the child Crypt_* class */ public function encrypt($plaintext) { if ($this->paddable) { $plaintext = $this->pad($plaintext); } if ($this->engine === self::ENGINE_OPENSSL) { if ($this->changed) { $this->clearBuffers(); $this->changed = false; } switch ($this->mode) { case self::MODE_STREAM: return openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); case self::MODE_ECB: return openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); case self::MODE_CBC: $result = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $this->encryptIV); if ($this->continuousBuffer) { $this->encryptIV = substr($result, -$this->block_size); } return $result; case self::MODE_CTR: return $this->openssl_ctr_process($plaintext, $this->encryptIV, $this->enbuffer); case self::MODE_IGE: $ciphertext = ''; $iv_part_1 = substr($this->encryptIV, 0, $this->block_size); $iv_part_2 = substr($this->encryptIV, $this->block_size); for ($i = 0; $i < strlen($plaintext); $i += $this->block_size) { $indata = substr($plaintext, $i, $this->block_size); $outdata = openssl_encrypt($indata ^ $iv_part_1, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING) ^ $iv_part_2; $iv_part_1 = $outdata; $iv_part_2 = $indata; $ciphertext .= $outdata; } if ($this->continuousBuffer) { $this->encryptIV = $iv_part_1.$iv_part_2; } return $ciphertext; case self::MODE_CFB: // cfb loosely routines inspired by openssl's: // {@link http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1} $ciphertext = ''; if ($this->continuousBuffer) { $iv = &$this->encryptIV; $pos = &$this->enbuffer['pos']; } else { $iv = $this->encryptIV; $pos = 0; } $len = strlen($plaintext); $i = 0; if ($pos) { $orig_pos = $pos; $max = $this->block_size - $pos; if ($len >= $max) { $i = $max; $len-= $max; $pos = 0; } else { $i = $len; $pos+= $len; $len = 0; } // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize $ciphertext = substr($iv, $orig_pos) ^ $plaintext; $iv = substr_replace($iv, $ciphertext, $orig_pos, $i); $plaintext = substr($plaintext, $i); } $overflow = $len % $this->block_size; if ($overflow) { $ciphertext.= openssl_encrypt(substr($plaintext, 0, -$overflow) . str_repeat("\0", $this->block_size), $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv); $iv = Strings::pop($ciphertext, $this->block_size); $size = $len - $overflow; $block = $iv ^ substr($plaintext, -$overflow); $iv = substr_replace($iv, $block, 0, $overflow); $ciphertext.= $block; $pos = $overflow; } elseif ($len) { $ciphertext = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv); $iv = substr($ciphertext, -$this->block_size); } return $ciphertext; case self::MODE_CFB8: $ciphertext = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $this->encryptIV); if ($this->continuousBuffer) { if (($len = strlen($ciphertext)) >= $this->block_size) { $this->encryptIV = substr($ciphertext, -$this->block_size); } else { $this->encryptIV = substr($this->encryptIV, $len - $this->block_size) . substr($ciphertext, -$len); } } return $ciphertext; case self::MODE_OFB: return $this->openssl_ofb_process($plaintext, $this->encryptIV, $this->enbuffer); } } if ($this->engine === self::ENGINE_MCRYPT) { if ($this->changed) { $this->setupMcrypt(); $this->changed = false; } if ($this->enchanged) { @mcrypt_generic_init($this->enmcrypt, $this->key, $this->getIV($this->encryptIV)); $this->enchanged = false; } // re: {@link http://phpseclib.sourceforge.net/cfb-demo.phps} // using mcrypt's default handing of CFB the above would output two different things. using phpseclib's // rewritten CFB implementation the above outputs the same thing twice. if ($this->mode == self::MODE_CFB && $this->continuousBuffer) { $block_size = $this->block_size; $iv = &$this->encryptIV; $pos = &$this->enbuffer['pos']; $len = strlen($plaintext); $ciphertext = ''; $i = 0; if ($pos) { $orig_pos = $pos; $max = $block_size - $pos; if ($len >= $max) { $i = $max; $len-= $max; $pos = 0; } else { $i = $len; $pos+= $len; $len = 0; } $ciphertext = substr($iv, $orig_pos) ^ $plaintext; $iv = substr_replace($iv, $ciphertext, $orig_pos, $i); $this->enbuffer['enmcrypt_init'] = true; } if ($len >= $block_size) { if ($this->enbuffer['enmcrypt_init'] === false || $len > $this->cfb_init_len) { if ($this->enbuffer['enmcrypt_init'] === true) { @mcrypt_generic_init($this->enmcrypt, $this->key, $iv); $this->enbuffer['enmcrypt_init'] = false; } $ciphertext.= @mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % $block_size)); $iv = substr($ciphertext, -$block_size); $len%= $block_size; } else { while ($len >= $block_size) { $iv = @mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, $block_size); $ciphertext.= $iv; $len-= $block_size; $i+= $block_size; } } } if ($len) { $iv = @mcrypt_generic($this->ecb, $iv); $block = $iv ^ substr($plaintext, -$len); $iv = substr_replace($iv, $block, 0, $len); $ciphertext.= $block; $pos = $len; } return $ciphertext; } if ($this->mode === self::MODE_IGE) { $ciphertext = ''; $iv_part_1 = substr($this->encryptIV, 0, $this->block_size); $iv_part_2 = substr($this->encryptIV, $this->block_size); for ($i = 0; $i < strlen($plaintext); $i += $this->block_size) { $indata = substr($plaintext, $i, $this->block_size); $outdata = @mcrypt_generic($this->enmcrypt, $indata ^ $iv_part_1) ^ $iv_part_2; $iv_part_1 = $outdata; $iv_part_2 = $indata; $ciphertext .= $outdata; } if ($this->continuousBuffer) { $this->encryptIV = $iv_part_1.$iv_part_2; } return $ciphertext; } $ciphertext = @mcrypt_generic($this->enmcrypt, $plaintext); if (!$this->continuousBuffer) { @mcrypt_generic_init($this->enmcrypt, $this->key, $this->getIV($this->encryptIV)); } return $ciphertext; } if ($this->changed) { $this->setup(); $this->changed = false; } if ($this->engine === self::ENGINE_EVAL) { $inline = $this->inline_crypt; return $inline('encrypt', $plaintext); } $buffer = &$this->enbuffer; $block_size = $this->block_size; $ciphertext = ''; switch ($this->mode) { case self::MODE_ECB: for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { $ciphertext.= $this->encryptBlock(substr($plaintext, $i, $block_size)); } break; case self::MODE_IGE: $iv_part_1 = substr($this->encryptIV, 0, $this->block_size); $iv_part_2 = substr($this->encryptIV, $this->block_size); for ($i = 0; $i < strlen($plaintext); $i += $this->block_size) { $indata = substr($plaintext, $i, $this->block_size); $outdata = $this->encryptBlock($indata ^ $iv_part_1) ^ $iv_part_2; $iv_part_1 = $outdata; $iv_part_2 = $indata; $ciphertext .= $outdata; } if ($this->continuousBuffer) { $this->encryptIV = $iv_part_1.$iv_part_2; } break; case self::MODE_CBC: $xor = $this->encryptIV; for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { $block = substr($plaintext, $i, $block_size); $block = $this->encryptBlock($block ^ $xor); $xor = $block; $ciphertext.= $block; } if ($this->continuousBuffer) { $this->encryptIV = $xor; } break; case self::MODE_CTR: $xor = $this->encryptIV; if (strlen($buffer['ciphertext'])) { for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { $block = substr($plaintext, $i, $block_size); if (strlen($block) > strlen($buffer['ciphertext'])) { $buffer['ciphertext'].= $this->encryptBlock($xor); } $this->increment_str($xor); $key = Strings::shift($buffer['ciphertext'], $block_size); $ciphertext.= $block ^ $key; } } else { for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { $block = substr($plaintext, $i, $block_size); $key = $this->encryptBlock($xor); $this->increment_str($xor); $ciphertext.= $block ^ $key; } } if ($this->continuousBuffer) { $this->encryptIV = $xor; if ($start = strlen($plaintext) % $block_size) { $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext']; } } break; case self::MODE_CFB: // cfb loosely routines inspired by openssl's: // {@link http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1} if ($this->continuousBuffer) { $iv = &$this->encryptIV; $pos = &$buffer['pos']; } else { $iv = $this->encryptIV; $pos = 0; } $len = strlen($plaintext); $i = 0; if ($pos) { $orig_pos = $pos; $max = $block_size - $pos; if ($len >= $max) { $i = $max; $len-= $max; $pos = 0; } else { $i = $len; $pos+= $len; $len = 0; } // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize $ciphertext = substr($iv, $orig_pos) ^ $plaintext; $iv = substr_replace($iv, $ciphertext, $orig_pos, $i); } while ($len >= $block_size) { $iv = $this->encryptBlock($iv) ^ substr($plaintext, $i, $block_size); $ciphertext.= $iv; $len-= $block_size; $i+= $block_size; } if ($len) { $iv = $this->encryptBlock($iv); $block = $iv ^ substr($plaintext, $i); $iv = substr_replace($iv, $block, 0, $len); $ciphertext.= $block; $pos = $len; } break; case self::MODE_CFB8: $ciphertext = ''; $len = strlen($plaintext); $iv = $this->encryptIV; for ($i = 0; $i < $len; ++$i) { $ciphertext .= ($c = $plaintext[$i] ^ $this->encryptBlock($iv)); $iv = substr($iv, 1) . $c; } if ($this->continuousBuffer) { if ($len >= $block_size) { $this->encryptIV = substr($ciphertext, -$block_size); } else { $this->encryptIV = substr($this->encryptIV, $len - $block_size) . substr($ciphertext, -$len); } } break; case self::MODE_OFB: $xor = $this->encryptIV; if (strlen($buffer['xor'])) { for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { $block = substr($plaintext, $i, $block_size); if (strlen($block) > strlen($buffer['xor'])) { $xor = $this->encryptBlock($xor); $buffer['xor'].= $xor; } $key = Strings::shift($buffer['xor'], $block_size); $ciphertext.= $block ^ $key; } } else { for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { $xor = $this->encryptBlock($xor); $ciphertext.= substr($plaintext, $i, $block_size) ^ $xor; } $key = $xor; } if ($this->continuousBuffer) { $this->encryptIV = $xor; if ($start = strlen($plaintext) % $block_size) { $buffer['xor'] = substr($key, $start) . $buffer['xor']; } } break; case self::MODE_STREAM: $ciphertext = $this->encryptBlock($plaintext); break; } return $ciphertext; } /** * Decrypts a message. * * If strlen($ciphertext) is not a multiple of the block size, null bytes will be added to the end of the string until * it is. * * @see self::encrypt() * @access public * @param string $ciphertext * @return string $plaintext * @throws \LengthException if we're inside a block cipher and the ciphertext length is not a multiple of the block size * @internal Could, but not must, extend by the child Crypt_* class */ public function decrypt($ciphertext) { if ($this->paddable && strlen($ciphertext) % $this->block_size) { throw new \LengthException('The ciphertext length (' . strlen($ciphertext) . ') needs to be a multiple of the block size (' . $this->block_size . ')'); } if ($this->engine === self::ENGINE_OPENSSL) { if ($this->changed) { $this->clearBuffers(); $this->changed = false; } switch ($this->mode) { case self::MODE_STREAM: $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); break; case self::MODE_ECB: $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); break; case self::MODE_CBC: $offset = $this->block_size; $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $this->decryptIV); if ($this->continuousBuffer) { $this->decryptIV = substr($ciphertext, -$offset, $this->block_size); } break; case self::MODE_IGE: $plaintext = ''; $iv_part_1 = substr($this->decryptIV, 0, $this->block_size); $iv_part_2 = substr($this->decryptIV, $this->block_size); for ($i = 0; $i < strlen($ciphertext); $i += $this->block_size) { $indata = substr($ciphertext, $i, $this->block_size); $outdata = openssl_decrypt($indata ^ $iv_part_2, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING) ^ $iv_part_1; $iv_part_1 = $indata; $iv_part_2 = $outdata; $plaintext .= $outdata; } if ($this->continuousBuffer) { $this->decryptIV = $iv_part_1.$iv_part_2; } break; case self::MODE_CTR: $plaintext = $this->openssl_ctr_process($ciphertext, $this->decryptIV, $this->debuffer); break; case self::MODE_CFB: // cfb loosely routines inspired by openssl's: // {@link http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1} $plaintext = ''; if ($this->continuousBuffer) { $iv = &$this->decryptIV; $pos = &$this->buffer['pos']; } else { $iv = $this->decryptIV; $pos = 0; } $len = strlen($ciphertext); $i = 0; if ($pos) { $orig_pos = $pos; $max = $this->block_size - $pos; if ($len >= $max) { $i = $max; $len-= $max; $pos = 0; } else { $i = $len; $pos+= $len; $len = 0; } // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $this->blocksize $plaintext = substr($iv, $orig_pos) ^ $ciphertext; $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i); $ciphertext = substr($ciphertext, $i); } $overflow = $len % $this->block_size; if ($overflow) { $plaintext.= openssl_decrypt(substr($ciphertext, 0, -$overflow), $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv); if ($len - $overflow) { $iv = substr($ciphertext, -$overflow - $this->block_size, -$overflow); } $iv = openssl_encrypt(str_repeat("\0", $this->block_size), $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv); $plaintext.= $iv ^ substr($ciphertext, -$overflow); $iv = substr_replace($iv, substr($ciphertext, -$overflow), 0, $overflow); $pos = $overflow; } elseif ($len) { $plaintext.= openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv); $iv = substr($ciphertext, -$this->block_size); } break; case self::MODE_CFB8: $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $this->decryptIV); if ($this->continuousBuffer) { if (($len = strlen($ciphertext)) >= $this->block_size) { $this->decryptIV = substr($ciphertext, -$this->block_size); } else { $this->decryptIV = substr($this->decryptIV, $len - $this->block_size) . substr($ciphertext, -$len); } } break; case self::MODE_OFB: $plaintext = $this->openssl_ofb_process($ciphertext, $this->decryptIV, $this->debuffer); } return $this->paddable ? $this->unpad($plaintext) : $plaintext; } if ($this->engine === self::ENGINE_MCRYPT) { $block_size = $this->block_size; if ($this->changed) { $this->setupMcrypt(); $this->changed = false; } if ($this->dechanged) { @mcrypt_generic_init($this->demcrypt, $this->key, $this->getIV($this->decryptIV)); $this->dechanged = false; } if ($this->mode == self::MODE_CFB && $this->continuousBuffer) { $iv = &$this->decryptIV; $pos = &$this->debuffer['pos']; $len = strlen($ciphertext); $plaintext = ''; $i = 0; if ($pos) { $orig_pos = $pos; $max = $block_size - $pos; if ($len >= $max) { $i = $max; $len-= $max; $pos = 0; } else { $i = $len; $pos+= $len; $len = 0; } // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize $plaintext = substr($iv, $orig_pos) ^ $ciphertext; $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i); } if ($len >= $block_size) { $cb = substr($ciphertext, $i, $len - $len % $block_size); $plaintext.= @mcrypt_generic($this->ecb, $iv . $cb) ^ $cb; $iv = substr($cb, -$block_size); $len%= $block_size; } if ($len) { $iv = @mcrypt_generic($this->ecb, $iv); $plaintext.= $iv ^ substr($ciphertext, -$len); $iv = substr_replace($iv, substr($ciphertext, -$len), 0, $len); $pos = $len; } return $plaintext; } if ($this->mode === self::MODE_IGE) { $plaintext = ''; $iv_part_1 = substr($this->decryptIV, 0, $this->block_size); $iv_part_2 = substr($this->decryptIV, $this->block_size); for ($i = 0; $i < strlen($ciphertext); $i += $this->block_size) { $indata = substr($ciphertext, $i, $this->block_size); $outdata = @mcrypt_generic($this->demcrypt, $indata ^ $iv_part_2) ^ $iv_part_1; $iv_part_1 = $indata; $iv_part_2 = $outdata; $plaintext .= $outdata; } if ($this->continuousBuffer) { $this->decryptIV = $iv_part_1.$iv_part_2; } return $plaintext; } $plaintext = @mdecrypt_generic($this->demcrypt, $ciphertext); if (!$this->continuousBuffer) { @mcrypt_generic_init($this->demcrypt, $this->key, $this->getIV($this->decryptIV)); } return $this->paddable ? $this->unpad($plaintext) : $plaintext; } if ($this->changed) { $this->setup(); $this->changed = false; } if ($this->engine === self::ENGINE_EVAL) { $inline = $this->inline_crypt; return $inline('decrypt', $ciphertext); } $block_size = $this->block_size; $buffer = &$this->debuffer; $plaintext = ''; switch ($this->mode) { case self::MODE_ECB: for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { $plaintext.= $this->decryptBlock(substr($ciphertext, $i, $block_size)); } break; case self::MODE_CBC: $xor = $this->decryptIV; for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { $block = substr($ciphertext, $i, $block_size); $plaintext.= $this->decryptBlock($block) ^ $xor; $xor = $block; } if ($this->continuousBuffer) { $this->decryptIV = $xor; } break; case self::MODE_IGE: $iv_part_1 = substr($this->decryptIV, 0, $this->block_size); $iv_part_2 = substr($this->decryptIV, $this->block_size); for ($i = 0; $i < strlen($ciphertext); $i += $this->block_size) { $indata = substr($ciphertext, $i, $this->block_size); $outdata = $this->decryptBlock($indata ^ $iv_part_2) ^ $iv_part_1; $iv_part_1 = $indata; $iv_part_2 = $outdata; $plaintext .= $outdata; } if ($this->continuousBuffer) { $this->decryptIV = $iv_part_1.$iv_part_2; } break; case self::MODE_CTR: $xor = $this->decryptIV; if (strlen($buffer['ciphertext'])) { for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { $block = substr($ciphertext, $i, $block_size); if (strlen($block) > strlen($buffer['ciphertext'])) { $buffer['ciphertext'].= $this->encryptBlock($xor); } $this->increment_str($xor); $key = Strings::shift($buffer['ciphertext'], $block_size); $plaintext.= $block ^ $key; } } else { for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { $block = substr($ciphertext, $i, $block_size); $key = $this->encryptBlock($xor); $this->increment_str($xor); $plaintext.= $block ^ $key; } } if ($this->continuousBuffer) { $this->decryptIV = $xor; if ($start = strlen($ciphertext) % $block_size) { $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext']; } } break; case self::MODE_CFB: if ($this->continuousBuffer) { $iv = &$this->decryptIV; $pos = &$buffer['pos']; } else { $iv = $this->decryptIV; $pos = 0; } $len = strlen($ciphertext); $i = 0; if ($pos) { $orig_pos = $pos; $max = $block_size - $pos; if ($len >= $max) { $i = $max; $len-= $max; $pos = 0; } else { $i = $len; $pos+= $len; $len = 0; } // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize $plaintext = substr($iv, $orig_pos) ^ $ciphertext; $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i); } while ($len >= $block_size) { $iv = $this->encryptBlock($iv); $cb = substr($ciphertext, $i, $block_size); $plaintext.= $iv ^ $cb; $iv = $cb; $len-= $block_size; $i+= $block_size; } if ($len) { $iv = $this->encryptBlock($iv); $plaintext.= $iv ^ substr($ciphertext, $i); $iv = substr_replace($iv, substr($ciphertext, $i), 0, $len); $pos = $len; } break; case self::MODE_CFB8: $plaintext = ''; $len = strlen($ciphertext); $iv = $this->decryptIV; for ($i = 0; $i < $len; ++$i) { $plaintext .= $ciphertext[$i] ^ $this->encryptBlock($iv); $iv = substr($iv, 1) . $ciphertext[$i]; } if ($this->continuousBuffer) { if ($len >= $block_size) { $this->decryptIV = substr($ciphertext, -$block_size); } else { $this->decryptIV = substr($this->decryptIV, $len - $block_size) . substr($ciphertext, -$len); } } break; case self::MODE_OFB: $xor = $this->decryptIV; if (strlen($buffer['xor'])) { for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { $block = substr($ciphertext, $i, $block_size); if (strlen($block) > strlen($buffer['xor'])) { $xor = $this->encryptBlock($xor); $buffer['xor'].= $xor; } $key = Strings::shift($buffer['xor'], $block_size); $plaintext.= $block ^ $key; } } else { for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { $xor = $this->encryptBlock($xor); $plaintext.= substr($ciphertext, $i, $block_size) ^ $xor; } $key = $xor; } if ($this->continuousBuffer) { $this->decryptIV = $xor; if ($start = strlen($ciphertext) % $block_size) { $buffer['xor'] = substr($key, $start) . $buffer['xor']; } } break; case self::MODE_STREAM: $plaintext = $this->decryptBlock($ciphertext); break; } return $this->paddable ? $this->unpad($plaintext) : $plaintext; } /** * Get the IV * * mcrypt requires an IV even if ECB is used * * @see self::encrypt() * @see self::decrypt() * @param string $iv * @return string * @access private */ public function getIV($iv) { return $this->mode == self::MODE_ECB ? str_repeat("\0", $this->block_size) : $iv; } /** * OpenSSL CTR Processor * * PHP's OpenSSL bindings do not operate in continuous mode so we'll wrap around it. Since the keystream * for CTR is the same for both encrypting and decrypting this function is re-used by both SymmetricKey::encrypt() * and SymmetricKey::decrypt(). Also, OpenSSL doesn't implement CTR for all of it's symmetric ciphers so this * function will emulate CTR with ECB when necesary. * * @see self::encrypt() * @see self::decrypt() * @param string $plaintext * @param string $encryptIV * @param array $buffer * @return string * @access private */ private function openssl_ctr_process($plaintext, &$encryptIV, &$buffer) { $ciphertext = ''; $block_size = $this->block_size; $key = $this->key; if ($this->openssl_emulate_ctr) { $xor = $encryptIV; if (strlen($buffer['ciphertext'])) { for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { $block = substr($plaintext, $i, $block_size); if (strlen($block) > strlen($buffer['ciphertext'])) { $buffer['ciphertext'].= openssl_encrypt($xor, $this->cipher_name_openssl_ecb, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); } $this->increment_str($xor); $otp = Strings::shift($buffer['ciphertext'], $block_size); $ciphertext.= $block ^ $otp; } } else { for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { $block = substr($plaintext, $i, $block_size); $otp = openssl_encrypt($xor, $this->cipher_name_openssl_ecb, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); $this->increment_str($xor); $ciphertext.= $block ^ $otp; } } if ($this->continuousBuffer) { $encryptIV = $xor; if ($start = strlen($plaintext) % $block_size) { $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext']; } } return $ciphertext; } if (strlen($buffer['ciphertext'])) { $ciphertext = $plaintext ^ Strings::shift($buffer['ciphertext'], strlen($plaintext)); $plaintext = substr($plaintext, strlen($ciphertext)); if (!strlen($plaintext)) { return $ciphertext; } } $overflow = strlen($plaintext) % $block_size; if ($overflow) { $plaintext2 = Strings::pop($plaintext, $overflow); // ie. trim $plaintext to a multiple of $block_size and put rest of $plaintext in $plaintext2 $encrypted = openssl_encrypt($plaintext . str_repeat("\0", $block_size), $this->cipher_name_openssl, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $encryptIV); $temp = Strings::pop($encrypted, $block_size); $ciphertext.= $encrypted . ($plaintext2 ^ $temp); if ($this->continuousBuffer) { $buffer['ciphertext'] = substr($temp, $overflow); $encryptIV = $temp; } } elseif (!strlen($buffer['ciphertext'])) { $ciphertext.= openssl_encrypt($plaintext . str_repeat("\0", $block_size), $this->cipher_name_openssl, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $encryptIV); $temp = Strings::pop($ciphertext, $block_size); if ($this->continuousBuffer) { $encryptIV = $temp; } } if ($this->continuousBuffer) { $encryptIV = openssl_decrypt($encryptIV, $this->cipher_name_openssl_ecb, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); if ($overflow) { $this->increment_str($encryptIV); } } return $ciphertext; } /** * OpenSSL OFB Processor * * PHP's OpenSSL bindings do not operate in continuous mode so we'll wrap around it. Since the keystream * for OFB is the same for both encrypting and decrypting this function is re-used by both SymmetricKey::encrypt() * and SymmetricKey::decrypt(). * * @see self::encrypt() * @see self::decrypt() * @param string $plaintext * @param string $encryptIV * @param array $buffer * @return string * @access private */ private function openssl_ofb_process($plaintext, &$encryptIV, &$buffer) { if (strlen($buffer['xor'])) { $ciphertext = $plaintext ^ $buffer['xor']; $buffer['xor'] = substr($buffer['xor'], strlen($ciphertext)); $plaintext = substr($plaintext, strlen($ciphertext)); } else { $ciphertext = ''; } $block_size = $this->block_size; $len = strlen($plaintext); $key = $this->key; $overflow = $len % $block_size; if (strlen($plaintext)) { if ($overflow) { $ciphertext.= openssl_encrypt(substr($plaintext, 0, -$overflow) . str_repeat("\0", $block_size), $this->cipher_name_openssl, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $encryptIV); $xor = Strings::pop($ciphertext, $block_size); if ($this->continuousBuffer) { $encryptIV = $xor; } $ciphertext.= Strings::shift($xor, $overflow) ^ substr($plaintext, -$overflow); if ($this->continuousBuffer) { $buffer['xor'] = $xor; } } else { $ciphertext = openssl_encrypt($plaintext, $this->cipher_name_openssl, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $encryptIV); if ($this->continuousBuffer) { $encryptIV = substr($ciphertext, -$block_size) ^ substr($plaintext, -$block_size); } } } return $ciphertext; } /** * phpseclib <-> OpenSSL Mode Mapper * * May need to be overwritten by classes extending this one in some cases * * @return string * @access private */ protected function openssl_translate_mode() { switch ($this->mode) { case self::MODE_ECB: case self::MODE_IGE: return 'ecb'; case self::MODE_CBC: return 'cbc'; case self::MODE_CTR: return 'ctr'; case self::MODE_CFB: return 'cfb'; case self::MODE_CFB8: return 'cfb8'; case self::MODE_OFB: return 'ofb'; } } /** * Pad "packets". * * Block ciphers working by encrypting between their specified [$this->]block_size at a time * If you ever need to encrypt or decrypt something that isn't of the proper length, it becomes necessary to * pad the input so that it is of the proper length. * * Padding is enabled by default. Sometimes, however, it is undesirable to pad strings. Such is the case in SSH, * where "packets" are padded with random bytes before being encrypted. Unpad these packets and you risk stripping * away characters that shouldn't be stripped away. (SSH knows how many bytes are added because the length is * transmitted separately) * * @see self::disablePadding() * @access public */ public function enablePadding() { $this->padding = true; } /** * Do not pad packets. * * @see self::enablePadding() * @access public */ public function disablePadding() { $this->padding = false; } /** * Treat consecutive "packets" as if they are a continuous buffer. * * Say you have a 32-byte plaintext $plaintext. Using the default behavior, the two following code snippets * will yield different outputs: * * <code> * echo $rijndael->encrypt(substr($plaintext, 0, 16)); * echo $rijndael->encrypt(substr($plaintext, 16, 16)); * </code> * <code> * echo $rijndael->encrypt($plaintext); * </code> * * The solution is to enable the continuous buffer. Although this will resolve the above discrepancy, it creates * another, as demonstrated with the following: * * <code> * $rijndael->encrypt(substr($plaintext, 0, 16)); * echo $rijndael->decrypt($rijndael->encrypt(substr($plaintext, 16, 16))); * </code> * <code> * echo $rijndael->decrypt($rijndael->encrypt(substr($plaintext, 16, 16))); * </code> * * With the continuous buffer disabled, these would yield the same output. With it enabled, they yield different * outputs. The reason is due to the fact that the initialization vector's change after every encryption / * decryption round when the continuous buffer is enabled. When it's disabled, they remain constant. * * Put another way, when the continuous buffer is enabled, the state of the \phpseclib\Crypt\*() object changes after each * encryption / decryption round, whereas otherwise, it'd remain constant. For this reason, it's recommended that * continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them), * however, they are also less intuitive and more likely to cause you problems. * * @see self::disableContinuousBuffer() * @access public * @internal Could, but not must, extend by the child Crypt_* class */ public function enableContinuousBuffer() { if ($this->mode == self::MODE_ECB) { return; } $this->continuousBuffer = true; $this->setEngine(); } /** * Treat consecutive packets as if they are a discontinuous buffer. * * The default behavior. * * @see self::enableContinuousBuffer() * @access public * @internal Could, but not must, extend by the child Crypt_* class */ public function disableContinuousBuffer() { if ($this->mode == self::MODE_ECB) { return; } if (!$this->continuousBuffer) { return; } $this->continuousBuffer = false; $this->changed = true; $this->setEngine(); } /** * Test for engine validity * * @see self::__construct() * @param int $engine * @access private * @return bool */ protected function isValidEngineHelper($engine) { switch ($engine) { case self::ENGINE_OPENSSL: if ($this->mode == self::MODE_STREAM && $this->continuousBuffer) { return false; } $this->openssl_emulate_ctr = false; $result = $this->cipher_name_openssl && extension_loaded('openssl'); if (!$result) { return false; } $methods = openssl_get_cipher_methods(); if (in_array($this->cipher_name_openssl, $methods)) { return true; } // not all of openssl's symmetric cipher's support ctr. for those // that don't we'll emulate it switch ($this->mode) { case self::MODE_CTR: if (in_array($this->cipher_name_openssl_ecb, $methods)) { $this->openssl_emulate_ctr = true; return true; } } return false; case self::ENGINE_MCRYPT: return $this->cipher_name_mcrypt && extension_loaded('mcrypt') && in_array($this->cipher_name_mcrypt, @mcrypt_list_algorithms()); case self::ENGINE_EVAL: return method_exists($this, 'setupInlineCrypt'); case self::ENGINE_INTERNAL: return true; } return false; } /** * Test for engine validity * * @see self::__construct() * @param string $engine * @access public * @return bool */ public function isValidEngine($engine) { static $reverseMap; if (!isset($reverseMap)) { $reverseMap = array_map('strtolower', self::ENGINE_MAP); $reverseMap = array_flip($reverseMap); } $engine = strtolower($engine); if (!isset($reverseMap[$engine])) { return false; } return $this->isValidEngineHelper($reverseMap[$engine]); } /** * Sets the preferred crypt engine * * Currently, $engine could be: * * - OpenSSL [very fast] * * - mcrypt [fast] * * - Eval [slow] * * - PHP [slowest] * * If the preferred crypt engine is not available the fastest available one will be used * * @see self::__construct() * @param string $engine * @access public */ public function setPreferredEngine($engine) { static $reverseMap; if (!isset($reverseMap)) { $reverseMap = array_map('strtolower', self::ENGINE_MAP); $reverseMap = array_flip($reverseMap); } $engine = strtolower($engine); $this->preferredEngine = isset($reverseMap[$engine]) ? $reverseMap[$engine] : self::ENGINE_OPENSSL; $this->setEngine(); } /** * Returns the engine currently being utilized * * @see self::setEngine() * @access public */ public function getEngine() { return self::ENGINE_MAP[$this->engine]; } /** * Sets the engine as appropriate * * @see self::__construct() * @access private */ protected function setEngine() { $this->engine = null; $candidateEngines = [ $this->preferredEngine, self::ENGINE_OPENSSL, self::ENGINE_MCRYPT, self::ENGINE_EVAL ]; foreach ($candidateEngines as $engine) { if ($this->isValidEngineHelper($engine)) { $this->engine = $engine; break; } } if (!$this->engine) { $this->engine = self::ENGINE_INTERNAL; } if ($this->engine != self::ENGINE_MCRYPT && $this->enmcrypt) { // Closing the current mcrypt resource(s). _mcryptSetup() will, if needed, // (re)open them with the module named in $this->cipher_name_mcrypt @mcrypt_module_close($this->enmcrypt); @mcrypt_module_close($this->demcrypt); $this->enmcrypt = null; $this->demcrypt = null; if ($this->ecb) { @mcrypt_module_close($this->ecb); $this->ecb = null; } } $this->changed = true; } /** * Encrypts a block * * Note: Must be extended by the child \phpseclib\Crypt\* class * * @access private * @param string $in * @return string */ abstract protected function encryptBlock($in); /** * Decrypts a block * * Note: Must be extended by the child \phpseclib\Crypt\* class * * @access private * @param string $in * @return string */ abstract protected function decryptBlock($in); /** * Setup the key (expansion) * * Only used if $engine == self::ENGINE_INTERNAL * * Note: Must extend by the child \phpseclib\Crypt\* class * * @see self::setup() * @access private */ abstract protected function setupKey(); /** * Setup the self::ENGINE_INTERNAL $engine * * (re)init, if necessary, the internal cipher $engine and flush all $buffers * Used (only) if $engine == self::ENGINE_INTERNAL * * _setup() will be called each time if $changed === true * typically this happens when using one or more of following public methods: * * - setKey() * * - setIV() * * - disableContinuousBuffer() * * - First run of encrypt() / decrypt() with no init-settings * * @see self::setKey() * @see self::setIV() * @see self::disableContinuousBuffer() * @access private * @internal setup() is always called before en/decryption. * @internal Could, but not must, extend by the child Crypt_* class */ protected function setup() { $this->clearBuffers(); $this->setupKey(); if ($this->engine === self::ENGINE_EVAL) { $this->setupInlineCrypt(); } } /** * Setup the self::ENGINE_MCRYPT $engine * * (re)init, if necessary, the (ext)mcrypt resources and flush all $buffers * Used (only) if $engine = self::ENGINE_MCRYPT * * _setupMcrypt() will be called each time if $changed === true * typically this happens when using one or more of following public methods: * * - setKey() * * - setIV() * * - disableContinuousBuffer() * * - First run of encrypt() / decrypt() * * @see self::setKey() * @see self::setIV() * @see self::disableContinuousBuffer() * @access private * @internal Could, but not must, extend by the child Crypt_* class */ private function setupMcrypt() { $this->clearBuffers(); $this->enchanged = $this->dechanged = true; if (!isset($this->enmcrypt)) { static $mcrypt_modes = [ self::MODE_CTR => 'ctr', self::MODE_IGE => MCRYPT_MODE_ECB, self::MODE_ECB => MCRYPT_MODE_ECB, self::MODE_CBC => MCRYPT_MODE_CBC, self::MODE_CFB => 'ncfb', self::MODE_CFB8 => MCRYPT_MODE_CFB, self::MODE_OFB => MCRYPT_MODE_NOFB, self::MODE_STREAM => MCRYPT_MODE_STREAM, ]; $this->demcrypt = @mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], ''); $this->enmcrypt = @mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], ''); // we need the $ecb mcrypt resource (only) in MODE_CFB with enableContinuousBuffer() // to workaround mcrypt's broken ncfb implementation in buffered mode // see: {@link http://phpseclib.sourceforge.net/cfb-demo.phps} if ($this->mode === self::MODE_CFB) { $this->ecb = @mcrypt_module_open($this->cipher_name_mcrypt, '', MCRYPT_MODE_ECB, ''); } } // else should mcrypt_generic_deinit be called? if ($this->mode == self::MODE_CFB) { @mcrypt_generic_init($this->ecb, $this->key, str_repeat("\0", $this->block_size)); } } /** * Pads a string * * Pads a string using the RSA PKCS padding standards so that its length is a multiple of the blocksize. * $this->block_size - (strlen($text) % $this->block_size) bytes are added, each of which is equal to * chr($this->block_size - (strlen($text) % $this->block_size) * * If padding is disabled and $text is not a multiple of the blocksize, the string will be padded regardless * and padding will, hence forth, be enabled. * * @see self::unpad() * @param string $text * @throws \LengthException if padding is disabled and the plaintext's length is not a multiple of the block size * @access private * @return string */ protected function pad($text) { $length = strlen($text); if (!$this->padding) { if ($length % $this->block_size == 0) { return $text; } else { throw new \LengthException("The plaintext's length ($length) is not a multiple of the block size ({$this->block_size}). Try enabling padding."); } } $pad = $this->block_size - ($length % $this->block_size); return str_pad($text, $length + $pad, chr($pad)); } /** * Unpads a string. * * If padding is enabled and the reported padding length is invalid the encryption key will be assumed to be wrong * and false will be returned. * * @see self::pad() * @param string $text * @throws \LengthException if the ciphertext's length is not a multiple of the block size * @access private * @return string */ protected function unpad($text) { if (!$this->padding) { return $text; } $length = ord($text[strlen($text) - 1]); if (!$length || $length > $this->block_size) { throw new \LengthException("The ciphertext has an invalid padding length ($length) compared to the block size ({$this->block_size})"); } return substr($text, 0, -$length); } /** * Clears internal buffers * * Clearing/resetting the internal buffers is done everytime * after disableContinuousBuffer() or on cipher $engine (re)init * ie after setKey() or setIV() * * @access private * @internal Could, but not must, extend by the child Crypt_* class * @throws \UnexpectedValueException when an IV is required but not defined */ private function clearBuffers() { $this->enbuffer = $this->debuffer = ['ciphertext' => '', 'xor' => '', 'pos' => 0, 'enmcrypt_init' => true]; if ($this->iv === false && !in_array($this->mode, [self::MODE_STREAM, self::MODE_ECB])) { throw new \UnexpectedValueException('No IV has been defined'); } $this->encryptIV = $this->decryptIV = $this->iv; } /** * Increment the current string * * @see self::decrypt() * @see self::encrypt() * @param string $var * @access private */ protected function increment_str(&$var) { for ($i = 4; $i <= strlen($var); $i+= 4) { $temp = substr($var, -$i, 4); switch ($temp) { case "\xFF\xFF\xFF\xFF": $var = substr_replace($var, "\x00\x00\x00\x00", -$i, 4); break; case "\x7F\xFF\xFF\xFF": $var = substr_replace($var, "\x80\x00\x00\x00", -$i, 4); return; default: $temp = unpack('Nnum', $temp); $var = substr_replace($var, pack('N', $temp['num'] + 1), -$i, 4); return; } } $remainder = strlen($var) % 4; if ($remainder == 0) { return; } $temp = unpack('Nnum', str_pad(substr($var, 0, $remainder), 4, "\0", STR_PAD_LEFT)); $temp = substr(pack('N', $temp['num'] + 1), -$remainder); $var = substr_replace($var, $temp, 0, $remainder); } /** * Setup the performance-optimized function for de/encrypt() * * Stores the created (or existing) callback function-name * in $this->inline_crypt * * Internally for phpseclib developers: * * _setupInlineCrypt() would be called only if: * * - $this->engine === self::ENGINE_EVAL * * - each time on _setup(), after(!) _setupKey() * * * This ensures that _setupInlineCrypt() has always a * full ready2go initializated internal cipher $engine state * where, for example, the keys allready expanded, * keys/block_size calculated and such. * * It is, each time if called, the responsibility of _setupInlineCrypt(): * * - to set $this->inline_crypt to a valid and fully working callback function * as a (faster) replacement for encrypt() / decrypt() * * - NOT to create unlimited callback functions (for memory reasons!) * no matter how often _setupInlineCrypt() would be called. At some * point of amount they must be generic re-useable. * * - the code of _setupInlineCrypt() it self, * and the generated callback code, * must be, in following order: * - 100% safe * - 100% compatible to encrypt()/decrypt() * - using only php5+ features/lang-constructs/php-extensions if * compatibility (down to php4) or fallback is provided * - readable/maintainable/understandable/commented and... not-cryptic-styled-code :-) * - >= 10% faster than encrypt()/decrypt() [which is, by the way, * the reason for the existence of _setupInlineCrypt() :-)] * - memory-nice * - short (as good as possible) * * Note: - _setupInlineCrypt() is using _createInlineCryptFunction() to create the full callback function code. * - In case of using inline crypting, _setupInlineCrypt() must extend by the child \phpseclib\Crypt\* class. * - The following variable names are reserved: * - $_* (all variable names prefixed with an underscore) * - $self (object reference to it self. Do not use $this, but $self instead) * - $in (the content of $in has to en/decrypt by the generated code) * - The callback function should not use the 'return' statement, but en/decrypt'ing the content of $in only * * * @see self::setup() * @see self::createInlineCryptFunction() * @see self::encrypt() * @see self::decrypt() * @access private * @internal If a Crypt_* class providing inline crypting it must extend _setupInlineCrypt() */ //protected function setupInlineCrypt(); /** * Creates the performance-optimized function for en/decrypt() * * Internally for phpseclib developers: * * _createInlineCryptFunction(): * * - merge the $cipher_code [setup'ed by _setupInlineCrypt()] * with the current [$this->]mode of operation code * * - create the $inline function, which called by encrypt() / decrypt() * as its replacement to speed up the en/decryption operations. * * - return the name of the created $inline callback function * * - used to speed up en/decryption * * * * The main reason why can speed up things [up to 50%] this way are: * * - using variables more effective then regular. * (ie no use of expensive arrays but integers $k_0, $... * or even, for example, the pure $key[] values hardcoded) * * - avoiding 1000's of function calls of ie _encryptBlock() * but inlining the crypt operations. * in the mode of operation for() loop. * * - full loop unroll the (sometimes key-dependent) rounds * avoiding this way ++$i counters and runtime-if's etc... * * The basic code architectur of the generated $inline en/decrypt() * lambda function, in pseudo php, is: * * <code> * +----------------------------------------------------------------------------------------------+ * | callback $inline = create_function: | * | lambda_function_0001_crypt_ECB($action, $text) | * | { | * | INSERT PHP CODE OF: | * | $cipher_code['init_crypt']; // general init code. | * | // ie: $sbox'es declarations used for | * | // encrypt and decrypt'ing. | * | | * | switch ($action) { | * | case 'encrypt': | * | INSERT PHP CODE OF: | * | $cipher_code['init_encrypt']; // encrypt sepcific init code. | * | ie: specified $key or $box | * | declarations for encrypt'ing. | * | | * | foreach ($ciphertext) { | * | $in = $block_size of $ciphertext; | * | | * | INSERT PHP CODE OF: | * | $cipher_code['encrypt_block']; // encrypt's (string) $in, which is always: | * | // strlen($in) == $this->block_size | * | // here comes the cipher algorithm in action | * | // for encryption. | * | // $cipher_code['encrypt_block'] has to | * | // encrypt the content of the $in variable | * | | * | $plaintext .= $in; | * | } | * | return $plaintext; | * | | * | case 'decrypt': | * | INSERT PHP CODE OF: | * | $cipher_code['init_decrypt']; // decrypt sepcific init code | * | ie: specified $key or $box | * | declarations for decrypt'ing. | * | foreach ($plaintext) { | * | $in = $block_size of $plaintext; | * | | * | INSERT PHP CODE OF: | * | $cipher_code['decrypt_block']; // decrypt's (string) $in, which is always | * | // strlen($in) == $this->block_size | * | // here comes the cipher algorithm in action | * | // for decryption. | * | // $cipher_code['decrypt_block'] has to | * | // decrypt the content of the $in variable | * | $ciphertext .= $in; | * | } | * | return $ciphertext; | * | } | * | } | * +----------------------------------------------------------------------------------------------+ * </code> * * See also the \phpseclib\Crypt\*::_setupInlineCrypt()'s for * productive inline $cipher_code's how they works. * * Structure of: * <code> * $cipher_code = [ * 'init_crypt' => (string) '', // optional * 'init_encrypt' => (string) '', // optional * 'init_decrypt' => (string) '', // optional * 'encrypt_block' => (string) '', // required * 'decrypt_block' => (string) '' // required * ]; * </code> * * @see self::setupInlineCrypt() * @see self::encrypt() * @see self::decrypt() * @param array $cipher_code * @access private * @return string (the name of the created callback function) */ protected function createInlineCryptFunction($cipher_code) { $block_size = $this->block_size; // optional $init_crypt = isset($cipher_code['init_crypt']) ? $cipher_code['init_crypt'] : ''; $init_encrypt = isset($cipher_code['init_encrypt']) ? $cipher_code['init_encrypt'] : ''; $init_decrypt = isset($cipher_code['init_decrypt']) ? $cipher_code['init_decrypt'] : ''; // required $encrypt_block = $cipher_code['encrypt_block']; $decrypt_block = $cipher_code['decrypt_block']; // Generating mode of operation inline code, // merged with the $cipher_code algorithm // for encrypt- and decryption. switch ($this->mode) { case self::MODE_ECB: $encrypt = $init_encrypt . ' $_ciphertext = ""; $_plaintext_len = strlen($_text); for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') { $in = substr($_text, $_i, '.$block_size.'); '.$encrypt_block.' $_ciphertext.= $in; } return $_ciphertext; '; $decrypt = $init_decrypt . ' $_plaintext = ""; $_text = str_pad($_text, strlen($_text) + ('.$block_size.' - strlen($_text) % '.$block_size.') % '.$block_size.', chr(0)); $_ciphertext_len = strlen($_text); for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') { $in = substr($_text, $_i, '.$block_size.'); '.$decrypt_block.' $_plaintext.= $in; } return $this->unpad($_plaintext); '; break; case self::MODE_CTR: $encrypt = $init_encrypt . ' $_ciphertext = ""; $_plaintext_len = strlen($_text); $_xor = $this->encryptIV; $_buffer = &$this->enbuffer; if (strlen($_buffer["ciphertext"])) { for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') { $_block = substr($_text, $_i, '.$block_size.'); if (strlen($_block) > strlen($_buffer["ciphertext"])) { $in = $_xor; '.$encrypt_block.' $this->increment_str($_xor); $_buffer["ciphertext"].= $in; } $_key = \phpseclib\Common\Functions\Strings::shift($_buffer["ciphertext"], '.$block_size.'); $_ciphertext.= $_block ^ $_key; } } else { for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') { $_block = substr($_text, $_i, '.$block_size.'); $in = $_xor; '.$encrypt_block.' $this->increment_str($_xor); $_key = $in; $_ciphertext.= $_block ^ $_key; } } if ($this->continuousBuffer) { $this->encryptIV = $_xor; if ($_start = $_plaintext_len % '.$block_size.') { $_buffer["ciphertext"] = substr($_key, $_start) . $_buffer["ciphertext"]; } } return $_ciphertext; '; $decrypt = $init_encrypt . ' $_plaintext = ""; $_ciphertext_len = strlen($_text); $_xor = $this->decryptIV; $_buffer = &$this->debuffer; if (strlen($_buffer["ciphertext"])) { for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') { $_block = substr($_text, $_i, '.$block_size.'); if (strlen($_block) > strlen($_buffer["ciphertext"])) { $in = $_xor; '.$encrypt_block.' $this->increment_str($_xor); $_buffer["ciphertext"].= $in; } $_key = \phpseclib\Common\Functions\Strings::shift($_buffer["ciphertext"], '.$block_size.'); $_plaintext.= $_block ^ $_key; } } else { for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') { $_block = substr($_text, $_i, '.$block_size.'); $in = $_xor; '.$encrypt_block.' $this->increment_str($_xor); $_key = $in; $_plaintext.= $_block ^ $_key; } } if ($this->continuousBuffer) { $this->decryptIV = $_xor; if ($_start = $_ciphertext_len % '.$block_size.') { $_buffer["ciphertext"] = substr($_key, $_start) . $_buffer["ciphertext"]; } } return $_plaintext; '; break; case self::MODE_CFB: $encrypt = $init_encrypt . ' $_ciphertext = ""; $_buffer = &$this->enbuffer; if ($this->continuousBuffer) { $_iv = &$this->encryptIV; $_pos = &$_buffer["pos"]; } else { $_iv = $this->encryptIV; $_pos = 0; } $_len = strlen($_text); $_i = 0; if ($_pos) { $_orig_pos = $_pos; $_max = '.$block_size.' - $_pos; if ($_len >= $_max) { $_i = $_max; $_len-= $_max; $_pos = 0; } else { $_i = $_len; $_pos+= $_len; $_len = 0; } $_ciphertext = substr($_iv, $_orig_pos) ^ $_text; $_iv = substr_replace($_iv, $_ciphertext, $_orig_pos, $_i); } while ($_len >= '.$block_size.') { $in = $_iv; '.$encrypt_block.'; $_iv = $in ^ substr($_text, $_i, '.$block_size.'); $_ciphertext.= $_iv; $_len-= '.$block_size.'; $_i+= '.$block_size.'; } if ($_len) { $in = $_iv; '.$encrypt_block.' $_iv = $in; $_block = $_iv ^ substr($_text, $_i); $_iv = substr_replace($_iv, $_block, 0, $_len); $_ciphertext.= $_block; $_pos = $_len; } return $_ciphertext; '; $decrypt = $init_encrypt . ' $_plaintext = ""; $_buffer = &$this->debuffer; if ($this->continuousBuffer) { $_iv = &$this->decryptIV; $_pos = &$_buffer["pos"]; } else { $_iv = $this->decryptIV; $_pos = 0; } $_len = strlen($_text); $_i = 0; if ($_pos) { $_orig_pos = $_pos; $_max = '.$block_size.' - $_pos; if ($_len >= $_max) { $_i = $_max; $_len-= $_max; $_pos = 0; } else { $_i = $_len; $_pos+= $_len; $_len = 0; } $_plaintext = substr($_iv, $_orig_pos) ^ $_text; $_iv = substr_replace($_iv, substr($_text, 0, $_i), $_orig_pos, $_i); } while ($_len >= '.$block_size.') { $in = $_iv; '.$encrypt_block.' $_iv = $in; $cb = substr($_text, $_i, '.$block_size.'); $_plaintext.= $_iv ^ $cb; $_iv = $cb; $_len-= '.$block_size.'; $_i+= '.$block_size.'; } if ($_len) { $in = $_iv; '.$encrypt_block.' $_iv = $in; $_plaintext.= $_iv ^ substr($_text, $_i); $_iv = substr_replace($_iv, substr($_text, $_i), 0, $_len); $_pos = $_len; } return $_plaintext; '; break; case self::MODE_CFB8: $encrypt = $init_encrypt . ' $_ciphertext = ""; $_len = strlen($_text); $_iv = $this->encryptIV; for ($_i = 0; $_i < $_len; ++$_i) { $in = $_iv; '.$encrypt_block.' $_ciphertext .= ($_c = $_text[$_i] ^ $in); $_iv = substr($_iv, 1) . $_c; } if ($this->continuousBuffer) { if ($_len >= '.$block_size.') { $this->encryptIV = substr($_ciphertext, -'.$block_size.'); } else { $this->encryptIV = substr($this->encryptIV, $_len - '.$block_size.') . substr($_ciphertext, -$_len); } } return $_ciphertext; '; $decrypt = $init_encrypt . ' $_plaintext = ""; $_len = strlen($_text); $_iv = $this->decryptIV; for ($_i = 0; $_i < $_len; ++$_i) { $in = $_iv; '.$encrypt_block.' $_plaintext .= $_text[$_i] ^ $in; $_iv = substr($_iv, 1) . $_text[$_i]; } if ($this->continuousBuffer) { if ($_len >= '.$block_size.') { $this->decryptIV = substr($_text, -'.$block_size.'); } else { $this->decryptIV = substr($this->decryptIV, $_len - '.$block_size.') . substr($_text, -$_len); } } return $_plaintext; '; break; case self::MODE_OFB: $encrypt = $init_encrypt . ' $_ciphertext = ""; $_plaintext_len = strlen($_text); $_xor = $this->encryptIV; $_buffer = &$this->enbuffer; if (strlen($_buffer["xor"])) { for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') { $_block = substr($_text, $_i, '.$block_size.'); if (strlen($_block) > strlen($_buffer["xor"])) { $in = $_xor; '.$encrypt_block.' $_xor = $in; $_buffer["xor"].= $_xor; } $_key = \phpseclib\Common\Functions\Strings::shift($_buffer["xor"], '.$block_size.'); $_ciphertext.= $_block ^ $_key; } } else { for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') { $in = $_xor; '.$encrypt_block.' $_xor = $in; $_ciphertext.= substr($_text, $_i, '.$block_size.') ^ $_xor; } $_key = $_xor; } if ($this->continuousBuffer) { $this->encryptIV = $_xor; if ($_start = $_plaintext_len % '.$block_size.') { $_buffer["xor"] = substr($_key, $_start) . $_buffer["xor"]; } } return $_ciphertext; '; $decrypt = $init_encrypt . ' $_plaintext = ""; $_ciphertext_len = strlen($_text); $_xor = $this->decryptIV; $_buffer = &$this->debuffer; if (strlen($_buffer["xor"])) { for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') { $_block = substr($_text, $_i, '.$block_size.'); if (strlen($_block) > strlen($_buffer["xor"])) { $in = $_xor; '.$encrypt_block.' $_xor = $in; $_buffer["xor"].= $_xor; } $_key = \phpseclib\Common\Functions\Strings::shift($_buffer["xor"], '.$block_size.'); $_plaintext.= $_block ^ $_key; } } else { for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') { $in = $_xor; '.$encrypt_block.' $_xor = $in; $_plaintext.= substr($_text, $_i, '.$block_size.') ^ $_xor; } $_key = $_xor; } if ($this->continuousBuffer) { $this->decryptIV = $_xor; if ($_start = $_ciphertext_len % '.$block_size.') { $_buffer["xor"] = substr($_key, $_start) . $_buffer["xor"]; } } return $_plaintext; '; break; case self::MODE_STREAM: $encrypt = $init_encrypt . ' $_ciphertext = ""; '.$encrypt_block.' return $_ciphertext; '; $decrypt = $init_decrypt . ' $_plaintext = ""; '.$decrypt_block.' return $_plaintext; '; break; case self::MODE_IGE: $encrypt = $init_encrypt . ' $_ciphertext = ""; $_plaintext_len = strlen($_text); $_iv_part_1 = substr($this->encryptIV, 0, '.$block_size.'); $_iv_part_2 = substr($this->encryptIV, '.$block_size.'); for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') { $in = ($indata = substr($_text, $_i, '.$block_size.')) ^ $_iv_part_1; '.$encrypt_block.' $outdata = $in ^ $_iv_part_2; $_iv_part_1 = $outdata; $_iv_part_2 = $indata; $_ciphertext .= $outdata; } if ($this->continuousBuffer) { $this->encryptIV = $_iv_part_1.$_iv_part_2; } return $_ciphertext; '; $decrypt = $init_decrypt . ' $_plaintext = ""; $_text = str_pad($_text, strlen($_text) + ('.$block_size.' - strlen($_text) % '.$block_size.') % '.$block_size.', chr(0)); $_ciphertext_len = strlen($_text); $_iv_part_1 = substr($this->decryptIV, 0, '.$block_size.'); $_iv_part_2 = substr($this->decryptIV, '.$block_size.'); for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') { $in = ($indata = substr($_text, $_i, '.$block_size.')) ^ $_iv_part_2; '.$decrypt_block.' $outdata = $in ^ $_iv_part_1; $_iv_part_1 = $indata; $_iv_part_2 = $outdata; $_plaintext .= $outdata; } if ($this->continuousBuffer) { $this->decryptIV = $_iv_part_1.$_iv_part_2; } return $_plaintext; '; break; // case self::MODE_CBC: default: $encrypt = $init_encrypt . ' $_ciphertext = ""; $_plaintext_len = strlen($_text); $in = $this->encryptIV; for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') { $in = substr($_text, $_i, '.$block_size.') ^ $in; '.$encrypt_block.' $_ciphertext.= $in; } if ($this->continuousBuffer) { $this->encryptIV = $in; } return $_ciphertext; '; $decrypt = $init_decrypt . ' $_plaintext = ""; $_text = str_pad($_text, strlen($_text) + ('.$block_size.' - strlen($_text) % '.$block_size.') % '.$block_size.', chr(0)); $_ciphertext_len = strlen($_text); $_iv = $this->decryptIV; for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') { $in = $_block = substr($_text, $_i, '.$block_size.'); '.$decrypt_block.' $_plaintext.= $in ^ $_iv; $_iv = $_block; } if ($this->continuousBuffer) { $this->decryptIV = $_iv; } return $this->unpad($_plaintext); '; break; } eval('$func = function ($_action, $_text) { ' . $init_crypt . 'if ($_action == "encrypt") { ' . $encrypt . ' } else { ' . $decrypt . ' }};'); return \Closure::bind($func, $this, static::class); } /** * Convert float to int * * On ARM CPUs converting floats to ints doesn't always work * * @access private * @param string $x * @return int */ protected static function safe_intval($x) { switch (true) { case is_int($x): // PHP 5.3, per http://php.net/releases/5_3_0.php, introduced "more consistent float rounding" case (php_uname('m') & "\xDF\xDF\xDF") != 'ARM': return $x; } return (fmod($x, 0x80000000) & 0x7FFFFFFF) | ((fmod(floor($x / 0x80000000), 2) & 1) << 31); } /** * eval()'able string for in-line float to int * * @access private * @return string */ protected static function safe_intval_inline() { switch (true) { case defined('PHP_INT_SIZE') && PHP_INT_SIZE == 8: case (php_uname('m') & "\xDF\xDF\xDF") != 'ARM': return '%s'; break; default: $safeint = '(is_int($temp = %s) ? $temp : (fmod($temp, 0x80000000) & 0x7FFFFFFF) | '; return $safeint . '((fmod(floor($temp / 0x80000000), 2) & 1) << 31))'; } } } <?php /** * Base Class for all block ciphers * * PHP version 5 * * @category Crypt * @package BlockCipher * @author Jim Wigginton <terrafrost@php.net> * @author Hans-Juergen Petrich <petrich@tronic-media.com> * @copyright 2007 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\Common; /** * Base Class for all block cipher classes * * @package BlockCipher * @author Jim Wigginton <terrafrost@php.net> */ abstract class BlockCipher extends SymmetricKey { } <?php /** * Base Class for all stream ciphers * * PHP version 5 * * @category Crypt * @package StreamCipher * @author Jim Wigginton <terrafrost@php.net> * @author Hans-Juergen Petrich <petrich@tronic-media.com> * @copyright 2007 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\Common; /** * Base Class for all stream cipher classes * * @package StreamCipher * @author Jim Wigginton <terrafrost@php.net> */ abstract class StreamCipher extends SymmetricKey { } <?php /** * OpenSSH Key Handler * * PHP version 5 * * Place in $HOME/.ssh/authorized_keys * * @category Crypt * @package Common * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\Common\Keys; use ParagonIE\ConstantTime\Base64; use phpseclib\Common\Functions\Strings; /** * OpenSSH Formatted RSA Key Handler * * @package Common * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class OpenSSH { /** * Default comment * * @var string * @access private */ protected static $comment = 'phpseclib-generated-key'; /** * Binary key flag * * @var bool * @access private */ protected static $binary = false; /** * Sets the default comment * * @access public * @param string $comment */ public static function setComment($comment) { self::$comment = str_replace(["\r", "\n"], '', $comment); } /** * Break a public or private key down into its constituent components * * $type can be either ssh-dss or ssh-rsa * * @access public * @param string $key * @param string $type * @return array|bool */ public static function load($key, $type) { if (!is_string($key)) { return false; } $parts = explode(' ', $key, 3); if (!isset($parts[1])) { $key = Base64::decode($parts[0]); $comment = isset($parts[1]) ? $parts[1] : false; } else { if ($parts[0] != $type) { return false; } $key = Base64::decode($parts[1]); $comment = isset($parts[2]) ? $parts[2] : false; } if ($key === false) { return false; } if (substr($key, 0, 11) != "\0\0\0\7$type") { return false; } Strings::shift($key, 11); if (strlen($key) <= 4) { return false; } return $key; } /** * Returns the comment for the key * * @access public * @param string $key * @return mixed */ public static function getComment($key) { $parts = explode(' ', $key, 3); return isset($parts[2]) ? $parts[2] : false; } /** * Toggle between binary and printable keys * * Printable keys are what are generated by default. These are the ones that go in * $HOME/.ssh/authorized_key. * * @access public * @param bool $enabled */ public static function setBinaryOutput($enabled) { self::$binary = $enabled; } /** * Returns the current binary output value * * @access public * @return bool */ public static function getBinaryOutput() { return (bool) self::$binary; } } <?php /** * PKCS#8 Formatted Key Handler * * PHP version 5 * * Used by PHP's openssl_public_encrypt() and openssl's rsautl (when -pubin is set) * * Processes keys with the following headers: * * -----BEGIN ENCRYPTED PRIVATE KEY----- * -----BEGIN PRIVATE KEY----- * -----BEGIN PUBLIC KEY----- * * Analogous to ssh-keygen's pkcs8 format (as specified by -m). Although PKCS8 * is specific to private keys it's basically creating a DER-encoded wrapper * for keys. This just extends that same concept to public keys (much like ssh-keygen) * * @category Crypt * @package Common * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\Common\Keys; use ParagonIE\ConstantTime\Base64; use phpseclib\Crypt\DES; use phpseclib\Crypt\RC2; use phpseclib\Crypt\RC4; use phpseclib\Crypt\AES; use phpseclib\Crypt\TripleDES; use phpseclib\Crypt\Random; use phpseclib\Math\BigInteger; use phpseclib\File\ASN1; use phpseclib\File\ASN1\Maps; use phpseclib\Exception\UnsupportedAlgorithmException; /** * PKCS#8 Formatted Key Handler * * @package Common * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PKCS8 extends PKCS { /** * Default encryption algorithm * * @var string * @access private */ private static $defaultEncryptionAlgorithm = 'id-PBES2'; /** * Default encryption scheme * * Only used when defaultEncryptionAlgorithm is id-PBES2 * * @var string * @access private */ private static $defaultEncryptionScheme = 'aes128-CBC-PAD'; /** * Default PRF * * Only used when defaultEncryptionAlgorithm is id-PBES2 * * @var string * @access private */ private static $defaultPRF = 'id-hmacWithSHA256'; /** * Default Iteration Count * * @var int * @access private */ private static $defaultIterationCount = 2048; /** * OIDs loaded * * @var bool * @access private */ private static $oidsLoaded = false; /** * Sets the default encryption algorithm * * @access public * @param string $algo */ public static function setEncryptionAlgorithm($algo) { self::$defaultEncryptionAlgorithm = $algo; } /** * Sets the default encryption algorithm for PBES2 * * @access public * @param string $algo */ public static function setEncryptionScheme($algo) { self::$defaultEncryptionScheme = $algo; } /** * Sets the iteration count * * @access public * @param int $count */ public static function setIterationCount($count) { self::$defaultIterationCount = $count; } /** * Sets the PRF for PBES2 * * @access public * @param string $algo */ public static function setPRF($algo) { self::$defaultPRF = $algo; } /** * Returns a SymmetricKey object based on a PBES1 $algo * @return \phpseclib\Crypt\Common\SymmetricKey * @access public * @param string $algo */ private static function getPBES1EncryptionObject($algo) { $algo = preg_match('#^pbeWith(?:MD2|MD5|SHA1|SHA)And(.*?)-CBC$#', $algo, $matches) ? $matches[1] : substr($algo, 13); // strlen('pbeWithSHAAnd') == 13 switch ($algo) { case 'DES': $cipher = new DES('cbc'); break; case 'RC2': $cipher = new RC2('cbc'); break; case '3-KeyTripleDES': $cipher = new TripleDES('cbc'); break; case '2-KeyTripleDES': $cipher = new TripleDES('cbc'); $cipher->setKeyLength(128); break; case '128BitRC2': $cipher = new RC2('cbc'); $cipher->setKeyLength(128); break; case '40BitRC2': $cipher = new RC2('cbc'); $cipher->setKeyLength(40); break; case '128BitRC4': $cipher = new RC4(); $cipher->setKeyLength(128); break; case '40BitRC4': $cipher = new RC4(); $cipher->setKeyLength(40); break; default: throw new UnsupportedAlgorithmException("$algo is not a supported algorithm"); } return $cipher; } /** * Returns a hash based on a PBES1 $algo * * @return string * @access public * @param string $algo */ private static function getPBES1Hash($algo) { if (preg_match('#^pbeWith(MD2|MD5|SHA1|SHA)And.*?-CBC$#', $algo, $matches)) { return $matches[1] == 'SHA' ? 'sha1' : $matches[1]; } return 'sha1'; } /** * Returns a KDF baesd on a PBES1 $algo * * @return string * @access public * @param string $algo */ private static function getPBES1KDF($algo) { switch ($algo) { case 'pbeWithMD2AndDES-CBC': case 'pbeWithMD2AndRC2-CBC': case 'pbeWithMD5AndDES-CBC': case 'pbeWithMD5AndRC2-CBC': case 'pbeWithSHA1AndDES-CBC': case 'pbeWithSHA1AndRC2-CBC': return 'pbkdf1'; } return 'pkcs12'; } /** * Returns a SymmetricKey object baesd on a PBES2 $algo * * @return SymmetricKey * @access public * @param string $algo */ private static function getPBES2EncryptionObject($algo) { switch ($algo) { case 'desCBC': $cipher = new TripleDES('cbc'); break; case 'des-EDE3-CBC': $cipher = new TripleDES('cbc'); break; case 'rc2CBC': $cipher = new RC2('cbc'); // in theory this can be changed $cipher->setKeyLength(128); break; case 'rc5-CBC-PAD': throw new UnsupportedAlgorithmException('rc5-CBC-PAD is not supported for PBES2 PKCS#8 keys'); case 'aes128-CBC-PAD': case 'aes192-CBC-PAD': case 'aes256-CBC-PAD': $cipher = new AES('cbc'); $cipher->setKeyLength(substr($algo, 3, 3)); break; default: throw new UnsupportedAlgorithmException("$algo is not supported"); } return $cipher; } /** * Initialize static variables * * @access private */ private static function initialize_static_variables() { if (!static::$childOIDsLoaded) { ASN1::loadOIDs([static::OID_VALUE => static::OID_NAME]); static::$childOIDsLoaded = true; } if (!self::$oidsLoaded) { // from https://tools.ietf.org/html/rfc2898 ASN1::loadOIDs([ // PBES1 encryption schemes '1.2.840.113549.1.5.1' => 'pbeWithMD2AndDES-CBC', '1.2.840.113549.1.5.4' => 'pbeWithMD2AndRC2-CBC', '1.2.840.113549.1.5.3' => 'pbeWithMD5AndDES-CBC', '1.2.840.113549.1.5.6' => 'pbeWithMD5AndRC2-CBC', '1.2.840.113549.1.5.10'=> 'pbeWithSHA1AndDES-CBC', '1.2.840.113549.1.5.11'=> 'pbeWithSHA1AndRC2-CBC', // from PKCS#12: // https://tools.ietf.org/html/rfc7292 '1.2.840.113549.1.12.1.1' => 'pbeWithSHAAnd128BitRC4', '1.2.840.113549.1.12.1.2' => 'pbeWithSHAAnd40BitRC4', '1.2.840.113549.1.12.1.3' => 'pbeWithSHAAnd3-KeyTripleDES-CBC', '1.2.840.113549.1.12.1.4' => 'pbeWithSHAAnd2-KeyTripleDES-CBC', '1.2.840.113549.1.12.1.5' => 'pbeWithSHAAnd128BitRC2-CBC', '1.2.840.113549.1.12.1.6' => 'pbeWithSHAAnd40BitRC2-CBC', '1.2.840.113549.1.5.12' => 'id-PBKDF2', '1.2.840.113549.1.5.13' => 'id-PBES2', '1.2.840.113549.1.5.14' => 'id-PBMAC1', // from PKCS#5 v2.1: // http://www.rsa.com/rsalabs/pkcs/files/h11302-wp-pkcs5v2-1-password-based-cryptography-standard.pdf '1.2.840.113549.2.7' => 'id-hmacWithSHA1', '1.2.840.113549.2.8' => 'id-hmacWithSHA224', '1.2.840.113549.2.9' => 'id-hmacWithSHA256', '1.2.840.113549.2.10'=> 'id-hmacWithSHA384', '1.2.840.113549.2.11'=> 'id-hmacWithSHA512', '1.2.840.113549.2.12'=> 'id-hmacWithSHA512-224', '1.2.840.113549.2.13'=> 'id-hmacWithSHA512-256', '1.3.14.3.2.7' => 'desCBC', '1.2.840.113549.3.7' => 'des-EDE3-CBC', '1.2.840.113549.3.2' => 'rc2CBC', '1.2.840.113549.3.9' => 'rc5-CBC-PAD', '2.16.840.1.101.3.4.1.2' => 'aes128-CBC-PAD', '2.16.840.1.101.3.4.1.22'=> 'aes192-CBC-PAD', '2.16.840.1.101.3.4.1.42'=> 'aes256-CBC-PAD' ]); self::$oidsLoaded = true; } } /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array|bool */ protected static function load($key, $password = '') { self::initialize_static_variables(); if (!is_string($key)) { return false; } if (self::$format != self::MODE_DER) { $decoded = ASN1::extractBER($key); if ($decoded !== false) { $key = $decoded; } elseif (self::$format == self::MODE_PEM) { return false; } } $decoded = ASN1::decodeBER($key); if (empty($decoded)) { return false; } $meta = []; $decrypted = ASN1::asn1map($decoded[0], Maps\EncryptedPrivateKeyInfo::MAP); if (strlen($password) && is_array($decrypted)) { $algorithm = $decrypted['encryptionAlgorithm']['algorithm']; switch ($algorithm) { // PBES1 case 'pbeWithMD2AndDES-CBC': case 'pbeWithMD2AndRC2-CBC': case 'pbeWithMD5AndDES-CBC': case 'pbeWithMD5AndRC2-CBC': case 'pbeWithSHA1AndDES-CBC': case 'pbeWithSHA1AndRC2-CBC': case 'pbeWithSHAAnd3-KeyTripleDES-CBC': case 'pbeWithSHAAnd2-KeyTripleDES-CBC': case 'pbeWithSHAAnd128BitRC2-CBC': case 'pbeWithSHAAnd40BitRC2-CBC': case 'pbeWithSHAAnd128BitRC4': case 'pbeWithSHAAnd40BitRC4': $cipher = self::getPBES1EncryptionObject($algorithm); $hash = self::getPBES1Hash($algorithm); $kdf = self::getPBES1KDF($algorithm); $meta['meta']['algorithm'] = $algorithm; $temp = ASN1::decodeBER($decrypted['encryptionAlgorithm']['parameters']); extract(ASN1::asn1map($temp[0], Maps\PBEParameter::MAP)); $iterationCount = (int) $iterationCount->toString(); $cipher->setPassword($password, $kdf, $hash, $salt, $iterationCount); $key = $cipher->decrypt($decrypted['encryptedData']); $decoded = ASN1::decodeBER($key); if (empty($decoded)) { return false; } break; case 'id-PBES2': $meta['meta']['algorithm'] = $algorithm; $temp = ASN1::decodeBER($decrypted['encryptionAlgorithm']['parameters']); $temp = ASN1::asn1map($temp[0], Maps\PBES2params::MAP); extract($temp); $cipher = self::getPBES2EncryptionObject($encryptionScheme['algorithm']); $meta['meta']['cipher'] = $encryptionScheme['algorithm']; $temp = ASN1::decodeBER($decrypted['encryptionAlgorithm']['parameters']); $temp = ASN1::asn1map($temp[0], Maps\PBES2params::MAP); extract($temp); if (!$cipher instanceof RC2) { $cipher->setIV($encryptionScheme['parameters']['octetString']); } else { $temp = ASN1::decodeBER($encryptionScheme['parameters']); extract(ASN1::asn1map($temp[0], Maps\RC2CBCParameter::MAP)); $effectiveKeyLength = (int) $rc2ParametersVersion->toString(); switch ($effectiveKeyLength) { case 160: $effectiveKeyLength = 40; break; case 120: $effectiveKeyLength = 64; break; case 58: $effectiveKeyLength = 128; break; //default: // should be >= 256 } $cipher->setIV($iv); $cipher->setKeyLength($effectiveKeyLength); } $meta['meta']['keyDerivationFunc'] = $keyDerivationFunc['algorithm']; switch ($keyDerivationFunc['algorithm']) { case 'id-PBKDF2': $temp = ASN1::decodeBER($keyDerivationFunc['parameters']); $prf = ['algorithm' => 'id-hmacWithSHA1']; $params = ASN1::asn1map($temp[0], Maps\PBKDF2params::MAP); extract($params); $meta['meta']['prf'] = $prf['algorithm']; $hash = str_replace('-', '/', substr($prf['algorithm'], 11)); $params = [ $password, 'pbkdf2', $hash, $salt, (int) $iterationCount->toString() ]; if (isset($keyLength)) { $params[] = (int) $keyLength->toString(); } call_user_func_array([$cipher, 'setPassword'], $params); $key = $cipher->decrypt($decrypted['encryptedData']); $decoded = ASN1::decodeBER($key); if (empty($decoded)) { return false; } break; default: throw new UnsupportedAlgorithmException('Only PBKDF2 is supported for PBES2 PKCS#8 keys'); } break; case 'id-PBMAC1': //$temp = ASN1::decodeBER($decrypted['encryptionAlgorithm']['parameters']); //$value = ASN1::asn1map($temp[0], Maps\PBMAC1params::MAP); // since i can't find any implementation that does PBMAC1 it is unsupported throw new UnsupportedAlgorithmException('Only PBES1 and PBES2 PKCS#8 keys are supported.'); // at this point we'll assume that the key conforms to PublicKeyInfo } } $private = ASN1::asn1map($decoded[0], Maps\PrivateKeyInfo::MAP); if (is_array($private)) { return $private['privateKeyAlgorithm']['algorithm'] == static::OID_NAME ? $private + $meta : false; } // EncryptedPrivateKeyInfo and PublicKeyInfo have largely identical "signatures". the only difference // is that the former has an octet string and the later has a bit string. the first byte of a bit // string represents the number of bits in the last byte that are to be ignored but, currently, // bit strings wanting a non-zero amount of bits trimmed are not supported $public = ASN1::asn1map($decoded[0], Maps\PublicKeyInfo::MAP); if (is_array($public)) { if ($public['publicKey'][0] != "\0" || $public['publicKeyAlgorithm']['algorithm'] != static::OID_NAME) { return false; } $public['publicKey'] = substr($public['publicKey'], 1); return $public; } return false; } /** * Wrap a private key appropriately * * @access public * @param string $key * @param string $attr * @param mixed $params * @param string $password * @return string */ protected static function wrapPrivateKey($key, $attr, $params, $password) { self::initialize_static_variables(); $key = [ 'version' => 'v1', 'privateKeyAlgorithm' => [ 'algorithm' => static::OID_NAME, 'parameters' => $params ], 'privateKey' => $key ]; if (!empty($attr)) { $key['attributes'] = $attr; } $key = ASN1::encodeDER($key, Maps\PrivateKeyInfo::MAP); if (!empty($password) && is_string($password)) { $salt = Random::string(8); $iterationCount = self::$defaultIterationCount; if (self::$defaultEncryptionAlgorithm == 'id-PBES2') { $crypto = self::getPBES2EncryptionObject(self::$defaultEncryptionScheme); $hash = str_replace('-', '/', substr(self::$defaultPRF, 11)); $kdf = 'pbkdf2'; $iv = Random::string($crypto->getBlockLength() >> 3); $PBKDF2params = [ 'salt' => $salt, 'iterationCount' => $iterationCount, 'prf' => ['algorithm' => self::$defaultPRF, 'parameters' => null] ]; $PBKDF2params = ASN1::encodeDER($PBKDF2params, Maps\PBKDF2params::MAP); if (!$crypto instanceof RC2) { $params = ['octetString' => $iv]; } else { $params = [ 'rc2ParametersVersion' => 58, 'iv' => $iv ]; $params = ASN1::encodeDER($params, Maps\RC2CBCParameter::MAP); $params = new ASN1\Element($params); } $params = [ 'keyDerivationFunc' => [ 'algorithm' => 'id-PBKDF2', 'parameters' => new ASN1\Element($PBKDF2params) ], 'encryptionScheme' => [ 'algorithm' => self::$defaultEncryptionScheme, 'parameters' => $params ] ]; $params = ASN1::encodeDER($params, Maps\PBES2params::MAP); $crypto->setIV($iv); } else { $crypto = self::getPBES1EncryptionObject(self::$defaultEncryptionAlgorithm); $hash = self::getPBES1Hash(self::$defaultEncryptionAlgorithm); $kdf = self::getPBES1KDF(self::$defaultEncryptionAlgorithm); $params = [ 'salt' => $salt, 'iterationCount' => $iterationCount ]; $params = ASN1::encodeDER($params, Maps\PBEParameter::MAP); } $crypto->setPassword($password, $kdf, $hash, $salt, $iterationCount); $key = $crypto->encrypt($key); $key = [ 'encryptionAlgorithm' => [ 'algorithm' => self::$defaultEncryptionAlgorithm, 'parameters' => new ASN1\Element($params) ], 'encryptedData' => $key ]; $key = ASN1::encodeDER($key, Maps\EncryptedPrivateKeyInfo::MAP); return "-----BEGIN ENCRYPTED PRIVATE KEY-----\r\n" . chunk_split(Base64::encode($key), 64) . "-----END ENCRYPTED PRIVATE KEY-----"; } return "-----BEGIN PRIVATE KEY-----\r\n" . chunk_split(Base64::encode($key), 64) . "-----END PRIVATE KEY-----"; } /** * Wrap a public key appropriately * * @access public * @param string $key * @param mixed $params * @return string */ protected static function wrapPublicKey($key, $params) { self::initialize_static_variables(); $key = [ 'publicKeyAlgorithm' => [ 'algorithm' => static::OID_NAME, 'parameters' => $params ], 'publicKey' => "\0" . $key ]; $key = ASN1::encodeDER($key, Maps\PublicKeyInfo::MAP); return "-----BEGIN PUBLIC KEY-----\r\n" . chunk_split(Base64::encode($key), 64) . "-----END PUBLIC KEY-----"; } } <?php /** * PKCS1 Formatted Key Handler * * PHP version 5 * * @category Crypt * @package Common * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\Common\Keys; use ParagonIE\ConstantTime\Base64; use ParagonIE\ConstantTime\Hex; use phpseclib\Crypt\Random; use phpseclib\Crypt\AES; use phpseclib\Crypt\DES; use phpseclib\Crypt\TripleDES; use phpseclib\File\ASN1; /** * PKCS1 Formatted Key Handler * * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PKCS1 extends PKCS { /** * Default encryption algorithm * * @var string * @access private */ private static $defaultEncryptionAlgorithm = 'AES-128-CBC'; /** * Sets the default encryption algorithm * * @access public * @param string $algo */ public static function setEncryptionAlgorithm($algo) { self::$defaultEncryptionAlgorithm = $algo; } /** * Returns the mode constant corresponding to the mode string * * @access public * @param string $mode * @return int * @throws \UnexpectedValueException if the block cipher mode is unsupported */ private static function getEncryptionMode($mode) { switch ($mode) { case 'CBC': case 'ECB': case 'CFB': case 'OFB': case 'CTR': return $mode; } throw new \UnexpectedValueException('Unsupported block cipher mode of operation'); } /** * Returns a cipher object corresponding to a string * * @access public * @param string $algo * @return string * @throws \UnexpectedValueException if the encryption algorithm is unsupported */ private static function getEncryptionObject($algo) { $modes = '(CBC|ECB|CFB|OFB|CTR)'; switch (true) { case preg_match("#^AES-(128|192|256)-$modes$#", $algo, $matches): $cipher = new AES(self::getEncryptionMode($matches[2])); $cipher->setKeyLength($matches[1]); return $cipher; case preg_match("#^DES-EDE3-$modes$#", $algo, $matches): return new TripleDES(self::getEncryptionMode($matches[1])); case preg_match("#^DES-$modes$#", $algo, $matches): return new DES(self::getEncryptionMode($matches[1])); default: throw new \UnexpectedValueException('Unsupported encryption algorithmn'); } } /** * Generate a symmetric key for PKCS#1 keys * * @access private * @param string $password * @param string $iv * @param int $length * @return string */ private static function generateSymmetricKey($password, $iv, $length) { $symkey = ''; $iv = substr($iv, 0, 8); while (strlen($symkey) < $length) { $symkey.= md5($symkey . $password . $iv, true); } return substr($symkey, 0, $length); } /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array|bool */ protected static function load($key, $password) { if (!is_string($key)) { return false; } /* Although PKCS#1 proposes a format that public and private keys can use, encrypting them is "outside the scope" of PKCS#1. PKCS#1 then refers you to PKCS#12 and PKCS#15 if you're wanting to protect private keys, however, that's not what OpenSSL* does. OpenSSL protects private keys by adding two new "fields" to the key - DEK-Info and Proc-Type. These fields are discussed here: http://tools.ietf.org/html/rfc1421#section-4.6.1.1 http://tools.ietf.org/html/rfc1421#section-4.6.1.3 DES-EDE3-CBC as an algorithm, however, is not discussed anywhere, near as I can tell. DES-CBC and DES-EDE are discussed in RFC1423, however, DES-EDE3-CBC isn't, nor is its key derivation function. As is, the definitive authority on this encoding scheme isn't the IETF but rather OpenSSL's own implementation. ie. the implementation *is* the standard and any bugs that may exist in that implementation are part of the standard, as well. * OpenSSL is the de facto standard. It's utilized by OpenSSH and other projects */ if (preg_match('#DEK-Info: (.+),(.+)#', $key, $matches)) { $iv = Hex::decode(trim($matches[2])); // remove the Proc-Type / DEK-Info sections as they're no longer needed $key = preg_replace('#^(?:Proc-Type|DEK-Info): .*#m', '', $key); $ciphertext = ASN1::extractBER($key); if ($ciphertext === false) { $ciphertext = $key; } $crypto = self::getEncryptionObject($matches[1]); $crypto->setKey(self::generateSymmetricKey($password, $iv, $crypto->getKeyLength() >> 3)); $crypto->setIV($iv); $key = $crypto->decrypt($ciphertext); } else { if (self::$format != self::MODE_DER) { $decoded = ASN1::extractBER($key); if ($decoded !== false) { $key = $decoded; } elseif (self::$format == self::MODE_PEM) { return false; } } } return $key; } /** * Wrap a private key appropriately * * @access public * @param string $key * @param string $type * @param string $password * @return string */ protected static function wrapPrivateKey($key, $type, $password) { if (empty($password) || !is_string($password)) { return "-----BEGIN $type PRIVATE KEY-----\r\n" . chunk_split(Base64::encode($key), 64) . "-----END $type PRIVATE KEY-----"; } $cipher = self::getEncryptionObject(self::$defaultEncryptionAlgorithm); $iv = Random::string($cipher->getBlockLength() >> 3); $cipher->setKey(self::generateSymmetricKey($password, $iv, $cipher->getKeyLength() >> 3)); $cipher->setIV($iv); $iv = strtoupper(Hex::encode($iv)); return "-----BEGIN $type PRIVATE KEY-----\r\n" . "Proc-Type: 4,ENCRYPTED\r\n" . "DEK-Info: " . self::$defaultEncryptionAlgorithm . ",$iv\r\n" . "\r\n" . chunk_split(Base64::encode($cipher->encrypt($key)), 64) . "-----END $type PRIVATE KEY-----"; } /** * Wrap a public key appropriately * * @access public * @param string $key * @param string $type * @return string */ protected static function wrapPublicKey($key, $type) { return "-----BEGIN $type PUBLIC KEY-----\r\n" . chunk_split(Base64::encode($key), 64) . "-----END $type PUBLIC KEY-----"; } }<?php /** * PKCS Formatted Key Handler * * PHP version 5 * * @category Crypt * @package Common * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\Common\Keys; /** * PKCS1 Formatted Key Handler * * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PKCS { /** * Auto-detect the format */ const MODE_ANY = 0; /** * Require base64-encoded PEM's be supplied */ const MODE_PEM = 1; /** * Require raw DER's be supplied */ const MODE_DER = 2; /**#@-*/ /** * Is the key a base-64 encoded PEM, DER or should it be auto-detected? * * @access private * @param int */ protected static $format = self::MODE_ANY; /** * Require base64-encoded PEM's be supplied * * @access public */ public static function requirePEM() { self::$format = self::MODE_PEM; } /** * Require raw DER's be supplied * * @access public */ public static function requireDER() { self::$format = self::MODE_DER; } /** * Accept any format and auto detect the format * * This is the default setting * * @access public */ public static function requireAny() { self::$format = self::MODE_ANY; } }<?php /** * PuTTY Formatted Key Handler * * PHP version 5 * * @category Crypt * @package Common * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\Common\Keys; use ParagonIE\ConstantTime\Base64; use ParagonIE\ConstantTime\Hex; use phpseclib\Crypt\AES; use phpseclib\Crypt\Hash; use phpseclib\Crypt\Random; use phpseclib\Common\Functions\Strings; /** * PuTTY Formatted Key Handler * * @package Common * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PuTTY { /** * Default comment * * @var string * @access private */ private static $comment = 'phpseclib-generated-key'; /** * Sets the default comment * * @access public * @param string $comment */ public static function setComment($comment) { self::$comment = str_replace(["\r", "\n"], '', $comment); } /** * Generate a symmetric key for PuTTY keys * * @access public * @param string $password * @param int $length * @return string */ private static function generateSymmetricKey($password, $length) { $symkey = ''; $sequence = 0; while (strlen($symkey) < $length) { $temp = pack('Na*', $sequence++, $password); $symkey.= Hex::decode(sha1($temp)); } return substr($symkey, 0, $length); } /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password * @return array|bool */ protected static function load($key, $password) { if (!is_string($key)) { return false; } if (strpos($key, 'BEGIN SSH2 PUBLIC KEY')) { $data = preg_split('#[\r\n]+#', $key); $data = array_splice($data, 2, -1); $data = implode('', $data); $components = call_user_func([static::PUBLIC_HANDLER, 'load'], $data); if ($components === false) { return false; } if (!preg_match('#Comment: "(.+)"#', $key, $matches)) { return false; } $components['comment'] = str_replace(['\\\\', '\"'], ['\\', '"'], $matches[1]); return $components; } $components = []; $key = preg_split('#\r\n|\r|\n#', trim($key)); $type = trim(preg_replace('#PuTTY-User-Key-File-2: (.+)#', '$1', $key[0])); if ($type != static::TYPE) { return false; } $encryption = trim(preg_replace('#Encryption: (.+)#', '$1', $key[1])); $components['comment'] = trim(preg_replace('#Comment: (.+)#', '$1', $key[2])); $publicLength = trim(preg_replace('#Public-Lines: (\d+)#', '$1', $key[3])); $public = Base64::decode(implode('', array_map('trim', array_slice($key, 4, $publicLength)))); $source = Strings::packSSH2('ssss', static::TYPE, $encryption, $components['comment'], $public); extract(unpack('Nlength', Strings::shift($public, 4))); /** @var integer $length */ if (Strings::shift($public, $length) != static::TYPE) { return false; } $components['public'] = $public; $privateLength = trim(preg_replace('#Private-Lines: (\d+)#', '$1', $key[$publicLength + 4])); $private = Base64::decode(implode('', array_map('trim', array_slice($key, $publicLength + 5, $privateLength)))); switch ($encryption) { case 'aes256-cbc': $symkey = self::generateSymmetricKey($password, 32); $crypto = new AES('cbc'); } $hashkey = 'putty-private-key-file-mac-key'; if ($encryption != 'none') { $hashkey.= $password; $crypto->setKey($symkey); $crypto->setIV(str_repeat("\0", $crypto->getBlockLength() >> 3)); $crypto->disablePadding(); $private = $crypto->decrypt($private); } $source.= Strings::packSSH2('s', $private); $hash = new Hash('sha1'); $hash->setKey(sha1($hashkey, true)); $hmac = trim(preg_replace('#Private-MAC: (.+)#', '$1', $key[$publicLength + $privateLength + 5])); $hmac = Hex::decode($hmac); if (!Strings::equals($hash->hash($source), $hmac)) { throw new \UnexpectedValueException('MAC validation error'); } $components['private'] = $private; return $components; } /** * Wrap a private key appropriately * * @access private * @param string $public * @param string $private * @param string $password * @return string */ protected static function wrapPrivateKey($public, $private, $password) { $key = "PuTTY-User-Key-File-2: " . static::TYPE . "\r\nEncryption: "; $encryption = (!empty($password) || is_string($password)) ? 'aes256-cbc' : 'none'; $key.= $encryption; $key.= "\r\nComment: " . self::$comment . "\r\n"; $public = Strings::packSSH2('s', static::TYPE) . $public; $source = Strings::packSSH2('ssss', static::TYPE, $encryption, self::$comment, $public); $public = Base64::encode($public); $key.= "Public-Lines: " . ((strlen($public) + 63) >> 6) . "\r\n"; $key.= chunk_split($public, 64); if (empty($password) && !is_string($password)) { $source.= Strings::packSSH2('s', $private); $hashkey = 'putty-private-key-file-mac-key'; } else { $private.= Random::string(16 - (strlen($private) & 15)); $source.= Strings::packSSH2('s', $private); $crypto = new AES('cbc'); $crypto->setKey(self::generateSymmetricKey($password, 32)); $crypto->setIV(str_repeat("\0", $crypto->getBlockLength() >> 3)); $crypto->disablePadding(); $private = $crypto->encrypt($private); $hashkey = 'putty-private-key-file-mac-key' . $password; } $private = Base64::encode($private); $key.= 'Private-Lines: ' . ((strlen($private) + 63) >> 6) . "\r\n"; $key.= chunk_split($private, 64); $hash = new Hash('sha1'); $hash->setKey(sha1($hashkey, true)); $key.= 'Private-MAC: ' . Hex::encode($hash->hash($source)) . "\r\n"; return $key; } /** * Wrap a public key appropriately * * This is basically the format described in RFC 4716 (https://tools.ietf.org/html/rfc4716) * * @access private * @param string $key * @return string */ protected static function wrapPublicKey($key) { $key = pack('Na*a*', strlen(static::TYPE), static::TYPE, $key); $key = "---- BEGIN SSH2 PUBLIC KEY ----\r\n" . 'Comment: "' . str_replace(['\\', '"'], ['\\\\', '\"'], self::$comment) . "\"\r\n" . chunk_split(Base64::encode($key), 64) . '---- END SSH2 PUBLIC KEY ----'; return $key; } } <?php /** * Base Class for all asymmetric key ciphers * * PHP version 5 * * @category Crypt * @package AsymmetricKey * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\Common; use phpseclib\Math\BigInteger; use phpseclib\Crypt\Hash; use ParagonIE\ConstantTime\Base64; /** * Base Class for all stream cipher classes * * @package AsymmetricKey * @author Jim Wigginton <terrafrost@php.net> */ abstract class AsymmetricKey { /** * Precomputed Zero * * @var \phpseclib\Math\BigInteger * @access private */ protected static $zero; /** * Precomputed One * * @var \phpseclib\Math\BigInteger * @access private */ protected static $one; /** * Engine * * This is only used for key generation. Valid values are RSA::ENGINE_INTERNAL and RSA::ENGINE_OPENSSL * * @var int * @access private */ protected static $engine = NULL; /** * OpenSSL configuration file name. * * Set to null to use system configuration file. * * @see self::createKey() * @var mixed * @access public */ protected static $configFile; /** * Supported plugins (lower case) * * @see self::initialize_static_variables() * @var array * @access private */ private static $plugins = []; /** * Supported plugins (original case) * * @see self::initialize_static_variables() * @var array * @access private */ private static $origPlugins = []; /** * Supported signature formats (lower case) * * @see self::initialize_static_variables() * @var array * @access private */ private static $signatureFormats = []; /** * Supported signature formats (original case) * * @see self::initialize_static_variables() * @var array * @access private */ private static $signatureFileFormats = []; /** * Password * * @var string * @access private */ protected $password = false; /** * Loaded File Format * * @var string * @access private */ protected $format = false; /** * Private Key Format * * @var string * @access private */ protected $privateKeyFormat = 'PKCS8'; /** * Public Key Format * * @var string * @access private */ protected $publicKeyFormat = 'PKCS8'; /** * Hash function * * @var \phpseclib\Crypt\Hash * @access private */ protected $hash; /** * HMAC function * * @var \phpseclib\Crypt\Hash * @access private */ private $hmac; /**#@+ * @access private * @see self::__construct() */ /** * To use the pure-PHP implementation */ const ENGINE_INTERNAL = 1; /** * To use the OpenSSL library * * (if enabled; otherwise, the internal implementation will be used) */ const ENGINE_OPENSSL = 2; /**#@-*/ /** * The constructor * * @access public */ public function __construct() { self::initialize_static_variables(); $this->hash = new Hash('sha256'); $this->hmac = new Hash('sha256'); } /** * Tests engine validity * * @return boolean * @access public * @param int $val */ public static function isValidEngine($val) { switch ($val) { case self::ENGINE_OPENSSL: return extension_loaded('openssl') && file_exists(self::$configFile); case self::ENGINE_INTERNAL: return true; } return false; } /** * Sets the engine * * Only used in RSA::createKey. Valid values are RSA::ENGINE_OPENSSL and RSA::ENGINE_INTERNAL * * @access public * @param int $val */ public static function setPreferredEngine($val) { static::$engine = null; $candidateEngines = [ $val, self::ENGINE_OPENSSL ]; foreach ($candidateEngines as $engine) { if (static::isValidEngine($engine)) { static::$engine = $engine; break; } } if (!isset(static::$engine)) { static::$engine = self::ENGINE_INTERNAL; } } /** * Returns the engine * * @access public * @return int */ public static function getEngine() { return self::$engine; } /** * Initialize static variables * * @access private */ protected static function initialize_static_variables() { if (!isset(self::$zero)) { self::$zero= new BigInteger(0); self::$one = new BigInteger(1); self::$configFile = __DIR__ . '/../openssl.cnf'; } self::loadPlugins('Keys'); if (static::ALGORITHM != 'RSA') { self::loadPlugins('Signature'); } } /** * Load Plugins * * @access private * @param $format */ private static function loadPlugins($format) { if (!isset(self::$plugins[static::ALGORITHM][$format])) { self::$plugins[static::ALGORITHM][$format] = []; foreach (new \DirectoryIterator(__DIR__ . '/../' . static::ALGORITHM . '/' . $format . '/') as $file) { if ($file->getExtension() !== 'php') continue; $name = pathinfo($file, PATHINFO_FILENAME); $type = 'phpseclib\Crypt\\' . static::ALGORITHM . '\\' . $format . '\\' . $name; self::$plugins[static::ALGORITHM][$format][strtolower($name)] = $type; self::$origPlugins[static::ALGORITHM][$format][] = $name; } } } /** * Validate Plugin * * @access private * @param string $format * @param string $type * @param string $method optional * @return mixed */ protected static function validatePlugin($format, $type, $method = NULL) { $type = strtolower($type); if (!isset(self::$plugins[static::ALGORITHM][$format][$type])) { return false; } $type = self::$plugins[static::ALGORITHM][$format][$type]; if (isset($method) && !method_exists($type, $method)) { return false; } return $type; } /** * Load the key * * @access private * @param string $key * @param string $type * @return array|bool */ public function load($key, $type) { $components = false; if ($type === false) { foreach (self::$plugins[static::ALGORITHM]['Keys'] as $format) { try { $components = $format::load($key, $this->password); } catch (\Exception $e) { $components = false; } if ($components !== false) { break; } } } else { $format = strtolower($type); if (isset(self::$plugins[static::ALGORITHM]['Keys'][$format])) { $format = self::$plugins[static::ALGORITHM]['Keys'][$format]; $components = $format::load($key, $this->password); } } if ($components === false) { $this->format = false; return false; } $this->format = $format; return $components; } /** * Load the public key * * @access private * @param string $key * @param string $type * @return array|bool */ public function setPublicKey($key, $type) { $components = false; if ($type === false) { foreach (self::$plugins[static::ALGORITHM]['Keys'] as $format) { if (!method_exists($format, 'savePublicKey')) { continue; } try { $components = $format::load($key, $this->password); } catch (\Exception $e) { $components = false; } if ($components !== false) { break; } } } else { $format = strtolower($type); if (isset(self::$plugins[static::ALGORITHM]['Keys'][$format])) { $format = self::$plugins[static::ALGORITHM]['Keys'][$format]; $components = $format::load($key, $this->password); } } if ($components === false) { $this->format = false; return false; } $this->format = $format; return $components; } /** * Returns a list of supported formats. * * @access public * @return array */ public static function getSupportedKeyFormats() { self::initialize_static_variables(); return self::$plugins[static::ALGORITHM]['Keys']; } /** * Add a fileformat plugin * * The plugin needs to either already be loaded or be auto-loadable. * Loading a plugin whose shortname overwrite an existing shortname will overwrite the old plugin. * * @see self::load() * @param string $fullname * @access public * @return bool */ public static function addFileFormat($fullname) { self::initialize_static_variables(); if (class_exists($fullname)) { $meta = new \ReflectionClass($path); $shortname = $meta->getShortName(); self::$plugins[static::ALGORITHM]['Keys'][strtolower($shortname)] = $fullname; self::$origPlugins[static::ALGORITHM]['Keys'][] = $shortname; } } /** * Returns the public key's fingerprint * * The public key's fingerprint is returned, which is equivalent to running `ssh-keygen -lf rsa.pub`. If there is * no public key currently loaded, false is returned. * Example output (md5): "c1:b1:30:29:d7:b8:de:6c:97:77:10:d7:46:41:63:87" (as specified by RFC 4716) * * @access public * @param string $algorithm The hashing algorithm to be used. Valid options are 'md5' and 'sha256'. False is returned * for invalid values. * @return mixed */ public function getPublicKeyFingerprint($algorithm = 'md5') { $type = self::validatePlugin('Keys', 'OpenSSH', 'getBinaryOutput'); if ($type === false) { return false; } $status = $type::getBinaryOutput(); $type::setBinaryOutput(true); $key = $this->getPublicKey('OpenSSH'); if ($key === false) { return false; } $type::setBinaryOutput($status); switch ($algorithm) { case 'sha256': $hash = new Hash('sha256'); $base = Base64::encode($hash->hash($key)); return substr($base, 0, strlen($base) - 1); case 'md5': return substr(chunk_split(md5($key), 2, ':'), 0, -1); default: return false; } } /** * __toString() magic method * * @access public * @return string */ public function __toString() { try { $key = $this->getPrivateKey($this->privateKeyFormat); if (is_string($key)) { return $key; } $key = $this->getPublicKey($this->publicKeyFormat); return is_string($key) ? $key : ''; } catch (\Exception $e) { return ''; } } /** * __clone() magic method * * @access public * @return static */ public function __clone() { $key = new static(); $key->load($this); return $key; } /** * Determines the private key format * * @see self::__toString() * @access public * @param string $format */ public function setPrivateKeyFormat($format) { $this->privateKeyFormat = $format; } /** * Determines the public key format * * @see self::__toString() * @access public * @param string $format */ public function setPublicKeyFormat($format) { $this->publicKeyFormat = $format; } /** * Returns the format of the loaded key. * * If the key that was loaded wasn't in a valid or if the key was auto-generated * with RSA::createKey() then this will return false. * * @see self::load() * @access public * @return mixed */ public function getLoadedFormat() { if ($this->format === false) { return false; } $meta = new \ReflectionClass($this->format); return $meta->getShortName(); } /** * Sets the password * * Private keys can be encrypted with a password. To unset the password, pass in the empty string or false. * Or rather, pass in $password such that empty($password) && !is_string($password) is true. * * @see self::createKey() * @see self::load() * @access public * @param string|boolean $password */ public function setPassword($password = false) { $this->password = $password; } /** * Determines which hashing function should be used * * @access public * @param string $hash */ public function setHash($hash) { $this->hash = new Hash($hash); $this->hmac = new Hash($hash); } /** * Compute the pseudorandom k for signature generation, * using the process specified for deterministic DSA. * * @access public * @param string $h1 * @return string */ protected function computek($h1) { $v = str_repeat("\1", strlen($h1)); $k = str_repeat("\0", strlen($h1)); $x = $this->int2octets($this->x); $h1 = $this->bits2octets($h1); $this->hmac->setKey($k); $k = $this->hmac->hash($v . "\0" . $x . $h1); $this->hmac->setKey($k); $v = $this->hmac->hash($v); $k = $this->hmac->hash($v . "\1" . $x . $h1); $this->hmac->setKey($k); $v = $this->hmac->hash($v); $qlen = $this->q->getLengthInBytes(); while (true) { $t = ''; while (strlen($t) < $qlen) { $v = $this->hmac->hash($v); $t = $t . $v; } $k = $this->bits2int($t); if (!$k->equals(self::$zero) && $k->compare($this->q) < 0) { break; } $k = $this->hmac->hash($v . "\0"); $this->hmac->setKey($k); $v = $this->hmac->hash($v); } return $k; } /** * Integer to Octet String * * @access private * @param \phpseclib\Math\BigInteger $v * @return string */ private function int2octets($v) { $out = $v->toBytes(); $rolen = $this->q->getLengthInBytes(); if (strlen($out) < $rolen) { return str_pad($out, $rolen, "\0", STR_PAD_LEFT); } else if (strlen($out) > $rolen) { return substr($out, -$rolen); } else { return $out; } } /** * Bit String to Integer * * @access private * @param string $in * @return \phpseclib\Math\BigInteger */ protected function bits2int($in) { $v = new BigInteger($in, 256); $vlen = strlen($in) << 3; $qlen = $this->q->getLength(); if ($vlen > $qlen) { return $v->bitwise_rightShift($vlen - $qlen); } return $v; } /** * Bit String to Octet String * * @access private * @param string $in * @return string */ private function bits2octets($in) { $z1 = $this->bits2int($in); $z2 = $z1->subtract($this->q); return $z2->compare(self::$zero) < 0 ? $this->int2octets($z1) : $this->int2octets($z2); } } <?php /** * Raw Signature Handler * * PHP version 5 * * Handles signatures as arrays * * @category Crypt * @package Common * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\Common\Signature; use phpseclib\Math\BigInteger; /** * Raw Signature Handler * * @package Common * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Raw { /** * Loads a signature * * @access public * @param array $sig * @return array|bool */ public static function load($sig) { switch (true) { case !is_array($sig): case !isset($sig['r']) || !isset($sig['s']): case !$sig['r'] instanceof BigInteger: case !$sig['s'] instanceof BigInteger: return false; } return [ 'r' => $sig['r'], 's' => $sig['s'] ]; } /** * Returns a signature in the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $r * @param \phpseclib\Math\BigInteger $s * @return string */ public static function save(BigInteger $r, BigInteger $s) { return compact('r', 's'); } } <?php /** * Raw DSA Key Handler * * PHP version 5 * * Reads and creates arrays as DSA keys * * @category Crypt * @package DSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\DSA\Keys; use phpseclib\Math\BigInteger; /** * Raw DSA Key Handler * * @package DSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Raw { /** * Break a public or private key down into its constituent components * * @access public * @param array $key * @param string $password optional * @return array|bool */ public static function load($key, $password = '') { if (!is_array($key)) { return false; } switch (true) { case !isset($key['p']) || !isset($key['q']) || !isset($key['g']): case !$key['p'] instanceof BigInteger: case !$key['q'] instanceof BigInteger: case !$key['g'] instanceof BigInteger: case !isset($key['x']) && !isset($key['y']): case isset($key['x']) && !$key['x'] instanceof BigInteger: case isset($key['y']) && !$key['y'] instanceof BigInteger: return false; } $options = ['p' => 1, 'q' => 1, 'g' => 1, 'x' => 1, 'y' => 1]; return array_intersect_key($key, $options); } /** * Convert a private key to the appropriate format. * * @access public * @param \phpseclib\Math\BigInteger $p * @param \phpseclib\Math\BigInteger $q * @param \phpseclib\Math\BigInteger $g * @param \phpseclib\Math\BigInteger $y * @param \phpseclib\Math\BigInteger $x * @param string $password optional * @return string */ public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = '') { return compact('p', 'q', 'g', 'y', 'x'); } /** * Convert a public key to the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $p * @param \phpseclib\Math\BigInteger $q * @param \phpseclib\Math\BigInteger $g * @param \phpseclib\Math\BigInteger $y * @return string */ public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y) { return compact('p', 'q', 'g', 'y'); } } <?php /** * XML Formatted DSA Key Handler * * While XKMS defines a private key format for RSA it does not do so for DSA. Quoting that standard: * * "[XKMS] does not specify private key parameters for the DSA signature algorithm since the algorithm only * supports signature modes and so the application of server generated keys and key recovery is of limited * value" * * PHP version 5 * * @category Crypt * @package DSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\DSA\Keys; use ParagonIE\ConstantTime\Base64; use phpseclib\Math\BigInteger; /** * XML Formatted DSA Key Handler * * @package DSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class XML { /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array|bool */ public static function load($key, $password = '') { if (!is_string($key)) { return false; } $use_errors = libxml_use_internal_errors(true); $dom = new \DOMDocument(); if (substr($key, 0, 5) != '<?xml') { $key = '<xml>' . $key . '</xml>'; } if (!$dom->loadXML($key)) { return false; } $xpath = new \DOMXPath($dom); $keys = ['p', 'q', 'g', 'y', 'j', 'seed', 'pgencounter']; foreach ($keys as $key) { // $dom->getElementsByTagName($key) is case-sensitive $temp = $xpath->query("//*[translate(local-name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='$key']"); if (!$temp->length) { continue; } $value = new BigInteger(Base64::decode($temp->item(0)->nodeValue), 256); switch ($key) { case 'p': // a prime modulus meeting the [DSS] requirements // Parameters P, Q, and G can be public and common to a group of users. They might be known // from application context. As such, they are optional but P and Q must either both appear // or both be absent $components['p'] = $value; break; case 'q': // an integer in the range 2**159 < Q < 2**160 which is a prime divisor of P-1 $components['q'] = $value; break; case 'g': // an integer with certain properties with respect to P and Q $components['g'] = $value; break; case 'y': // G**X mod P (where X is part of the private key and not made public) $components['y'] = $value; // the remaining options do not do anything case 'j': // (P - 1) / Q // Parameter J is available for inclusion solely for efficiency as it is calculatable from // P and Q case 'seed': // a DSA prime generation seed // Parameters seed and pgenCounter are used in the DSA prime number generation algorithm // specified in [DSS]. As such, they are optional but must either both be present or both // be absent case 'pgencounter': // a DSA prime generation counter } } libxml_use_internal_errors($use_errors); if (!isset($components['y'])) { return false; } switch (true) { case !isset($components['p']): case !isset($components['q']): case !isset($components['g']): return ['y' => $components['y']]; } return $components; } /** * Convert a public key to the appropriate format * * See https://www.w3.org/TR/xmldsig-core/#sec-DSAKeyValue * * @access public * @param \phpseclib\Math\BigInteger $p * @param \phpseclib\Math\BigInteger $q * @param \phpseclib\Math\BigInteger $g * @param \phpseclib\Math\BigInteger $y * @return string */ public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y) { return "<DSAKeyValue>\r\n" . ' <P>' . Base64::encode($p->toBytes()) . "</P>\r\n" . ' <Q>' . Base64::encode($q->toBytes()) . "</Q>\r\n" . ' <G>' . Base64::encode($g->toBytes()) . "</G>\r\n" . ' <Y>' . Base64::encode($y->toBytes()) . "</Y>\r\n" . '</DSAKeyValue>'; } } <?php /** * OpenSSH Formatted DSA Key Handler * * PHP version 5 * * Place in $HOME/.ssh/authorized_keys * * @category Crypt * @package DSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\DSA\Keys; use ParagonIE\ConstantTime\Base64; use phpseclib\Math\BigInteger; use phpseclib\Common\Functions\Strings; use phpseclib\Crypt\Common\Keys\OpenSSH as Progenitor; /** * OpenSSH Formatted DSA Key Handler * * @package DSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class OpenSSH extends Progenitor { /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array|bool */ public static function load($key, $password = '') { $key = parent::load($key, 'ssh-dss'); if ($key === false) { return false; } $result = Strings::unpackSSH2('iiii', $key); if ($result === false) { return false; } list($p, $q, $g, $y) = $result; $comment = parent::getComment($key); return compact('p', 'q', 'g', 'y', 'comment'); } /** * Convert a public key to the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $p * @param \phpseclib\Math\BigInteger $q * @param \phpseclib\Math\BigInteger $g * @param \phpseclib\Math\BigInteger $y * @return string */ public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y) { if ($q->getLength() != 160) { throw new \InvalidArgumentException('SSH only supports keys with an N (length of Group Order q) of 160'); } // from <http://tools.ietf.org/html/rfc4253#page-15>: // string "ssh-dss" // mpint p // mpint q // mpint g // mpint y $DSAPublicKey = Strings::packSSH2('siiii', 'ssh-dss', $p, $q, $g, $y); if (self::$binary) { return $DSAPublicKey; } $DSAPublicKey = 'ssh-dss ' . Base64::encode($DSAPublicKey) . ' ' . self::$comment; return $DSAPublicKey; } } <?php /** * PKCS#8 Formatted DSA Key Handler * * PHP version 5 * * Processes keys with the following headers: * * -----BEGIN ENCRYPTED PRIVATE KEY----- * -----BEGIN PRIVATE KEY----- * -----BEGIN PUBLIC KEY----- * * Analogous to ssh-keygen's pkcs8 format (as specified by -m). Although PKCS8 * is specific to private keys it's basically creating a DER-encoded wrapper * for keys. This just extends that same concept to public keys (much like ssh-keygen) * * @category Crypt * @package DSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\DSA\Keys; use phpseclib\Math\BigInteger; use phpseclib\Crypt\Common\Keys\PKCS8 as Progenitor; use phpseclib\File\ASN1; use phpseclib\File\ASN1\Maps; /** * PKCS#8 Formatted DSA Key Handler * * @package DSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PKCS8 extends Progenitor { /** * OID Name * * @var string * @access private */ const OID_NAME = 'id-dsa'; /** * OID Value * * @var string * @access private */ const OID_VALUE = '1.2.840.10040.4.1'; /** * Child OIDs loaded * * @var bool * @access private */ protected static $childOIDsLoaded = false; /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array|bool */ public static function load($key, $password = '') { if (!is_string($key)) { return false; } $isPublic = strpos($key, 'PUBLIC') !== false; $key = parent::load($key, $password); if ($key === false) { return false; } $type = isset($key['privateKey']) ? 'privateKey' : 'publicKey'; switch (true) { case !$isPublic && $type == 'publicKey': case $isPublic && $type == 'privateKey': return false; } $decoded = ASN1::decodeBER($key[$type . 'Algorithm']['parameters']->element); if (empty($decoded)) { return false; } $components = ASN1::asn1map($decoded[0], Maps\DSAParams::MAP); if (!is_array($components)) { return false; } $decoded = ASN1::decodeBER($key[$type]); if (empty($decoded)) { return false; } $var = $type == 'privateKey' ? 'x' : 'y'; $components[$var] = ASN1::asn1map($decoded[0], Maps\DSAPublicKey::MAP); if (!$components[$var] instanceof BigInteger) { return false; } if (isset($key['meta'])) { $components['meta'] = $key['meta']; } return $components; } /** * Convert a private key to the appropriate format. * * @access public * @param \phpseclib\Math\BigInteger $p * @param \phpseclib\Math\BigInteger $q * @param \phpseclib\Math\BigInteger $g * @param \phpseclib\Math\BigInteger $x * @param \phpseclib\Math\BigInteger $y * @param string $password optional * @return string */ public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = '') { $params = [ 'p' => $p, 'q' => $q, 'g' => $g ]; $params = ASN1::encodeDER($params, Maps\DSAParams::MAP); $params = new ASN1\Element($params); $key = ASN1::encodeDER($x, Maps\DSAPublicKey::MAP); return self::wrapPrivateKey($key, [], $params, $password); } /** * Convert a public key to the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $p * @param \phpseclib\Math\BigInteger $q * @param \phpseclib\Math\BigInteger $g * @param \phpseclib\Math\BigInteger $y * @return string */ public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y) { $params = [ 'p' => $p, 'q' => $q, 'g' => $g ]; $params = ASN1::encodeDER($params, Maps\DSAParams::MAP); $params = new ASN1\Element($params); $key = ASN1::encodeDER($y, Maps\DSAPublicKey::MAP); return self::wrapPublicKey($key, $params); } } <?php /** * PKCS#1 Formatted DSA Key Handler * * PHP version 5 * * Used by File/X509.php * * Processes keys with the following headers: * * -----BEGIN DSA PRIVATE KEY----- * -----BEGIN DSA PUBLIC KEY----- * -----BEGIN DSA PARAMETERS----- * * Analogous to ssh-keygen's pem format (as specified by -m) * * @category Crypt * @package DSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\DSA\Keys; use phpseclib\Math\BigInteger; use phpseclib\Crypt\Common\Keys\PKCS1 as Progenitor; use phpseclib\File\ASN1; use phpseclib\File\ASN1\Maps; use ParagonIE\ConstantTime\Base64; /** * PKCS#1 Formatted RSA Key Handler * * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PKCS1 extends Progenitor { /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array|bool */ public static function load($key, $password = '') { if (!is_string($key)) { return false; } $key = parent::load($key, $password); if ($key === false) { return false; } $decoded = ASN1::decodeBER($key); if (empty($decoded)) { return false; } $key = ASN1::asn1map($decoded[0], Maps\DSAParams::MAP); if (is_array($key)) { return $key; } $key = ASN1::asn1map($decoded[0], Maps\DSAPrivateKey::MAP); if (is_array($key)) { return $key; } $key = ASN1::asn1map($decoded[0], Maps\DSAPublicKey::MAP); return is_array($key) ? $key : false; } /** * Convert DSA parameters to the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $p * @param \phpseclib\Math\BigInteger $q * @param \phpseclib\Math\BigInteger $g * @return string */ public static function saveParameters(BigInteger $p, BigInteger $q, BigInteger $g) { $key = [ 'p' => $p, 'q' => $q, 'g' => $g ]; $key = ASN1::encodeDER($key, Maps\DSAParams::MAP); return "-----BEGIN DSA PARAMETERS-----\r\n" . chunk_split(Base64::encode($key), 64) . "-----END DSA PARAMETERS-----\r\n"; } /** * Convert a private key to the appropriate format. * * @access public * @param \phpseclib\Math\BigInteger $p * @param \phpseclib\Math\BigInteger $q * @param \phpseclib\Math\BigInteger $g * @param \phpseclib\Math\BigInteger $x * @param \phpseclib\Math\BigInteger $y * @param string $password optional * @return string */ public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = '') { $key = [ 'version' => 0, 'p' => $p, 'q' => $q, 'g' => $g, 'y' => $y, 'x' => $x ]; $key = ASN1::encodeDER($key, Maps\DSAPrivateKey::MAP); return self::wrapPrivateKey($key, 'DSA', $password); } /** * Convert a public key to the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $p * @param \phpseclib\Math\BigInteger $q * @param \phpseclib\Math\BigInteger $g * @param \phpseclib\Math\BigInteger $y * @return string */ public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y) { $key = ASN1::encodeDER($y, Maps\DSAPublicKey::MAP); return self::wrapPublicKey($key, 'DSA'); } } <?php /** * PuTTY Formatted DSA Key Handler * * puttygen does not generate DSA keys with an N of anything other than 160, however, * it can still load them and convert them. PuTTY will load them, too, but SSH servers * won't accept them. Since PuTTY formatted keys are primarily used with SSH this makes * keys with N > 160 kinda useless, hence this handlers not supporting such keys. * * PHP version 5 * * @category Crypt * @package DSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\DSA\Keys; use phpseclib\Math\BigInteger; use phpseclib\Common\Functions\Strings; use phpseclib\Crypt\Common\Keys\PuTTY as Progenitor; /** * PuTTY Formatted DSA Key Handler * * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PuTTY extends Progenitor { /** * Public Handler * * @var string * @access private */ const PUBLIC_HANDLER = 'phpseclib\Crypt\DSA\Keys\OpenSSH'; /** * Algorithm Identifier * * @var string * @access private */ const TYPE = 'ssh-dss'; /** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array|bool */ public static function load($key, $password = '') { $components = parent::load($key, $password); if ($components === false || !isset($components['private'])) { return $components; } $result = Strings::unpackSSH2('iiii', $components['public']); if ($result === false) { return false; } list($p, $q, $g, $y) = $result; $result = Strings::unpackSSH2('i', $components['private']); if ($result === false) { return false; } list($x) = $result; if (isset($components['comment'])) { $comment = $components['comment']; } return compact('p', 'q', 'g', 'y', 'x', 'comment'); } /** * Convert a private key to the appropriate format. * * @access public * @param \phpseclib\Math\BigInteger $p * @param \phpseclib\Math\BigInteger $q * @param \phpseclib\Math\BigInteger $g * @param \phpseclib\Math\BigInteger $y * @param \phpseclib\Math\BigInteger $x * @param string $password optional * @return string */ public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = '') { if ($q->getLength() != 160) { throw new \InvalidArgumentException('SSH only supports keys with an N (length of Group Order q) of 160'); } $public = Strings::packSSH2('iiii', $p, $q, $g, $y); $private = Strings::packSSH2('i', $x); return self::wrapPrivateKey($public, $private, $password); } /** * Convert a public key to the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $p * @param \phpseclib\Math\BigInteger $q * @param \phpseclib\Math\BigInteger $g * @param \phpseclib\Math\BigInteger $y * @return string */ public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y) { if ($q->getLength() != 160) { throw new \InvalidArgumentException('SSH only supports keys with an N (length of Group Order q) of 160'); } return self::wrapPublicKey(Strings::packSSH2('iiii', $p, $q, $g, $y)); } } <?php /** * SSH2 Signature Handler * * PHP version 5 * * Handles signatures in the format used by SSH2 * * @category Crypt * @package Common * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\DSA\Signature; use phpseclib\Math\BigInteger; use phpseclib\Common\Functions\Strings; /** * SSH2 Signature Handler * * @package Common * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class SSH2 { /** * Loads a signature * * @access public * @param string $sig * @return mixed */ public static function load($sig) { if (!is_string($sig)) { return false; } $result = Strings::unpackSSH2('ss', $sig); if ($result === false) { return false; } list($type, $blob) = $result; if ($type != 'ssh-dss' || strlen($blob) != 40) { return false; } return [ 'r' => new BigInteger(substr($blob, 0, 20), 256), 's' => new BigInteger(substr($blob, 20), 256) ]; } /** * Returns a signature in the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $r * @param \phpseclib\Math\BigInteger $s * @return string */ public static function save(BigInteger $r, BigInteger $s) { if ($r->getLength() > 160 || $s->getLength() > 160) { return false; } return Strings::packSSH2('ss', 'ssh-dss', str_pad($r->toBytes(), 20, "\0", STR_PAD_LEFT) . str_pad($s->toBytes(), 20, "\0", STR_PAD_LEFT) ); } } <?php /** * Raw DSA Signature Handler * * PHP version 5 * * @category Crypt * @package DSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\DSA\Signature; use phpseclib\Crypt\Common\Signature\Raw as Progenitor; /** * Raw DSA Signature Handler * * @package DSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Raw extends Progenitor { } <?php /** * PKCS Signature Handler * * PHP version 5 * * Handles signatures in the format described in * https://tools.ietf.org/html/rfc3279#section-2.2.2 * * @category Crypt * @package Common * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt\DSA\Signature; use phpseclib\Math\BigInteger; use phpseclib\File\ASN1; use phpseclib\File\ASN1\Maps; /** * PKCS Signature Handler * * @package Common * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PKCS { /** * Loads a signature * * @access public * @param string $sig * @return array|bool */ public static function load($sig) { if (!is_string($sig)) { return false; } $decoded = ASN1::decodeBER($sig); if (empty($decoded)) { return false; } $components = ASN1::asn1map($decoded[0], Maps\DssSigValue::MAP); return $components; } /** * Returns a signature in the appropriate format * * @access public * @param \phpseclib\Math\BigInteger $r * @param \phpseclib\Math\BigInteger $s * @return string */ public static function save(BigInteger $r, BigInteger $s) { return ASN1::encodeDER(compact('r', 's'), Maps\DssSigValue::MAP); } } <?php /** * Pure-PHP implementation of Blowfish. * * Uses mcrypt, if available, and an internal implementation, otherwise. * * PHP version 5 * * Useful resources are as follows: * * - {@link http://en.wikipedia.org/wiki/Blowfish_(cipher) Wikipedia description of Blowfish} * * Here's a short example of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * $blowfish = new \phpseclib\Crypt\Blowfish(); * * $blowfish->setKey('12345678901234567890123456789012'); * * $plaintext = str_repeat('a', 1024); * * echo $blowfish->decrypt($blowfish->encrypt($plaintext)); * ?> * </code> * * @category Crypt * @package Blowfish * @author Jim Wigginton <terrafrost@php.net> * @author Hans-Juergen Petrich <petrich@tronic-media.com> * @copyright 2007 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt; use phpseclib\Crypt\Common\BlockCipher; /** * Pure-PHP implementation of Blowfish. * * @package Blowfish * @author Jim Wigginton <terrafrost@php.net> * @author Hans-Juergen Petrich <petrich@tronic-media.com> * @access public */ class Blowfish extends BlockCipher { /** * Block Length of the cipher * * @see \phpseclib\Crypt\Common\SymmetricKey::block_size * @var int * @access private */ protected $block_size = 8; /** * The mcrypt specific name of the cipher * * @see \phpseclib\Crypt\Common\SymmetricKey::cipher_name_mcrypt * @var string * @access private */ protected $cipher_name_mcrypt = 'blowfish'; /** * Optimizing value while CFB-encrypting * * @see \phpseclib\Crypt\Common\SymmetricKey::cfb_init_len * @var int * @access private */ protected $cfb_init_len = 500; /** * The fixed subkeys boxes ($sbox0 - $sbox3) with 256 entries each * * S-Box 0 * * @access private * @var array */ private $sbox0 = [ 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0, 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8, 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1, 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a ]; /** * S-Box 1 * * @access private * @var array */ private $sbox1 = [ 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1, 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff, 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7, 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509, 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50, 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281, 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7 ]; /** * S-Box 2 * * @access private * @var array */ private $sbox2 = [ 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb, 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb, 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc, 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b, 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61, 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633, 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0 ]; /** * S-Box 3 * * @access private * @var array */ private $sbox3 = [ 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22, 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51, 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd, 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd, 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38, 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525, 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d, 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6 ]; /** * P-Array consists of 18 32-bit subkeys * * @var array * @access private */ private $parray = [ 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b ]; /** * The BCTX-working Array * * Holds the expanded key [p] and the key-depended s-boxes [sb] * * @var array * @access private */ private $bctx; /** * Holds the last used key * * @var array * @access private */ private $kl; /** * The Key Length (in bytes) * * @see \phpseclib\Crypt\Common\SymmetricKey::setKeyLength() * @var int * @access private * @internal The max value is 256 / 8 = 32, the min value is 128 / 8 = 16. Exists in conjunction with $Nk * because the encryption / decryption / key schedule creation requires this number and not $key_length. We could * derive this from $key_length or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu * of that, we'll just precompute it once. */ protected $key_length = 16; /** * Default Constructor. * * @param int $mode * @access public * @throws \InvalidArgumentException if an invalid / unsupported mode is provided */ public function __construct($mode) { if ($mode == self::MODE_STREAM) { throw new \InvalidArgumentException('Block ciphers cannot be ran in stream mode'); } parent::__construct($mode); } /** * Sets the key length. * * Key lengths can be between 32 and 448 bits. * * @access public * @param int $length */ public function setKeyLength($length) { if ($length < 32 || $length > 448) { throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys of sizes between 32 and 448 bits are supported'); } $this->key_length = $length >> 3; parent::setKeyLength($length); } /** * Test for engine validity * * This is mainly just a wrapper to set things up for \phpseclib\Crypt\Common\SymmetricKey::isValidEngine() * * @see \phpseclib\Crypt\Common\SymmetricKey::isValidEngine() * @param int $engine * @access protected * @return bool */ protected function isValidEngineHelper($engine) { if ($engine == self::ENGINE_OPENSSL) { if (version_compare(PHP_VERSION, '5.3.7') < 0 && $this->key_length != 16) { return false; } if ($this->key_length < 16) { return false; } $this->cipher_name_openssl_ecb = 'bf-ecb'; $this->cipher_name_openssl = 'bf-' . $this->openssl_translate_mode(); } return parent::isValidEngineHelper($engine); } /** * Setup the key (expansion) * * @see \phpseclib\Crypt\Common\SymmetricKey::_setupKey() * @access private */ protected function setupKey() { if (isset($this->kl['key']) && $this->key === $this->kl['key']) { // already expanded return; } $this->kl = ['key' => $this->key]; /* key-expanding p[] and S-Box building sb[] */ $this->bctx = [ 'p' => [], 'sb' => [ $this->sbox0, $this->sbox1, $this->sbox2, $this->sbox3 ] ]; // unpack binary string in unsigned chars $key = array_values(unpack('C*', $this->key)); $keyl = count($key); for ($j = 0, $i = 0; $i < 18; ++$i) { // xor P1 with the first 32-bits of the key, xor P2 with the second 32-... for ($data = 0, $k = 0; $k < 4; ++$k) { $data = ($data << 8) | $key[$j]; if (++$j >= $keyl) { $j = 0; } } $this->bctx['p'][] = $this->parray[$i] ^ $data; } // encrypt the zero-string, replace P1 and P2 with the encrypted data, // encrypt P3 and P4 with the new P1 and P2, do it with all P-array and subkeys $data = "\0\0\0\0\0\0\0\0"; for ($i = 0; $i < 18; $i += 2) { list($l, $r) = array_values(unpack('N*', $data = $this->encryptBlock($data))); $this->bctx['p'][$i ] = $l; $this->bctx['p'][$i + 1] = $r; } for ($i = 0; $i < 4; ++$i) { for ($j = 0; $j < 256; $j += 2) { list($l, $r) = array_values(unpack('N*', $data = $this->encryptBlock($data))); $this->bctx['sb'][$i][$j ] = $l; $this->bctx['sb'][$i][$j + 1] = $r; } } } /** * Encrypts a block * * @access private * @param string $in * @return string */ protected function encryptBlock($in) { $p = $this->bctx["p"]; // extract($this->bctx["sb"], EXTR_PREFIX_ALL, "sb"); // slower $sb_0 = $this->bctx["sb"][0]; $sb_1 = $this->bctx["sb"][1]; $sb_2 = $this->bctx["sb"][2]; $sb_3 = $this->bctx["sb"][3]; $in = unpack("N*", $in); $l = $in[1]; $r = $in[2]; for ($i = 0; $i < 16; $i+= 2) { $l^= $p[$i]; $r^= self::safe_intval((self::safe_intval($sb_0[$l >> 24 & 0xff] + $sb_1[$l >> 16 & 0xff]) ^ $sb_2[$l >> 8 & 0xff]) + $sb_3[$l & 0xff]); $r^= $p[$i + 1]; $l^= self::safe_intval((self::safe_intval($sb_0[$r >> 24 & 0xff] + $sb_1[$r >> 16 & 0xff]) ^ $sb_2[$r >> 8 & 0xff]) + $sb_3[$r & 0xff]); } return pack("N*", $r ^ $p[17], $l ^ $p[16]); } /** * Decrypts a block * * @access private * @param string $in * @return string */ protected function decryptBlock($in) { $p = $this->bctx["p"]; $sb_0 = $this->bctx["sb"][0]; $sb_1 = $this->bctx["sb"][1]; $sb_2 = $this->bctx["sb"][2]; $sb_3 = $this->bctx["sb"][3]; $in = unpack("N*", $in); $l = $in[1]; $r = $in[2]; for ($i = 17; $i > 2; $i-= 2) { $l^= $p[$i]; $r^= self::safe_intval((self::safe_intval($sb_0[$l >> 24 & 0xff] + $sb_1[$l >> 16 & 0xff]) ^ $sb_2[$l >> 8 & 0xff]) + $sb_3[$l & 0xff]); $r^= $p[$i - 1]; $l^= self::safe_intval((self::safe_intval($sb_0[$r >> 24 & 0xff] + $sb_1[$r >> 16 & 0xff]) ^ $sb_2[$r >> 8 & 0xff]) + $sb_3[$r & 0xff]); } return pack("N*", $r ^ $p[0], $l ^ $p[1]); } /** * Setup the performance-optimized function for de/encrypt() * * @see \phpseclib\Crypt\Common\SymmetricKey::_setupInlineCrypt() * @access private */ protected function setupInlineCrypt() { $p = $this->bctx['p']; $init_crypt = ' static $sb_0, $sb_1, $sb_2, $sb_3; if (!$sb_0) { $sb_0 = $this->bctx["sb"][0]; $sb_1 = $this->bctx["sb"][1]; $sb_2 = $this->bctx["sb"][2]; $sb_3 = $this->bctx["sb"][3]; } '; $safeint = self::safe_intval_inline(); // Generating encrypt code: $encrypt_block = ' $in = unpack("N*", $in); $l = $in[1]; $r = $in[2]; '; for ($i = 0; $i < 16; $i+= 2) { $encrypt_block.= ' $l^= ' . $p[$i] . '; $r^= ' . sprintf($safeint, '(' . sprintf($safeint, '$sb_0[$l >> 24 & 0xff] + $sb_1[$l >> 16 & 0xff]') . ' ^ $sb_2[$l >> 8 & 0xff]) + $sb_3[$l & 0xff]') . '; $r^= ' . $p[$i + 1] . '; $l^= ' . sprintf($safeint, '(' . sprintf($safeint, '$sb_0[$r >> 24 & 0xff] + $sb_1[$r >> 16 & 0xff]') . ' ^ $sb_2[$r >> 8 & 0xff]) + $sb_3[$r & 0xff]') . '; '; } $encrypt_block.= ' $in = pack("N*", $r ^ ' . $p[17] . ', $l ^ ' . $p[16] . ' ); '; // Generating decrypt code: $decrypt_block = ' $in = unpack("N*", $in); $l = $in[1]; $r = $in[2]; '; for ($i = 17; $i > 2; $i-= 2) { $decrypt_block.= ' $l^= ' . $p[$i] . '; $r^= ' . sprintf($safeint, '(' . sprintf($safeint, '$sb_0[$l >> 24 & 0xff] + $sb_1[$l >> 16 & 0xff]') . ' ^ $sb_2[$l >> 8 & 0xff]) + $sb_3[$l & 0xff]') . '; $r^= ' . $p[$i - 1] . '; $l^= ' . sprintf($safeint, '(' . sprintf($safeint, '$sb_0[$r >> 24 & 0xff] + $sb_1[$r >> 16 & 0xff]') . ' ^ $sb_2[$r >> 8 & 0xff]) + $sb_3[$r & 0xff]') . '; '; } $decrypt_block.= ' $in = pack("N*", $r ^ ' . $p[0] . ', $l ^ ' . $p[1] . ' ); '; $this->inline_crypt = $this->createInlineCryptFunction( [ 'init_crypt' => $init_crypt, 'init_encrypt' => '', 'init_decrypt' => '', 'encrypt_block' => $encrypt_block, 'decrypt_block' => $decrypt_block ] ); } } <?php /** * Pure-PHP PKCS#1 (v2.1) compliant implementation of RSA. * * PHP version 5 * * Here's an example of how to encrypt and decrypt text with this library: * <code> * <?php * include 'vendor/autoload.php'; * * extract(\phpseclib\Crypt\RSA::createKey()); * * $plaintext = 'terrafrost'; * * $ciphertext = $publickey->encrypt($plaintext); * * echo $privatekey->decrypt($ciphertext); * ?> * </code> * * Here's an example of how to create signatures and verify signatures with this library: * <code> * <?php * include 'vendor/autoload.php'; * * extract(\phpseclib\Crypt\RSA::createKey()); * * $plaintext = 'terrafrost'; * * $signature = $privatekey->sign($plaintext); * * echo $publickey->verify($plaintext, $signature) ? 'verified' : 'unverified'; * ?> * </code> * * @category Crypt * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2009 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt; use ParagonIE\ConstantTime\Base64; use phpseclib\File\ASN1; use phpseclib\Math\BigInteger; use phpseclib\Common\Functions\Strings; use phpseclib\File\ASN1\Maps\DigestInfo; use phpseclib\Crypt\Common\AsymmetricKey; use phpseclib\Exception\UnsupportedAlgorithmException; use phpseclib\Exception\UnsupportedOperationException; use phpseclib\Exception\NoKeyLoadedException; /** * Pure-PHP PKCS#1 compliant implementation of RSA. * * @package RSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ class RSA extends AsymmetricKey { /** * Algorithm Name * * @var string * @access private */ const ALGORITHM = 'RSA'; /**#@+ * @access public * @see self::encrypt() * @see self::decrypt() */ /** * Use {@link http://en.wikipedia.org/wiki/Optimal_Asymmetric_Encryption_Padding Optimal Asymmetric Encryption Padding} * (OAEP) for encryption / decryption. * * Uses sha256 by default * * @see self::setHash() * @see self::setMGFHash() */ const PADDING_OAEP = 1; /** * Use PKCS#1 padding. * * Although self::PADDING_OAEP / self::PADDING_PSS offers more security, including PKCS#1 padding is necessary for purposes of backwards * compatibility with protocols (like SSH-1) written before OAEP's introduction. */ const PADDING_PKCS1 = 2; /** * Do not use any padding * * Although this method is not recommended it can none-the-less sometimes be useful if you're trying to decrypt some legacy * stuff, if you're trying to diagnose why an encrypted message isn't decrypting, etc. */ const PADDING_NONE = 3; /** * Use PKCS#1 padding with PKCS1 v1.5 compatibility * * A PKCS1 v2.1 encrypted message may not successfully decrypt with a PKCS1 v1.5 implementation (such as OpenSSL). */ const PADDING_PKCS15_COMPAT = 6; /**#@-*/ /**#@+ * @access public * @see self::sign() * @see self::verify() * @see self::setHash() */ /** * Use the Probabilistic Signature Scheme for signing * * Uses sha256 and 0 as the salt length * * @see self::setSaltLength() * @see self::setMGFHash() * @see self::setHash() */ const PADDING_PSS = 4; /** * Use a relaxed version of PKCS#1 padding for signature verification */ const PADDING_RELAXED_PKCS1 = 5; /**#@-*/ /** * Modulus (ie. n) * * @var \phpseclib\Math\BigInteger * @access private */ private $modulus; /** * Modulus length * * @var \phpseclib\Math\BigInteger * @access private */ private $k; /** * Exponent (ie. e or d) * * @var \phpseclib\Math\BigInteger * @access private */ private $exponent; /** * Primes for Chinese Remainder Theorem (ie. p and q) * * @var array * @access private */ private $primes; /** * Exponents for Chinese Remainder Theorem (ie. dP and dQ) * * @var array * @access private */ private $exponents; /** * Coefficients for Chinese Remainder Theorem (ie. qInv) * * @var array * @access private */ private $coefficients; /** * Hash name * * @var string * @access private */ private $hashName; /** * Length of hash function output * * @var int * @access private */ private $hLen; /** * Length of salt * * @var int * @access private */ private $sLen; /** * Comment * * @var string * @access private */ private $comment; /** * Hash function for the Mask Generation Function * * @var \phpseclib\Crypt\Hash * @access private */ private $mgfHash; /** * Length of MGF hash function output * * @var int * @access private */ private $mgfHLen; /** * Public Exponent * * @var mixed * @access private */ private $publicExponent = false; /** * Public exponent * * @var int * @link http://en.wikipedia.org/wiki/65537_%28number%29 * @access private */ private static $defaultExponent = 65537; /** * Is the loaded key a public key? * * @var bool * @access private */ private $isPublic = false; /** * Smallest Prime * * Per <http://cseweb.ucsd.edu/~hovav/dist/survey.pdf#page=5>, this number ought not result in primes smaller * than 256 bits. As a consequence if the key you're trying to create is 1024 bits and you've set smallestPrime * to 384 bits then you're going to get a 384 bit prime and a 640 bit prime (384 + 1024 % 384). At least if * engine is set to self::ENGINE_INTERNAL. If Engine is set to self::ENGINE_OPENSSL then smallest Prime is * ignored (ie. multi-prime RSA support is more intended as a way to speed up RSA key generation when there's * a chance neither gmp nor OpenSSL are installed) * * @var int * @access private */ private static $smallestPrime = 4096; /** * Enable Blinding? * * @var bool * @access private */ private static $enableBlinding = true; /** * The constructor * * If you want to make use of the openssl extension, you'll need to set the mode manually, yourself. The reason * \phpseclib\Crypt\RSA doesn't do it is because OpenSSL doesn't fail gracefully. openssl_pkey_new(), in particular, requires * openssl.cnf be present somewhere and, unfortunately, the only real way to find out is too late. * * @return \phpseclib\Crypt\RSA * @access public */ public function __construct() { parent::__construct(); //$this->hash = new Hash('sha256'); $this->hLen = $this->hash->getLengthInBytes(); $this->hashName = 'sha256'; $this->mgfHash = new Hash('sha256'); $this->mgfHLen = $this->mgfHash->getLengthInBytes(); } /** * Sets the public exponent * * This will be 65537 unless changed. * * @access public * @param int $val */ public static function setExponent($val) { self::$defaultExponent = $val; } /** * Sets the smallest prime number in bits * * This will be 4096 unless changed. * * @access public * @param int $val */ public static function setSmallestPrime($val) { self::$smallestPrime = $val; } /** * Create public / private key pair * * Returns an array with the following two elements: * - 'privatekey': The private key. * - 'publickey': The public key. * * @return array * @access public * @param int $bits * */ public static function createKey($bits = 2048) { self::initialize_static_variables(); if (!isset(self::$engine)) { self::setPreferredEngine(self::ENGINE_OPENSSL); } // OpenSSL uses 65537 as the exponent and requires RSA keys be 384 bits minimum if (self::$engine == self::ENGINE_OPENSSL && $bits >= 384 && self::$defaultExponent == 65537) { $config = []; if (isset(self::$configFile)) { $config['config'] = self::$configFile; } $rsa = openssl_pkey_new(['private_key_bits' => $bits] + $config); openssl_pkey_export($rsa, $privatekeystr, null, $config); $privatekey = new RSA(); $privatekey->load($privatekeystr); $publickeyarr = openssl_pkey_get_details($rsa); $publickey = new RSA(); $publickey->load($publickeyarr['key']); $publickey->setPublicKey(); // clear the buffer of error strings stemming from a minimalistic openssl.cnf while (openssl_error_string() !== false) { } return compact('privatekey', 'publickey'); } static $e; if (!isset($e)) { $e = new BigInteger(self::$defaultExponent); } $regSize = $bits >> 1; // divide by two to see how many bits P and Q would be if ($regSize > self::$smallestPrime) { $num_primes = floor($bits / self::$smallestPrime); $regSize = self::$smallestPrime; } else { $num_primes = 2; } $n = clone self::$one; $exponents = $coefficients = $primes = []; $lcm = [ 'top' => clone self::$one, 'bottom' => false ]; do { for ($i = 1; $i <= $num_primes; $i++) { if ($i != $num_primes) { $primes[$i] = BigInteger::randomPrime($regSize); } else { extract(BigInteger::minMaxBits($bits)); /** @var BigInteger $min * @var BigInteger $max */ list($min) = $min->divide($n); $min = $min->add(self::$one); list($max) = $max->divide($n); $primes[$i] = BigInteger::randomRangePrime($min, $max); } // the first coefficient is calculated differently from the rest // ie. instead of being $primes[1]->modInverse($primes[2]), it's $primes[2]->modInverse($primes[1]) if ($i > 2) { $coefficients[$i] = $n->modInverse($primes[$i]); } $n = $n->multiply($primes[$i]); $temp = $primes[$i]->subtract(self::$one); // textbook RSA implementations use Euler's totient function instead of the least common multiple. // see http://en.wikipedia.org/wiki/Euler%27s_totient_function $lcm['top'] = $lcm['top']->multiply($temp); $lcm['bottom'] = $lcm['bottom'] === false ? $temp : $lcm['bottom']->gcd($temp); } list($temp) = $lcm['top']->divide($lcm['bottom']); $gcd = $temp->gcd($e); $i0 = 1; } while (!$gcd->equals(self::$one)); $coefficients[2] = $primes[2]->modInverse($primes[1]); $d = $e->modInverse($temp); foreach ($primes as $i => $prime) { $temp = $prime->subtract(self::$one); $exponents[$i] = $e->modInverse($temp); } // from <http://tools.ietf.org/html/rfc3447#appendix-A.1.2>: // RSAPrivateKey ::= SEQUENCE { // version Version, // modulus INTEGER, -- n // publicExponent INTEGER, -- e // privateExponent INTEGER, -- d // prime1 INTEGER, -- p // prime2 INTEGER, -- q // exponent1 INTEGER, -- d mod (p-1) // exponent2 INTEGER, -- d mod (q-1) // coefficient INTEGER, -- (inverse of q) mod p // otherPrimeInfos OtherPrimeInfos OPTIONAL // } $privatekey = new RSA(); $privatekey->modulus = $n; $privatekey->k = $bits >> 3; $privatekey->publicExponent = $e; $privatekey->exponent = $d; $privatekey->privateExponent = $e; $privatekey->primes = $primes; $privatekey->exponents = $exponents; $privatekey->coefficients = $coefficients; $publickey = new RSA(); $publickey->modulus = $n; $publickey->k = $bits >> 3; $publickey->exponent = $e; $publickey->publicExponent = $e; $publickey->isPublic = true; return compact('privatekey', 'publickey'); } /** * Loads a public or private key * * Returns true on success and false on failure (ie. an incorrect password was provided or the key was malformed) * * @return bool * @access public * @param string $key * @param int|bool $type optional */ public function load($key, $type = false) { if ($key instanceof RSA) { $this->privateKeyFormat = $key->privateKeyFormat; $this->publicKeyFormat = $key->publicKeyFormat; $this->format = $key->format; $this->k = $key->k; $this->hLen = $key->hLen; $this->sLen = $key->sLen; $this->mgfHLen = $key->mgfHLen; $this->password = $key->password; $this->isPublic = $key->isPublic; if (is_object($key->hash)) { $this->hash = new Hash($key->hash->getHash()); } if (is_object($key->mgfHash)) { $this->mgfHash = new Hash($key->mgfHash->getHash()); } if (is_object($key->modulus)) { $this->modulus = clone $key->modulus; } if (is_object($key->exponent)) { $this->exponent = clone $key->exponent; } if (is_object($key->publicExponent)) { $this->publicExponent = clone $key->publicExponent; } $this->primes = []; $this->exponents = []; $this->coefficients = []; foreach ($this->primes as $prime) { $this->primes[] = clone $prime; } foreach ($this->exponents as $exponent) { $this->exponents[] = clone $exponent; } foreach ($this->coefficients as $coefficient) { $this->coefficients[] = clone $coefficient; } return true; } $components = parent::load($key, $type); if ($components === false) { $this->comment = null; $this->modulus = null; $this->k = null; $this->exponent = null; $this->primes = null; $this->exponents = null; $this->coefficients = null; $this->publicExponent = null; return false; } $this->isPublic = false; $this->modulus = $components['modulus']; $this->k = $this->modulus->getLengthInBytes(); $this->exponent = isset($components['privateExponent']) ? $components['privateExponent'] : $components['publicExponent']; if (isset($components['primes'])) { $this->primes = $components['primes']; $this->exponents = $components['exponents']; $this->coefficients = $components['coefficients']; $this->publicExponent = $components['publicExponent']; } else { $this->primes = []; $this->exponents = []; $this->coefficients = []; $this->publicExponent = false; } if ($components['isPublicKey']) { $this->setPublicKey(); } return true; } /** * Returns the private key * * The private key is only returned if the currently loaded key contains the constituent prime numbers. * * @see self::getPublicKey() * @access public * @param string $type optional * @return mixed */ public function getPrivateKey($type = 'PKCS8') { $type = self::validatePlugin('Keys', $type, 'savePrivateKey'); if ($type === false) { return false; } if (empty($this->primes)) { return false; } return $type::savePrivateKey($this->modulus, $this->publicExponent, $this->exponent, $this->primes, $this->exponents, $this->coefficients, $this->password); /* $key = $type::savePrivateKey($this->modulus, $this->publicExponent, $this->exponent, $this->primes, $this->exponents, $this->coefficients, $this->password); if ($key !== false || count($this->primes) == 2) { return $key; } $nSize = $this->getSize() >> 1; $primes = [1 => clone self::$one, clone self::$one]; $i = 1; foreach ($this->primes as $prime) { $primes[$i] = $primes[$i]->multiply($prime); if ($primes[$i]->getLength() >= $nSize) { $i++; } } $exponents = []; $coefficients = [2 => $primes[2]->modInverse($primes[1])]; foreach ($primes as $i => $prime) { $temp = $prime->subtract(self::$one); $exponents[$i] = $this->modulus->modInverse($temp); } return $type::savePrivateKey($this->modulus, $this->publicExponent, $this->exponent, $primes, $exponents, $coefficients, $this->password); */ } /** * Returns a minimalistic private key * * Returns the private key without the prime number constituants. Structurally identical to a public key that * hasn't been set as the public key * * @see self::getPrivateKey() * @access private * @param string $type optional * @return mixed */ protected function getPrivatePublicKey($type = 'PKCS8') { $type = self::validatePlugin('Keys', $type, 'savePublicKey'); if ($type === false) { return false; } if (empty($this->modulus) || empty($this->exponent)) { return false; } $oldFormat = $this->publicKeyFormat; $this->publicKeyFormat = $type; $temp = $type::savePublicKey($this->modulus, $this->exponent); $this->publicKeyFormat = $oldFormat; return $temp; } /** * Returns the key size * * More specifically, this returns the size of the modulo in bits. * * @access public * @return int */ public function getLength() { return !isset($this->modulus) ? 0 : $this->modulus->getLength(); } /** * Defines the public key * * Some private key formats define the public exponent and some don't. Those that don't define it are problematic when * used in certain contexts. For example, in SSH-2, RSA authentication works by sending the public key along with a * message signed by the private key to the server. The SSH-2 server looks the public key up in an index of public keys * and if it's present then proceeds to verify the signature. Problem is, if your private key doesn't include the public * exponent this won't work unless you manually add the public exponent. phpseclib tries to guess if the key being used * is the public key but in the event that it guesses incorrectly you might still want to explicitly set the key as being * public. * * Do note that when a new key is loaded the index will be cleared. * * Returns true on success, false on failure * * @see self::getPublicKey() * @access public * @param string|bool $key optional * @param int|bool $type optional * @return bool */ public function setPublicKey($key = false, $type = false) { // if a public key has already been loaded return false if (!empty($this->publicExponent)) { return false; } if ($key === false && !empty($this->modulus)) { $this->isPublic = true; $this->publicExponent = $this->exponent; return true; } $components = parent::setPublicKey($key, $type); if ($components === false) { return false; } if (empty($this->modulus) || !$this->modulus->equals($components['modulus'])) { $this->modulus = $components['modulus']; $this->exponent = $this->publicExponent = $components['publicExponent']; $this->isPublic = true; return true; } $this->publicExponent = $components['publicExponent']; return true; } /** * Does the key self-identify as being a public key or not? * * @see self::isPublicKey() * @access public * @return bool */ public function isPublicKey() { return $this->isPublic(); } /** * Defines the private key * * If phpseclib guessed a private key was a public key and loaded it as such it might be desirable to force * phpseclib to treat the key as a private key. This function will do that. * * Do note that when a new key is loaded the index will be cleared. * * Returns true on success, false on failure * * @see self::getPublicKey() * @access public * @param string|bool $key optional * @param int|bool $type optional * @return bool */ public function setPrivateKey($key = false, $type = false) { if ($key === false && !empty($this->publicExponent)) { $this->publicExponent = false; return true; } $rsa = new RSA(); if (!$rsa->load($key, $type)) { return false; } $rsa->publicExponent = false; // don't overwrite the old key if the new key is invalid $this->load($rsa); return true; } /** * Returns the public key * * The public key is only returned under two circumstances - if the private key had the public key embedded within it * or if the public key was set via setPublicKey(). If the currently loaded key is supposed to be the public key this * function won't return it since this library, for the most part, doesn't distinguish between public and private keys. * * @see self::getPrivateKey() * @access public * @param string $type optional * @return mixed */ public function getPublicKey($type = 'PKCS8') { $type = self::validatePlugin('Keys', $type, 'savePublicKey'); if ($type === false) { return false; } if (empty($this->modulus) || empty($this->publicExponent)) { return false; } return $type::savePublicKey($this->modulus, $this->publicExponent); } /** * __toString() magic method * * @access public * @return string */ public function __toString() { try { $key = $this->getPrivateKey($this->privateKeyFormat); if (is_string($key)) { return $key; } $key = $this->getPrivatePublicKey($this->publicKeyFormat); return is_string($key) ? $key : ''; } catch (\Exception $e) { return ''; } } /** * Determines which hashing function should be used * * Used with signature production / verification and (if the encryption mode is self::PADDING_OAEP) encryption and * decryption. * * @access public * @param string $hash */ public function setHash($hash) { // \phpseclib\Crypt\Hash supports algorithms that PKCS#1 doesn't support. md5-96 and sha1-96, for example. switch (strtolower($hash)) { case 'md2': case 'md5': case 'sha1': case 'sha256': case 'sha384': case 'sha512': case 'sha224': case 'sha512/224': case 'sha512/256': $this->hash = new Hash($hash); $this->hashName = $hash; break; default: throw new UnsupportedAlgorithmException( 'The only supported hash algorithms are: md2, md5, sha1, sha256, sha384, sha512, sha224, sha512/224, sha512/256' ); } $this->hLen = $this->hash->getLengthInBytes(); } /** * Determines which hashing function should be used for the mask generation function * * The mask generation function is used by self::PADDING_OAEP and self::PADDING_PSS and although it's * best if Hash and MGFHash are set to the same thing this is not a requirement. * * @access public * @param string $hash */ public function setMGFHash($hash) { // \phpseclib\Crypt\Hash supports algorithms that PKCS#1 doesn't support. md5-96 and sha1-96, for example. switch ($hash) { case 'md2': case 'md5': case 'sha1': case 'sha256': case 'sha384': case 'sha512': case 'sha224': case 'sha512/224': case 'sha512/256': $this->mgfHash = new Hash($hash); break; default: $this->mgfHash = new Hash('sha256'); } $this->mgfHLen = $this->mgfHash->getLengthInBytes(); } /** * Determines the salt length * * To quote from {@link http://tools.ietf.org/html/rfc3447#page-38 RFC3447#page-38}: * * Typical salt lengths in octets are hLen (the length of the output * of the hash function Hash) and 0. * * @access public * @param int $sLen */ public function setSaltLength($sLen) { $this->sLen = $sLen; } /** * Integer-to-Octet-String primitive * * See {@link http://tools.ietf.org/html/rfc3447#section-4.1 RFC3447#section-4.1}. * * @access private * @param bool|\phpseclib\Math\BigInteger $x * @param int $xLen * @return bool|string */ private function i2osp($x, $xLen) { if ($x === false) { return false; } $x = $x->toBytes(); if (strlen($x) > $xLen) { return false; } return str_pad($x, $xLen, chr(0), STR_PAD_LEFT); } /** * Octet-String-to-Integer primitive * * See {@link http://tools.ietf.org/html/rfc3447#section-4.2 RFC3447#section-4.2}. * * @access private * @param string $x * @return \phpseclib\Math\BigInteger */ private function os2ip($x) { return new BigInteger($x, 256); } /** * Exponentiate with or without Chinese Remainder Theorem * * See {@link http://tools.ietf.org/html/rfc3447#section-5.1.1 RFC3447#section-5.1.2}. * * @access private * @param \phpseclib\Math\BigInteger $x * @return \phpseclib\Math\BigInteger */ private function exponentiate($x) { switch (true) { case empty($this->primes): case $this->primes[1]->equals(self::$zero): case empty($this->coefficients): case $this->coefficients[2]->equals(self::$zero): case empty($this->exponents): case $this->exponents[1]->equals(self::$zero): return $x->modPow($this->exponent, $this->modulus); } $num_primes = count($this->primes); if (!static::$enableBlinding) { $m_i = [ 1 => $x->modPow($this->exponents[1], $this->primes[1]), 2 => $x->modPow($this->exponents[2], $this->primes[2]) ]; $h = $m_i[1]->subtract($m_i[2]); $h = $h->multiply($this->coefficients[2]); list(, $h) = $h->divide($this->primes[1]); $m = $m_i[2]->add($h->multiply($this->primes[2])); $r = $this->primes[1]; for ($i = 3; $i <= $num_primes; $i++) { $m_i = $x->modPow($this->exponents[$i], $this->primes[$i]); $r = $r->multiply($this->primes[$i - 1]); $h = $m_i->subtract($m); $h = $h->multiply($this->coefficients[$i]); list(, $h) = $h->divide($this->primes[$i]); $m = $m->add($r->multiply($h)); } } else { $smallest = $this->primes[1]; for ($i = 2; $i <= $num_primes; $i++) { if ($smallest->compare($this->primes[$i]) > 0) { $smallest = $this->primes[$i]; } } $r = BigInteger::randomRange(self::$one, $smallest->subtract(self::$one)); $m_i = [ 1 => $this->blind($x, $r, 1), 2 => $this->blind($x, $r, 2) ]; $h = $m_i[1]->subtract($m_i[2]); $h = $h->multiply($this->coefficients[2]); list(, $h) = $h->divide($this->primes[1]); $m = $m_i[2]->add($h->multiply($this->primes[2])); $r = $this->primes[1]; for ($i = 3; $i <= $num_primes; $i++) { $m_i = $this->blind($x, $r, $i); $r = $r->multiply($this->primes[$i - 1]); $h = $m_i->subtract($m); $h = $h->multiply($this->coefficients[$i]); list(, $h) = $h->divide($this->primes[$i]); $m = $m->add($r->multiply($h)); } } return $m; } /** * Enable RSA Blinding * * @access public */ public static function enableBlinding() { static::$enableBlinding = true; } /** * Disable RSA Blinding * * @access public */ public static function disableBlinding() { static::$enableBlinding = false; } /** * Performs RSA Blinding * * Protects against timing attacks by employing RSA Blinding. * Returns $x->modPow($this->exponents[$i], $this->primes[$i]) * * @access private * @param \phpseclib\Math\BigInteger $x * @param \phpseclib\Math\BigInteger $r * @param int $i * @return \phpseclib\Math\BigInteger */ private function blind($x, $r, $i) { $x = $x->multiply($r->modPow($this->publicExponent, $this->primes[$i])); $x = $x->modPow($this->exponents[$i], $this->primes[$i]); $r = $r->modInverse($this->primes[$i]); $x = $x->multiply($r); list(, $x) = $x->divide($this->primes[$i]); return $x; } /** * RSAEP * * See {@link http://tools.ietf.org/html/rfc3447#section-5.1.1 RFC3447#section-5.1.1}. * * @access private * @param \phpseclib\Math\BigInteger $m * @return bool|\phpseclib\Math\BigInteger */ private function rsaep($m) { if ($m->compare(self::$zero) < 0 || $m->compare($this->modulus) > 0) { return false; } return $this->exponentiate($m); } /** * RSADP * * See {@link http://tools.ietf.org/html/rfc3447#section-5.1.2 RFC3447#section-5.1.2}. * * @access private * @param \phpseclib\Math\BigInteger $c * @return bool|\phpseclib\Math\BigInteger */ private function rsadp($c) { if ($c->compare(self::$zero) < 0 || $c->compare($this->modulus) > 0) { return false; } return $this->exponentiate($c); } /** * RSASP1 * * See {@link http://tools.ietf.org/html/rfc3447#section-5.2.1 RFC3447#section-5.2.1}. * * @access private * @param \phpseclib\Math\BigInteger $m * @return bool|\phpseclib\Math\BigInteger */ private function rsasp1($m) { if ($m->compare(self::$zero) < 0 || $m->compare($this->modulus) > 0) { return false; } return $this->exponentiate($m); } /** * RSAVP1 * * See {@link http://tools.ietf.org/html/rfc3447#section-5.2.2 RFC3447#section-5.2.2}. * * @access private * @param \phpseclib\Math\BigInteger $s * @return bool|\phpseclib\Math\BigInteger */ private function rsavp1($s) { if ($s->compare(self::$zero) < 0 || $s->compare($this->modulus) > 0) { return false; } return $this->exponentiate($s); } /** * MGF1 * * See {@link http://tools.ietf.org/html/rfc3447#appendix-B.2.1 RFC3447#appendix-B.2.1}. * * @access private * @param string $mgfSeed * @param int $maskLen * @return string */ private function mgf1($mgfSeed, $maskLen) { // if $maskLen would yield strings larger than 4GB, PKCS#1 suggests a "Mask too long" error be output. $t = ''; $count = ceil($maskLen / $this->mgfHLen); for ($i = 0; $i < $count; $i++) { $c = pack('N', $i); $t.= $this->mgfHash->hash($mgfSeed . $c); } return substr($t, 0, $maskLen); } /** * RSAES-OAEP-ENCRYPT * * See {@link http://tools.ietf.org/html/rfc3447#section-7.1.1 RFC3447#section-7.1.1} and * {http://en.wikipedia.org/wiki/Optimal_Asymmetric_Encryption_Padding OAES}. * * @access private * @param string $m * @param string $l * @throws \OutOfBoundsException if strlen($m) > $this->k - 2 * $this->hLen - 2 * @return string */ private function rsaes_oaep_encrypt($m, $l = '') { $mLen = strlen($m); // Length checking // if $l is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error // be output. if ($mLen > $this->k - 2 * $this->hLen - 2) { throw new \OutOfBoundsException('Message too long'); } // EME-OAEP encoding $lHash = $this->hash->hash($l); $ps = str_repeat(chr(0), $this->k - $mLen - 2 * $this->hLen - 2); $db = $lHash . $ps . chr(1) . $m; $seed = Random::string($this->hLen); $dbMask = $this->mgf1($seed, $this->k - $this->hLen - 1); $maskedDB = $db ^ $dbMask; $seedMask = $this->mgf1($maskedDB, $this->hLen); $maskedSeed = $seed ^ $seedMask; $em = chr(0) . $maskedSeed . $maskedDB; // RSA encryption $m = $this->os2ip($em); $c = $this->rsaep($m); $c = $this->i2osp($c, $this->k); // Output the ciphertext C return $c; } /** * RSAES-OAEP-DECRYPT * * See {@link http://tools.ietf.org/html/rfc3447#section-7.1.2 RFC3447#section-7.1.2}. The fact that the error * messages aren't distinguishable from one another hinders debugging, but, to quote from RFC3447#section-7.1.2: * * Note. Care must be taken to ensure that an opponent cannot * distinguish the different error conditions in Step 3.g, whether by * error message or timing, or, more generally, learn partial * information about the encoded message EM. Otherwise an opponent may * be able to obtain useful information about the decryption of the * ciphertext C, leading to a chosen-ciphertext attack such as the one * observed by Manger [36]. * * As for $l... to quote from {@link http://tools.ietf.org/html/rfc3447#page-17 RFC3447#page-17}: * * Both the encryption and the decryption operations of RSAES-OAEP take * the value of a label L as input. In this version of PKCS #1, L is * the empty string; other uses of the label are outside the scope of * this document. * * @access private * @param string $c * @param string $l * @return bool|string */ private function rsaes_oaep_decrypt($c, $l = '') { // Length checking // if $l is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error // be output. if (strlen($c) != $this->k || $this->k < 2 * $this->hLen + 2) { return false; } // RSA decryption $c = $this->os2ip($c); $m = $this->rsadp($c); $em = $this->i2osp($m, $this->k); if ($em === false) { return false; } // EME-OAEP decoding $lHash = $this->hash->hash($l); $y = ord($em[0]); $maskedSeed = substr($em, 1, $this->hLen); $maskedDB = substr($em, $this->hLen + 1); $seedMask = $this->mgf1($maskedDB, $this->hLen); $seed = $maskedSeed ^ $seedMask; $dbMask = $this->mgf1($seed, $this->k - $this->hLen - 1); $db = $maskedDB ^ $dbMask; $lHash2 = substr($db, 0, $this->hLen); $m = substr($db, $this->hLen); if (!Strings::equals($lHash, $lHash2)) { return false; } $m = ltrim($m, chr(0)); if (ord($m[0]) != 1) { return false; } // Output the message M return substr($m, 1); } /** * Raw Encryption / Decryption * * Doesn't use padding and is not recommended. * * @access private * @param string $m * @return bool|string * @throws \OutOfBoundsException if strlen($m) > $this->k */ private function raw_encrypt($m) { if (strlen($m) > $this->k) { throw new \OutOfBoundsException('Message too long'); } $temp = $this->os2ip($m); $temp = $this->rsaep($temp); return $this->i2osp($temp, $this->k); } /** * RSAES-PKCS1-V1_5-ENCRYPT * * See {@link http://tools.ietf.org/html/rfc3447#section-7.2.1 RFC3447#section-7.2.1}. * * @access private * @param string $m * @param bool $pkcs15_compat optional * @throws \OutOfBoundsException if strlen($m) > $this->k - 11 * @return bool|string */ private function rsaes_pkcs1_v1_5_encrypt($m, $pkcs15_compat = false) { $mLen = strlen($m); // Length checking if ($mLen > $this->k - 11) { throw new \OutOfBoundsException('Message too long'); } // EME-PKCS1-v1_5 encoding $psLen = $this->k - $mLen - 3; $ps = ''; while (strlen($ps) != $psLen) { $temp = Random::string($psLen - strlen($ps)); $temp = str_replace("\x00", '', $temp); $ps.= $temp; } $type = 2; // see the comments of _rsaes_pkcs1_v1_5_decrypt() to understand why this is being done if ($pkcs15_compat && (!isset($this->publicExponent) || $this->exponent !== $this->publicExponent)) { $type = 1; // "The padding string PS shall consist of k-3-||D|| octets.... for block type 01, they shall have value FF" $ps = str_repeat("\xFF", $psLen); } $em = chr(0) . chr($type) . $ps . chr(0) . $m; // RSA encryption $m = $this->os2ip($em); $c = $this->rsaep($m); $c = $this->i2osp($c, $this->k); // Output the ciphertext C return $c; } /** * RSAES-PKCS1-V1_5-DECRYPT * * See {@link http://tools.ietf.org/html/rfc3447#section-7.2.2 RFC3447#section-7.2.2}. * * For compatibility purposes, this function departs slightly from the description given in RFC3447. * The reason being that RFC2313#section-8.1 (PKCS#1 v1.5) states that ciphertext's encrypted by the * private key should have the second byte set to either 0 or 1 and that ciphertext's encrypted by the * public key should have the second byte set to 2. In RFC3447 (PKCS#1 v2.1), the second byte is supposed * to be 2 regardless of which key is used. For compatibility purposes, we'll just check to make sure the * second byte is 2 or less. If it is, we'll accept the decrypted string as valid. * * As a consequence of this, a private key encrypted ciphertext produced with \phpseclib\Crypt\RSA may not decrypt * with a strictly PKCS#1 v1.5 compliant RSA implementation. Public key encrypted ciphertext's should but * not private key encrypted ciphertext's. * * @access private * @param string $c * @return bool|string */ private function rsaes_pkcs1_v1_5_decrypt($c) { // Length checking if (strlen($c) != $this->k) { // or if k < 11 return false; } // RSA decryption $c = $this->os2ip($c); $m = $this->rsadp($c); $em = $this->i2osp($m, $this->k); if ($em === false) { return false; } // EME-PKCS1-v1_5 decoding if (ord($em[0]) != 0 || ord($em[1]) > 2) { return false; } $ps = substr($em, 2, strpos($em, chr(0), 2) - 2); $m = substr($em, strlen($ps) + 3); if (strlen($ps) < 8) { return false; } // Output M return $m; } /** * EMSA-PSS-ENCODE * * See {@link http://tools.ietf.org/html/rfc3447#section-9.1.1 RFC3447#section-9.1.1}. * * @return string * @access private * @param string $m * @throws \RuntimeException on encoding error * @param int $emBits */ private function emsa_pss_encode($m, $emBits) { // if $m is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error // be output. $emLen = ($emBits + 1) >> 3; // ie. ceil($emBits / 8) $sLen = $this->sLen !== null ? $this->sLen : $this->hLen; $mHash = $this->hash->hash($m); if ($emLen < $this->hLen + $sLen + 2) { return false; } $salt = Random::string($sLen); $m2 = "\0\0\0\0\0\0\0\0" . $mHash . $salt; $h = $this->hash->hash($m2); $ps = str_repeat(chr(0), $emLen - $sLen - $this->hLen - 2); $db = $ps . chr(1) . $salt; $dbMask = $this->mgf1($h, $emLen - $this->hLen - 1); $maskedDB = $db ^ $dbMask; $maskedDB[0] = ~chr(0xFF << ($emBits & 7)) & $maskedDB[0]; $em = $maskedDB . $h . chr(0xBC); return $em; } /** * EMSA-PSS-VERIFY * * See {@link http://tools.ietf.org/html/rfc3447#section-9.1.2 RFC3447#section-9.1.2}. * * @access private * @param string $m * @param string $em * @param int $emBits * @return string */ private function emsa_pss_verify($m, $em, $emBits) { // if $m is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error // be output. $emLen = ($emBits + 1) >> 3; // ie. ceil($emBits / 8); $sLen = $this->sLen !== null ? $this->sLen : $this->hLen; $mHash = $this->hash->hash($m); if ($emLen < $this->hLen + $sLen + 2) { return false; } if ($em[strlen($em) - 1] != chr(0xBC)) { return false; } $maskedDB = substr($em, 0, -$this->hLen - 1); $h = substr($em, -$this->hLen - 1, $this->hLen); $temp = chr(0xFF << ($emBits & 7)); if ((~$maskedDB[0] & $temp) != $temp) { return false; } $dbMask = $this->mgf1($h, $emLen - $this->hLen - 1); $db = $maskedDB ^ $dbMask; $db[0] = ~chr(0xFF << ($emBits & 7)) & $db[0]; $temp = $emLen - $this->hLen - $sLen - 2; if (substr($db, 0, $temp) != str_repeat(chr(0), $temp) || ord($db[$temp]) != 1) { return false; } $salt = substr($db, $temp + 1); // should be $sLen long $m2 = "\0\0\0\0\0\0\0\0" . $mHash . $salt; $h2 = $this->hash->hash($m2); return Strings::equals($h, $h2); } /** * RSASSA-PSS-SIGN * * See {@link http://tools.ietf.org/html/rfc3447#section-8.1.1 RFC3447#section-8.1.1}. * * @access private * @param string $m * @return bool|string */ private function rsassa_pss_sign($m) { // EMSA-PSS encoding $em = $this->emsa_pss_encode($m, 8 * $this->k - 1); // RSA signature $m = $this->os2ip($em); $s = $this->rsasp1($m); $s = $this->i2osp($s, $this->k); // Output the signature S return $s; } /** * RSASSA-PSS-VERIFY * * See {@link http://tools.ietf.org/html/rfc3447#section-8.1.2 RFC3447#section-8.1.2}. * * @access private * @param string $m * @param string $s * @return bool|string */ private function rsassa_pss_verify($m, $s) { // Length checking if (strlen($s) != $this->k) { return false; } // RSA verification $modBits = 8 * $this->k; $s2 = $this->os2ip($s); $m2 = $this->rsavp1($s2); $em = $this->i2osp($m2, $modBits >> 3); if ($em === false) { return false; } // EMSA-PSS verification return $this->emsa_pss_verify($m, $em, $modBits - 1); } /** * EMSA-PKCS1-V1_5-ENCODE * * See {@link http://tools.ietf.org/html/rfc3447#section-9.2 RFC3447#section-9.2}. * * @access private * @param string $m * @param int $emLen * @throws \LengthException if the intended encoded message length is too short * @return string */ private function emsa_pkcs1_v1_5_encode($m, $emLen) { $h = $this->hash->hash($m); // see http://tools.ietf.org/html/rfc3447#page-43 switch ($this->hashName) { case 'md2': $t = "\x30\x20\x30\x0c\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x02\x05\x00\x04\x10"; break; case 'md5': $t = "\x30\x20\x30\x0c\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x05\x05\x00\x04\x10"; break; case 'sha1': $t = "\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14"; break; case 'sha256': $t = "\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01\x05\x00\x04\x20"; break; case 'sha384': $t = "\x30\x41\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x02\x05\x00\x04\x30"; break; case 'sha512': $t = "\x30\x51\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x03\x05\x00\x04\x40"; break; // from https://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptography-standard-wp.pdf#page=40 case 'sha224': $t = "\x30\x2d\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x04\x05\x00\x04\x1c"; break; case 'sha512/224': $t = "\x30\x2d\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x05\x05\x00\x04\x1c"; break; case 'sha512/256': $t = "\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x06\x05\x00\x04\x20"; } $t.= $h; $tLen = strlen($t); if ($emLen < $tLen + 11) { throw new \LengthException('Intended encoded message length too short'); } $ps = str_repeat(chr(0xFF), $emLen - $tLen - 3); $em = "\0\1$ps\0$t"; return $em; } /** * RSASSA-PKCS1-V1_5-SIGN * * See {@link http://tools.ietf.org/html/rfc3447#section-8.2.1 RFC3447#section-8.2.1}. * * @access private * @param string $m * @throws \LengthException if the RSA modulus is too short * @return bool|string */ private function rsassa_pkcs1_v1_5_sign($m) { // EMSA-PKCS1-v1_5 encoding // If the encoding operation outputs "intended encoded message length too short," output "RSA modulus // too short" and stop. try { $em = $this->emsa_pkcs1_v1_5_encode($m, $this->k); } catch (\LengthException $e) { throw new \LengthException('RSA modulus too short'); } // RSA signature $m = $this->os2ip($em); $s = $this->rsasp1($m); $s = $this->i2osp($s, $this->k); // Output the signature S return $s; } /** * RSASSA-PKCS1-V1_5-VERIFY * * See {@link http://tools.ietf.org/html/rfc3447#section-8.2.2 RFC3447#section-8.2.2}. * * @access private * @param string $m * @param string $s * @throws \LengthException if the RSA modulus is too short * @return bool */ private function rsassa_pkcs1_v1_5_verify($m, $s) { // Length checking if (strlen($s) != $this->k) { return false; } // RSA verification $s = $this->os2ip($s); $m2 = $this->rsavp1($s); $em = $this->i2osp($m2, $this->k); if ($em === false) { return false; } // EMSA-PKCS1-v1_5 encoding // If the encoding operation outputs "intended encoded message length too short," output "RSA modulus // too short" and stop. try { $em2 = $this->emsa_pkcs1_v1_5_encode($m, $this->k); } catch (\LengthException $e) { throw new \LengthException('RSA modulus too short'); } // Compare return Strings::equals($em, $em2); } /** * RSASSA-PKCS1-V1_5-VERIFY (relaxed matching) * * Per {@link http://tools.ietf.org/html/rfc3447#page-43 RFC3447#page-43} PKCS1 v1.5 * specified the use BER encoding rather than DER encoding that PKCS1 v2.0 specified. * This means that under rare conditions you can have a perfectly valid v1.5 signature * that fails to validate with _rsassa_pkcs1_v1_5_verify(). PKCS1 v2.1 also recommends * that if you're going to validate these types of signatures you "should indicate * whether the underlying BER encoding is a DER encoding and hence whether the signature * is valid with respect to the specification given in [PKCS1 v2.0+]". so if you do * $rsa->getLastPadding() and get RSA::PADDING_RELAXED_PKCS1 back instead of * RSA::PADDING_PKCS1... that means BER encoding was used. * * @access private * @param string $m * @param string $s * @return bool */ private function rsassa_pkcs1_v1_5_relaxed_verify($m, $s) { // Length checking if (strlen($s) != $this->k) { return false; } // RSA verification $s = $this->os2ip($s); $m2 = $this->rsavp1($s); if ($m2 === false) { return false; } $em = $this->i2osp($m2, $this->k); if ($em === false) { return false; } if (Strings::shift($em, 2) != "\0\1") { return false; } $em = ltrim($em, "\xFF"); if (Strings::shift($em) != "\0") { return false; } $decoded = ASN1::decodeBER($em); if (!is_array($decoded) || empty($decoded[0]) || strlen($em) > $decoded[0]['length']) { return false; } static $oids; if (!isset($oids)) { $oids = [ '1.2.840.113549.2.2' => 'md2', '1.2.840.113549.2.4' => 'md4', // from PKCS1 v1.5 '1.2.840.113549.2.5' => 'md5', '1.3.14.3.2.26' => 'id-sha1', '2.16.840.1.101.3.4.2.1' => 'id-sha256', '2.16.840.1.101.3.4.2.2' => 'id-sha384', '2.16.840.1.101.3.4.2.3' => 'id-sha512', // from PKCS1 v2.2 '2.16.840.1.101.3.4.2.4' => 'id-sha224', '2.16.840.1.101.3.4.2.5' => 'id-sha512/224', '2.16.840.1.101.3.4.2.6' => 'id-sha512/256', ]; ASN1::loadOIDs($oids); } $decoded = ASN1::asn1map($decoded[0], DigestInfo::MAP); if (!isset($decoded) || $decoded === false) { return false; } if (!in_array($decoded['digestAlgorithm']['algorithm'], $oids)) { return false; } $hash = $decoded['digestAlgorithm']['algorithm']; $hash = substr($hash, 0, 3) == 'id-' ? substr($hash, 3) : $hash; $hash = new Hash($hash); $em = $hash->hash($m); $em2 = $decoded['digest']; return Strings::equals($em, $em2); } /** * Encryption * * Both self::PADDING_OAEP and self::PADDING_PKCS1 both place limits on how long $plaintext can be. * If $plaintext exceeds those limits it will be broken up so that it does and the resultant ciphertext's will * be concatenated together. * * @see self::decrypt() * @access public * @param string $plaintext * @param int $padding optional * @return bool|string * @throws \LengthException if the RSA modulus is too short */ public function encrypt($plaintext, $padding = self::PADDING_OAEP) { if (empty($this->modulus) || empty($this->exponent)) { throw new NoKeyLoadedException('No key has been loaded'); } if (!$this->isPublic) { throw new UnsupportedOperationException('phpseclib does not allow the use of private keys to encrypt data'); } switch ($padding) { case self::PADDING_NONE: return $this->raw_encrypt($plaintext); case self::PADDING_PKCS15_COMPAT: case self::PADDING_PKCS1: return $this->rsaes_pkcs1_v1_5_encrypt($plaintext, $padding == self::PADDING_PKCS15_COMPAT); //case self::PADDING_OAEP: default: return $this->rsaes_oaep_encrypt($plaintext); } } /** * Decryption * * @see self::encrypt() * @access public * @param string $ciphertext * @param int $padding optional * @return bool|string */ public function decrypt($ciphertext, $padding = self::PADDING_OAEP) { if (empty($this->modulus) || empty($this->exponent)) { throw new NoKeyLoadedException('No key has been loaded'); } if ($this->isPublic) { throw new UnsupportedOperationException('phpseclib does not allow the use of public keys to decrypt data'); } switch ($padding) { case self::PADDING_NONE: return $this->raw_encrypt($ciphertext); case self::PADDING_PKCS1: return $this->rsaes_pkcs1_v1_5_decrypt($ciphertext); //case self::PADDING_OAEP: default: return $this->rsaes_oaep_decrypt($ciphertext); } } /** * Create a signature * * @see self::verify() * @access public * @param string $message * @param int $padding optional * @return string */ public function sign($message, $padding = self::PADDING_PSS) { if (empty($this->modulus) || empty($this->exponent)) { throw new NoKeyLoadedException('No key has been loaded'); } if ($this->isPublic) { throw new UnsupportedOperationException('phpseclib does not allow the use of public keys to sign data'); } switch ($padding) { case self::PADDING_PKCS1: case self::PADDING_RELAXED_PKCS1: return $this->rsassa_pkcs1_v1_5_sign($message); //case self::PADDING_PSS: default: return $this->rsassa_pss_sign($message); } } /** * Verifies a signature * * @see self::sign() * @access public * @param string $message * @param string $signature * @param int $padding optional * @return bool */ public function verify($message, $signature, $padding = self::PADDING_PSS) { if (empty($this->modulus) || empty($this->exponent)) { throw new NoKeyLoadedException('No key has been loaded'); } if (!$this->isPublic) { throw new UnsupportedOperationException('phpseclib does not allow the use of private keys to verify data'); } switch ($padding) { case self::PADDING_RELAXED_PKCS1: return $this->rsassa_pkcs1_v1_5_relaxed_verify($message, $signature); case self::PADDING_PKCS1: return $this->rsassa_pkcs1_v1_5_verify($message, $signature); //case self::PADDING_PSS: default: return $this->rsassa_pss_verify($message, $signature); } } } <?php /** * Pure-PHP implementation of Rijndael. * * Uses mcrypt, if available/possible, and an internal implementation, otherwise. * * PHP version 5 * * If {@link self::setBlockLength() setBlockLength()} isn't called, it'll be assumed to be 128 bits. If * {@link self::setKeyLength() setKeyLength()} isn't called, it'll be calculated from * {@link self::setKey() setKey()}. ie. if the key is 128-bits, the key length will be 128-bits. If it's * 136-bits it'll be null-padded to 192-bits and 192 bits will be the key length until * {@link self::setKey() setKey()} is called, again, at which point, it'll be recalculated. * * Not all Rijndael implementations may support 160-bits or 224-bits as the block length / key length. mcrypt, for example, * does not. AES, itself, only supports block lengths of 128 and key lengths of 128, 192, and 256. * {@link http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=10 Rijndael-ammended.pdf#page=10} defines the * algorithm for block lengths of 192 and 256 but not for block lengths / key lengths of 160 and 224. Indeed, 160 and 224 * are first defined as valid key / block lengths in * {@link http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=44 Rijndael-ammended.pdf#page=44}: * Extensions: Other block and Cipher Key lengths. * Note: Use of 160/224-bit Keys must be explicitly set by setKeyLength(160) respectively setKeyLength(224). * * {@internal The variable names are the same as those in * {@link http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf#page=10 fips-197.pdf#page=10}.}} * * Here's a short example of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * $rijndael = new \phpseclib\Crypt\Rijndael(); * * $rijndael->setKey('abcdefghijklmnop'); * * $size = 10 * 1024; * $plaintext = ''; * for ($i = 0; $i < $size; $i++) { * $plaintext.= 'a'; * } * * echo $rijndael->decrypt($rijndael->encrypt($plaintext)); * ?> * </code> * * @category Crypt * @package Rijndael * @author Jim Wigginton <terrafrost@php.net> * @copyright 2008 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt; use phpseclib\Crypt\Common\BlockCipher; /** * Pure-PHP implementation of Rijndael. * * @package Rijndael * @author Jim Wigginton <terrafrost@php.net> * @access public */ class Rijndael extends BlockCipher { /** * The mcrypt specific name of the cipher * * Mcrypt is useable for 128/192/256-bit $block_size/$key_length. For 160/224 not. * \phpseclib\Crypt\Rijndael determines automatically whether mcrypt is useable * or not for the current $block_size/$key_length. * In case of, $cipher_name_mcrypt will be set dynamically at run time accordingly. * * @see \phpseclib\Crypt\Common\SymmetricKey::cipher_name_mcrypt * @see \phpseclib\Crypt\Common\SymmetricKey::engine * @see self::isValidEngine() * @var string * @access private */ protected $cipher_name_mcrypt = 'rijndael-128'; /** * The Key Schedule * * @see self::setup() * @var array * @access private */ private $w; /** * The Inverse Key Schedule * * @see self::setup() * @var array * @access private */ private $dw; /** * The Block Length divided by 32 * * @see self::setBlockLength() * @var int * @access private * @internal The max value is 256 / 32 = 8, the min value is 128 / 32 = 4. Exists in conjunction with $block_size * because the encryption / decryption / key schedule creation requires this number and not $block_size. We could * derive this from $block_size or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu * of that, we'll just precompute it once. */ private $Nb = 4; /** * The Key Length (in bytes) * * @see self::setKeyLength() * @var int * @access private * @internal The max value is 256 / 8 = 32, the min value is 128 / 8 = 16. Exists in conjunction with $Nk * because the encryption / decryption / key schedule creation requires this number and not $key_length. We could * derive this from $key_length or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu * of that, we'll just precompute it once. */ protected $key_length = 16; /** * The Key Length divided by 32 * * @see self::setKeyLength() * @var int * @access private * @internal The max value is 256 / 32 = 8, the min value is 128 / 32 = 4 */ private $Nk = 4; /** * The Number of Rounds * * @var int * @access private * @internal The max value is 14, the min value is 10. */ private $Nr; /** * Shift offsets * * @var array * @access private */ private $c; /** * Holds the last used key- and block_size information * * @var array * @access private */ private $kl; /** * Default Constructor. * * @param int $mode * @access public * @throws \InvalidArgumentException if an invalid / unsupported mode is provided */ public function __construct($mode) { if ($mode == self::MODE_STREAM) { throw new \InvalidArgumentException('Block ciphers cannot be ran in stream mode'); } parent::__construct($mode); } /** * Sets the key length. * * Valid key lengths are 128, 160, 192, 224, and 256. * * Note: phpseclib extends Rijndael (and AES) for using 160- and 224-bit keys but they are officially not defined * and the most (if not all) implementations are not able using 160/224-bit keys but round/pad them up to * 192/256 bits as, for example, mcrypt will do. * * That said, if you want be compatible with other Rijndael and AES implementations, * you should not setKeyLength(160) or setKeyLength(224). * * Additional: In case of 160- and 224-bit keys, phpseclib will/can, for that reason, not use * the mcrypt php extension, even if available. * This results then in slower encryption. * * @access public * @throws \LengthException if the key length is invalid * @param int $length */ public function setKeyLength($length) { switch ($length) { case 128: case 160: case 192: case 224: case 256: $this->key_length = $length >> 3; break; default: throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys of sizes 128, 160, 192, 224 or 256 bits are supported'); } parent::setKeyLength($length); } /** * Sets the key. * * Rijndael supports five different key lengths * * @see setKeyLength() * @access public * @param string $key * @throws \LengthException if the key length isn't supported */ public function setKey($key) { switch (strlen($key)) { case 16: case 20: case 24: case 28: case 32: break; default: throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes 16, 20, 24, 28 or 32 are supported'); } parent::setKey($key); } /** * Sets the block length * * Valid block lengths are 128, 160, 192, 224, and 256. * * @access public * @param int $length */ public function setBlockLength($length) { switch ($length) { case 128: case 160: case 192: case 224: case 256: break; default: throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys of sizes 128, 160, 192, 224 or 256 bits are supported'); } $this->Nb = $length >> 5; $this->block_size = $length >> 3; $this->changed = true; $this->setEngine(); } /** * Test for engine validity * * This is mainly just a wrapper to set things up for \phpseclib\Crypt\Common\SymmetricKey::isValidEngine() * * @see \phpseclib\Crypt\Common\SymmetricKey::__construct() * @param int $engine * @access protected * @return bool */ protected function isValidEngineHelper($engine) { switch ($engine) { case self::ENGINE_OPENSSL: if ($this->block_size != 16) { return false; } $this->cipher_name_openssl_ecb = 'aes-' . ($this->key_length << 3) . '-ecb'; $this->cipher_name_openssl = 'aes-' . ($this->key_length << 3) . '-' . $this->openssl_translate_mode(); break; case self::ENGINE_MCRYPT: $this->cipher_name_mcrypt = 'rijndael-' . ($this->block_size << 3); if ($this->key_length % 8) { // is it a 160/224-bit key? // mcrypt is not usable for them, only for 128/192/256-bit keys return false; } } return parent::isValidEngineHelper($engine); } /** * Encrypts a block * * @access private * @param string $in * @return string */ protected function encryptBlock($in) { static $tables; if (empty($tables)) { $tables = &$this->getTables(); } $t0 = $tables[0]; $t1 = $tables[1]; $t2 = $tables[2]; $t3 = $tables[3]; $sbox = $tables[4]; $state = []; $words = unpack('N*', $in); $c = $this->c; $w = $this->w; $Nb = $this->Nb; $Nr = $this->Nr; // addRoundKey $wc = $Nb - 1; foreach ($words as $word) { $state[] = $word ^ $w[++$wc]; } // fips-197.pdf#page=19, "Figure 5. Pseudo Code for the Cipher", states that this loop has four components - // subBytes, shiftRows, mixColumns, and addRoundKey. fips-197.pdf#page=30, "Implementation Suggestions Regarding // Various Platforms" suggests that performs enhanced implementations are described in Rijndael-ammended.pdf. // Rijndael-ammended.pdf#page=20, "Implementation aspects / 32-bit processor", discusses such an optimization. // Unfortunately, the description given there is not quite correct. Per aes.spec.v316.pdf#page=19 [1], // equation (7.4.7) is supposed to use addition instead of subtraction, so we'll do that here, as well. // [1] http://fp.gladman.plus.com/cryptography_technology/rijndael/aes.spec.v316.pdf $temp = []; for ($round = 1; $round < $Nr; ++$round) { $i = 0; // $c[0] == 0 $j = $c[1]; $k = $c[2]; $l = $c[3]; while ($i < $Nb) { $temp[$i] = $t0[$state[$i] >> 24 & 0x000000FF] ^ $t1[$state[$j] >> 16 & 0x000000FF] ^ $t2[$state[$k] >> 8 & 0x000000FF] ^ $t3[$state[$l] & 0x000000FF] ^ $w[++$wc]; ++$i; $j = ($j + 1) % $Nb; $k = ($k + 1) % $Nb; $l = ($l + 1) % $Nb; } $state = $temp; } // subWord for ($i = 0; $i < $Nb; ++$i) { $state[$i] = $sbox[$state[$i] & 0x000000FF] | ($sbox[$state[$i] >> 8 & 0x000000FF] << 8) | ($sbox[$state[$i] >> 16 & 0x000000FF] << 16) | ($sbox[$state[$i] >> 24 & 0x000000FF] << 24); } // shiftRows + addRoundKey $i = 0; // $c[0] == 0 $j = $c[1]; $k = $c[2]; $l = $c[3]; while ($i < $Nb) { $temp[$i] = ($state[$i] & 0xFF000000) ^ ($state[$j] & 0x00FF0000) ^ ($state[$k] & 0x0000FF00) ^ ($state[$l] & 0x000000FF) ^ $w[$i]; ++$i; $j = ($j + 1) % $Nb; $k = ($k + 1) % $Nb; $l = ($l + 1) % $Nb; } switch ($Nb) { case 8: return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6], $temp[7]); case 7: return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6]); case 6: return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5]); case 5: return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4]); default: return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3]); } } /** * Decrypts a block * * @access private * @param string $in * @return string */ protected function decryptBlock($in) { static $invtables; if (empty($invtables)) { $invtables = &$this->getInvTables(); } $dt0 = $invtables[0]; $dt1 = $invtables[1]; $dt2 = $invtables[2]; $dt3 = $invtables[3]; $isbox = $invtables[4]; $state = []; $words = unpack('N*', $in); $c = $this->c; $dw = $this->dw; $Nb = $this->Nb; $Nr = $this->Nr; // addRoundKey $wc = $Nb - 1; foreach ($words as $word) { $state[] = $word ^ $dw[++$wc]; } $temp = []; for ($round = $Nr - 1; $round > 0; --$round) { $i = 0; // $c[0] == 0 $j = $Nb - $c[1]; $k = $Nb - $c[2]; $l = $Nb - $c[3]; while ($i < $Nb) { $temp[$i] = $dt0[$state[$i] >> 24 & 0x000000FF] ^ $dt1[$state[$j] >> 16 & 0x000000FF] ^ $dt2[$state[$k] >> 8 & 0x000000FF] ^ $dt3[$state[$l] & 0x000000FF] ^ $dw[++$wc]; ++$i; $j = ($j + 1) % $Nb; $k = ($k + 1) % $Nb; $l = ($l + 1) % $Nb; } $state = $temp; } // invShiftRows + invSubWord + addRoundKey $i = 0; // $c[0] == 0 $j = $Nb - $c[1]; $k = $Nb - $c[2]; $l = $Nb - $c[3]; while ($i < $Nb) { $word = ($state[$i] & 0xFF000000) | ($state[$j] & 0x00FF0000) | ($state[$k] & 0x0000FF00) | ($state[$l] & 0x000000FF); $temp[$i] = $dw[$i] ^ ($isbox[$word & 0x000000FF] | ($isbox[$word >> 8 & 0x000000FF] << 8) | ($isbox[$word >> 16 & 0x000000FF] << 16) | ($isbox[$word >> 24 & 0x000000FF] << 24)); ++$i; $j = ($j + 1) % $Nb; $k = ($k + 1) % $Nb; $l = ($l + 1) % $Nb; } switch ($Nb) { case 8: return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6], $temp[7]); case 7: return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6]); case 6: return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5]); case 5: return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4]); default: return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3]); } } /** * Setup the key (expansion) * * @see \phpseclib\Crypt\Common\SymmetricKey::setupKey() * @access private */ protected function setupKey() { // Each number in $rcon is equal to the previous number multiplied by two in Rijndael's finite field. // See http://en.wikipedia.org/wiki/Finite_field_arithmetic#Multiplicative_inverse static $rcon = [0, 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000, 0x6C000000, 0xD8000000, 0xAB000000, 0x4D000000, 0x9A000000, 0x2F000000, 0x5E000000, 0xBC000000, 0x63000000, 0xC6000000, 0x97000000, 0x35000000, 0x6A000000, 0xD4000000, 0xB3000000, 0x7D000000, 0xFA000000, 0xEF000000, 0xC5000000, 0x91000000 ]; if (isset($this->kl['key']) && $this->key === $this->kl['key'] && $this->key_length === $this->kl['key_length'] && $this->block_size === $this->kl['block_size']) { // already expanded return; } $this->kl = ['key' => $this->key, 'key_length' => $this->key_length, 'block_size' => $this->block_size]; $this->Nk = $this->key_length >> 2; // see Rijndael-ammended.pdf#page=44 $this->Nr = max($this->Nk, $this->Nb) + 6; // shift offsets for Nb = 5, 7 are defined in Rijndael-ammended.pdf#page=44, // "Table 8: Shift offsets in Shiftrow for the alternative block lengths" // shift offsets for Nb = 4, 6, 8 are defined in Rijndael-ammended.pdf#page=14, // "Table 2: Shift offsets for different block lengths" switch ($this->Nb) { case 4: case 5: case 6: $this->c = [0, 1, 2, 3]; break; case 7: $this->c = [0, 1, 2, 4]; break; case 8: $this->c = [0, 1, 3, 4]; } $w = array_values(unpack('N*words', $this->key)); $length = $this->Nb * ($this->Nr + 1); for ($i = $this->Nk; $i < $length; $i++) { $temp = $w[$i - 1]; if ($i % $this->Nk == 0) { // according to <http://php.net/language.types.integer>, "the size of an integer is platform-dependent". // on a 32-bit machine, it's 32-bits, and on a 64-bit machine, it's 64-bits. on a 32-bit machine, // 0xFFFFFFFF << 8 == 0xFFFFFF00, but on a 64-bit machine, it equals 0xFFFFFFFF00. as such, doing 'and' // with 0xFFFFFFFF (or 0xFFFFFF00) on a 32-bit machine is unnecessary, but on a 64-bit machine, it is. $temp = (($temp << 8) & 0xFFFFFF00) | (($temp >> 24) & 0x000000FF); // rotWord $temp = $this->subWord($temp) ^ $rcon[$i / $this->Nk]; } elseif ($this->Nk > 6 && $i % $this->Nk == 4) { $temp = $this->subWord($temp); } $w[$i] = $w[$i - $this->Nk] ^ $temp; } // convert the key schedule from a vector of $Nb * ($Nr + 1) length to a matrix with $Nr + 1 rows and $Nb columns // and generate the inverse key schedule. more specifically, // according to <http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=23> (section 5.3.3), // "The key expansion for the Inverse Cipher is defined as follows: // 1. Apply the Key Expansion. // 2. Apply InvMixColumn to all Round Keys except the first and the last one." // also, see fips-197.pdf#page=27, "5.3.5 Equivalent Inverse Cipher" list($dt0, $dt1, $dt2, $dt3) = $this->getInvTables(); $temp = $this->w = $this->dw = []; for ($i = $row = $col = 0; $i < $length; $i++, $col++) { if ($col == $this->Nb) { if ($row == 0) { $this->dw[0] = $this->w[0]; } else { // subWord + invMixColumn + invSubWord = invMixColumn $j = 0; while ($j < $this->Nb) { $dw = $this->subWord($this->w[$row][$j]); $temp[$j] = $dt0[$dw >> 24 & 0x000000FF] ^ $dt1[$dw >> 16 & 0x000000FF] ^ $dt2[$dw >> 8 & 0x000000FF] ^ $dt3[$dw & 0x000000FF]; $j++; } $this->dw[$row] = $temp; } $col = 0; $row++; } $this->w[$row][$col] = $w[$i]; } $this->dw[$row] = $this->w[$row]; // Converting to 1-dim key arrays (both ascending) $this->dw = array_reverse($this->dw); $w = array_pop($this->w); $dw = array_pop($this->dw); foreach ($this->w as $r => $wr) { foreach ($wr as $c => $wc) { $w[] = $wc; $dw[] = $this->dw[$r][$c]; } } $this->w = $w; $this->dw = $dw; } /** * Performs S-Box substitutions * * @return array * @access private * @param int $word */ private function subWord($word) { static $sbox; if (empty($sbox)) { list(, , , , $sbox) = self::getTables(); } return $sbox[$word & 0x000000FF] | ($sbox[$word >> 8 & 0x000000FF] << 8) | ($sbox[$word >> 16 & 0x000000FF] << 16) | ($sbox[$word >> 24 & 0x000000FF] << 24); } /** * Provides the mixColumns and sboxes tables * * @see self::encryptBlock() * @see self::setupInlineCrypt() * @see self::subWord() * @access private * @return array &$tables */ protected function &getTables() { static $tables; if (empty($tables)) { // according to <http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=19> (section 5.2.1), // precomputed tables can be used in the mixColumns phase. in that example, they're assigned t0...t3, so // those are the names we'll use. $t3 = array_map('intval', [ // with array_map('intval',...) we ensure we have only int's and not // some slower floats converted by php automatically on high values 0x6363A5C6, 0x7C7C84F8, 0x777799EE, 0x7B7B8DF6, 0xF2F20DFF, 0x6B6BBDD6, 0x6F6FB1DE, 0xC5C55491, 0x30305060, 0x01010302, 0x6767A9CE, 0x2B2B7D56, 0xFEFE19E7, 0xD7D762B5, 0xABABE64D, 0x76769AEC, 0xCACA458F, 0x82829D1F, 0xC9C94089, 0x7D7D87FA, 0xFAFA15EF, 0x5959EBB2, 0x4747C98E, 0xF0F00BFB, 0xADADEC41, 0xD4D467B3, 0xA2A2FD5F, 0xAFAFEA45, 0x9C9CBF23, 0xA4A4F753, 0x727296E4, 0xC0C05B9B, 0xB7B7C275, 0xFDFD1CE1, 0x9393AE3D, 0x26266A4C, 0x36365A6C, 0x3F3F417E, 0xF7F702F5, 0xCCCC4F83, 0x34345C68, 0xA5A5F451, 0xE5E534D1, 0xF1F108F9, 0x717193E2, 0xD8D873AB, 0x31315362, 0x15153F2A, 0x04040C08, 0xC7C75295, 0x23236546, 0xC3C35E9D, 0x18182830, 0x9696A137, 0x05050F0A, 0x9A9AB52F, 0x0707090E, 0x12123624, 0x80809B1B, 0xE2E23DDF, 0xEBEB26CD, 0x2727694E, 0xB2B2CD7F, 0x75759FEA, 0x09091B12, 0x83839E1D, 0x2C2C7458, 0x1A1A2E34, 0x1B1B2D36, 0x6E6EB2DC, 0x5A5AEEB4, 0xA0A0FB5B, 0x5252F6A4, 0x3B3B4D76, 0xD6D661B7, 0xB3B3CE7D, 0x29297B52, 0xE3E33EDD, 0x2F2F715E, 0x84849713, 0x5353F5A6, 0xD1D168B9, 0x00000000, 0xEDED2CC1, 0x20206040, 0xFCFC1FE3, 0xB1B1C879, 0x5B5BEDB6, 0x6A6ABED4, 0xCBCB468D, 0xBEBED967, 0x39394B72, 0x4A4ADE94, 0x4C4CD498, 0x5858E8B0, 0xCFCF4A85, 0xD0D06BBB, 0xEFEF2AC5, 0xAAAAE54F, 0xFBFB16ED, 0x4343C586, 0x4D4DD79A, 0x33335566, 0x85859411, 0x4545CF8A, 0xF9F910E9, 0x02020604, 0x7F7F81FE, 0x5050F0A0, 0x3C3C4478, 0x9F9FBA25, 0xA8A8E34B, 0x5151F3A2, 0xA3A3FE5D, 0x4040C080, 0x8F8F8A05, 0x9292AD3F, 0x9D9DBC21, 0x38384870, 0xF5F504F1, 0xBCBCDF63, 0xB6B6C177, 0xDADA75AF, 0x21216342, 0x10103020, 0xFFFF1AE5, 0xF3F30EFD, 0xD2D26DBF, 0xCDCD4C81, 0x0C0C1418, 0x13133526, 0xECEC2FC3, 0x5F5FE1BE, 0x9797A235, 0x4444CC88, 0x1717392E, 0xC4C45793, 0xA7A7F255, 0x7E7E82FC, 0x3D3D477A, 0x6464ACC8, 0x5D5DE7BA, 0x19192B32, 0x737395E6, 0x6060A0C0, 0x81819819, 0x4F4FD19E, 0xDCDC7FA3, 0x22226644, 0x2A2A7E54, 0x9090AB3B, 0x8888830B, 0x4646CA8C, 0xEEEE29C7, 0xB8B8D36B, 0x14143C28, 0xDEDE79A7, 0x5E5EE2BC, 0x0B0B1D16, 0xDBDB76AD, 0xE0E03BDB, 0x32325664, 0x3A3A4E74, 0x0A0A1E14, 0x4949DB92, 0x06060A0C, 0x24246C48, 0x5C5CE4B8, 0xC2C25D9F, 0xD3D36EBD, 0xACACEF43, 0x6262A6C4, 0x9191A839, 0x9595A431, 0xE4E437D3, 0x79798BF2, 0xE7E732D5, 0xC8C8438B, 0x3737596E, 0x6D6DB7DA, 0x8D8D8C01, 0xD5D564B1, 0x4E4ED29C, 0xA9A9E049, 0x6C6CB4D8, 0x5656FAAC, 0xF4F407F3, 0xEAEA25CF, 0x6565AFCA, 0x7A7A8EF4, 0xAEAEE947, 0x08081810, 0xBABAD56F, 0x787888F0, 0x25256F4A, 0x2E2E725C, 0x1C1C2438, 0xA6A6F157, 0xB4B4C773, 0xC6C65197, 0xE8E823CB, 0xDDDD7CA1, 0x74749CE8, 0x1F1F213E, 0x4B4BDD96, 0xBDBDDC61, 0x8B8B860D, 0x8A8A850F, 0x707090E0, 0x3E3E427C, 0xB5B5C471, 0x6666AACC, 0x4848D890, 0x03030506, 0xF6F601F7, 0x0E0E121C, 0x6161A3C2, 0x35355F6A, 0x5757F9AE, 0xB9B9D069, 0x86869117, 0xC1C15899, 0x1D1D273A, 0x9E9EB927, 0xE1E138D9, 0xF8F813EB, 0x9898B32B, 0x11113322, 0x6969BBD2, 0xD9D970A9, 0x8E8E8907, 0x9494A733, 0x9B9BB62D, 0x1E1E223C, 0x87879215, 0xE9E920C9, 0xCECE4987, 0x5555FFAA, 0x28287850, 0xDFDF7AA5, 0x8C8C8F03, 0xA1A1F859, 0x89898009, 0x0D0D171A, 0xBFBFDA65, 0xE6E631D7, 0x4242C684, 0x6868B8D0, 0x4141C382, 0x9999B029, 0x2D2D775A, 0x0F0F111E, 0xB0B0CB7B, 0x5454FCA8, 0xBBBBD66D, 0x16163A2C ]); foreach ($t3 as $t3i) { $t0[] = (($t3i << 24) & 0xFF000000) | (($t3i >> 8) & 0x00FFFFFF); $t1[] = (($t3i << 16) & 0xFFFF0000) | (($t3i >> 16) & 0x0000FFFF); $t2[] = (($t3i << 8) & 0xFFFFFF00) | (($t3i >> 24) & 0x000000FF); } $tables = [ // The Precomputed mixColumns tables t0 - t3 $t0, $t1, $t2, $t3, // The SubByte S-Box [ 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15, 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75, 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84, 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF, 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8, 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2, 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73, 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB, 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79, 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08, 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A, 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF, 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16 ] ]; } return $tables; } /** * Provides the inverse mixColumns and inverse sboxes tables * * @see self::decryptBlock() * @see self::setupInlineCrypt() * @see self::setupKey() * @access private * @return array &$tables */ public function &getInvTables() { static $tables; if (empty($tables)) { $dt3 = array_map('intval', [ 0xF4A75051, 0x4165537E, 0x17A4C31A, 0x275E963A, 0xAB6BCB3B, 0x9D45F11F, 0xFA58ABAC, 0xE303934B, 0x30FA5520, 0x766DF6AD, 0xCC769188, 0x024C25F5, 0xE5D7FC4F, 0x2ACBD7C5, 0x35448026, 0x62A38FB5, 0xB15A49DE, 0xBA1B6725, 0xEA0E9845, 0xFEC0E15D, 0x2F7502C3, 0x4CF01281, 0x4697A38D, 0xD3F9C66B, 0x8F5FE703, 0x929C9515, 0x6D7AEBBF, 0x5259DA95, 0xBE832DD4, 0x7421D358, 0xE0692949, 0xC9C8448E, 0xC2896A75, 0x8E7978F4, 0x583E6B99, 0xB971DD27, 0xE14FB6BE, 0x88AD17F0, 0x20AC66C9, 0xCE3AB47D, 0xDF4A1863, 0x1A3182E5, 0x51336097, 0x537F4562, 0x6477E0B1, 0x6BAE84BB, 0x81A01CFE, 0x082B94F9, 0x48685870, 0x45FD198F, 0xDE6C8794, 0x7BF8B752, 0x73D323AB, 0x4B02E272, 0x1F8F57E3, 0x55AB2A66, 0xEB2807B2, 0xB5C2032F, 0xC57B9A86, 0x3708A5D3, 0x2887F230, 0xBFA5B223, 0x036ABA02, 0x16825CED, 0xCF1C2B8A, 0x79B492A7, 0x07F2F0F3, 0x69E2A14E, 0xDAF4CD65, 0x05BED506, 0x34621FD1, 0xA6FE8AC4, 0x2E539D34, 0xF355A0A2, 0x8AE13205, 0xF6EB75A4, 0x83EC390B, 0x60EFAA40, 0x719F065E, 0x6E1051BD, 0x218AF93E, 0xDD063D96, 0x3E05AEDD, 0xE6BD464D, 0x548DB591, 0xC45D0571, 0x06D46F04, 0x5015FF60, 0x98FB2419, 0xBDE997D6, 0x4043CC89, 0xD99E7767, 0xE842BDB0, 0x898B8807, 0x195B38E7, 0xC8EEDB79, 0x7C0A47A1, 0x420FE97C, 0x841EC9F8, 0x00000000, 0x80868309, 0x2BED4832, 0x1170AC1E, 0x5A724E6C, 0x0EFFFBFD, 0x8538560F, 0xAED51E3D, 0x2D392736, 0x0FD9640A, 0x5CA62168, 0x5B54D19B, 0x362E3A24, 0x0A67B10C, 0x57E70F93, 0xEE96D2B4, 0x9B919E1B, 0xC0C54F80, 0xDC20A261, 0x774B695A, 0x121A161C, 0x93BA0AE2, 0xA02AE5C0, 0x22E0433C, 0x1B171D12, 0x090D0B0E, 0x8BC7ADF2, 0xB6A8B92D, 0x1EA9C814, 0xF1198557, 0x75074CAF, 0x99DDBBEE, 0x7F60FDA3, 0x01269FF7, 0x72F5BC5C, 0x663BC544, 0xFB7E345B, 0x4329768B, 0x23C6DCCB, 0xEDFC68B6, 0xE4F163B8, 0x31DCCAD7, 0x63851042, 0x97224013, 0xC6112084, 0x4A247D85, 0xBB3DF8D2, 0xF93211AE, 0x29A16DC7, 0x9E2F4B1D, 0xB230F3DC, 0x8652EC0D, 0xC1E3D077, 0xB3166C2B, 0x70B999A9, 0x9448FA11, 0xE9642247, 0xFC8CC4A8, 0xF03F1AA0, 0x7D2CD856, 0x3390EF22, 0x494EC787, 0x38D1C1D9, 0xCAA2FE8C, 0xD40B3698, 0xF581CFA6, 0x7ADE28A5, 0xB78E26DA, 0xADBFA43F, 0x3A9DE42C, 0x78920D50, 0x5FCC9B6A, 0x7E466254, 0x8D13C2F6, 0xD8B8E890, 0x39F75E2E, 0xC3AFF582, 0x5D80BE9F, 0xD0937C69, 0xD52DA96F, 0x2512B3CF, 0xAC993BC8, 0x187DA710, 0x9C636EE8, 0x3BBB7BDB, 0x267809CD, 0x5918F46E, 0x9AB701EC, 0x4F9AA883, 0x956E65E6, 0xFFE67EAA, 0xBCCF0821, 0x15E8E6EF, 0xE79BD9BA, 0x6F36CE4A, 0x9F09D4EA, 0xB07CD629, 0xA4B2AF31, 0x3F23312A, 0xA59430C6, 0xA266C035, 0x4EBC3774, 0x82CAA6FC, 0x90D0B0E0, 0xA7D81533, 0x04984AF1, 0xECDAF741, 0xCD500E7F, 0x91F62F17, 0x4DD68D76, 0xEFB04D43, 0xAA4D54CC, 0x9604DFE4, 0xD1B5E39E, 0x6A881B4C, 0x2C1FB8C1, 0x65517F46, 0x5EEA049D, 0x8C355D01, 0x877473FA, 0x0B412EFB, 0x671D5AB3, 0xDBD25292, 0x105633E9, 0xD647136D, 0xD7618C9A, 0xA10C7A37, 0xF8148E59, 0x133C89EB, 0xA927EECE, 0x61C935B7, 0x1CE5EDE1, 0x47B13C7A, 0xD2DF599C, 0xF2733F55, 0x14CE7918, 0xC737BF73, 0xF7CDEA53, 0xFDAA5B5F, 0x3D6F14DF, 0x44DB8678, 0xAFF381CA, 0x68C43EB9, 0x24342C38, 0xA3405FC2, 0x1DC37216, 0xE2250CBC, 0x3C498B28, 0x0D9541FF, 0xA8017139, 0x0CB3DE08, 0xB4E49CD8, 0x56C19064, 0xCB84617B, 0x32B670D5, 0x6C5C7448, 0xB85742D0 ]); foreach ($dt3 as $dt3i) { $dt0[] = (($dt3i << 24) & 0xFF000000) | (($dt3i >> 8) & 0x00FFFFFF); $dt1[] = (($dt3i << 16) & 0xFFFF0000) | (($dt3i >> 16) & 0x0000FFFF); $dt2[] = (($dt3i << 8) & 0xFFFFFF00) | (($dt3i >> 24) & 0x000000FF); }; $tables = [ // The Precomputed inverse mixColumns tables dt0 - dt3 $dt0, $dt1, $dt2, $dt3, // The inverse SubByte S-Box [ 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB, 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB, 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E, 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25, 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84, 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06, 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B, 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73, 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E, 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B, 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4, 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F, 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D ] ]; } return $tables; } /** * Setup the performance-optimized function for de/encrypt() * * @see \phpseclib\Crypt\Common\SymmetricKey::setupInlineCrypt() * @access private */ protected function setupInlineCrypt() { $w = $this->w; $dw = $this->dw; $init_encrypt = ''; $init_decrypt = ''; $Nr = $this->Nr; $Nb = $this->Nb; $c = $this->c; // Generating encrypt code: $init_encrypt.= ' static $tables; if (empty($tables)) { $tables = &$this->getTables(); } $t0 = $tables[0]; $t1 = $tables[1]; $t2 = $tables[2]; $t3 = $tables[3]; $sbox = $tables[4]; '; $s = 'e'; $e = 's'; $wc = $Nb - 1; // Preround: addRoundKey $encrypt_block = '$in = unpack("N*", $in);'."\n"; for ($i = 0; $i < $Nb; ++$i) { $encrypt_block .= '$s'.$i.' = $in['.($i + 1).'] ^ '.$w[++$wc].";\n"; } // Mainrounds: shiftRows + subWord + mixColumns + addRoundKey for ($round = 1; $round < $Nr; ++$round) { list($s, $e) = [$e, $s]; for ($i = 0; $i < $Nb; ++$i) { $encrypt_block.= '$'.$e.$i.' = $t0[($'.$s.$i .' >> 24) & 0xff] ^ $t1[($'.$s.(($i + $c[1]) % $Nb).' >> 16) & 0xff] ^ $t2[($'.$s.(($i + $c[2]) % $Nb).' >> 8) & 0xff] ^ $t3[ $'.$s.(($i + $c[3]) % $Nb).' & 0xff] ^ '.$w[++$wc].";\n"; } } // Finalround: subWord + shiftRows + addRoundKey for ($i = 0; $i < $Nb; ++$i) { $encrypt_block.= '$'.$e.$i.' = $sbox[ $'.$e.$i.' & 0xff] | ($sbox[($'.$e.$i.' >> 8) & 0xff] << 8) | ($sbox[($'.$e.$i.' >> 16) & 0xff] << 16) | ($sbox[($'.$e.$i.' >> 24) & 0xff] << 24);'."\n"; } $encrypt_block .= '$in = pack("N*"'."\n"; for ($i = 0; $i < $Nb; ++$i) { $encrypt_block.= ', ($'.$e.$i .' & '.((int)0xFF000000).') ^ ($'.$e.(($i + $c[1]) % $Nb).' & 0x00FF0000 ) ^ ($'.$e.(($i + $c[2]) % $Nb).' & 0x0000FF00 ) ^ ($'.$e.(($i + $c[3]) % $Nb).' & 0x000000FF ) ^ '.$w[$i]."\n"; } $encrypt_block .= ');'; // Generating decrypt code: $init_decrypt.= ' static $invtables; if (empty($invtables)) { $invtables = &$this->getInvTables(); } $dt0 = $invtables[0]; $dt1 = $invtables[1]; $dt2 = $invtables[2]; $dt3 = $invtables[3]; $isbox = $invtables[4]; '; $s = 'e'; $e = 's'; $wc = $Nb - 1; // Preround: addRoundKey $decrypt_block = '$in = unpack("N*", $in);'."\n"; for ($i = 0; $i < $Nb; ++$i) { $decrypt_block .= '$s'.$i.' = $in['.($i + 1).'] ^ '.$dw[++$wc].';'."\n"; } // Mainrounds: shiftRows + subWord + mixColumns + addRoundKey for ($round = 1; $round < $Nr; ++$round) { list($s, $e) = [$e, $s]; for ($i = 0; $i < $Nb; ++$i) { $decrypt_block.= '$'.$e.$i.' = $dt0[($'.$s.$i .' >> 24) & 0xff] ^ $dt1[($'.$s.(($Nb + $i - $c[1]) % $Nb).' >> 16) & 0xff] ^ $dt2[($'.$s.(($Nb + $i - $c[2]) % $Nb).' >> 8) & 0xff] ^ $dt3[ $'.$s.(($Nb + $i - $c[3]) % $Nb).' & 0xff] ^ '.$dw[++$wc].";\n"; } } // Finalround: subWord + shiftRows + addRoundKey for ($i = 0; $i < $Nb; ++$i) { $decrypt_block.= '$'.$e.$i.' = $isbox[ $'.$e.$i.' & 0xff] | ($isbox[($'.$e.$i.' >> 8) & 0xff] << 8) | ($isbox[($'.$e.$i.' >> 16) & 0xff] << 16) | ($isbox[($'.$e.$i.' >> 24) & 0xff] << 24);'."\n"; } $decrypt_block .= '$in = pack("N*"'."\n"; for ($i = 0; $i < $Nb; ++$i) { $decrypt_block.= ', ($'.$e.$i. ' & '.((int)0xFF000000).') ^ ($'.$e.(($Nb + $i - $c[1]) % $Nb).' & 0x00FF0000 ) ^ ($'.$e.(($Nb + $i - $c[2]) % $Nb).' & 0x0000FF00 ) ^ ($'.$e.(($Nb + $i - $c[3]) % $Nb).' & 0x000000FF ) ^ '.$dw[$i]."\n"; } $decrypt_block .= ');'; $this->inline_crypt = $this->createInlineCryptFunction( [ 'init_crypt' => '', 'init_encrypt' => $init_encrypt, 'init_decrypt' => $init_decrypt, 'encrypt_block' => $encrypt_block, 'decrypt_block' => $decrypt_block ] ); } } <?php /** * Pure-PHP FIPS 186-4 compliant implementation of DSA. * * PHP version 5 * * Here's an example of how to create signatures and verify signatures with this library: * <code> * <?php * include 'vendor/autoload.php'; * * extract(\phpseclib\Crypt\DSA::createKey()); * * $plaintext = 'terrafrost'; * * $signature = $privatekey->sign($plaintext, 'ASN1'); * * echo $publickey->verify($plaintext, $signature) ? 'verified' : 'unverified'; * ?> * </code> * * @category Crypt * @package DSA * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt; use ParagonIE\ConstantTime\Base64; use phpseclib\File\ASN1; use phpseclib\Math\BigInteger; use phpseclib\Crypt\Common\AsymmetricKey; use phpseclib\Common\Functions\Strings; /** * Pure-PHP FIPS 186-4 compliant implementation of DSA. * * @package DSA * @author Jim Wigginton <terrafrost@php.net> * @access public */ class DSA extends AsymmetricKey { /** * Algorithm Name * * @var string * @access private */ const ALGORITHM = 'DSA'; /** * DSA Prime P * * @var \phpseclib\Math\BigInteger * @access private */ private $p; /** * DSA Group Order q * * Prime divisor of p-1 * * @var \phpseclib\Math\BigInteger * @access private */ protected $q; /** * DSA Group Generator G * * @var \phpseclib\Math\BigInteger * @access private */ private $g; /** * DSA secret exponent x * * @var \phpseclib\Math\BigInteger * @access private */ protected $x; /** * DSA public key value y * * @var \phpseclib\Math\BigInteger * @access private */ private $y; /** * Parameters Format * * @var string * @access private */ private $parametersFormat = 'PKCS1'; /** * Create DSA parameters * * @access public * @param int $L * @param int $N * @return \phpseclib\Crypt\DSA|bool */ static function createParameters($L = 2048, $N = 224) { self::initialize_static_variables(); switch (true) { case $N == 160: /* in FIPS 186-1 and 186-2 N was fixed at 160 whereas K had an upper bound of 1024. RFC 4253 (SSH Transport Layer Protocol) references FIPS 186-2 and as such most SSH DSA implementations only support keys with an N of 160. puttygen let's you set the size of L (but not the size of N) and uses 2048 as the default L value. that's not really compliant with any of the FIPS standards, however, for the purposes of maintaining compatibility with puttygen, we'll support it */ //case ($L >= 512 || $L <= 1024) && (($L & 0x3F) == 0) && $N == 160: // FIPS 186-3 changed this as follows: //case $L == 1024 && $N == 160: case $L == 2048 && $N == 224: case $L == 2048 && $N == 256: case $L == 3072 && $N == 256: break; default: return false; } $two = new BigInteger(2); $q = BigInteger::randomPrime($N); $divisor = $q->multiply($two); do { $x = BigInteger::random($L); list(, $c) = $x->divide($divisor); $p = $x->subtract($c->subtract(self::$one)); } while ($p->getLength() != $L || !$p->isPrime()); $p_1 = $p->subtract(self::$one); list($e) = $p_1->divide($q); // quoting http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf#page=50 , // "h could be obtained from a random number generator or from a counter that // changes after each use". PuTTY (sshdssg.c) starts h off at 1 and increments // it on each loop. wikipedia says "commonly h = 2 is used" so we'll just do that $h = clone $two; while (true) { $g = $h->powMod($e, $p); if (!$g->equals(self::$one)) { break; } $h = $h->add(self::$one); } $dsa = new DSA(); $dsa->p = $p; $dsa->q = $q; $dsa->g = $g; return $dsa; } /** * Create public / private key pair. * * This method is a bit polymorphic. It can take a DSA object (eg. pre-loaded with parameters), * L / N as two distinct parameters or no parameters (at which point L and N will be generated * with this method) * * Returns an array with the following two elements: * - 'privatekey': The private key. * - 'publickey': The public key. * * @param $args[] * @access public * @return array|DSA */ static function createKey(...$args) { self::initialize_static_variables(); if (count($args) == 2 && is_int($args[0]) && is_int($args[1])) { $private = self::createParameters($args[0], $args[1]); } else if (count($args) == 1 && $args[0] instanceof DSA) { $private = clone $args[0]; } else if (!count($args)) { $private = self::createParameters(); } else { throw new \InvalidArgumentException('Valid parameters are either two integers (L and N), a single DSA object or no parameters at all.'); } $private->x = BigInteger::randomRange(self::$one, $private->q->subtract(self::$one)); $private->y = $private->g->powMod($private->x, $private->p); $public = clone $private; unset($public->x); return ['privatekey' => $private, 'publickey' => $public]; } /** * Loads a public or private key * * Returns true on success and false on failure (ie. an incorrect password was provided or the key was malformed) * @return bool * @access public * @param string $key * @param int|bool $type optional */ public function load($key, $type = false) { if ($key instanceof DSA) { $this->privateKeyFormat = $key->privateKeyFormat; $this->publicKeyFormat = $key->publicKeyFormat; $this->format = $key->format; $this->p = $key->p; $this->q = $key->q; $this->g = $key->g; $this->x = $key->x; $this->y = $key->y; $this->parametersFormat = $key->parametersFormat; return true; } $components = parent::load($key, $type); if ($components === false) { return false; } if (isset($components['p'])) { switch (true) { case isset($this->p) && !$this->p->equals($components['p']): case isset($this->q) && !$this->q->equals($components['q']): case isset($this->g) && !$this->g->equals($components['g']): $this->x = $this->y = null; } $this->p = $components['p']; $this->q = $components['q']; $this->g = $components['g']; } if (isset($components['x'])) { $this->x = $components['x']; } if (isset($components['y'])) { $this->y = $components['y']; } //} else if (isset($components['x'])) { // $this->y = $this->g->powMod($this->x, $this->p); //} return true; } /** * Returns the key size * * More specifically, this L (the length of DSA Prime P) and N (the length of DSA Group Order q) * * @access public * @return array */ public function getLength() { return isset($this->p) ? ['L' => $this->p->getLength(), 'N' => $this->q->getLength()] : ['L' => 0, 'N' => 0]; } /** * __toString() magic method * * @access public * @return string */ public function __toString() { $key = parent::__toString(); if (!empty($key)) { return $key; } try { $key = $this->getParameters($this->parametersFormat); return is_string($key) ? $key : ''; } catch (\Exception $e) { return ''; } } /** * Returns the private key * * PKCS1 DSA private keys contain x and y. PKCS8 DSA private keys just contain x * but y can be derived from x. * * @see self::getPublicKey() * @access public * @param string $type optional * @return mixed */ public function getPrivateKey($type = 'PKCS8') { $type = self::validatePlugin('Keys', $type, 'savePrivateKey'); if ($type === false) { return false; } if (!isset($this->x)) { return false; } if (!isset($this->y)) { $this->y = $this->g->powMod($this->x, $this->p); } return $type::savePrivateKey($this->p, $this->q, $this->g, $this->y, $this->x, $this->password); } /** * Returns the public key * * If you do "openssl rsa -in private.rsa -pubout -outform PEM" you get a PKCS8 formatted key * that contains a publicKeyAlgorithm AlgorithmIdentifier and a publicKey BIT STRING. * An AlgorithmIdentifier contains an OID and a parameters field. With RSA public keys this * parameters field is NULL. With DSA PKCS8 public keys it is not - it contains the p, q and g * variables. The publicKey BIT STRING contains, simply, the y variable. This can be verified * by getting a DSA PKCS8 public key: * * "openssl dsa -in private.dsa -pubout -outform PEM" * * ie. just swap out rsa with dsa in the rsa command above. * * A PKCS1 public key corresponds to the publicKey portion of the PKCS8 key. In the case of RSA * the publicKey portion /is/ the key. In the case of DSA it is not. You cannot verify a signature * without the parameters and the PKCS1 DSA public key format does not include the parameters. * * @see self::getPrivateKey() * @access public * @param string $type optional * @return mixed */ public function getPublicKey($type = 'PKCS8') { $type = self::validatePlugin('Keys', $type, 'savePublicKey'); if ($type === false) { return false; } if (!isset($this->y)) { if (!isset($this->x) || !isset($this->p)) { return false; } $this->y = $this->g->powMod($this->x, $this->p); } return $type::savePublicKey($this->p, $this->q, $this->g, $this->y); } /** * Returns the parameters * * A public / private key is only returned if the currently loaded "key" contains an x or y * value. * * @see self::getPublicKey() * @see self::getPrivateKey() * @access public * @param string $type optional * @return mixed */ public function getParameters($type = 'PKCS1') { $type = self::validatePlugin('Keys', $type, 'saveParameters'); if ($type === false) { return false; } if (!isset($this->p) || !isset($this->q) || !isset($this->g)) { return false; } return $type::saveParameters($this->p, $this->q, $this->g); } /** * Create a signature * * @see self::verify() * @access public * @param string $message * @param string $format optional * @return mixed */ function sign($message, $format = 'Raw') { $format = self::validatePlugin('Signature', $format); if ($format === false) { return false; } if (empty($this->x) || empty($this->p)) { return false; } while (true) { $k = BigInteger::randomRange(self::$one, $this->q->subtract(self::$one)); $r = $this->g->powMod($k, $this->p); list(, $r) = $r->divide($this->q); if ($r->equals(self::$zero)) { continue; } $kinv = $k->modInverse($this->q); $h = $this->hash->hash($message); $h = $this->bits2int($h); $temp = $h->add($this->x->multiply($r)); $temp = $kinv->multiply($temp); list(, $s) = $temp->divide($this->q); if (!$s->equals(self::$zero)) { break; } } // the following is an RFC6979 compliant implementation of deterministic DSA // it's unused because it's mainly intended for use when a good CSPRNG isn't // available. if phpseclib's CSPRNG isn't good then even key generation is // suspect /* $h1 = $this->hash->hash($message); $k = $this->computek($h1); $r = $this->g->powMod($k, $this->p); list(, $r) = $r->divide($this->q); $kinv = $k->modInverse($this->q); $h1 = $this->bits2int($h1); $temp = $h1->add($this->x->multiply($r)); $temp = $kinv->multiply($temp); list(, $s) = $temp->divide($this->q); */ return $format::save($r, $s); } /** * Verify a signature * * @see self::verify() * @access public * @param string $message * @param string $signature * @param string $format optional * @return mixed */ function verify($message, $signature, $format = 'Raw') { $format = self::validatePlugin('Signature', $format); if ($format === false) { return false; } $params = $format::load($signature); if ($params === false || count($params) != 2) { return false; } extract($params); if (empty($this->y) || empty($this->p)) { return false; } $q_1 = $this->q->subtract(self::$one); if (!$r->between(self::$one, $q_1) || !$s->between(self::$one, $q_1)) { return false; } $w = $s->modInverse($this->q); $h = $this->hash->hash($message); $h = $this->bits2int($h); list(, $u1) = $h->multiply($w)->divide($this->q); list(, $u2) = $r->multiply($w)->divide($this->q); $v1 = $this->g->powMod($u1, $this->p); $v2 = $this->y->powMod($u2, $this->p); list(, $v) = $v1->multiply($v2)->divide($this->p); list(, $v) = $v->divide($this->q); return Strings::equals($v->toBytes(), $r->toBytes()); } }<?php /** * Pure-PHP implementation of RC4. * * Uses mcrypt, if available, and an internal implementation, otherwise. * * PHP version 5 * * Useful resources are as follows: * * - {@link http://www.mozilla.org/projects/security/pki/nss/draft-kaukonen-cipher-arcfour-03.txt ARCFOUR Algorithm} * - {@link http://en.wikipedia.org/wiki/RC4 - Wikipedia: RC4} * * RC4 is also known as ARCFOUR or ARC4. The reason is elaborated upon at Wikipedia. This class is named RC4 and not * ARCFOUR or ARC4 because RC4 is how it is referred to in the SSH1 specification. * * Here's a short example of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * $rc4 = new \phpseclib\Crypt\RC4(); * * $rc4->setKey('abcdefgh'); * * $size = 10 * 1024; * $plaintext = ''; * for ($i = 0; $i < $size; $i++) { * $plaintext.= 'a'; * } * * echo $rc4->decrypt($rc4->encrypt($plaintext)); * ?> * </code> * * @category Crypt * @package RC4 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2007 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Crypt; use phpseclib\Crypt\Common\StreamCipher; /** * Pure-PHP implementation of RC4. * * @package RC4 * @author Jim Wigginton <terrafrost@php.net> * @access public */ class RC4 extends StreamCipher { /**#@+ * @access private * @see \phpseclib\Crypt\RC4::_crypt() */ const ENCRYPT = 0; const DECRYPT = 1; /**#@-*/ /** * Block Length of the cipher * * RC4 is a stream cipher * so we the block_size to 0 * * @see \phpseclib\Crypt\Common\SymmetricKey::block_size * @var int * @access private */ protected $block_size = 0; /** * Key Length (in bytes) * * @see \phpseclib\Crypt\RC4::setKeyLength() * @var int * @access private */ protected $key_length = 128; // = 1024 bits /** * The mcrypt specific name of the cipher * * @see \phpseclib\Crypt\Common\SymmetricKey::cipher_name_mcrypt * @var string * @access private */ protected $cipher_name_mcrypt = 'arcfour'; /** * Holds whether performance-optimized $inline_crypt() can/should be used. * * @see \phpseclib\Crypt\Common\SymmetricKey::inline_crypt * @var mixed * @access private */ protected $use_inline_crypt = false; // currently not available /** * The Key * * @see self::setKey() * @var string * @access private */ protected $key; /** * The Key Stream for decryption and encryption * * @see self::setKey() * @var array * @access private */ private $stream; /** * Default Constructor. * * @see \phpseclib\Crypt\Common\SymmetricKey::__construct() * @return \phpseclib\Crypt\RC4 * @access public */ public function __construct() { parent::__construct('stream'); } /** * Test for engine validity * * This is mainly just a wrapper to set things up for \phpseclib\Crypt\Common\SymmetricKey::isValidEngine() * * @see \phpseclib\Crypt\Common\SymmetricKey::__construct() * @param int $engine * @access protected * @return bool */ protected function isValidEngineHelper($engine) { if ($engine == self::ENGINE_OPENSSL) { if (version_compare(PHP_VERSION, '5.3.7') >= 0) { $this->cipher_name_openssl = 'rc4-40'; } else { switch (strlen($this->key)) { case 5: $this->cipher_name_openssl = 'rc4-40'; break; case 8: $this->cipher_name_openssl = 'rc4-64'; break; case 16: $this->cipher_name_openssl = 'rc4'; break; default: return false; } } } return parent::isValidEngineHelper($engine); } /** * RC4 does not use an IV * * @access public * @return bool */ public function usesIV() { return false; } /** * Sets the key length * * Keys can be between 1 and 256 bytes long. * * @access public * @param int $length * @throws \LengthException if the key length is invalid */ public function setKeyLength($length) { if ($length < 8 || $length > 2048) { throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys between 1 and 256 bytes are supported'); } $this->key_length = $length >> 3; parent::setKeyLength($length); } /** * Sets the key length * * Keys can be between 1 and 256 bytes long. * * @access public * @param string $key */ public function setKey($key) { $length = strlen($key); if ($length < 1 || $length > 256) { throw new \LengthException('Key size of ' . $length . ' bytes is not supported by RC4. Keys must be between 1 and 256 bytes long'); } parent::setKey($key); } /** * Encrypts a message. * * @see \phpseclib\Crypt\Common\SymmetricKey::decrypt() * @see self::crypt() * @access public * @param string $plaintext * @return string $ciphertext */ public function encrypt($plaintext) { if ($this->engine != self::ENGINE_INTERNAL) { return parent::encrypt($plaintext); } return $this->crypt($plaintext, self::ENCRYPT); } /** * Decrypts a message. * * $this->decrypt($this->encrypt($plaintext)) == $this->encrypt($this->encrypt($plaintext)). * At least if the continuous buffer is disabled. * * @see \phpseclib\Crypt\Common\SymmetricKey::encrypt() * @see self::crypt() * @access public * @param string $ciphertext * @return string $plaintext */ public function decrypt($ciphertext) { if ($this->engine != self::ENGINE_INTERNAL) { return parent::decrypt($ciphertext); } return $this->crypt($ciphertext, self::DECRYPT); } /** * Encrypts a block * * @access private * @param string $in */ protected function encryptBlock($in) { // RC4 does not utilize this method } /** * Decrypts a block * * @access private * @param string $in */ protected function decryptBlock($in) { // RC4 does not utilize this method } /** * Setup the key (expansion) * * @see \phpseclib\Crypt\Common\SymmetricKey::_setupKey() * @access private */ protected function setupKey() { $key = $this->key; $keyLength = strlen($key); $keyStream = range(0, 255); $j = 0; for ($i = 0; $i < 256; $i++) { $j = ($j + $keyStream[$i] + ord($key[$i % $keyLength])) & 255; $temp = $keyStream[$i]; $keyStream[$i] = $keyStream[$j]; $keyStream[$j] = $temp; } $this->stream = []; $this->stream[self::DECRYPT] = $this->stream[self::ENCRYPT] = [ 0, // index $i 0, // index $j $keyStream ]; } /** * Encrypts or decrypts a message. * * @see self::encrypt() * @see self::decrypt() * @access private * @param string $text * @param int $mode * @return string $text */ private function crypt($text, $mode) { if ($this->changed) { $this->setup(); $this->changed = false; } $stream = &$this->stream[$mode]; if ($this->continuousBuffer) { $i = &$stream[0]; $j = &$stream[1]; $keyStream = &$stream[2]; } else { $i = $stream[0]; $j = $stream[1]; $keyStream = $stream[2]; } $len = strlen($text); for ($k = 0; $k < $len; ++$k) { $i = ($i + 1) & 255; $ksi = $keyStream[$i]; $j = ($j + $ksi) & 255; $ksj = $keyStream[$j]; $keyStream[$i] = $ksj; $keyStream[$j] = $ksi; $text[$k] = $text[$k] ^ chr($keyStream[($ksj + $ksi) & 255]); } return $text; } } <?php /** * Pure-PHP ssh-agent client. * * PHP version 5 * * Here are some examples of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * $agent = new \phpseclib\System\SSH\Agent(); * * $ssh = new \phpseclib\Net\SSH2('www.domain.tld'); * if (!$ssh->login('username', $agent)) { * exit('Login Failed'); * } * * echo $ssh->exec('pwd'); * echo $ssh->exec('ls -la'); * ?> * </code> * * @category System * @package SSH\Agent * @author Jim Wigginton <terrafrost@php.net> * @copyright 2014 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net * @internal See http://api.libssh.org/rfc/PROTOCOL.agent */ namespace phpseclib\System\SSH; use ParagonIE\ConstantTime\Base64; use phpseclib\Crypt\RSA; use phpseclib\Exception\BadConfigurationException; use phpseclib\System\SSH\Agent\Identity; use phpseclib\Common\Functions\Objects; /** * Pure-PHP ssh-agent client identity factory * * requestIdentities() method pumps out \phpseclib\System\SSH\Agent\Identity objects * * @package SSH\Agent * @author Jim Wigginton <terrafrost@php.net> * @access internal */ class Agent { /**#@+ * Message numbers * * @access private */ // to request SSH1 keys you have to use SSH_AGENTC_REQUEST_RSA_IDENTITIES (1) const SSH_AGENTC_REQUEST_IDENTITIES = 11; // this is the SSH2 response; the SSH1 response is SSH_AGENT_RSA_IDENTITIES_ANSWER (2). const SSH_AGENT_IDENTITIES_ANSWER = 12; // the SSH1 request is SSH_AGENTC_RSA_CHALLENGE (3) const SSH_AGENTC_SIGN_REQUEST = 13; // the SSH1 response is SSH_AGENT_RSA_RESPONSE (4) const SSH_AGENT_SIGN_RESPONSE = 14; /**#@-*/ /**@+ * Agent forwarding status * * @access private */ // no forwarding requested and not active const FORWARD_NONE = 0; // request agent forwarding when opportune const FORWARD_REQUEST = 1; // forwarding has been request and is active const FORWARD_ACTIVE = 2; /**#@-*/ /** * Unused */ const SSH_AGENT_FAILURE = 5; /** * Socket Resource * * @var resource * @access private */ private $fsock; /** * Agent forwarding status * * @var int * @access private */ private $forward_status = self::FORWARD_NONE; /** * Buffer for accumulating forwarded authentication * agent data arriving on SSH data channel destined * for agent unix socket * * @var string * @access private */ private $socket_buffer = ''; /** * Tracking the number of bytes we are expecting * to arrive for the agent socket on the SSH data * channel * * @var int * @access private */ private $expected_bytes = 0; /** * The current request channel * * @var int * @access private */ private $request_channel; /** * Default Constructor * * @return \phpseclib\System\SSH\Agent * @throws \phpseclib\Exception\BadConfigurationException if SSH_AUTH_SOCK cannot be found * @throws \RuntimeException on connection errors * @access public */ public function __construct() { switch (true) { case isset($_SERVER['SSH_AUTH_SOCK']): $address = $_SERVER['SSH_AUTH_SOCK']; break; case isset($_ENV['SSH_AUTH_SOCK']): $address = $_ENV['SSH_AUTH_SOCK']; break; default: throw new BadConfigurationException('SSH_AUTH_SOCK not found'); } $this->fsock = fsockopen('unix://' . $address, 0, $errno, $errstr); if (!$this->fsock) { throw new \RuntimeException("Unable to connect to ssh-agent (Error $errno: $errstr)"); } } /** * Request Identities * * See "2.5.2 Requesting a list of protocol 2 keys" * Returns an array containing zero or more \phpseclib\System\SSH\Agent\Identity objects * * @return array * @throws \RuntimeException on receipt of unexpected packets * @access public */ public function requestIdentities() { if (!$this->fsock) { return []; } $packet = pack('NC', 1, self::SSH_AGENTC_REQUEST_IDENTITIES); if (strlen($packet) != fputs($this->fsock, $packet)) { throw new \RuntimeException('Connection closed while requesting identities'); } $length = current(unpack('N', fread($this->fsock, 4))); $type = ord(fread($this->fsock, 1)); if ($type != self::SSH_AGENT_IDENTITIES_ANSWER) { throw new \RuntimeException('Unable to request identities'); } $identities = []; $keyCount = current(unpack('N', fread($this->fsock, 4))); for ($i = 0; $i < $keyCount; $i++) { $length = current(unpack('N', fread($this->fsock, 4))); $key_blob = fread($this->fsock, $length); $key_str = 'ssh-rsa ' . Base64::encode($key_blob); $length = current(unpack('N', fread($this->fsock, 4))); if ($length) { $key_str.= ' ' . fread($this->fsock, $length); } $length = current(unpack('N', substr($key_blob, 0, 4))); $key_type = substr($key_blob, 4, $length); switch ($key_type) { case 'ssh-rsa': $key = new RSA(); $key->load($key_str); break; case 'ssh-dss': // not currently supported break; } // resources are passed by reference by default if (isset($key)) { $identity = new Identity($this->fsock); $identity->setPublicKey($key); $identity->setPublicKeyBlob($key_blob); $identities[] = $identity; unset($key); } } return $identities; } /** * Signal that agent forwarding should * be requested when a channel is opened * * @param \phpseclib\Net\SSH2 $ssh * @return bool * @access public */ public function startSSHForwarding($ssh) { if ($this->forward_status == self::FORWARD_NONE) { $this->forward_status = self::FORWARD_REQUEST; } } /** * Request agent forwarding of remote server * * @param \phpseclib\Net\SSH2 $ssh * @return bool * @access private */ private function request_forwarding($ssh) { $this->request_channel = Objects::callFunc($ssh, 'get_open_channel'); if ($this->request_channel === false) { return false; } $packet = pack( 'CNNa*C', NET_SSH2_MSG_CHANNEL_REQUEST, Objects::getVar($ssh, 'server_channels')[$this->request_channel], strlen('auth-agent-req@openssh.com'), 'auth-agent-req@openssh.com', 1 ); $this->update_channel_status($ssh, NET_SSH2_MSG_CHANNEL_REQUEST); if (!Objects::callFunc($ssh, 'send_binary_packet', [$packet])) { return false; } $response = Objects::callFunc($ssh, 'get_channel_packet', [$this->request_channel]); if ($response === false) { return false; } $this->update_channel_status($ssh, NET_SSH2_MSG_CHANNEL_OPEN); $this->forward_status = self::FORWARD_ACTIVE; return true; } /** * On successful channel open * * This method is called upon successful channel * open to give the SSH Agent an opportunity * to take further action. i.e. request agent forwarding * * @param \phpseclib\Net\SSH2 $ssh * @access private */ private function on_channel_open($ssh) { if ($this->forward_status == self::FORWARD_REQUEST) { $this->request_forwarding($ssh); } } /** * Forward data to SSH Agent and return data reply * * @param string $data * @return string Data from SSH Agent * @throws \RuntimeException on connection errors * @access private */ private function forward_data($data) { if ($this->expected_bytes > 0) { $this->socket_buffer.= $data; $this->expected_bytes -= strlen($data); } else { $agent_data_bytes = current(unpack('N', $data)); $current_data_bytes = strlen($data); $this->socket_buffer = $data; if ($current_data_bytes != $agent_data_bytes + 4) { $this->expected_bytes = ($agent_data_bytes + 4) - $current_data_bytes; return false; } } if (strlen($this->socket_buffer) != fwrite($this->fsock, $this->socket_buffer)) { throw new \RuntimeException('Connection closed attempting to forward data to SSH agent'); } $this->socket_buffer = ''; $this->expected_bytes = 0; $agent_reply_bytes = current(unpack('N', fread($this->fsock, 4))); $agent_reply_data = fread($this->fsock, $agent_reply_bytes); $agent_reply_data = current(unpack('a*', $agent_reply_data)); return pack('Na*', $agent_reply_bytes, $agent_reply_data); } /** * Forward data to SSH Agent and return data reply * * @param \phpseclib\Net\SSH2 $ssh * @param integer $status * @access private */ private function update_channel_status($ssh, $status) { $temp = Objects::getVar($ssh, 'channel_status'); $temp[$this->request_channel] = $status; Objects::setVar($ssh, 'channel_status', $temp); } } <?php /** * Pure-PHP ssh-agent client. * * PHP version 5 * * @category System * @package SSH\Agent * @author Jim Wigginton <terrafrost@php.net> * @copyright 2009 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net * @internal See http://api.libssh.org/rfc/PROTOCOL.agent */ namespace phpseclib\System\SSH\Agent; use phpseclib\Crypt\RSA; use phpseclib\Exception\UnsupportedAlgorithmException; use phpseclib\System\SSH\Agent; /** * Pure-PHP ssh-agent client identity object * * Instantiation should only be performed by \phpseclib\System\SSH\Agent class. * This could be thought of as implementing an interface that phpseclib\Crypt\RSA * implements. ie. maybe a Net_SSH_Auth_PublicKey interface or something. * The methods in this interface would be getPublicKey and sign since those are the * methods phpseclib looks for to perform public key authentication. * * @package SSH\Agent * @author Jim Wigginton <terrafrost@php.net> * @access internal */ class Identity { /** * Key Object * * @var \phpseclib\Crypt\RSA * @access private * @see self::getPublicKey() */ private $key; /** * Key Blob * * @var string * @access private * @see self::sign() */ private $key_blob; /** * Socket Resource * * @var resource * @access private * @see self::sign() */ private $fsock; /** * Default Constructor. * * @param resource $fsock * @return \phpseclib\System\SSH\Agent\Identity * @access private */ public function __construct($fsock) { $this->fsock = $fsock; } /** * Set Public Key * * Called by \phpseclib\System\SSH\Agent::requestIdentities() * * @param \phpseclib\Crypt\RSA $key * @access private */ public function setPublicKey($key) { $this->key = $key; $this->key->setPublicKey(); } /** * Set Public Key * * Called by \phpseclib\System\SSH\Agent::requestIdentities(). The key blob could be extracted from $this->key * but this saves a small amount of computation. * * @param string $key_blob * @access private */ public function setPublicKeyBlob($key_blob) { $this->key_blob = $key_blob; } /** * Get Public Key * * Wrapper for $this->key->getPublicKey() * * @param string $type optional * @return mixed * @access public */ public function getPublicKey($type = 'PKCS8') { return $this->key->getPublicKey($type); } /** * Sets the hash * * ssh-agent only supports signatures with sha1 hashes but to maintain BC with RSA.php this function exists * * @param string $hash optional * @throws \phpseclib\Exception\UnsupportedAlgorithmException if the algorithm is unsupported * @access public */ public function setHash($hash = 'sha1') { if ($hash != 'sha1') { throw new UnsupportedAlgorithmException('ssh-agent can only be used with the sha1 hash'); } } /** * Create a signature * * See "2.6.2 Protocol 2 private key signature request" * * @param string $message * @param int $padding optional * @return string * @throws \RuntimeException on connection errors * @throws \phpseclib\Exception\UnsupportedAlgorithmException if the algorithm is unsupported * @access public */ public function sign($message, $padding = RSA::PADDING_PKCS1) { if ($padding != RSA::PADDING_PKCS1 && $padding != RSA::PADDING_RELAXED_PKCS1) { throw new UnsupportedAlgorithmException('ssh-agent can only create PKCS1 signatures'); } // the last parameter (currently 0) is for flags and ssh-agent only defines one flag (for ssh-dss): SSH_AGENT_OLD_SIGNATURE $packet = pack('CNa*Na*N', Agent::SSH_AGENTC_SIGN_REQUEST, strlen($this->key_blob), $this->key_blob, strlen($message), $message, 0); $packet = pack('Na*', strlen($packet), $packet); if (strlen($packet) != fputs($this->fsock, $packet)) { throw new \RuntimeException('Connection closed during signing'); } $length = current(unpack('N', fread($this->fsock, 4))); $type = ord(fread($this->fsock, 1)); if ($type != Agent::SSH_AGENT_SIGN_RESPONSE) { throw new \RuntimeException('Unable to retrieve signature'); } $signature_blob = fread($this->fsock, $length - 1); // the only other signature format defined - ssh-dss - is the same length as ssh-rsa // the + 12 is for the other various SSH added length fields return substr($signature_blob, strlen('ssh-rsa') + 12); } } <?php /** * Pure-PHP arbitrary precision integer arithmetic library. * * Supports base-2, base-10, base-16, and base-256 numbers. Uses the GMP or BCMath extensions, if available, * and an internal implementation, otherwise. * * PHP version 5 and 7 * * Here's an example of how to use this library: * <code> * <?php * $a = new \phpseclib\Math\BigInteger(2); * $b = new \phpseclib\Math\BigInteger(3); * * $c = $a->add($b); * * echo $c->toString(); // outputs 5 * ?> * </code> * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math; use phpseclib\Exception\BadConfigurationException; /** * Pure-PHP arbitrary precision integer arithmetic library. Supports base-2, base-10, base-16, and base-256 * numbers. * * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @access public */ class BigInteger implements \Serializable { /** * Main Engine * * @var string */ private static $mainEngine; /** * Modular Exponentiation Engine * * @var string */ private static $modexpEngine; /** * Selected Engines * * @var array */ private static $engines; /** * The actual BigInteger object * * @var object */ private $value; /** * Sets engine type. * * Throws an exception if the type is invalid * * @param string $main * @param array $modexps optional */ public static function setEngine($main, $modexps = ['DefaultEngine']) { self::$engines = []; $fqmain = 'phpseclib\\Math\\BigInteger\\Engines\\' . $main; if (!class_exists($fqmain) || !method_exists($fqmain, 'isValidEngine')) { throw new \InvalidArgumentException("$main is not a valid engine"); } if (!$fqmain::isValidEngine()) { throw new BadConfigurationException("$main is not setup correctly on this system"); } self::$mainEngine = $fqmain; if (!in_array('Default', $modexps)) { $modexps[] = 'DefaultEngine'; } $found = false; foreach ($modexps as $modexp) { try { $fqmain::setModExpEngine($modexp); $found = true; break; } catch (\Exception $e) { } } if (!$found) { throw new BadConfigurationException("No valid modular exponentiation engine found for $main"); } self::$modexpEngine = $modexp; self::$engines = [$main, $modexp]; } /** * Converts base-2, base-10, base-16, and binary strings (base-256) to BigIntegers. * * If the second parameter - $base - is negative, then it will be assumed that the number's are encoded using * two's compliment. The sole exception to this is -10, which is treated the same as 10 is. * * @param $x integer|BigInteger\Engines\Engine Base-10 number or base-$base number if $base set. * @param int $base * @return BigInteger */ public function __construct($x = 0, $base = 10) { if (!isset(self::$mainEngine)) { $engines = [ ['GMP'], ['PHP64', ['OpenSSL']], ['BCMath', ['OpenSSL']], ['PHP32', ['OpenSSL']] ]; foreach ($engines as $engine) { try { self::setEngine($engine[0], isset($engine[1]) ? $engine[1] : []); break; } catch (\Exception $e) { } } } if ($x instanceof self::$mainEngine) { $this->value = clone $x; } elseif ($x instanceof BigInteger\Engines\Engine) { $this->value = new static("$x"); $this->value->setPrecision($x->getPrecision()); } else { $this->value = new self::$mainEngine($x, $base); } } /** * Converts a BigInteger to a base-10 number. * * @return string */ public function toString() { return $this->value->toString(); } /** * __toString() magic method */ public function __toString() { return (string) $this->value; } /** * __debugInfo() magic method * * Will be called, automatically, when print_r() or var_dump() are called */ public function __debugInfo() { return $this->value->__debugInfo(); } /** * Converts a BigInteger to a byte string (eg. base-256). * * @param bool $twos_compliment * @return string */ public function toBytes($twos_compliment = false) { return $this->value->toBytes($twos_compliment); } /** * Converts a BigInteger to a hex string (eg. base-16). * * @param bool $twos_compliment * @return string */ public function toHex($twos_compliment = false) { return $this->value->toHex($twos_compliment); } /** * Converts a BigInteger to a bit string (eg. base-2). * * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're * saved as two's compliment. * * @param bool $twos_compliment * @return string */ function toBits($twos_compliment = false) { return $this->value->toBits(); } /** * Adds two BigIntegers. * * @param BigInteger $y * @return BigInteger */ public function add(BigInteger $y) { return new static($this->value->add($y->value)); } /** * Subtracts two BigIntegers. * * @param BigInteger $y * @return BigInteger */ function subtract(BigInteger $y) { return new static($this->value->subtract($y->value)); } /** * Multiplies two BigIntegers * * @param BigInteger $x * @return BigInteger */ public function multiply(BigInteger $x) { return new static($this->value->multiply($x->value)); } /** * Divides two BigIntegers. * * Returns an array whose first element contains the quotient and whose second element contains the * "common residue". If the remainder would be positive, the "common residue" and the remainder are the * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder * and the divisor (basically, the "common residue" is the first positive modulo). * * Here's an example: * <code> * <?php * $a = new \phpseclib\Math\BigInteger('10'); * $b = new \phpseclib\Math\BigInteger('20'); * * list($quotient, $remainder) = $a->divide($b); * * echo $quotient->toString(); // outputs 0 * echo "\r\n"; * echo $remainder->toString(); // outputs 10 * ?> * </code> * * @param BigInteger $y * @return BigInteger[] */ public function divide(BigInteger $y) { list($q, $r) = $this->value->divide($y->value); return [ new static($q), new static($r) ]; } /** * Calculates modular inverses. * * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. * @return BigInteger * @param BigInteger $n */ public function modInverse(BigInteger $n) { return new static($this->value->modInverse($n->value)); } /** * Calculates modular inverses. * * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. * @return BigInteger[] * @param BigInteger $n */ public function extendedGCD(BigInteger $n) { extract($this->value->extendedGCD($n->value)); /** * @var BigInteger $gcd * @var BigInteger $x * @var BigInteger $y */ return [ 'gcd' => new static($gcd), 'x' => new static($x), 'y' => new static($y) ]; } /** * Calculates the greatest common divisor * * Say you have 693 and 609. The GCD is 21. * * @param BigInteger $n * @return BigInteger */ public function gcd(BigInteger $n) { return new static($this->value->gcd($n->value)); } /** * Absolute value. * * @return BigInteger * @access public */ public function abs() { return new static($this->value->abs()); } /** * Set Precision * * Some bitwise operations give different results depending on the precision being used. Examples include left * shift, not, and rotates. * * @param int $bits */ public function setPrecision($bits) { $this->value->setPrecision($bits); } /** * Get Precision * * Returns the precision if it exists, false if it doesn't * * @return int|bool */ public function getPrecision() { return $this->value->getPrecision(); } /** * Serialize * * Will be called, automatically, when serialize() is called on a BigInteger object. * * phpseclib 1.0 serialized strings look like this: * O:15:"Math_BigInteger":1:{s:3:"hex";s:18:"00ab54a98ceb1f0ad2";} * * phpseclib 3.0 serialized strings look like this: * C:25:"phpseclib\Math\BigInteger":42:{a:1:{s:3:"hex";s:18:"00ab54a98ceb1f0ad2";}} * * @return string */ public function serialize() { $val = ['hex' => $this->toHex(true)]; $precision = $this->value->getPrecision(); if ($precision > 0) { $val['precision'] = $precision; } return serialize($val); } /** * Serialize * * Will be called, automatically, when unserialize() is called on a BigInteger object. * * @param string $serialized */ public function unserialize($serialized) { $r = unserialize($serialized); $temp = new static($r['hex'], -16); $this->value = $temp->value; if (isset($r['precision'])) { // recalculate $this->bitmask $this->setPrecision($r['precision']); } } /** * Performs modular exponentiation. * * @param BigInteger $e * @param BigInteger $n * @return BigInteger */ public function powMod(BigInteger $e, BigInteger $n) { return new static($this->value->powMod($e->value, $n->value)); } /** * Performs modular exponentiation. * * @param BigInteger $e * @param BigInteger $n * @return BigInteger */ public function modPow(BigInteger $e, BigInteger $n) { return new static($this->value->modPow($e->value, $n->value)); } /** * Compares two numbers. * * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is * demonstrated thusly: * * $x > $y: $x->compare($y) > 0 * $x < $y: $x->compare($y) < 0 * $x == $y: $x->compare($y) == 0 * * Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y). * * @param BigInteger $y * @return int < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal. * @access public * @see self::equals() * @internal Could return $this->subtract($x), but that's not as fast as what we do do. */ public function compare(BigInteger $y) { return $this->value->compare($y->value); } /** * Tests the equality of two numbers. * * If you need to see if one number is greater than or less than another number, use BigInteger::compare() * * @param BigInteger $x * @return bool */ public function equals(BigInteger $x) { return $this->value->equals($x->value); } /** * Logical Not * * @return BigInteger */ public function bitwise_not() { return new static($this->value->bitwise_not()); } /** * Logical And * * @param BigInteger $x * @return BigInteger */ public function bitwise_and(BigInteger $x) { return new static($this->value->bitwise_and($x->value)); } /** * Logical Or * * @param BigInteger $x * @return BigInteger */ public function bitwise_or(BigInteger $x) { return new static($this->value->bitwise_or($x->value)); } /** * Logical Exlusive Or * * @param BigInteger $x * @return BigInteger */ public function bitwise_xor(BigInteger $x) { return new static($this->value->bitwise_xor($x->value)); } /** * Logical Right Shift * * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift. * * @param int $shift * @return BigInteger */ public function bitwise_rightShift($shift) { return new static($this->value->bitwise_rightShift($shift)); } /** * Logical Left Shift * * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift. * * @param int $shift * @return BigInteger */ public function bitwise_leftShift($shift) { return new static($this->value->bitwise_leftShift($shift)); } /** * Logical Left Rotate * * Instead of the top x bits being dropped they're appended to the shifted bit string. * * @param int $shift * @return BigInteger */ public function bitwise_leftRotate($shift) { return new static($this->value->bitwise_leftRotate($shift)); } /** * Logical Right Rotate * * Instead of the bottom x bits being dropped they're prepended to the shifted bit string. * * @param int $shift * @return BigInteger */ public function bitwise_rightRotate($shift) { return new static($this->value->bitwise_rightRotate($shift)); } /** * Returns the smallest and largest n-bit number * * @param int $bits * @return BigInteger[] */ public static function minMaxBits($bits) { $class = self::$mainEngine; extract($class::minMaxBits($bits)); /** @var BigInteger $min * @var BigInteger $max */ return [ 'min' => new static($min), 'max' => new static($max) ]; } /** * Return the size of a BigInteger in bits * * @return int */ public function getLength() { return $this->value->getLength(); } /** * Return the size of a BigInteger in bytes * * @return int */ public function getLengthInBytes() { return $this->value->getLengthInBytes(); } /** * Generates a random number of a certain size * * Bit length is equal to $size * * @param int $size * @return BigInteger */ public static function random($size) { $class = self::$mainEngine; return new static($class::random($size)); } /** * Generates a random prime number of a certain size * * Bit length is equal to $size * * @param int $size * @return BigInteger */ public static function randomPrime($size) { $class = self::$mainEngine; return new static($class::randomPrime($size)); } /** * Generate a random prime number between a range * * If there's not a prime within the given range, false will be returned. * * @param BigInteger $min * @param BigInteger $max * @return false|BigInteger */ public static function randomRangePrime(BigInteger $min, BigInteger $max) { $class = self::$mainEngine; return new static($class::randomRangePrime($min->value, $max->value)); } /** * Generate a random number between a range * * Returns a random number between $min and $max where $min and $max * can be defined using one of the two methods: * * BigInteger::randomRange($min, $max) * BigInteger::randomRange($max, $min) * * @param BigInteger $min * @param BigInteger $max * @return BigInteger */ public static function randomRange(BigInteger $min, BigInteger $max) { $class = self::$mainEngine; return new static($class::randomRange($min->value, $max->value)); } /** * Checks a numer to see if it's prime * * Assuming the $t parameter is not set, this function has an error rate of 2**-80. The main motivation for the * $t parameter is distributability. BigInteger::randomPrime() can be distributed across multiple pageloads * on a website instead of just one. * * @param int|bool $t * @return bool */ public function isPrime($t = false) { return $this->value->isPrime($t); } /** * Calculates the nth root of a biginteger. * * Returns the nth root of a positive biginteger, where n defaults to 2 * * @param int $n optional * @return BigInteger */ public function root($n = 2) { return new static($this->value->root($n)); } /** * Performs exponentiation. * * @param BigInteger $n * @return BigInteger */ public function pow(BigInteger $n) { return new static($this->value->pow($n->value)); } /** * Return the minimum BigInteger between an arbitrary number of BigIntegers. * * @param BigInteger[] $nums * @return BigInteger */ public static function min(...$nums) { $class = self::$mainEngine; $nums = array_map(function($num) { return $num->value; }, $nums); return new static($class::min(...$nums)); } /** * Return the maximum BigInteger between an arbitrary number of BigIntegers. * * @param BigInteger[] $nums * @return BigInteger */ public static function max(...$nums) { $class = self::$mainEngine; $nums = array_map(function($num) { return $num->value; }, $nums); return new static($class::max(...$nums)); } /** * Tests BigInteger to see if it is between two integers, inclusive * * @param BigInteger $min * @param BigInteger $max * @return bool */ public function between(BigInteger $min, BigInteger $max) { return $this->value->between($min->value, $max->value); } /** * Clone */ public function __clone() { $this->value = clone $this->value; } } <?php /** * GMP Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\GMP; use phpseclib\Math\BigInteger\Engines\GMP; /** * GMP Modular Exponentiation Engine * * @package GMP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class DefaultEngine extends GMP { /** * Performs modular exponentiation. * * @param GMP $x * @param GMP $e * @param GMP $n * @return GMP */ protected static function powModHelper(GMP $x, GMP $e, GMP $n) { $temp = new GMP(); $temp->value = gmp_powm($x->value, $e->value, $n->value); return $x->normalize($temp); } }<?php /** * PHP Barrett Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\PHP\Reductions; use phpseclib\Math\BigInteger\Engines\PHP\Base; /** * PHP Barrett Modular Exponentiation Engine * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Barrett extends Base { /** * Barrett Modular Reduction * * See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=14 HAC 14.3.3} / * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=165 MPM 6.2.5} for more information. Modified slightly, * so as not to require negative numbers (initially, this script didn't support negative numbers). * * Employs "folding", as described at * {@link http://www.cosic.esat.kuleuven.be/publications/thesis-149.pdf#page=66 thesis-149.pdf#page=66}. To quote from * it, "the idea [behind folding] is to find a value x' such that x (mod m) = x' (mod m), with x' being smaller than x." * * Unfortunately, the "Barrett Reduction with Folding" algorithm described in thesis-149.pdf is not, as written, all that * usable on account of (1) its not using reasonable radix points as discussed in * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=162 MPM 6.2.2} and (2) the fact that, even with reasonable * radix points, it only works when there are an even number of digits in the denominator. The reason for (2) is that * (x >> 1) + (x >> 1) != x / 2 + x / 2. If x is even, they're the same, but if x is odd, they're not. See the in-line * comments for details. * * @param array $n * @param array $m * @param string $class * @return array */ protected static function reduce(array $n, array $m, $class) { static $cache = [ self::VARIABLE => [], self::DATA => [] ]; $m_length = count($m); // if (self::compareHelper($n, $static::square($m)) >= 0) { if (count($n) > 2 * $m_length) { $lhs = new $class(); $rhs = new $class(); $lhs->value = $n; $rhs->value = $m; list(, $temp) = $lhs->divide($rhs); return $temp->value; } // if (m.length >> 1) + 2 <= m.length then m is too small and n can't be reduced if ($m_length < 5) { return self::regularBarrett($n, $m, $class); } // n = 2 * m.length if (($key = array_search($m, $cache[self::VARIABLE])) === false) { $key = count($cache[self::VARIABLE]); $cache[self::VARIABLE][] = $m; $lhs = new $class(); $lhs_value = &$lhs->value; $lhs_value = self::array_repeat(0, $m_length + ($m_length >> 1)); $lhs_value[] = 1; $rhs = new $class(); $rhs->value = $m; list($u, $m1) = $lhs->divide($rhs); $u = $u->value; $m1 = $m1->value; $cache[self::DATA][] = [ 'u' => $u, // m.length >> 1 (technically (m.length >> 1) + 1) 'm1'=> $m1 // m.length ]; } else { extract($cache[self::DATA][$key]); } $cutoff = $m_length + ($m_length >> 1); $lsd = array_slice($n, 0, $cutoff); // m.length + (m.length >> 1) $msd = array_slice($n, $cutoff); // m.length >> 1 $lsd = self::trim($lsd); $temp = $class::multiplyHelper($msd, false, $m1, false); // m.length + (m.length >> 1) $n = $class::addHelper($lsd, false, $temp[self::VALUE], false); // m.length + (m.length >> 1) + 1 (so basically we're adding two same length numbers) //if ($m_length & 1) { // return self::regularBarrett($n[self::VALUE], $m, $class); //} // (m.length + (m.length >> 1) + 1) - (m.length - 1) == (m.length >> 1) + 2 $temp = array_slice($n[self::VALUE], $m_length - 1); // if even: ((m.length >> 1) + 2) + (m.length >> 1) == m.length + 2 // if odd: ((m.length >> 1) + 2) + (m.length >> 1) == (m.length - 1) + 2 == m.length + 1 $temp = $class::multiplyHelper($temp, false, $u, false); // if even: (m.length + 2) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) + 1 // if odd: (m.length + 1) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) $temp = array_slice($temp[self::VALUE], ($m_length >> 1) + 1); // if even: (m.length - (m.length >> 1) + 1) + m.length = 2 * m.length - (m.length >> 1) + 1 // if odd: (m.length - (m.length >> 1)) + m.length = 2 * m.length - (m.length >> 1) $temp = $class::multiplyHelper($temp, false, $m, false); // at this point, if m had an odd number of digits, we'd be subtracting a 2 * m.length - (m.length >> 1) digit // number from a m.length + (m.length >> 1) + 1 digit number. ie. there'd be an extra digit and the while loop // following this comment would loop a lot (hence our calling _regularBarrett() in that situation). $result = $class::subtractHelper($n[self::VALUE], false, $temp[self::VALUE], false); while (self::compareHelper($result[self::VALUE], $result[self::SIGN], $m, false) >= 0) { $result = $class::subtractHelper($result[self::VALUE], $result[self::SIGN], $m, false); } return $result[self::VALUE]; } /** * (Regular) Barrett Modular Reduction * * For numbers with more than four digits BigInteger::_barrett() is faster. The difference between that and this * is that this function does not fold the denominator into a smaller form. * * @param array $x * @param array $n * @param string $class * @return array */ private static function regularBarrett(array $x, array $n, $class) { static $cache = [ self::VARIABLE => [], self::DATA => [] ]; $n_length = count($n); if (count($x) > 2 * $n_length) { $lhs = new $class(); $rhs = new $class(); $lhs->value = $x; $rhs->value = $n; list(, $temp) = $lhs->divide($rhs); return $temp->value; } if (($key = array_search($n, $cache[self::VARIABLE])) === false) { $key = count($cache[self::VARIABLE]); $cache[self::VARIABLE][] = $n; $lhs = new $class(); $lhs_value = &$lhs->value; $lhs_value = self::array_repeat(0, 2 * $n_length); $lhs_value[] = 1; $rhs = new $class(); $rhs->value = $n; list($temp, ) = $lhs->divide($rhs); // m.length $cache[self::DATA][] = $temp->value; } // 2 * m.length - (m.length - 1) = m.length + 1 $temp = array_slice($x, $n_length - 1); // (m.length + 1) + m.length = 2 * m.length + 1 $temp = $class::multiplyHelper($temp, false, $cache[self::DATA][$key], false); // (2 * m.length + 1) - (m.length - 1) = m.length + 2 $temp = array_slice($temp[self::VALUE], $n_length + 1); // m.length + 1 $result = array_slice($x, 0, $n_length + 1); // m.length + 1 $temp = self::multiplyLower($temp, false, $n, false, $n_length + 1, $class); // $temp == array_slice($class::regularMultiply($temp, false, $n, false)->value, 0, $n_length + 1) if (self::compareHelper($result, false, $temp[self::VALUE], $temp[self::SIGN]) < 0) { $corrector_value = self::array_repeat(0, $n_length + 1); $corrector_value[count($corrector_value)] = 1; $result = $class::addHelper($result, false, $corrector_value, false); $result = $result[self::VALUE]; } // at this point, we're subtracting a number with m.length + 1 digits from another number with m.length + 1 digits $result = $class::subtractHelper($result, false, $temp[self::VALUE], $temp[self::SIGN]); while (self::compareHelper($result[self::VALUE], $result[self::SIGN], $n, false) > 0) { $result = $class::subtractHelper($result[self::VALUE], $result[self::SIGN], $n, false); } return $result[self::VALUE]; } /** * Performs long multiplication up to $stop digits * * If you're going to be doing array_slice($product->value, 0, $stop), some cycles can be saved. * * @see self::regularBarrett() * @param array $x_value * @param bool $x_negative * @param array $y_value * @param bool $y_negative * @param int $stop * @param string $class * @return array */ private static function multiplyLower(array $x_value, $x_negative, array $y_value, $y_negative, $stop, $class) { $x_length = count($x_value); $y_length = count($y_value); if (!$x_length || !$y_length) { // a 0 is being multiplied return [ self::VALUE => [], self::SIGN => false ]; } if ($x_length < $y_length) { $temp = $x_value; $x_value = $y_value; $y_value = $temp; $x_length = count($x_value); $y_length = count($y_value); } $product_value = self::array_repeat(0, $x_length + $y_length); // the following for loop could be removed if the for loop following it // (the one with nested for loops) initially set $i to 0, but // doing so would also make the result in one set of unnecessary adds, // since on the outermost loops first pass, $product->value[$k] is going // to always be 0 $carry = 0; for ($j = 0; $j < $x_length; ++$j) { // ie. $i = 0, $k = $i $temp = $x_value[$j] * $y_value[0] + $carry; // $product_value[$k] == 0 $carry = $class::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31); $product_value[$j] = (int) ($temp - $class::BASE_FULL * $carry); } if ($j < $stop) { $product_value[$j] = $carry; } // the above for loop is what the previous comment was talking about. the // following for loop is the "one with nested for loops" for ($i = 1; $i < $y_length; ++$i) { $carry = 0; for ($j = 0, $k = $i; $j < $x_length && $k < $stop; ++$j, ++$k) { $temp = $product_value[$k] + $x_value[$j] * $y_value[$i] + $carry; $carry = $class::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31); $product_value[$k] = (int) ($temp - $class::BASE_FULL * $carry); } if ($k < $stop) { $product_value[$k] = $carry; } } return [ self::VALUE => self::trim($product_value), self::SIGN => $x_negative != $y_negative ]; } }<?php /** * PHP Classic Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\PHP\Reductions; use phpseclib\Math\BigInteger\Engines\PHP\Base; /** * PHP Classic Modular Exponentiation Engine * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Classic extends Base { /** * Regular Division * * @param array $x * @param array $n * @param string $class * @return array */ protected static function reduce(array $x, array $n, $class) { $lhs = new $class(); $lhs->value = $x; $rhs = new $class(); $rhs->value = $n; list(, $temp) = $lhs->divide($rhs); return $temp->value; } }<?php /** * PHP Montgomery Modular Exponentiation Engine with interleaved multiplication * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\PHP\Reductions; use phpseclib\Math\BigInteger\Engines\PHP\Base; /** * PHP Montgomery Modular Exponentiation Engine with interleaved multiplication * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class MontgomeryMult extends Montgomery { /** * Montgomery Multiply * * Interleaves the montgomery reduction and long multiplication algorithms together as described in * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=13 HAC 14.36} * * @see self::_prepMontgomery() * @see self::_montgomery() * @access private * @param array $x * @param array $y * @param array $m * @param string $class * @return array */ public static function multiplyReduce(array $x, array $y, array $m, $class) { // the following code, although not callable, can be run independently of the above code // although the above code performed better in my benchmarks the following could might // perform better under different circumstances. in lieu of deleting it it's just been // made uncallable static $cache = [ self::VARIABLE => [], self::DATA => [] ]; if (($key = array_search($m, $cache[self::VARIABLE])) === false) { $key = count($cache[self::VARIABLE]); $cache[self::VARIABLE][] = $m; $cache[self::DATA][] = self::modInverse67108864($m, $class); } $n = max(count($x), count($y), count($m)); $x = array_pad($x, $n, 0); $y = array_pad($y, $n, 0); $m = array_pad($m, $n, 0); $a = [self::VALUE => self::array_repeat(0, $n + 1)]; for ($i = 0; $i < $n; ++$i) { $temp = $a[self::VALUE][0] + $x[$i] * $y[0]; $temp = $temp - $class::BASE_FULL * ($class::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31)); $temp = $temp * $cache[self::DATA][$key]; $temp = $temp - $class::BASE_FULL * ($class::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31)); $temp = $class::addHelper($class::regularMultiply([$x[$i]], $y), false, $class::regularMultiply([$temp], $m), false); $a = $class::addHelper($a[self::VALUE], false, $temp[self::VALUE], false); $a[self::VALUE] = array_slice($a[self::VALUE], 1); } if (self::compareHelper($a[self::VALUE], false, $m, false) >= 0) { $a = $class::subtractHelper($a[self::VALUE], false, $m, false); } return $a[self::VALUE]; } }<?php /** * PHP Montgomery Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\PHP\Reductions; use phpseclib\Math\BigInteger\Engines\PHP\Montgomery as Progenitor; /** * PHP Montgomery Modular Exponentiation Engine * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Montgomery extends Progenitor { /** * Prepare a number for use in Montgomery Modular Reductions * * @param array $x * @param array $n * @param string $class * @return array */ protected static function prepareReduce(array $x, array $n, $class) { $lhs = new $class(); $lhs->value = array_merge(self::array_repeat(0, count($n)), $x); $rhs = new $class(); $rhs->value = $n; list(, $temp) = $lhs->divide($rhs); return $temp->value; } /** * Montgomery Multiply * * Interleaves the montgomery reduction and long multiplication algorithms together as described in * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=13 HAC 14.36} * * @param array $x * @param array $n * @param string $class * @return array */ protected static function reduce(array $x, array $n, $class) { static $cache = [ self::VARIABLE => [], self::DATA => [] ]; if (($key = array_search($n, $cache[self::VARIABLE])) === false) { $key = count($cache[self::VARIABLE]); $cache[self::VARIABLE][] = $x; $cache[self::DATA][] = self::modInverse67108864($n, $class); } $k = count($n); $result = [self::VALUE => $x]; for ($i = 0; $i < $k; ++$i) { $temp = $result[self::VALUE][$i] * $cache[self::DATA][$key]; $temp = $temp - $class::BASE_FULL * ($class::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31)); $temp = $class::regularMultiply([$temp], $n); $temp = array_merge(self::array_repeat(0, $i), $temp); $result = $class::addHelper($result[self::VALUE], false, $temp, false); } $result[self::VALUE] = array_slice($result[self::VALUE], $k); if (self::compareHelper($result, false, $n, false) >= 0) { $result = $class::subtractHelper($result[self::VALUE], false, $n, false); } return $result[self::VALUE]; } /** * Modular Inverse of a number mod 2**26 (eg. 67108864) * * Based off of the bnpInvDigit function implemented and justified in the following URL: * * {@link http://www-cs-students.stanford.edu/~tjw/jsbn/jsbn.js} * * The following URL provides more info: * * {@link http://groups.google.com/group/sci.crypt/msg/7a137205c1be7d85} * * As for why we do all the bitmasking... strange things can happen when converting from floats to ints. For * instance, on some computers, var_dump((int) -4294967297) yields int(-1) and on others, it yields * int(-2147483648). To avoid problems stemming from this, we use bitmasks to guarantee that ints aren't * auto-converted to floats. The outermost bitmask is present because without it, there's no guarantee that * the "residue" returned would be the so-called "common residue". We use fmod, in the last step, because the * maximum possible $x is 26 bits and the maximum $result is 16 bits. Thus, we have to be able to handle up to * 40 bits, which only 64-bit floating points will support. * * Thanks to Pedro Gimeno Fortea for input! * * @param array $x * @param string $class * @return int */ protected static function modInverse67108864(array $x, $class) // 2**26 == 67,108,864 { $x = -$x[0]; $result = $x & 0x3; // x**-1 mod 2**2 $result = ($result * (2 - $x * $result)) & 0xF; // x**-1 mod 2**4 $result = ($result * (2 - ($x & 0xFF) * $result)) & 0xFF; // x**-1 mod 2**8 $result = ($result * ((2 - ($x & 0xFFFF) * $result) & 0xFFFF)) & 0xFFFF; // x**-1 mod 2**16 $result = $class::BASE == 26 ? fmod($result * (2 - fmod($x * $result, $class::BASE_FULL)), $class::BASE_FULL) : // x**-1 mod 2**26 ($result * (2 - ($x * $result) % $class::BASE_FULL)) % $class::BASE_FULL; return $result & $class::MAX_DIGIT; } }<?php /** * PHP Dynamic Barrett Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\PHP\Reductions; use phpseclib\Math\BigInteger\Engines\PHP\Base; use phpseclib\Math\BigInteger\Engines\PHP; /** * PHP Dynamic Barrett Modular Exponentiation Engine * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class EvalBarrett extends Base { /** * Custom Reduction Function * * @see self::generateCustomReduction */ private static $custom_reduction; /** * Barrett Modular Reduction * * This calls a dynamically generated loop unrolled function that's specific to a given modulo. * Array lookups are avoided as are if statements testing for how many bits the host OS supports, etc. * * @param array $n * @param array $m * @param string $class * @return array */ protected static function reduce(array $n, array $m, $class) { $inline = self::$custom_reduction; return $inline($n); } /** * Generate Custom Reduction * * @param PHP $m * @param string $class * @return callable */ protected static function generateCustomReduction(PHP $m, $class) { $m_length = count($m->value); if ($m_length < 5) { $code = ' $lhs = new ' . $class . '(); $lhs->value = $x; $rhs = new ' . $class . '(); $rhs->value = [' . implode(',', array_map('self::float2string', $m->value)) . ']; list(, $temp) = $lhs->divide($rhs); return $temp->value; '; eval('$func = function ($x) { ' . $code . '};'); self::$custom_reduction = $func; //self::$custom_reduction = \Closure::bind($func, $m, $class); return; } $lhs = new $class(); $lhs_value = &$lhs->value; $lhs_value = self::array_repeat(0, $m_length + ($m_length >> 1)); $lhs_value[] = 1; $rhs = new $class(); list($u, $m1) = $lhs->divide($m); if ($class::BASE != 26) { $u = $u->value; } else { $lhs_value = self::array_repeat(0, 2 * $m_length); $lhs_value[] = 1; $rhs = new $class(); list($u) = $lhs->divide($m); $u = $u->value; } $m = $m->value; $m1 = $m1->value; $cutoff = count($m) + (count($m) >> 1); $code = ' if (count($n) > ' . (2 * count($m)) . ') { $lhs = new ' . $class . '(); $rhs = new ' . $class . '(); $lhs->value = $n; $rhs->value = [' . implode(',', array_map('self::float2string', $m)) . ']; list(, $temp) = $lhs->divide($rhs); return $temp->value; } $lsd = array_slice($n, 0, ' . $cutoff . '); $msd = array_slice($n, ' . $cutoff . ');'; $code.= self::generateInlineTrim('msd'); $code.= self::generateInlineMultiply('msd', $m1, 'temp', $class); $code.= self::generateInlineAdd('lsd', 'temp', 'n', $class); $code.= '$temp = array_slice($n, ' . (count($m) - 1) . ');'; $code.= self::generateInlineMultiply('temp', $u, 'temp2', $class); $code.= self::generateInlineTrim('temp2'); $code.= $class::BASE == 26 ? '$temp = array_slice($temp2, ' . (count($m) + 1) . ');' : '$temp = array_slice($temp2, ' . ((count($m) >> 1) + 1) . ');'; $code.= self::generateInlineMultiply('temp', $m, 'temp2', $class); $code.= self::generateInlineTrim('temp2'); /* if ($class::BASE == 26) { $code.= '$n = array_slice($n, 0, ' . (count($m) + 1) . '); $temp2 = array_slice($temp2, 0, ' . (count($m) + 1) . ');'; } */ $code.= self::generateInlineSubtract2('n', 'temp2', 'temp', $class); $subcode = self::generateInlineSubtract1('temp', $m, 'temp2', $class); $subcode.= '$temp = $temp2;'; $code.= self::generateInlineCompare($m, 'temp', $subcode); $code.= 'return $temp;'; eval('$func = function ($n) { ' . $code . '};'); self::$custom_reduction = $func; //self::$custom_reduction = \Closure::bind($func, $m, $class); } /** * Inline Trim * * Removes leading zeros * * @param string $name * @return string */ private static function generateInlineTrim($name) { return ' for ($i = count($' . $name . ') - 1; $i >= 0; --$i) { if ($' . $name . '[$i]) { break; } unset($' . $name . '[$i]); }'; } /** * Inline Multiply (unknown, known) * * @param string $input * @param array $arr * @param string $output * @param string $class * @return string */ private static function generateInlineMultiply($input, array $arr, $output, $class) { if (!count($arr)) { return 'return [];'; } $regular = ' $length = count($' . $input . '); if (!$length) { $' . $output . ' = []; }else{ $' . $output . ' = array_fill(0, $length + ' . count($arr) . ', 0); $carry = 0;'; for ($i = 0; $i < count($arr); $i++) { $regular.= ' $subtemp = $' . $input . '[0] * ' . $arr[$i]; $regular.= $i ? ' + $carry;' : ';'; $regular.= '$carry = '; $regular.= $class::BASE === 26 ? 'intval($subtemp / 0x4000000);' : '$subtemp >> 31;'; $regular.= '$' . $output . '[' . $i . '] = '; if ($class::BASE === 26) { $regular.= '(int) ('; } $regular.= '$subtemp - ' . $class::BASE_FULL . ' * $carry'; $regular.= $class::BASE === 26 ? ');' : ';'; } $regular.= '$' . $output . '[' . count($arr) . '] = $carry;'; $regular.= ' for ($i = 1; $i < $length; ++$i) {'; for ($j = 0; $j < count($arr); $j++) { $regular.= $j ? '$k++;' : '$k = $i;'; $regular.= ' $subtemp = $' . $output . '[$k] + $' . $input . '[$i] * ' . $arr[$j]; $regular.= $j ? ' + $carry;' : ';'; $regular.= '$carry = '; $regular.= $class::BASE === 26 ? 'intval($subtemp / 0x4000000);' : '$subtemp >> 31;'; $regular.= '$' . $output . '[$k] = '; if ($class::BASE === 26) { $regular.= '(int) ('; } $regular.= '$subtemp - ' . $class::BASE_FULL . ' * $carry'; $regular.= $class::BASE === 26 ? ');' : ';'; } $regular.= '$' . $output. '[++$k] = $carry; $carry = 0;'; $regular.= '}}'; //if (count($arr) < 2 * self::KARATSUBA_CUTOFF) { //} return $regular; } /** * Inline Addition * * @param string $x * @param string $y * @param string $result * @param string $class * @return string */ private static function generateInlineAdd($x, $y, $result, $class) { $code = ' $length = max(count($' . $x . '), count($' . $y . ')); $' . $result . ' = array_pad($' . $x . ', $length + 1, 0); $_' . $y . ' = array_pad($' . $y . ', $length, 0); $carry = 0; for ($i = 0, $j = 1; $j < $length; $i+=2, $j+=2) { $sum = ($' . $result . '[$j] + $_' . $y . '[$j]) * ' . $class::BASE_FULL . ' + $' . $result . '[$i] + $_' . $y . '[$i] + $carry; $carry = $sum >= ' . self::float2string($class::MAX_DIGIT2) . '; $sum = $carry ? $sum - ' . self::float2string($class::MAX_DIGIT2) . ' : $sum;'; $code.= $class::BASE === 26 ? '$upper = intval($sum / 0x4000000); $' . $result . '[$i] = (int) ($sum - ' . $class::BASE_FULL . ' * $upper);' : '$upper = $sum >> 31; $' . $result . '[$i] = $sum - ' . $class::BASE_FULL . ' * $upper;'; $code.= ' $' . $result . '[$j] = $upper; } if ($j == $length) { $sum = $' . $result . '[$i] + $_' . $y . '[$i] + $carry; $carry = $sum >= ' . self::float2string($class::BASE_FULL) . '; $' . $result . '[$i] = $carry ? $sum - ' . self::float2string($class::BASE_FULL) . ' : $sum; } if ($carry) { for (; $' . $result . '[$i] == ' . $class::MAX_DIGIT . '; ++$i) { $' . $result . '[$i] = 0; } ++$' . $result . '[$i]; }'; $code.= self::generateInlineTrim($result); return $code; } /** * Inline Subtraction 2 * * For when $known is more digits than $unknown. This is the harder use case to optimize for. * * @param string $known * @param string $unknown * @param string $result * @param string $class * @return string */ private static function generateInlineSubtract2($known, $unknown, $result, $class) { $code = ' $' . $result .' = $' . $known . '; $carry = 0; $size = count($' . $unknown . '); for ($i = 0, $j = 1; $j < $size; $i+= 2, $j+= 2) { $sum = ($' . $known . '[$j] - $' . $unknown . '[$j]) * ' . $class::BASE_FULL . ' + $' . $known . '[$i] - $' . $unknown . '[$i] - $carry; $carry = $sum < 0; if ($carry) { $sum+= ' . self::float2string($class::MAX_DIGIT2) . '; } $subtemp = '; $code.= $class::BASE === 26 ? 'intval($sum / 0x4000000);' : '$sum >> 31;'; $code.= '$' . $result . '[$i] = '; if ($class::BASE === 26) { $code.= '(int) ('; } $code.= '$sum - ' . $class::BASE_FULL . ' * $subtemp'; if ($class::BASE === 26) { $code.= ')'; } $code.= '; $' . $result . '[$j] = $subtemp; } if ($j == $size) { $sum = $' . $known . '[$i] - $' . $unknown . '[$i] - $carry; $carry = $sum < 0; $' . $result . '[$i] = $carry ? $sum + ' . $class::BASE_FULL . ' : $sum; ++$i; } if ($carry) { for (; !$' . $result . '[$i]; ++$i) { $' . $result . '[$i] = ' . $class::MAX_DIGIT . '; } --$' . $result . '[$i]; }'; $code.= self::generateInlineTrim($result); return $code; } /** * Inline Subtraction 1 * * For when $unknown is more digits than $known. This is the easier use case to optimize for. * * @param string $unknown * @param array $known * @param string $result * @param string $class * @return string */ private static function generateInlineSubtract1($unknown, array $known, $result, $class) { $code = '$' . $result . ' = $' . $unknown . ';'; for ($i = 0, $j = 1; $j < count($known); $i+=2, $j+=2) { $code.= '$sum = $' . $unknown . '[' . $j . '] * ' . $class::BASE_FULL . ' + $' . $unknown . '[' . $i . '] - '; $code.= self::float2string($known[$j] * $class::BASE_FULL + $known[$i]); if ($i != 0) { $code.= ' - $carry'; } $code.= '; if ($carry = $sum < 0) { $sum+= ' . self::float2string($class::MAX_DIGIT2) . '; } $subtemp = '; $code.= $class::BASE === 26 ? 'intval($sum / 0x4000000);' : '$sum >> 31;'; $code.= ' $' . $result . '[' . $i . '] = '; if ($class::BASE === 26) { $code.= ' (int) ('; } $code.= '$sum - ' . $class::BASE_FULL . ' * $subtemp'; if ($class::BASE === 26) { $code.= ')'; } $code.= '; $' . $result . '[' . $j . '] = $subtemp;'; } $code.= '$i = ' . $i . ';'; if ($j == count($known)) { $code.= ' $sum = $' . $unknown . '[' . $i . '] - ' . $known[$i] . ' - $carry; $carry = $sum < 0; $' . $result . '[' . $i . '] = $carry ? $sum + ' . $class::BASE_FULL . ' : $sum; ++$i;'; } $code.= ' if ($carry) { for (; !$' . $result . '[$i]; ++$i) { $' . $result . '[$i] = ' . $class::MAX_DIGIT . '; } --$' . $result . '[$i]; }'; $code.= self::generateInlineTrim($result); return $code; } /** * Inline Comparison * * If $uknown >= $known then loop * * @param array $known * @param string $unknown * @param string $subcode * @return string */ private static function generateInlineCompare(array $known, $unknown, $subcode) { $uniqid = uniqid(); $code = 'loop_' . $uniqid . ': $clength = count($' . $unknown . '); switch (true) { case $clength < ' . count($known) . ': goto end_' . $uniqid . '; case $clength > ' . count($known) . ':'; for ($i = count($known) - 1; $i >= 0; $i--) { $code.= ' case $' . $unknown . '[' . $i . '] > ' . $known[$i] . ': goto subcode_' . $uniqid . '; case $' . $unknown . '[' . $i . '] < ' . $known[$i] . ': goto end_' . $uniqid . ';'; } $code.= ' default: // do subcode } subcode_' . $uniqid . ':' . $subcode . ' goto loop_' . $uniqid . '; end_' . $uniqid . ':'; return $code; } /** * Convert a float to a string * * If you do echo floatval(pow(2, 52)) you'll get 4.6116860184274E+18. It /can/ be displayed without a loss of * precision but displayed in this way there will be precision loss, hence the need for this method. * * @param int|float $num * @return string */ private static function float2string($num) { if (!is_float($num)) { return $num; } if ($num < 0) { return '-' . self::float2string(abs($num)); } $temp = ''; while ($num) { $temp = fmod($num, 10) . $temp; $num = floor($num / 10); } return $temp; } }<?php /** * PHP Power of Two Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\PHP\Reductions; use phpseclib\Math\BigInteger\Engines\PHP\Base; /** * PHP Power Of Two Modular Exponentiation Engine * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PowerOfTwo extends Base { /** * Prepare a number for use in Montgomery Modular Reductions * * @param array $x * @param array $n * @param string $class * @return array */ protected static function prepareReduce(array $x, array $n, $class) { return self::reduce($x, $n, $class); } /** * Power Of Two Reduction * * @param array $x * @param array $n * @param string $class * @return array */ protected static function reduce(array $x, array $n, $class) { $lhs = new $class(); $lhs->value = $x; $rhs = new $class(); $rhs->value = $n; $temp = new $class(); $temp->value = [1]; $result = $lhs->bitwise_and($rhs->subtract($temp)); return $result->value; } }<?php /** * OpenSSL Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\PHP; use phpseclib\Math\BigInteger\Engines\OpenSSL as Progenitor; /** * OpenSSL Modular Exponentiation Engine * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class OpenSSL extends Progenitor { }<?php /** * PHP Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\PHP; use phpseclib\Math\BigInteger\Engines\PHP; /** * PHP Modular Exponentiation Engine * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Base extends PHP { /**#@+ * @access private */ /** * Cache constants * * $cache[self::VARIABLE] tells us whether or not the cached data is still valid. */ const VARIABLE = 0; /** * $cache[self::DATA] contains the cached data. */ const DATA = 1; /**#@-*/ /** * Test for engine validity * * @return bool */ public static function isValidEngine() { return static::class != __CLASS__; } /** * Performs modular exponentiation. * * The most naive approach to modular exponentiation has very unreasonable requirements, and * and although the approach involving repeated squaring does vastly better, it, too, is impractical * for our purposes. The reason being that division - by far the most complicated and time-consuming * of the basic operations (eg. +,-,*,/) - occurs multiple times within it. * * Modular reductions resolve this issue. Although an individual modular reduction takes more time * then an individual division, when performed in succession (with the same modulo), they're a lot faster. * * The two most commonly used modular reductions are Barrett and Montgomery reduction. Montgomery reduction, * although faster, only works when the gcd of the modulo and of the base being used is 1. In RSA, when the * base is a power of two, the modulo - a product of two primes - is always going to have a gcd of 1 (because * the product of two odd numbers is odd), but what about when RSA isn't used? * * In contrast, Barrett reduction has no such constraint. As such, some bigint implementations perform a * Barrett reduction after every operation in the modpow function. Others perform Barrett reductions when the * modulo is even and Montgomery reductions when the modulo is odd. BigInteger.java's modPow method, however, * uses a trick involving the Chinese Remainder Theorem to factor the even modulo into two numbers - one odd and * the other, a power of two - and recombine them, later. This is the method that this modPow function uses. * {@link http://islab.oregonstate.edu/papers/j34monex.pdf Montgomery Reduction with Even Modulus} elaborates. * * @param \phpseclib\Math\BigInteger\Engines\PHP $x * @param \phpseclib\Math\BigInteger\Engines\PHP $e * @param \phpseclib\Math\BigInteger\Engines\PHP $n * @param string $class * @return \phpseclib\Math\BigInteger\Engines\PHP */ protected static function powModHelper(PHP $x, PHP $e, PHP $n, $class) { if (empty($e->value)) { $temp = new $class(); $temp->value = [1]; return $x->normalize($temp); } if ($e->value == [1]) { list(, $temp) = $x->divide($n); return $x->normalize($temp); } if ($e->value == [2]) { $temp = new $class; $temp->value = $class::square($x->value); list(, $temp) = $temp->divide($n); return $x->normalize($temp); } return $x->normalize(static::slidingWindow($x, $e, $n, $class)); } /** * Modular reduction preperation * * @param array $x * @param array $n * @param string $class * @see self::slidingWindow() * @return array */ protected static function prepareReduce(array $x, array $n, $class) { return static::reduce($x, $n, $class); } /** * Modular multiply * * @param array $x * @param array $y * @param array $n * @param string $class * @see self::slidingWindow() * @return array */ protected static function multiplyReduce(array $x, array $y, array $n, $class) { $temp = $class::multiplyHelper($x, false, $y, false); return static::reduce($temp[self::VALUE], $n, $class); } /** * Modular square * * @param array $x * @param array $n * @param string $class * @see self::slidingWindow() * @return array */ protected static function squareReduce(array $x, array $n, $class) { return static::reduce($class::square($x), $n, $class); } }<?php /** * PHP Default Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\PHP; use phpseclib\Math\BigInteger\Engines\PHP\Reductions\EvalBarrett; /** * PHP Default Modular Exponentiation Engine * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class DefaultEngine extends EvalBarrett { }<?php /** * PHP Montgomery Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\PHP; use phpseclib\Math\BigInteger\Engines\PHP\Reductions\PowerOfTwo; use phpseclib\Math\BigInteger\Engines\PHP; use phpseclib\Math\BigInteger\Engines\PHP\Base; use phpseclib\Math\BigInteger\Engines\Engine; /** * PHP Montgomery Modular Exponentiation Engine * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Montgomery extends Base { /** * Test for engine validity * * @return bool */ public static function isValidEngine() { return static::class != __CLASS__; } /** * Performs modular exponentiation. * * @param \phpseclib\Math\BigInteger\Engines\Engine $x * @param \phpseclib\Math\BigInteger\Engines\Engine $e * @param \phpseclib\Math\BigInteger\Engines\Engine $n * @param string $class * @return \phpseclib\Math\BigInteger\Engines\Engine */ protected static function slidingWindow(Engine $x, Engine $e, Engine $n, $class) { // is the modulo odd? if ($n->value[0] & 1) { return parent::slidingWindow($x, $e, $n, $class); } // if it's not, it's even // find the lowest set bit (eg. the max pow of 2 that divides $n) for ($i = 0; $i < count($n->value); ++$i) { if ($n->value[$i]) { $temp = decbin($n->value[$i]); $j = strlen($temp) - strrpos($temp, '1') - 1; $j+= $class::BASE * $i; break; } } // at this point, 2^$j * $n/(2^$j) == $n $mod1 = clone $n; $mod1->rshift($j); $mod2 = new $class(); $mod2->value = [1]; $mod2->lshift($j); $part1 = $mod1->value != [1] ? parent::slidingWindow($x, $e, $mod1, $class) : new $class(); $part2 = PowerOfTwo::slidingWindow($x, $e, $mod2, $class); $y1 = $mod2->modInverse($mod1); $y2 = $mod1->modInverse($mod2); $result = $part1->multiply($mod2); $result = $result->multiply($y1); $temp = $part2->multiply($mod1); $temp = $temp->multiply($y2); $result = $result->add($temp); list(, $result) = $result->divide($n); return $result; } }<?php /** * OpenSSL Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines; use phpseclib\Crypt\RSA; use phpseclib\Math\BigInteger; /** * OpenSSL Modular Exponentiation Engine * * @package Engines * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class OpenSSL { /** * Test for engine validity * * @return bool */ public static function isValidEngine() { return extension_loaded('openssl') && static::class != __CLASS__; } /** * Performs modular exponentiation. * * @param Engine $x * @param Engine $e * @param Engine $n * @return Engine */ public static function powModHelper(Engine $x, Engine $e, Engine $n) { if ($n->getLengthInBytes() < 31 || $n->getLengthInBytes() > 16384) { throw new \OutOfRangeException('Only modulo between 31 and 16384 bits are accepted'); } $rsa = new RSA(); $rsa->load([ 'e' => new BigInteger($e), 'n' => new BigInteger($n) ]); //$rsa->setPublicKeyFormat('PKCS1'); $plaintext = str_pad($x->toBytes(), strlen($n->toBytes(true)) - 1, "\0", STR_PAD_LEFT); // this is easily prone to failure. if the modulo is a multiple of 2 or 3 or whatever it // won't work and you'll get a "failure: error:0906D06C:PEM routines:PEM_read_bio:no start line" // error. i suppose, for even numbers, we could do what PHP\Montgomery.php does, but then what // about odd numbers divisible by 3, by 5, etc? if (!openssl_public_encrypt($plaintext, $result, "$rsa", OPENSSL_NO_PADDING)) { throw new \UnexpectedValueException(openssl_error_string()); } $class = get_class($x); return new $class($result, 256); } }<?php /** * Pure-PHP BigInteger Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines; use ParagonIE\ConstantTime\Hex; use phpseclib\Exception\BadConfigurationException; /** * pure-PHP Engine. * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PHP extends Engine { /**#@+ * Array constants * * Rather than create a thousands and thousands of new BigInteger objects in repeated function calls to add() and * multiply() or whatever, we'll just work directly on arrays, taking them in as parameters and returning them. * * @access protected */ /** * $result[self::VALUE] contains the value. */ const VALUE = 0; /** * $result[self::SIGN] contains the sign. */ const SIGN = 1; /**#@-*/ /** * Karatsuba Cutoff * * At what point do we switch between Karatsuba multiplication and schoolbook long multiplication? * * @access private */ const KARATSUBA_CUTOFF = 25; /** * Can Bitwise operations be done fast? * * @see parent::bitwise_leftRotate() * @see parent::bitwise_rightRotate() * @access protected */ const FAST_BITWISE = true; /** * Engine Directory * * @see parent::setModExpEngine * @access protected */ const ENGINE_DIR = 'PHP'; /** * Default constructor * * @param mixed $x integer Base-10 number or base-$base number if $base set. * @param int $base * @see parent::__construct() * @return \phpseclib\Math\BigInteger\Engines\PHP */ public function __construct($x = 0, $base = 10) { if (!isset(static::$isValidEngine)) { static::$isValidEngine = static::isValidEngine(); } if (!static::$isValidEngine) { throw new BadConfigurationException(static::class . ' is not setup correctly on this system'); } $this->value = []; parent::__construct($x, $base); } /** * Initialize a PHP BigInteger Engine instance * * @param int $base * @see parent::__construct() */ protected function initialize($base) { switch (abs($base)) { case 256: $x = $this->value; $this->value = []; while (strlen($x)) { $this->value[] = self::bytes2int(self::base256_rshift($x, static::BASE)); } break; case 16: $x = (strlen($this->value) & 1) ? '0' . $this->value : $this->value; $temp = new static(Hex::decode($x), 256); $this->value = $temp->value; break; case 10: $temp = new static(); $multiplier = new static(); $multiplier->value = [static::MAX10]; $x = $this->value; if ($x[0] == '-') { $this->is_negative = true; $x = substr($x, 1); } $x = str_pad($x, strlen($x) + ((static::MAX10LEN - 1) * strlen($x)) % static::MAX10LEN, 0, STR_PAD_LEFT); while (strlen($x)) { $temp = $temp->multiply($multiplier); $temp = $temp->add(new static($this->int2bytes(substr($x, 0, static::MAX10LEN)), 256)); $x = substr($x, static::MAX10LEN); } $this->value = $temp->value; } } /** * Pads strings so that unpack may be used on them * * @param string $str * @return string */ protected function pad($str) { $length = strlen($str); $pad = 4 - (strlen($str) % 4); return str_pad($str, $length + $pad, "\0", STR_PAD_LEFT); } /** * Converts a BigInteger to a base-10 number. * * @return string */ public function toString() { if (!count($this->value)) { return '0'; } $temp = clone $this; $temp->is_negative = false; $divisor = new static(); $divisor->value = [static::MAX10]; $result = ''; while (count($temp->value)) { list($temp, $mod) = $temp->divide($divisor); $result = str_pad(isset($mod->value[0]) ? $mod->value[0] : '', static::MAX10LEN, '0', STR_PAD_LEFT) . $result; } $result = ltrim($result, '0'); if (empty($result)) { $result = '0'; } if ($this->is_negative) { $result = '-' . $result; } return $result; } /** * Converts a BigInteger to a byte string (eg. base-256). * * @param bool $twos_compliment * @return string */ public function toBytes($twos_compliment = false) { if ($twos_compliment) { return $this->toBytesHelper(); } if (!count($this->value)) { return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; } $result = self::int2bytes($this->value[count($this->value) - 1]); for ($i = count($this->value) - 2; $i >= 0; --$i) { self::base256_lshift($result, static::BASE); $result = $result | str_pad(self::int2bytes($this->value[$i]), strlen($result), chr(0), STR_PAD_LEFT); } return $this->precision > 0 ? str_pad(substr($result, -(($this->precision + 7) >> 3)), ($this->precision + 7) >> 3, chr(0), STR_PAD_LEFT) : $result; } /** * Performs addition. * * @param array $x_value * @param bool $x_negative * @param array $y_value * @param bool $y_negative * @return array */ protected static function addHelper(array $x_value, $x_negative, array $y_value, $y_negative) { $x_size = count($x_value); $y_size = count($y_value); if ($x_size == 0) { return [ self::VALUE => $y_value, self::SIGN => $y_negative ]; } elseif ($y_size == 0) { return [ self::VALUE => $x_value, self::SIGN => $x_negative ]; } // subtract, if appropriate if ($x_negative != $y_negative) { if ($x_value == $y_value) { return [ self::VALUE => [], self::SIGN => false ]; } $temp = self::subtractHelper($x_value, false, $y_value, false); $temp[self::SIGN] = self::compareHelper($x_value, false, $y_value, false) > 0 ? $x_negative : $y_negative; return $temp; } if ($x_size < $y_size) { $size = $x_size; $value = $y_value; } else { $size = $y_size; $value = $x_value; } $value[count($value)] = 0; // just in case the carry adds an extra digit $carry = 0; for ($i = 0, $j = 1; $j < $size; $i+=2, $j+=2) { //$sum = $x_value[$j] * static::BASE_FULL + $x_value[$i] + $y_value[$j] * static::BASE_FULL + $y_value[$i] + $carry; $sum = ($x_value[$j] + $y_value[$j]) * static::BASE_FULL + $x_value[$i] + $y_value[$i] + $carry; $carry = $sum >= static::MAX_DIGIT2; // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1 $sum = $carry ? $sum - static::MAX_DIGIT2 : $sum; $temp = static::BASE === 26 ? intval($sum / 0x4000000) : ($sum >> 31); $value[$i] = (int) ($sum - static::BASE_FULL * $temp); // eg. a faster alternative to fmod($sum, 0x4000000) $value[$j] = $temp; } if ($j == $size) { // ie. if $y_size is odd $sum = $x_value[$i] + $y_value[$i] + $carry; $carry = $sum >= static::BASE_FULL; $value[$i] = $carry ? $sum - static::BASE_FULL : $sum; ++$i; // ie. let $i = $j since we've just done $value[$i] } if ($carry) { for (; $value[$i] == static::MAX_DIGIT; ++$i) { $value[$i] = 0; } ++$value[$i]; } return [ self::VALUE => self::trim($value), self::SIGN => $x_negative ]; } /** * Performs subtraction. * * @param array $x_value * @param bool $x_negative * @param array $y_value * @param bool $y_negative * @return array */ static function subtractHelper(array $x_value, $x_negative, array $y_value, $y_negative) { $x_size = count($x_value); $y_size = count($y_value); if ($x_size == 0) { return [ self::VALUE => $y_value, self::SIGN => !$y_negative ]; } elseif ($y_size == 0) { return [ self::VALUE => $x_value, self::SIGN => $x_negative ]; } // add, if appropriate (ie. -$x - +$y or +$x - -$y) if ($x_negative != $y_negative) { $temp = self::addHelper($x_value, false, $y_value, false); $temp[self::SIGN] = $x_negative; return $temp; } $diff = self::compareHelper($x_value, $x_negative, $y_value, $y_negative); if (!$diff) { return [ self::VALUE => [], self::SIGN => false ]; } // switch $x and $y around, if appropriate. if ((!$x_negative && $diff < 0) || ($x_negative && $diff > 0)) { $temp = $x_value; $x_value = $y_value; $y_value = $temp; $x_negative = !$x_negative; $x_size = count($x_value); $y_size = count($y_value); } // at this point, $x_value should be at least as big as - if not bigger than - $y_value $carry = 0; for ($i = 0, $j = 1; $j < $y_size; $i+=2, $j+=2) { $sum = ($x_value[$j] - $y_value[$j]) * static::BASE_FULL + $x_value[$i] - $y_value[$i] - $carry; $carry = $sum < 0; // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1 $sum = $carry ? $sum + static::MAX_DIGIT2 : $sum; $temp = static::BASE === 26 ? intval($sum / 0x4000000) : ($sum >> 31); $x_value[$i] = (int) ($sum - static::BASE_FULL * $temp); $x_value[$j] = $temp; } if ($j == $y_size) { // ie. if $y_size is odd $sum = $x_value[$i] - $y_value[$i] - $carry; $carry = $sum < 0; $x_value[$i] = $carry ? $sum + static::BASE_FULL : $sum; ++$i; } if ($carry) { for (; !$x_value[$i]; ++$i) { $x_value[$i] = static::MAX_DIGIT; } --$x_value[$i]; } return [ self::VALUE => self::trim($x_value), self::SIGN => $x_negative ]; } /** * Performs multiplication. * * @param array $x_value * @param bool $x_negative * @param array $y_value * @param bool $y_negative * @return array */ protected static function multiplyHelper(array $x_value, $x_negative, array $y_value, $y_negative) { //if ( $x_value == $y_value ) { // return [ // self::VALUE => $this->_square($x_value), // self::SIGN => $x_sign != $y_value // ]; //} $x_length = count($x_value); $y_length = count($y_value); if (!$x_length || !$y_length) { // a 0 is being multiplied return [ self::VALUE => [], self::SIGN => false ]; } return [ self::VALUE => min($x_length, $y_length) < 2 * self::KARATSUBA_CUTOFF ? self::trim(self::regularMultiply($x_value, $y_value)) : self::trim(self::karatsuba($x_value, $y_value)), self::SIGN => $x_negative != $y_negative ]; } /** * Performs Karatsuba multiplication on two BigIntegers * * See {@link http://en.wikipedia.org/wiki/Karatsuba_algorithm Karatsuba algorithm} and * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=120 MPM 5.2.3}. * * @param array $x_value * @param array $y_value * @return array */ private static function karatsuba(array $x_value, array $y_value) { $m = min(count($x_value) >> 1, count($y_value) >> 1); if ($m < self::KARATSUBA_CUTOFF) { return self::regularMultiply($x_value, $y_value); } $x1 = array_slice($x_value, $m); $x0 = array_slice($x_value, 0, $m); $y1 = array_slice($y_value, $m); $y0 = array_slice($y_value, 0, $m); $z2 = self::karatsuba($x1, $y1); $z0 = self::karatsuba($x0, $y0); $z1 = self::addHelper($x1, false, $x0, false); $temp = self::addHelper($y1, false, $y0, false); $z1 = self::karatsuba($z1[self::VALUE], $temp[self::VALUE]); $temp = self::addHelper($z2, false, $z0, false); $z1 = self::subtractHelper($z1, false, $temp[self::VALUE], false); $z2 = array_merge(array_fill(0, 2 * $m, 0), $z2); $z1[self::VALUE] = array_merge(array_fill(0, $m, 0), $z1[self::VALUE]); $xy = self::addHelper($z2, false, $z1[self::VALUE], $z1[self::SIGN]); $xy = self::addHelper($xy[self::VALUE], $xy[self::SIGN], $z0, false); return $xy[self::VALUE]; } /** * Performs long multiplication on two BigIntegers * * Modeled after 'multiply' in MutableBigInteger.java. * * @param array $x_value * @param array $y_value * @return array */ protected static function regularMultiply(array $x_value, array $y_value) { $x_length = count($x_value); $y_length = count($y_value); if (!$x_length || !$y_length) { // a 0 is being multiplied return []; } $product_value = self::array_repeat(0, $x_length + $y_length); // the following for loop could be removed if the for loop following it // (the one with nested for loops) initially set $i to 0, but // doing so would also make the result in one set of unnecessary adds, // since on the outermost loops first pass, $product->value[$k] is going // to always be 0 $carry = 0; for ($j = 0; $j < $x_length; ++$j) { // ie. $i = 0 $temp = $x_value[$j] * $y_value[0] + $carry; // $product_value[$k] == 0 $carry = static::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31); $product_value[$j] = (int) ($temp - static::BASE_FULL * $carry); } $product_value[$j] = $carry; // the above for loop is what the previous comment was talking about. the // following for loop is the "one with nested for loops" for ($i = 1; $i < $y_length; ++$i) { $carry = 0; for ($j = 0, $k = $i; $j < $x_length; ++$j, ++$k) { $temp = $product_value[$k] + $x_value[$j] * $y_value[$i] + $carry; $carry = static::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31); $product_value[$k] = (int) ($temp - static::BASE_FULL * $carry); } $product_value[$k] = $carry; } return $product_value; } /** * Divides two BigIntegers. * * Returns an array whose first element contains the quotient and whose second element contains the * "common residue". If the remainder would be positive, the "common residue" and the remainder are the * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder * and the divisor (basically, the "common residue" is the first positive modulo). * * @param \phpseclib\Math\BigInteger\engines\PHP $y * @return array * @internal This function is based off of {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=9 HAC 14.20}. */ protected function divideHelper(PHP $y) { if (count($y->value) == 1) { list($q, $r) = $this->divide_digit($this->value, $y->value[0]); $quotient = new static(); $remainder = new static(); $quotient->value = $q; $remainder->value = [$r]; $quotient->is_negative = $this->is_negative != $y->is_negative; return [$this->normalize($quotient), $this->normalize($remainder)]; } $x = clone $this; $y = clone $y; $x_sign = $x->is_negative; $y_sign = $y->is_negative; $x->is_negative = $y->is_negative = false; $diff = $x->compare($y); if (!$diff) { $temp = new static(); $temp->value = [1]; $temp->is_negative = $x_sign != $y_sign; return [$this->normalize($temp), $this->normalize(static::$zero)]; } if ($diff < 0) { // if $x is negative, "add" $y. if ($x_sign) { $x = $y->subtract($x); } return [$this->normalize(static::$zero), $this->normalize($x)]; } // normalize $x and $y as described in HAC 14.23 / 14.24 $msb = $y->value[count($y->value) - 1]; for ($shift = 0; !($msb & static::MSB); ++$shift) { $msb <<= 1; } $x->lshift($shift); $y->lshift($shift); $y_value = &$y->value; $x_max = count($x->value) - 1; $y_max = count($y->value) - 1; $quotient = new static(); $quotient_value = &$quotient->value; $quotient_value = self::array_repeat(0, $x_max - $y_max + 1); static $temp, $lhs, $rhs; if (!isset($temp)) { $temp = new static(); $lhs = new static(); $rhs = new static(); } $temp_value = &$temp->value; $rhs_value = &$rhs->value; // $temp = $y << ($x_max - $y_max-1) in base 2**26 $temp_value = array_merge(self::array_repeat(0, $x_max - $y_max), $y_value); while ($x->compare($temp) >= 0) { // calculate the "common residue" ++$quotient_value[$x_max - $y_max]; $x = $x->subtract($temp); $x_max = count($x->value) - 1; } for ($i = $x_max; $i >= $y_max + 1; --$i) { $x_value = &$x->value; $x_window = [ isset($x_value[$i]) ? $x_value[$i] : 0, isset($x_value[$i - 1]) ? $x_value[$i - 1] : 0, isset($x_value[$i - 2]) ? $x_value[$i - 2] : 0 ]; $y_window = [ $y_value[$y_max], ($y_max > 0) ? $y_value[$y_max - 1] : 0 ]; $q_index = $i - $y_max - 1; if ($x_window[0] == $y_window[0]) { $quotient_value[$q_index] = static::MAX_DIGIT; } else { $quotient_value[$q_index] = self::safe_divide( $x_window[0] * static::BASE_FULL + $x_window[1], $y_window[0] ); } $temp_value = [$y_window[1], $y_window[0]]; $lhs->value = [$quotient_value[$q_index]]; $lhs = $lhs->multiply($temp); $rhs_value = [$x_window[2], $x_window[1], $x_window[0]]; while ($lhs->compare($rhs) > 0) { --$quotient_value[$q_index]; $lhs->value = [$quotient_value[$q_index]]; $lhs = $lhs->multiply($temp); } $adjust = self::array_repeat(0, $q_index); $temp_value = [$quotient_value[$q_index]]; $temp = $temp->multiply($y); $temp_value = &$temp->value; $temp_value = array_merge($adjust, $temp_value); $x = $x->subtract($temp); if ($x->compare(static::$zero) < 0) { $temp_value = array_merge($adjust, $y_value); $x = $x->add($temp); --$quotient_value[$q_index]; } $x_max = count($x_value) - 1; } // unnormalize the remainder $x->rshift($shift); $quotient->is_negative = $x_sign != $y_sign; // calculate the "common residue", if appropriate if ($x_sign) { $y->rshift($shift); $x = $y->subtract($x); } return [$this->normalize($quotient), $this->normalize($x)]; } /** * Divides a BigInteger by a regular integer * * abc / x = a00 / x + b0 / x + c / x * * @param array $dividend * @param int $divisor * @return array */ private static function divide_digit(array $dividend, $divisor) { $carry = 0; $result = []; for ($i = count($dividend) - 1; $i >= 0; --$i) { $temp = static::BASE_FULL * $carry + $dividend[$i]; $result[$i] = self::safe_divide($temp, $divisor); $carry = (int) ($temp - $divisor * $result[$i]); } return [$result, $carry]; } /** * Single digit division * * Even if int64 is being used the division operator will return a float64 value * if the dividend is not evenly divisible by the divisor. Since a float64 doesn't * have the precision of int64 this is a problem so, when int64 is being used, * we'll guarantee that the dividend is divisible by first subtracting the remainder. * * @param int $x * @param int $y * @return int */ private static function safe_divide($x, $y) { if (static::BASE === 26) { return (int) ($x / $y); } // static::BASE === 31 return ($x - ($x % $y)) / $y; } /* * Convert an array / boolean to a PHP BigInteger object * * @param array $arr * @return \phpseclib\Math\BigInteger\Engines\PHP */ protected function convertToObj(array $arr) { $result = new static(); $result->value = $arr[self::VALUE]; $result->is_negative = $arr[self::SIGN]; return $this->normalize($result); } /** * Normalize * * Removes leading zeros and truncates (if necessary) to maintain the appropriate precision * * @param PHP $result * @return PHP */ protected function normalize(PHP $result) { $result->precision = $this->precision; $result->bitmask = $this->bitmask; $value = &$result->value; if (!count($value)) { return $result; } $value = $this->trim($value); if (!empty($result->bitmask->value)) { $length = min(count($value), count($result->bitmask->value)); $value = array_slice($value, 0, $length); for ($i = 0; $i < $length; ++$i) { $value[$i] = $value[$i] & $result->bitmask->value[$i]; } } return $result; } /* * Compares two numbers. * * @param array $x_value * @param bool $x_negative * @param array $y_value * @param bool $y_negative * @return int * @see static::compare() */ protected static function compareHelper(array $x_value, $x_negative, array $y_value, $y_negative) { if ($x_negative != $y_negative) { return (!$x_negative && $y_negative) ? 1 : -1; } $result = $x_negative ? -1 : 1; if (count($x_value) != count($y_value)) { return (count($x_value) > count($y_value)) ? $result : -$result; } $size = max(count($x_value), count($y_value)); $x_value = array_pad($x_value, $size, 0); $y_value = array_pad($y_value, $size, 0); for ($i = count($x_value) - 1; $i >= 0; --$i) { if ($x_value[$i] != $y_value[$i]) { return ($x_value[$i] > $y_value[$i]) ? $result : -$result; } } return 0; } /** * Calculates the greatest common divisor and Bezout's identity. * * Say you have 693 and 609. The GCD is 21. Bezout's identity states that there exist integers x and y such that * 693*x + 609*y == 21. In point of fact, there are actually an infinite number of x and y combinations and which * combination is returned is dependent upon which mode is in use. See * {@link http://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity Bezout's identity - Wikipedia} for more information. * * @param PHP $n * @return PHP[] * @internal Calculates the GCD using the binary xGCD algorithim described in * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=19 HAC 14.61}. As the text above 14.61 notes, * the more traditional algorithim requires "relatively costly multiple-precision divisions". */ protected function extendedGCDHelper(PHP $n) { $y = clone $n; $x = clone $this; $g = new static(); $g->value = [1]; while (!(($x->value[0] & 1)|| ($y->value[0] & 1))) { $x->rshift(1); $y->rshift(1); $g->lshift(1); } $u = clone $x; $v = clone $y; $a = new static(); $b = new static(); $c = new static(); $d = new static(); $a->value = $d->value = $g->value = [1]; $b->value = $c->value = []; while (!empty($u->value)) { while (!($u->value[0] & 1)) { $u->rshift(1); if ((!empty($a->value) && ($a->value[0] & 1)) || (!empty($b->value) && ($b->value[0] & 1))) { $a = $a->add($y); $b = $b->subtract($x); } $a->rshift(1); $b->rshift(1); } while (!($v->value[0] & 1)) { $v->rshift(1); if ((!empty($d->value) && ($d->value[0] & 1)) || (!empty($c->value) && ($c->value[0] & 1))) { $c = $c->add($y); $d = $d->subtract($x); } $c->rshift(1); $d->rshift(1); } if ($u->compare($v) >= 0) { $u = $u->subtract($v); $a = $a->subtract($c); $b = $b->subtract($d); } else { $v = $v->subtract($u); $c = $c->subtract($a); $d = $d->subtract($b); } } return [ 'gcd' => $this->normalize($g->multiply($v)), 'x' => $this->normalize($c), 'y' => $this->normalize($d) ]; } /** * Absolute value. * * @return \phpseclib\Math\BigInteger\Engines\PHP */ public function abs() { $temp = new static(); $temp->value = $this->value; return $temp; } /** * Logical And * * @param PHP $x * @return PHP */ protected function bitwiseAndHelper(PHP $x) { $result = clone $this; $length = min(count($x->value), count($this->value)); $result->value = array_slice($result->value, 0, $length); for ($i = 0; $i < $length; ++$i) { $result->value[$i]&= $x->value[$i]; } return $this->normalize($result); } /** * Logical Or * * @param PHP $x * @return PHP */ protected function bitwiseOrHelper(PHP $x) { $length = max(count($this->value), count($x->value)); $result = clone $this; $result->value = array_pad($result->value, $length, 0); $x->value = array_pad($x->value, $length, 0); for ($i = 0; $i < $length; ++$i) { $result->value[$i]|= $x->value[$i]; } return $this->normalize($result); } /** * Logical Exlusive Or * * @param PHP $x * @return PHP */ protected function bitwiseXorHelper(PHP $x) { $length = max(count($this->value), count($x->value)); $result = clone $this; $result->is_negative = false; $result->value = array_pad($result->value, $length, 0); $x->value = array_pad($x->value, $length, 0); for ($i = 0; $i < $length; ++$i) { $result->value[$i]^= $x->value[$i]; } return $this->normalize($result); } /** * Trim * * Removes leading zeros * * @param array $value * @return PHP */ protected static function trim(array $value) { for ($i = count($value) - 1; $i >= 0; --$i) { if ($value[$i]) { break; } unset($value[$i]); } return $value; } /** * Logical Right Shift * * Shifts binary strings $shift bits, essentially dividing by 2**$shift and returning the remainder. * * @param $x String * @param $shift Integer * @return string */ private static function base256_rshift(&$x, $shift) { if ($shift == 0) { $x = ltrim($x, chr(0)); return ''; } $num_bytes = $shift >> 3; // eg. floor($shift/8) $shift &= 7; // eg. $shift % 8 $remainder = ''; if ($num_bytes) { $start = $num_bytes > strlen($x) ? -strlen($x) : -$num_bytes; $remainder = substr($x, $start); $x = substr($x, 0, -$num_bytes); } $carry = 0; $carry_shift = 8 - $shift; for ($i = 0; $i < strlen($x); ++$i) { $temp = (ord($x[$i]) >> $shift) | $carry; $carry = (ord($x[$i]) << $carry_shift) & 0xFF; $x[$i] = chr($temp); } $x = ltrim($x, chr(0)); $remainder = chr($carry >> $carry_shift) . $remainder; return ltrim($remainder, chr(0)); } /** * Logical Right Shift * * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift. * * @param int $shift * @return \phpseclib\Math\BigInteger\Engines\PHP */ public function bitwise_rightShift($shift) { $temp = new static(); // could just replace lshift with this, but then all lshift() calls would need to be rewritten // and I don't want to do that... $temp->value = $this->value; $temp->rshift($shift); return $this->normalize($temp); } /** * Logical Left Shift * * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift. * * @param int $shift * @return \phpseclib\Math\BigInteger\Engines\PHP */ public function bitwise_leftShift($shift) { $temp = new static(); // could just replace _rshift with this, but then all _lshift() calls would need to be rewritten // and I don't want to do that... $temp->value = $this->value; $temp->lshift($shift); return $this->normalize($temp); } /** * Converts 32-bit integers to bytes. * * @param int $x * @return string */ private static function int2bytes($x) { return ltrim(pack('N', $x), chr(0)); } /** * Converts bytes to 32-bit integers * * @param string $x * @return int */ private static function bytes2int($x) { $temp = unpack('Nint', str_pad($x, 4, chr(0), STR_PAD_LEFT)); return $temp['int']; } /** * Array Repeat * * @param int $input * @param int $multiplier * @return array */ protected static function array_repeat($input, $multiplier) { return $multiplier ? array_fill(0, $multiplier, $input) : []; } /** * Logical Left Shift * * Shifts BigInteger's by $shift bits. * * @param int $shift */ protected function lshift($shift) { if ($shift == 0) { return; } $num_digits = (int) ($shift / static::BASE); $shift %= static::BASE; $shift = 1 << $shift; $carry = 0; for ($i = 0; $i < count($this->value); ++$i) { $temp = $this->value[$i] * $shift + $carry; $carry = static::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31); $this->value[$i] = (int) ($temp - $carry * static::BASE_FULL); } if ($carry) { $this->value[count($this->value)] = $carry; } while ($num_digits--) { array_unshift($this->value, 0); } } /** * Logical Right Shift * * Shifts BigInteger's by $shift bits. * * @param int $shift */ protected function rshift($shift) { if ($shift == 0) { return; } $num_digits = (int) ($shift / static::BASE); $shift %= static::BASE; $carry_shift = static::BASE - $shift; $carry_mask = (1 << $shift) - 1; if ($num_digits) { $this->value = array_slice($this->value, $num_digits); } $carry = 0; for ($i = count($this->value) - 1; $i >= 0; --$i) { $temp = $this->value[$i] >> $shift | $carry; $carry = ($this->value[$i] & $carry_mask) << $carry_shift; $this->value[$i] = $temp; } $this->value = $this->trim($this->value); } /** * Performs modular exponentiation. * * @param PHP $e * @param PHP $n * @return PHP */ protected function powModInner(PHP $e, PHP $n) { try { $class = static::$modexpEngine; return $class::powModHelper($this, $e, $n, static::class); } catch (\Exception $err) { return PHP\DefaultEngine::powModHelper($this, $e, $n, static::class); } } /** * Performs squaring * * @param array $x * @return array */ protected static function square(array $x) { return count($x) < 2 * self::KARATSUBA_CUTOFF ? self::trim(self::baseSquare($x)) : self::trim(self::karatsubaSquare($x)); } /** * Performs traditional squaring on two BigIntegers * * Squaring can be done faster than multiplying a number by itself can be. See * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=7 HAC 14.2.4} / * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=141 MPM 5.3} for more information. * * @param array $value * @return array */ protected static function baseSquare(array $value) { if (empty($value)) { return []; } $square_value = self::array_repeat(0, 2 * count($value)); for ($i = 0, $max_index = count($value) - 1; $i <= $max_index; ++$i) { $i2 = $i << 1; $temp = $square_value[$i2] + $value[$i] * $value[$i]; $carry = static::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31); $square_value[$i2] = (int) ($temp - static::BASE_FULL * $carry); // note how we start from $i+1 instead of 0 as we do in multiplication. for ($j = $i + 1, $k = $i2 + 1; $j <= $max_index; ++$j, ++$k) { $temp = $square_value[$k] + 2 * $value[$j] * $value[$i] + $carry; $carry = static::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31); $square_value[$k] = (int) ($temp - static::BASE_FULL * $carry); } // the following line can yield values larger 2**15. at this point, PHP should switch // over to floats. $square_value[$i + $max_index + 1] = $carry; } return $square_value; } /** * Performs Karatsuba "squaring" on two BigIntegers * * See {@link http://en.wikipedia.org/wiki/Karatsuba_algorithm Karatsuba algorithm} and * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=151 MPM 5.3.4}. * * @param array $value * @return array */ protected static function karatsubaSquare(array $value) { $m = count($value) >> 1; if ($m < self::KARATSUBA_CUTOFF) { return self::baseSquare($value); } $x1 = array_slice($value, $m); $x0 = array_slice($value, 0, $m); $z2 = self::karatsubaSquare($x1); $z0 = self::karatsubaSquare($x0); $z1 = self::addHelper($x1, false, $x0, false); $z1 = self::karatsubaSquare($z1[self::VALUE]); $temp = self::addHelper($z2, false, $z0, false); $z1 = self::subtractHelper($z1, false, $temp[self::VALUE], false); $z2 = array_merge(array_fill(0, 2 * $m, 0), $z2); $z1[self::VALUE] = array_merge(array_fill(0, $m, 0), $z1[self::VALUE]); $xx = self::addHelper($z2, false, $z1[self::VALUE], $z1[self::SIGN]); $xx = self::addHelper($xx[self::VALUE], $xx[self::SIGN], $z0, false); return $xx[self::VALUE]; } /** * Make the current number odd * * If the current number is odd it'll be unchanged. If it's even, one will be added to it. * * @see self::randomPrime() */ protected function make_odd() { $this->value[0] |= 1; } /** * Test the number against small primes. * * @see self::isPrime() */ protected function testSmallPrimes() { if ($this->value == [1]) { return false; } if ($this->value == [2]) { return true; } if (~$this->value[0] & 1) { return false; } $value = $this->value; foreach (static::$primes as $prime) { list(, $r) = self::divide_digit($value, $prime); if (!$r) { return count($value) == 1 && $value[0] == $prime; } } return true; } /** * Scan for 1 and right shift by that amount * * ie. $s = gmp_scan1($n, 0) and $r = gmp_div_q($n, gmp_pow(gmp_init('2'), $s)); * * @see self::isPrime() * @param PHP $r * @return int */ protected static function scan1divide(PHP $r) { $r_value = &$r->value; for ($i = 0, $r_length = count($r_value); $i < $r_length; ++$i) { $temp = ~$r_value[$i] & static::MAX_DIGIT; for ($j = 1; ($temp >> $j) & 1; ++$j) { } if ($j <= static::BASE) { break; } } $s = static::BASE * $i + $j; $r->rshift($s); return $s; } /** * Performs exponentiation. * * @param PHP $n * @return PHP */ protected function powHelper(PHP $n) { if ($n->compare(static::$zero) == 0) { return new static(1); } // n^0 = 1 $temp = clone $this; while (!$n->equals(static::$one)) { $temp = $temp->multiply($this); $n = $n->subtract(static::$one); } return $temp; } } <?php /** * BCMath Barrett Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\BCMath\Reductions; use phpseclib\Math\BigInteger\Engines\BCMath\Base; /** * PHP Barrett Modular Exponentiation Engine * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Barrett extends Base { /**#@+ * @access private */ /** * Cache constants * * $cache[self::VARIABLE] tells us whether or not the cached data is still valid. */ const VARIABLE = 0; /** * $cache[self::DATA] contains the cached data. */ const DATA = 1; /**#@-*/ /** * Barrett Modular Reduction * * See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=14 HAC 14.3.3} / * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=165 MPM 6.2.5} for more information. Modified slightly, * so as not to require negative numbers (initially, this script didn't support negative numbers). * * Employs "folding", as described at * {@link http://www.cosic.esat.kuleuven.be/publications/thesis-149.pdf#page=66 thesis-149.pdf#page=66}. To quote from * it, "the idea [behind folding] is to find a value x' such that x (mod m) = x' (mod m), with x' being smaller than x." * * Unfortunately, the "Barrett Reduction with Folding" algorithm described in thesis-149.pdf is not, as written, all that * usable on account of (1) its not using reasonable radix points as discussed in * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=162 MPM 6.2.2} and (2) the fact that, even with reasonable * radix points, it only works when there are an even number of digits in the denominator. The reason for (2) is that * (x >> 1) + (x >> 1) != x / 2 + x / 2. If x is even, they're the same, but if x is odd, they're not. See the in-line * comments for details. * * @param string $n * @param string $m * @return array|string */ protected static function reduce($n, $m) { static $cache = [ self::VARIABLE => [], self::DATA => [] ]; $m_length = strlen($m); if (strlen($n) > 2 * $m_length) { return bcmod($n, $m); } // if (m.length >> 1) + 2 <= m.length then m is too small and n can't be reduced if ($m_length < 5) { return self::regularBarrett($n, $m); } // n = 2 * m.length if (($key = array_search($m, $cache[self::VARIABLE])) === false) { $key = count($cache[self::VARIABLE]); $cache[self::VARIABLE][] = $m; $lhs = '1' . str_repeat('0', $m_length + ($m_length >> 1)); $u = bcdiv($lhs, $m, 0); $m1 = bcsub($lhs, bcmul($u, $m)); $cache[self::DATA][] = [ 'u' => $u, // m.length >> 1 (technically (m.length >> 1) + 1) 'm1'=> $m1 // m.length ]; } else { extract($cache[self::DATA][$key]); } $cutoff = $m_length + ($m_length >> 1); $lsd = substr($n, -$cutoff); $msd = substr($n, 0, -$cutoff); $temp = bcmul($msd, $m1); // m.length + (m.length >> 1) $n = bcadd($lsd, $temp); // m.length + (m.length >> 1) + 1 (so basically we're adding two same length numbers) //if ($m_length & 1) { // return self::regularBarrett($n, $m); //} // (m.length + (m.length >> 1) + 1) - (m.length - 1) == (m.length >> 1) + 2 $temp = substr($n, 0, -$m_length + 1); // if even: ((m.length >> 1) + 2) + (m.length >> 1) == m.length + 2 // if odd: ((m.length >> 1) + 2) + (m.length >> 1) == (m.length - 1) + 2 == m.length + 1 $temp = bcmul($temp, $u); // if even: (m.length + 2) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) + 1 // if odd: (m.length + 1) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) $temp = substr($temp, 0, -($m_length >> 1) - 1); // if even: (m.length - (m.length >> 1) + 1) + m.length = 2 * m.length - (m.length >> 1) + 1 // if odd: (m.length - (m.length >> 1)) + m.length = 2 * m.length - (m.length >> 1) $temp = bcmul($temp, $m); // at this point, if m had an odd number of digits, we'd be subtracting a 2 * m.length - (m.length >> 1) digit // number from a m.length + (m.length >> 1) + 1 digit number. ie. there'd be an extra digit and the while loop // following this comment would loop a lot (hence our calling _regularBarrett() in that situation). $result = bcsub($n, $temp); //if (bccomp($result, '0') < 0) { if ($result[0] == '-') { $temp = '1' . str_repeat('0', $m_length + 1); $result = bcadd($result, $temp); } while (bccomp($result, $m) >= 0) { $result = bcsub($result, $m); } return $result; } /** * (Regular) Barrett Modular Reduction * * For numbers with more than four digits BigInteger::_barrett() is faster. The difference between that and this * is that this function does not fold the denominator into a smaller form. * * @param string $x * @param string $n * @return string */ private static function regularBarrett($x, $n) { static $cache = [ self::VARIABLE => [], self::DATA => [] ]; $n_length = strlen($n); if (strlen($x) > 2 * $n_length) { return bcmod($x, $n); } if (($key = array_search($n, $cache[self::VARIABLE])) === false) { $key = count($cache[self::VARIABLE]); $cache[self::VARIABLE][] = $n; $lhs = '1' . str_repeat('0', 2 * $n_length); $cache[self::DATA][] = bcdiv($lhs, $n, 0); } $temp = substr($x, 0, -$n_length + 1); $temp = bcmul($temp, $cache[self::DATA][$key]); $temp = substr($temp, 0, -$n_length - 1); $r1 = substr($x, -$n_length - 1); $r2 = substr(bcmul($temp, $n), -$n_length - 1); $result = bcsub($r1, $r2); //if (bccomp($result, '0') < 0) { if ($result[0] == '-') { $q = '1' . str_repeat('0', $n_length + 1); $result = bcadd($result, $q); } while (bccomp($result, $n) >= 0) { $result = bcsub($result, $n); } return $result; } }<?php /** * BCMath Dynamic Barrett Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\BCMath\Reductions; use phpseclib\Math\BigInteger\Engines\BCMath\Base; use phpseclib\Math\BigInteger\Engines\BCMath; /** * PHP Barrett Modular Exponentiation Engine * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class EvalBarrett extends Base { /** * Custom Reduction Function * * @see self::generateCustomReduction */ private static $custom_reduction; /** * Barrett Modular Reduction * * This calls a dynamically generated loop unrolled function that's specific to a given modulo. * Array lookups are avoided as are if statements testing for how many bits the host OS supports, etc. * * @param string $n * @param string $m * @return string */ protected static function reduce($n, $m) { $inline = self::$custom_reduction; return $inline($n); } /** * Generate Custom Reduction * * @param BCMath $m * @param string $class * @return callable|void */ protected static function generateCustomReduction(BCMath $m, $class) { $m_length = strlen($m); if ($m_length < 5) { $code = 'return bcmod($x, $n);'; eval('$func = function ($n) { ' . $code . '};'); self::$custom_reduction = $func; return; } $lhs = '1' . str_repeat('0', $m_length + ($m_length >> 1)); $u = bcdiv($lhs, $m, 0); $m1 = bcsub($lhs, bcmul($u, $m)); $cutoff = $m_length + ($m_length >> 1); $m = "'$m'"; $u = "'$u'"; $m1= "'$m1'"; $code.= ' $lsd = substr($n, -' . $cutoff . '); $msd = substr($n, 0, -' . $cutoff . '); $temp = bcmul($msd, ' . $m1 . '); $n = bcadd($lsd, $temp); $temp = substr($n, 0, ' . (-$m_length + 1) . '); $temp = bcmul($temp, ' . $u . '); $temp = substr($temp, 0, ' . (-($m_length >> 1) - 1) . '); $temp = bcmul($temp, ' . $m . '); $result = bcsub($n, $temp); if ($result[0] == \'-\') { $temp = \'1' . str_repeat('0', $m_length + 1) . '\'; $result = bcadd($result, $temp); } while (bccomp($result, ' . $m . ') >= 0) { $result = bcsub($result, ' . $m . '); } return $result;'; eval('$func = function ($n) { ' . $code . '};'); self::$custom_reduction = $func; } }<?php /** * Built-In BCMath Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\BCMath; use phpseclib\Math\BigInteger\Engines\BCMath; /** * Built-In BCMath Modular Exponentiation Engine * * @package BCMath * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class BuiltIn extends BCMath { /** * Performs modular exponentiation. * * @param BCMath $x * @param BCMath $e * @param BCMath $n * @return BCMath */ protected static function powModHelper(BCMath $x, BCMath $e, BCMath $n) { $temp = new BCMath(); $temp->value = bcpowmod($x->value, $e->value, $n->value); return $x->normalize($temp); } }<?php /** * OpenSSL Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\BCMath; use phpseclib\Math\BigInteger\Engines\OpenSSL as Progenitor; /** * OpenSSL Modular Exponentiation Engine * * @package BCMath * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class OpenSSL extends Progenitor { }<?php /** * Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\BCMath; use phpseclib\Math\BigInteger\Engines\BCMath; /** * Sliding Window Exponentiation Engine * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Base extends BCMath { /**#@+ * @access private */ /** * Cache constants * * $cache[self::VARIABLE] tells us whether or not the cached data is still valid. */ const VARIABLE = 0; /** * $cache[self::DATA] contains the cached data. */ const DATA = 1; /**#@-*/ /** * Test for engine validity * * @return bool */ public static function isValidEngine() { return static::class != __CLASS__; } /** * Performs modular exponentiation. * * @param \phpseclib\Math\BigInteger\Engines\BCMath $x * @param \phpseclib\Math\BigInteger\Engines\BCMath $e * @param \phpseclib\Math\BigInteger\Engines\BCMath $n * @param string $class * @return \phpseclib\Math\BigInteger\Engines\BCMath */ protected static function powModHelper(BCMath $x, BCMath $e, BCMath $n, $class) { if (empty($e->value)) { $temp = new $class(); $temp->value = '1'; return $x->normalize($temp); } if ($e->value == '1') { $temp = bcdiv($x, $n); return $x->normalize($temp); } return $x->normalize(static::slidingWindow($x, $e, $n, $class)); } /** * Modular reduction preperation * * @param string $x * @param string $n * @param string $class * @see self::slidingWindow() * @return string */ protected static function prepareReduce($x, $n, $class) { return static::reduce($x, $n); } /** * Modular multiply * * @param string $x * @param string $y * @param string $n * @param string $class * @see self::slidingWindow() * @return string */ protected static function multiplyReduce($x, $y, $n, $class) { return static::reduce(bcmul($x, $y), $n); } /** * Modular square * * @param string $x * @param string $n * @param string $class * @see self::slidingWindow() * @return string */ protected static function squareReduce($x, $n, $class) { return static::reduce(bcmul($x, $x), $n); } }<?php /** * BCMath Default Modular Exponentiation Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines\BCMath; use phpseclib\Math\BigInteger\Engines\BCMath\Reductions\Barrett; /** * PHP Default Modular Exponentiation Engine * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class DefaultEngine extends Barrett { }<?php /** * Pure-PHP 32-bit BigInteger Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines; use ParagonIE\ConstantTime\Hex; /** * Pure-PHP 32-bit Engine. * * Uses 64-bit floats if int size is 4 bits * * @package PHP32 * @author Jim Wigginton <terrafrost@php.net> * @access public */ class PHP32 extends PHP { /**#@+ * Constants used by PHP.php */ const BASE = 26; const BASE_FULL = 0x4000000; const MAX_DIGIT = 0x3FFFFFF; const MSB = 0x2000000; /** * MAX10 in greatest MAX10LEN satisfying * MAX10 = 10**MAX10LEN <= 2**BASE. */ const MAX10 = 10000000; /** * MAX10LEN in greatest MAX10LEN satisfying * MAX10 = 10**MAX10LEN <= 2**BASE. */ const MAX10LEN = 7; const MAX_DIGIT2 = 4503599627370496; /**#@-*/ /** * Modular Exponentiation Engine * * @var string */ protected static $modexpEngine; /** * Engine Validity Flag * * @var bool */ protected static $isValidEngine; /** * Primes > 2 and < 1000 * * @var array */ protected static $primes; /** * BigInteger(0) * * @var \phpseclib\Math\BigInteger\Engines\PHP32 */ protected static $zero; /** * BigInteger(1) * * @var \phpseclib\Math\BigInteger\Engines\PHP32 */ protected static $one; /** * BigInteger(2) * * @var \phpseclib\Math\BigInteger\Engines\PHP32 */ protected static $two; /** * Test for engine validity * * @see parent::__construct() * @return bool */ public static function isValidEngine() { return PHP_INT_SIZE >= 4; } /** * Adds two BigIntegers. * * @param PHP32 $y * @return PHP32 */ public function add(PHP32 $y) { $temp = self::addHelper($this->value, $this->is_negative, $y->value, $y->is_negative); return $this->convertToObj($temp); } /** * Subtracts two BigIntegers. * * @param PHP32 $y * @return PHP32 */ public function subtract(PHP32 $y) { $temp = self::subtractHelper($this->value, $this->is_negative, $y->value, $y->is_negative); return $this->convertToObj($temp); } /** * Multiplies two BigIntegers. * * @param PHP32 $y * @return PHP32 */ public function multiply(PHP32 $y) { $temp = self::multiplyHelper($this->value, $this->is_negative, $y->value, $y->is_negative); return $this->convertToObj($temp); } /** * Divides two BigIntegers. * * Returns an array whose first element contains the quotient and whose second element contains the * "common residue". If the remainder would be positive, the "common residue" and the remainder are the * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder * and the divisor (basically, the "common residue" is the first positive modulo). * * @param PHP32 $y * @return PHP32 */ public function divide(PHP32 $y) { return $this->divideHelper($y); } /** * Calculates modular inverses. * * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. * @param PHP32 $n * @return false|PHP32 */ public function modInverse(PHP32 $n) { return $this->modInverseHelper($n); } /** * Calculates modular inverses. * * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. * @param PHP32 $n * @return PHP32[] */ public function extendedGCD(PHP32 $n) { return $this->extendedGCDHelper($n); } /** * Calculates the greatest common divisor * * Say you have 693 and 609. The GCD is 21. * * @param PHP32 $n * @return PHP32 */ public function gcd(PHP32 $n) { return $this->extendedGCD($n)['gcd']; } /** * Logical And * * @param PHP32 $x * @return PHP32 */ public function bitwise_and(PHP32 $x) { return $this->bitwiseAndHelper($x); } /** * Logical Or * * @param PHP32 $x * @return PHP32 */ public function bitwise_or(PHP32 $x) { return $this->bitwiseOrHelper($x); } /** * Logical Exlusive Or * * @param PHP32 $x * @return PHP32 */ public function bitwise_xor(PHP32 $x) { return $this->bitwiseXorHelper($x); } /** * Compares two numbers. * * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is * demonstrated thusly: * * $x > $y: $x->compare($y) > 0 * $x < $y: $x->compare($y) < 0 * $x == $y: $x->compare($y) == 0 * * Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y). * * @param PHP32 $y * @return int < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal. * @access public * @see self::equals() * @internal Could return $this->subtract($x), but that's not as fast as what we do do. */ public function compare(PHP32 $y) { return $this->compareHelper($this->value, $this->is_negative, $y->value, $y->is_negative); } /** * Tests the equality of two numbers. * * If you need to see if one number is greater than or less than another number, use BigInteger::compare() * * @param PHP32 $x * @return bool */ public function equals(PHP32 $x) { return $this->value === $x->value && $this->is_negative == $x->is_negative; } /** * Performs modular exponentiation. * * @param PHP32 $e * @param PHP32 $n * @return PHP32 */ public function modPow(PHP32 $e, PHP32 $n) { return $this->powModOuter($e, $n); } /** * Performs modular exponentiation. * * Alias for modPow(). * * @param PHP32 $e * @param PHP32 $n * @return PHP32 */ public function powMod(PHP32 $e, PHP32 $n) { return $this->powModOuter($e, $n); } /** * Generate a random prime number between a range * * If there's not a prime within the given range, false will be returned. * * @param PHP32 $min * @param PHP32 $max * @return false|PHP32 */ public static function randomRangePrime(PHP32 $min, PHP32 $max) { return self::randomRangePrimeOuter($min, $max); } /** * Generate a random number between a range * * Returns a random number between $min and $max where $min and $max * can be defined using one of the two methods: * * BigInteger::randomRange($min, $max) * BigInteger::randomRange($max, $min) * * @param PHP32 $min * @param PHP32 $max * @return PHP32 */ public static function randomRange(PHP32 $min, PHP32 $max) { return self::randomRangeHelper($min, $max); } /** * Performs exponentiation. * * @param PHP32 $n * @return PHP32 */ public function pow(PHP32 $n) { return $this->powHelper($n); } /** * Return the minimum BigInteger between an arbitrary number of BigIntegers. * * @param PHP32[] $nums * @return PHP32 */ public static function min(...$nums) { return self::minHelper($nums); } /** * Return the maximum BigInteger between an arbitrary number of BigIntegers. * * @param PHP32[] $nums * @return PHP32 */ public static function max(...$nums) { return self::maxHelper($nums); } /** * Tests BigInteger to see if it is between two integers, inclusive * * @param PHP32 $min * @param PHP32 $max * @return bool */ public function between(PHP32 $min, PHP32 $max) { return $this->compare($min) >= 0 && $this->compare($max) <= 0; } }<?php /** * GMP BigInteger Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines; use ParagonIE\ConstantTime\Hex; use phpseclib\Exception\BadConfigurationException; /** * GMP Engine. * * @package GMP * @author Jim Wigginton <terrafrost@php.net> * @access public */ class GMP extends Engine { /** * Can Bitwise operations be done fast? * * @see parent::bitwise_leftRotate() * @see parent::bitwise_rightRotate() * @access protected */ const FAST_BITWISE = true; /** * Engine Directory * * @see parent::setModExpEngine * @access protected */ const ENGINE_DIR = 'GMP'; /** * Modular Exponentiation Engine * * @var string */ protected static $modexpEngine; /** * Engine Validity Flag * * @var bool */ protected static $isValidEngine; /** * BigInteger(0) * * @var \phpseclib\Math\BigInteger\Engines\GMP */ protected static $zero; /** * BigInteger(1) * * @var \phpseclib\Math\BigInteger\Engines\GMP */ protected static $one; /** * BigInteger(2) * * @var \phpseclib\Math\BigInteger\Engines\GMP */ protected static $two; /** * Primes > 2 and < 1000 * * Unused for GMP Engine * * @var mixed */ protected static $primes; /** * Test for engine validity * * @see parent::__construct() * @return bool */ public static function isValidEngine() { return extension_loaded('gmp'); } /** * Default constructor * * @param mixed $x integer Base-10 number or base-$base number if $base set. * @param int $base * @see parent::__construct() * @return \phpseclib\Math\BigInteger\Engines\GMP */ public function __construct($x = 0, $base = 10) { if (!isset(self::$isValidEngine)) { self::$isValidEngine = self::isValidEngine(); } if (!self::$isValidEngine) { throw new BadConfigurationException('GMP is not setup correctly on this system'); } if ($x instanceof \GMP) { $this->value = $x; return; } $this->value = gmp_init(0); parent::__construct($x, $base); } /** * Initialize a GMP BigInteger Engine instance * * @param int $base * @see parent::__construct() */ protected function initialize($base) { switch (abs($base)) { case 256: $sign = $this->is_negative ? '-' : ''; $this->value = gmp_import($this->value); break; case 16: $temp = $this->is_negative ? '-0x' . $this->value : '0x' . $this->value; $this->value = gmp_init($temp); break; case 10: $this->value = gmp_init(isset($this->value) ? $this->value : '0'); } } /** * Converts a BigInteger to a base-10 number. * * @return string */ public function toString() { return (string) $this->value; } /** * Converts a BigInteger to a byte string (eg. base-256). * * @param bool $twos_compliment * @return string */ function toBytes($twos_compliment = false) { if ($twos_compliment) { return $this->toBytesHelper(); } if (gmp_cmp($this->value, gmp_init(0)) == 0) { return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; } $temp = gmp_export($this->value); return $this->precision > 0 ? substr(str_pad($temp, $this->precision >> 3, chr(0), STR_PAD_LEFT), -($this->precision >> 3)) : ltrim($temp, chr(0)); } /** * Adds two BigIntegers. * * @param GMP $y * @return GMP */ public function add(GMP $y) { $temp = new self(); $temp->value = $this->value + $y->value; return $this->normalize($temp); } /** * Subtracts two BigIntegers. * * @param GMP $y * @return GMP */ public function subtract(GMP $y) { $temp = new self(); $temp->value = $this->value - $y->value; return $this->normalize($temp); } /** * Multiplies two BigIntegers. * * @param GMP $x * @return GMP */ public function multiply(GMP $x) { $temp = new self(); $temp->value = $this->value * $x->value; return $this->normalize($temp); } /** * Divides two BigIntegers. * * Returns an array whose first element contains the quotient and whose second element contains the * "common residue". If the remainder would be positive, the "common residue" and the remainder are the * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder * and the divisor (basically, the "common residue" is the first positive modulo). * * @param GMP $y * @return GMP */ public function divide(GMP $y) { $quotient = new self(); $remainder = new self(); list($quotient->value, $remainder->value) = gmp_div_qr($this->value, $y->value); if (gmp_sign($remainder->value) < 0) { $remainder->value = $remainder->value + gmp_abs($y->value); } return [$this->normalize($quotient), $this->normalize($remainder)]; } /** * Compares two numbers. * * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is * demonstrated thusly: * * $x > $y: $x->compare($y) > 0 * $x < $y: $x->compare($y) < 0 * $x == $y: $x->compare($y) == 0 * * Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y). * * @param GMP $y * @return int < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal. * @access public * @see self::equals() * @internal Could return $this->subtract($x), but that's not as fast as what we do do. */ public function compare(GMP $y) { return gmp_cmp($this->value, $y->value); } /** * Tests the equality of two numbers. * * If you need to see if one number is greater than or less than another number, use BigInteger::compare() * * @param GMP $x * @return bool */ public function equals(GMP $x) { return $this->value == $x->value; } /** * Calculates modular inverses. * * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. * * @param GMP $n * @return false|GMP */ public function modInverse(GMP $n) { $temp = new self(); $temp->value = gmp_invert($this->value, $n->value); return $temp->value === false ? false : $this->normalize($temp); } /** * Calculates the greatest common divisor and Bezout's identity. * * Say you have 693 and 609. The GCD is 21. Bezout's identity states that there exist integers x and y such that * 693*x + 609*y == 21. In point of fact, there are actually an infinite number of x and y combinations and which * combination is returned is dependent upon which mode is in use. See * {@link http://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity Bezout's identity - Wikipedia} for more information. * * @param \phpseclib\Math\BigInteger\Engines\GMP $n * @return \phpseclib\Math\BigInteger\Engines\GMP[] */ public function extendedGCD(GMP $n) { extract(gmp_gcdext($this->value, $n->value)); return [ 'gcd' => $this->normalize(new self($g)), 'x' => $this->normalize(new self($s)), 'y' => $this->normalize(new self($t)) ]; } /** * Calculates the greatest common divisor * * Say you have 693 and 609. The GCD is 21. * * @param GMP $n * @return GMP */ public function gcd(GMP $n) { $r = gmp_gcd($this->value, $n->value); return $this->normalize(new self($r)); } /** * Absolute value. * * @return \phpseclib\Math\BigInteger\Engines\GMP * @access public */ public function abs() { $temp = new self(); $temp->value = gmp_abs($this->value); return $temp; } /** * Logical And * * @param GMP $x * @return GMP */ public function bitwise_and(GMP $x) { $temp = new self(); $temp->value = $this->value & $x->value; return $this->normalize($temp); } /** * Logical Or * * @param GMP $x * @return GMP */ public function bitwise_or(GMP $x) { $temp = new self(); $temp->value = $this->value | $x->value; return $this->normalize($temp); } /** * Logical Exclusive Or * * @param GMP $x * @return GMP */ public function bitwise_xor(GMP $x) { $temp = new self(); $temp->value = gmp_abs($this->value) ^ gmp_abs($x->value); return $this->normalize($temp); } /** * Logical Right Shift * * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift. * * @param int $shift * @return \phpseclib\Math\BigInteger\Engines\GMP */ public function bitwise_rightShift($shift) { // 0xFFFFFFFF >> 2 == -1 (on 32-bit systems) // gmp_init('0xFFFFFFFF') >> 2 == gmp_init('0x3FFFFFFF') $temp = new self(); $temp->value = $this->value >> $shift; return $this->normalize($temp); } /** * Logical Left Shift * * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift. * * @param int $shift * @return \phpseclib\Math\BigInteger\Engines\GMP */ public function bitwise_leftShift($shift) { $temp = new self(); $temp->value = $this->value << $shift; return $this->normalize($temp); } /** * Performs modular exponentiation. * * @param GMP $e * @param GMP $n * @return GMP */ public function modPow(GMP $e, GMP $n) { return $this->powModOuter($e, $n); } /** * Performs modular exponentiation. * * Alias for modPow(). * * @param GMP $e * @param GMP $n * @return GMP */ public function powMod(GMP $e, GMP $n) { return $this->powModOuter($e, $n); } /** * Performs modular exponentiation. * * @param GMP $e * @param GMP $n * @return GMP */ protected function powModInner(GMP $e, GMP $n) { $class = self::$modexpEngine; return $class::powModHelper($this, $e, $n); } /** * Normalize * * Removes leading zeros and truncates (if necessary) to maintain the appropriate precision * * @param GMP $result * @return GMP */ protected function normalize(GMP $result) { $result->precision = $this->precision; $result->bitmask = $this->bitmask; if ($result->bitmask !== false) { $result->value = $result->value & $result->bitmask->value; } return $result; } /** * Performs some post-processing for randomRangePrime * * @param Engine $x * @param Engine $min * @param Engine $max * @return GMP */ protected static function randomRangePrimeInner(Engine $x, Engine $min, Engine $max) { $p = gmp_nextprime($x->value); if ($p <= $max->value) { return new self($p); } if ($min->value != $x->value) { $x = new self($x->value - 1); } return self::randomRangePrime($min, $x); } /** * Generate a random prime number between a range * * If there's not a prime within the given range, false will be returned. * * @param GMP $min * @param GMP $max * @return false|GMP */ public static function randomRangePrime(GMP $min, GMP $max) { return self::randomRangePrimeOuter($min, $max); } /** * Generate a random number between a range * * Returns a random number between $min and $max where $min and $max * can be defined using one of the two methods: * * BigInteger::randomRange($min, $max) * BigInteger::randomRange($max, $min) * * @param GMP $min * @param GMP $max * @return GMP */ public static function randomRange(GMP $min, GMP $max) { return self::randomRangeHelper($min, $max); } /** * Make the current number odd * * If the current number is odd it'll be unchanged. If it's even, one will be added to it. * * @see self::randomPrime() */ protected function make_odd() { gmp_setbit($this->value, 0); } /** * Tests Primality * * @param int $t * @return bool */ protected function testPrimality($t) { return gmp_prob_prime($this->value, $t) != 0; } /** * Calculates the nth root of a biginteger. * * Returns the nth root of a positive biginteger, where n defaults to 2 * * @param int $n * @return GMP */ protected function rootInner($n) { $root = new self(); $root->value = gmp_root($this->value, $n); return $this->normalize($root); } /** * Performs exponentiation. * * @param GMP $n * @return GMP */ public function pow(GMP $n) { $temp = new self(); $temp->value = $this->value ** $n->value; return $this->normalize($temp); } /** * Return the minimum BigInteger between an arbitrary number of BigIntegers. * * @param GMP[] $nums * @return GMP */ public static function min(...$nums) { return self::minHelper($nums); } /** * Return the maximum BigInteger between an arbitrary number of BigIntegers. * * @param GMP[] $nums * @return GMP */ public static function max(...$nums) { return self::maxHelper($nums); } /** * Tests BigInteger to see if it is between two integers, inclusive * * @param GMP $min * @param GMP $max * @return bool */ public function between(GMP $min, GMP $max) { return $this->compare($min) >= 0 && $this->compare($max) <= 0; } }<?php /** * BCMath BigInteger Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines; use ParagonIE\ConstantTime\Hex; use phpseclib\Exception\BadConfigurationException; /** * BCMath Engine. * * @package BCMath * @author Jim Wigginton <terrafrost@php.net> * @access public */ class BCMath extends Engine { /** * Can Bitwise operations be done fast? * * @see parent::bitwise_leftRotate() * @see parent::bitwise_rightRotate() * @access protected */ const FAST_BITWISE = false; /** * Engine Directory * * @see parent::setModExpEngine * @access protected */ const ENGINE_DIR = 'BCMath'; /** * Modular Exponentiation Engine * * @var string */ protected static $modexpEngine; /** * Engine Validity Flag * * @var bool */ protected static $isValidEngine; /** * BigInteger(0) * * @var \phpseclib\Math\BigInteger\Engines\BCMath */ protected static $zero; /** * BigInteger(1) * * @var \phpseclib\Math\BigInteger\Engines\BCMath */ protected static $one; /** * BigInteger(2) * * @var \phpseclib\Math\BigInteger\Engines\BCMath */ protected static $two; /** * Primes > 2 and < 1000 * * @var array */ protected static $primes; /** * Test for engine validity * * @see parent::__construct() * @return bool */ public static function isValidEngine() { return extension_loaded('bcmath'); } /** * Default constructor * * @param mixed $x integer Base-10 number or base-$base number if $base set. * @param int $base * @see parent::__construct() * @return \phpseclib\Math\BigInteger\Engines\BCMath */ public function __construct($x = 0, $base = 10) { if (!isset(self::$isValidEngine)) { self::$isValidEngine = self::isValidEngine(); } if (!self::$isValidEngine) { throw new BadConfigurationException('BCMath is not setup correctly on this system'); } $this->value = '0'; parent::__construct($x, $base); } /** * Initialize a BCMath BigInteger Engine instance * * @param int $base * @see parent::__construct() */ protected function initialize($base) { switch (abs($base)) { case 256: // round $len to the nearest 4 $len = (strlen($this->value) + 3) & 0xFFFFFFFC; $x = str_pad($this->value, $len, chr(0), STR_PAD_LEFT); $this->value = '0'; for ($i = 0; $i < $len; $i+= 4) { $this->value = bcmul($this->value, '4294967296', 0); // 4294967296 == 2**32 $this->value = bcadd($this->value, 0x1000000 * ord($x[$i]) + ((ord($x[$i + 1]) << 16) | (ord($x[$i + 2]) << 8) | ord($x[$i + 3])), 0); } if ($this->is_negative) { $this->value = '-' . $this->value; } break; case 16: $x = (strlen($this->value) & 1) ? '0' . $this->value : $this->value; $temp = new self(Hex::decode($x), 256); $this->value = $this->is_negative ? '-' . $temp->value : $temp->value; $this->is_negative = false; break; case 10: // explicitly casting $x to a string is necessary, here, since doing $x[0] on -1 yields different // results then doing it on '-1' does (modInverse does $x[0]) $this->value = $this->value === '-' ? '0' : (string) $this->value; } } /** * Converts a BigInteger to a base-10 number. * * @return string */ public function toString() { if ($this->value === '0') { return '0'; } return ltrim($this->value, '0'); } /** * Converts a BigInteger to a byte string (eg. base-256). * * @param bool $twos_compliment * @return string */ function toBytes($twos_compliment = false) { if ($twos_compliment) { return $this->toBytesHelper(); } $value = ''; $current = $this->value; if ($current[0] == '-') { $current = substr($current, 1); } while (bccomp($current, '0', 0) > 0) { $temp = bcmod($current, '16777216'); $value = chr($temp >> 16) . chr($temp >> 8) . chr($temp) . $value; $current = bcdiv($current, '16777216', 0); } return $this->precision > 0 ? substr(str_pad($value, $this->precision >> 3, chr(0), STR_PAD_LEFT), -($this->precision >> 3)) : ltrim($value, chr(0)); } /** * Adds two BigIntegers. * * @param BCMath $y * @return BCMath */ public function add(BCMath $y) { $temp = new self(); $temp->value = bcadd($this->value, $y->value); return $this->normalize($temp); } /** * Subtracts two BigIntegers. * * @param BCMath $y * @return BCMath */ public function subtract(BCMath $y) { $temp = new self(); $temp->value = bcsub($this->value, $y->value); return $this->normalize($temp); } /** * Multiplies two BigIntegers. * * @param BCMath $x * @return BCMath */ public function multiply(BCMath $x) { $temp = new self(); $temp->value = bcmul($this->value, $x->value); return $this->normalize($temp); } /** * Divides two BigIntegers. * * Returns an array whose first element contains the quotient and whose second element contains the * "common residue". If the remainder would be positive, the "common residue" and the remainder are the * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder * and the divisor (basically, the "common residue" is the first positive modulo). * * @param BCMath $y * @return BCMath */ public function divide(BCMath $y) { $quotient = new self(); $remainder = new self(); $quotient->value = bcdiv($this->value, $y->value, 0); $remainder->value = bcmod($this->value, $y->value); if ($remainder->value[0] == '-') { $remainder->value = bcadd($remainder->value, $y->value[0] == '-' ? substr($y->value, 1) : $y->value, 0); } return [$this->normalize($quotient), $this->normalize($remainder)]; } /** * Calculates modular inverses. * * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. * * @return false|BCMath * @param \phpseclib\Math\BigInteger\Engines\BCMath $n */ public function modInverse(BCMath $n) { return $this->modInverseHelper($n); } /** * Calculates the greatest common divisor and Bezout's identity. * * Say you have 693 and 609. The GCD is 21. Bezout's identity states that there exist integers x and y such that * 693*x + 609*y == 21. In point of fact, there are actually an infinite number of x and y combinations and which * combination is returned is dependent upon which mode is in use. See * {@link http://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity Bezout's identity - Wikipedia} for more information. * * @param BCMath $n * @return BCMath */ public function extendedGCD(BCMath $n) { // it might be faster to use the binary xGCD algorithim here, as well, but (1) that algorithim works // best when the base is a power of 2 and (2) i don't think it'd make much difference, anyway. as is, // the basic extended euclidean algorithim is what we're using. $u = $this->value; $v = $n->value; $a = '1'; $b = '0'; $c = '0'; $d = '1'; while (bccomp($v, '0', 0) != 0) { $q = bcdiv($u, $v, 0); $temp = $u; $u = $v; $v = bcsub($temp, bcmul($v, $q, 0), 0); $temp = $a; $a = $c; $c = bcsub($temp, bcmul($a, $q, 0), 0); $temp = $b; $b = $d; $d = bcsub($temp, bcmul($b, $q, 0), 0); } return [ 'gcd' => $this->normalize(new static($u)), 'x' => $this->normalize(new static($a)), 'y' => $this->normalize(new static($b)) ]; } /** * Calculates the greatest common divisor * * Say you have 693 and 609. The GCD is 21. * * @param BCMath $n * @return BCMath */ public function gcd(BCMath $n) { extract($this->extendedGCD($n)); /** @var BCMath $gcd */ return $gcd; } /** * Absolute value. * * @return \phpseclib\Math\BigInteger\Engines\BCMath */ public function abs() { $temp = new static(); $temp->value = bccomp($this->value, '0', 0) < 0 ? substr($this->value, 1) : $this->value; return $temp; } /** * Logical And * * @param BCMath $x * @return BCMath */ public function bitwise_and(BCMath $x) { $left = $this->toBytes(); $right = $x->toBytes(); $length = max(strlen($left), strlen($right)); $left = str_pad($left, $length, chr(0), STR_PAD_LEFT); $right = str_pad($right, $length, chr(0), STR_PAD_LEFT); return $this->normalize(new static($left & $right, 256)); } /** * Logical Or * * @param BCMath $x * @return BCMath */ public function bitwise_or(BCMath $x) { $left = $this->toBytes(); $right = $x->toBytes(); $length = max(strlen($left), strlen($right)); $left = str_pad($left, $length, chr(0), STR_PAD_LEFT); $right = str_pad($right, $length, chr(0), STR_PAD_LEFT); return $this->normalize(new static($left | $right, 256)); } /** * Logical Exlusive Or * * @param BCMath $x * @return BCMath */ public function bitwise_xor(BCMath $x) { $left = $this->toBytes(); $right = $x->toBytes(); $length = max(strlen($left), strlen($right)); $left = str_pad($left, $length, chr(0), STR_PAD_LEFT); $right = str_pad($right, $length, chr(0), STR_PAD_LEFT); return $this->normalize(new static($left ^ $right, 256)); } /** * Logical Right Shift * * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift. * * @param int $shift * @return \phpseclib\Math\BigInteger\Engines\BCMath */ public function bitwise_rightShift($shift) { $temp = new static(); $temp->value = bcdiv($this->value, bcpow('2', $shift, 0), 0); return $this->normalize($temp); } /** * Logical Left Shift * * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift. * * @param int $shift * @return \phpseclib\Math\BigInteger\Engines\BCMath */ public function bitwise_leftShift($shift) { $temp = new static(); $temp->value = bcmul($this->value, bcpow('2', $shift, 0), 0); return $this->normalize($temp); } /** * Compares two numbers. * * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is * demonstrated thusly: * * $x > $y: $x->compare($y) > 0 * $x < $y: $x->compare($y) < 0 * $x == $y: $x->compare($y) == 0 * * Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y). * * @param BCMath $y * @return int < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal. * @see self::equals() * @internal Could return $this->subtract($x), but that's not as fast as what we do do. */ public function compare(BCMath $y) { return bccomp($this->value, $y->value, 0); } /** * Tests the equality of two numbers. * * If you need to see if one number is greater than or less than another number, use BigInteger::compare() * * @param BCMath $x * @return bool */ public function equals(BCMath $x) { return $this->value == $x->value; } /** * Performs modular exponentiation. * * @param BCMath $e * @param BCMath $n * @return BCMath */ public function modPow(BCMath $e, BCMath $n) { return $this->powModOuter($e, $n); } /** * Performs modular exponentiation. * * Alias for modPow(). * * @param BCMath $e * @param BCMath $n * @return BCMath */ public function powMod(BCMath $e, BCMath $n) { return $this->powModOuter($e, $n); } /** * Performs modular exponentiation. * * @param BCMath $e * @param BCMath $n * @return BCMath */ protected function powModInner(BCMath $e, BCMath $n) { try { $class = self::$modexpEngine; return $class::powModHelper($this, $e, $n, static::class); } catch (\Exception $err) { return BCMath\DefaultEngine::powModHelper($this, $e, $n, static::class); } } /** * Normalize * * Removes leading zeros and truncates (if necessary) to maintain the appropriate precision * * @param BCMath $result * @return BCMath */ protected function normalize(BCMath $result) { $result->precision = $this->precision; $result->bitmask = $this->bitmask; if ($result->bitmask !== false) { $result->value = bcmod($result->value, $result->bitmask->value); } return $result; } /** * Generate a random prime number between a range * * If there's not a prime within the given range, false will be returned. * * @param BCMath $min * @param BCMath $max * @return false|BCMath */ public static function randomRangePrime(BCMath $min, BCMath $max) { return self::randomRangePrimeOuter($min, $max); } /** * Generate a random number between a range * * Returns a random number between $min and $max where $min and $max * can be defined using one of the two methods: * * BigInteger::randomRange($min, $max) * BigInteger::randomRange($max, $min) * * @param BCMath $min * @param BCMath $max * @return BCMath */ public static function randomRange(BCMath $min, BCMath $max) { return self::randomRangeHelper($min, $max); } /** * Make the current number odd * * If the current number is odd it'll be unchanged. If it's even, one will be added to it. * * @see self::randomPrime() */ protected function make_odd() { if ($this->value[strlen($this->value) - 1] % 2 == 0) { $this->value = bcadd($this->value, '1'); } } /** * Test the number against small primes. * * @see self::isPrime() */ protected function testSmallPrimes() { if ($this->value === '1') { return false; } if ($this->value === '2') { return true; } if ($this->value[strlen($this->value) - 1] % 2 == 0) { return false; } $value = $this->value; foreach (self::$primes as $prime) { $r = bcmod($this->value, $prime); if ($r == '0') { return $this->value == $prime; } } return true; } /** * Scan for 1 and right shift by that amount * * ie. $s = gmp_scan1($n, 0) and $r = gmp_div_q($n, gmp_pow(gmp_init('2'), $s)); * * @see self::isPrime() * @param BCMath $r * @return int */ protected static function scan1divide(BCMath $r) { $r_value = &$r->value; $s = 0; // if $n was 1, $r would be 0 and this would be an infinite loop, hence our $this->equals(static::$one) check earlier while ($r_value[strlen($r_value) - 1] % 2 == 0) { $r_value = bcdiv($r_value, '2', 0); ++$s; } return $s; } /** * Performs exponentiation. * * @param BCMath $n * @return BCMath */ public function pow(BCMath $n) { $temp = new self(); $temp->value = bcpow($this->value, $n->value); return $this->normalize($temp); } /** * Return the minimum BigInteger between an arbitrary number of BigIntegers. * * @param BCMath[] $nums * @return BCMath */ public static function min(...$nums) { return self::minHelper($nums); } /** * Return the maximum BigInteger between an arbitrary number of BigIntegers. * * @param BCMath[] $nums * @return BCMath */ public static function max(...$nums) { return self::maxHelper($nums); } /** * Tests BigInteger to see if it is between two integers, inclusive * * @param BCMath $min * @param BCMath $max * @return bool */ public function between(BCMath $min, BCMath $max) { return $this->compare($min) >= 0 && $this->compare($max) <= 0; } /** * Set Bitmask * * @return Engine * @param int $bits * @see self::setPrecision() */ protected static function setBitmask($bits) { $temp = parent::setBitmask($bits); return $temp->add(static::$one); } }<?php /** * Base BigInteger Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines; use ParagonIE\ConstantTime\Hex; use phpseclib\Exception\BadConfigurationException; use phpseclib\Crypt\Random; use phpseclib\Math\BigInteger; /** * Base Engine. * * @package Engine * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Engine implements \Serializable { /** * Holds the BigInteger's value * * @var mixed */ protected $value; /** * Holds the BigInteger's sign * * @var bool */ protected $is_negative; /** * Precision * * @see static::setPrecision() */ protected $precision = -1; /** * Precision Bitmask * * @see static::setPrecision() */ protected $bitmask = false; /** * Default constructor * * @param mixed $x integer Base-10 number or base-$base number if $base set. * @param int $base */ public function __construct($x, $base) { if (!isset(static::$primes)) { static::$primes = [ 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997 ]; static::$zero = new static(0); static::$one = new static(1); static::$two = new static(2); } // '0' counts as empty() but when the base is 256 '0' is equal to ord('0') or 48 // '0' is the only value like this per http://php.net/empty if (empty($x) && (abs($base) != 256 || $x !== '0')) { return; } switch ($base) { case -256: case 256: if ($base == -256 && (ord($x[0]) & 0x80)) { $this->value = ~$x; $this->is_negative = true; } else { $this->value = $x; $this->is_negative = false; } static::initialize($base); if ($this->is_negative) { $temp = $this->add(new static('-1')); $this->value = $temp->value; } break; case -16: case 16: if ($base > 0 && $x[0] == '-') { $this->is_negative = true; $x = substr($x, 1); } $x = preg_replace('#^(?:0x)?([A-Fa-f0-9]*).*#', '$1', $x); $is_negative = false; if ($base < 0 && hexdec($x[0]) >= 8) { $this->is_negative = $is_negative = true; $x = Hex::encode(~Hex::decode($x)); } $this->value = $x; static::initialize($base); if ($is_negative) { $temp = $this->add(new static('-1')); $this->value = $temp->value; } break; case -10: case 10: // (?<!^)(?:-).*: find any -'s that aren't at the beginning and then any characters that follow that // (?<=^|-)0*: find any 0's that are preceded by the start of the string or by a - (ie. octals) // [^-0-9].*: find any non-numeric characters and then any characters that follow that $this->value = preg_replace('#(?<!^)(?:-).*|(?<=^|-)0*|[^-0-9].*#', '', $x); static::initialize($base); break; case -2: case 2: if ($base > 0 && $x[0] == '-') { $this->is_negative = true; $x = substr($x, 1); } $x = preg_replace('#^([01]*).*#', '$1', $x); $x = str_pad($x, strlen($x) + (3 * strlen($x)) % 4, 0, STR_PAD_LEFT); $str = '0x'; while (strlen($x)) { $part = substr($x, 0, 4); $str.= dechex(bindec($part)); $x = substr($x, 4); } if ($this->is_negative) { $str = '-' . $str; } $temp = new static($str, 8 * $base); // ie. either -16 or +16 $this->value = $temp->value; $this->is_negative = $temp->is_negative; break; default: // base not supported, so we'll let $this == 0 } } /** * Sets engine type. * * Throws an exception if the type is invalid * * @param string $engine */ public static function setModExpEngine($engine) { $fqengine = '\\phpseclib\\Math\\BigInteger\\Engines\\' . static::ENGINE_DIR . '\\' . $engine; if (!class_exists($fqengine) || !method_exists($fqengine, 'isValidEngine')) { throw new \InvalidArgumentException("$engine is not a valid engine"); } if (!$fqengine::isValidEngine()) { throw new BadConfigurationException("$engine is not setup correctly on this system"); } static::$modexpEngine = $fqengine; } /** * Converts a BigInteger to a byte string (eg. base-256). * * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're * saved as two's compliment. * @return string */ protected function toBytesHelper() { $comparison = $this->compare(new static()); if ($comparison == 0) { return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; } $temp = $comparison < 0 ? $this->add(new static(1)) : $this; $bytes = $temp->toBytes(); if (empty($bytes)) { // eg. if the number we're trying to convert is -1 $bytes = chr(0); } if (ord($bytes[0]) & 0x80) { $bytes = chr(0) . $bytes; } return $comparison < 0 ? ~$bytes : $bytes; } /** * Converts a BigInteger to a hex string (eg. base-16). * * @param bool $twos_compliment * @return string */ public function toHex($twos_compliment = false) { return Hex::encode($this->toBytes($twos_compliment)); } /** * Converts a BigInteger to a bit string (eg. base-2). * * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're * saved as two's compliment. * * @param bool $twos_compliment * @return string */ public function toBits($twos_compliment = false) { $hex = $this->toHex($twos_compliment); $bits = ''; for ($i = strlen($hex) - 8, $start = strlen($hex) & 7; $i >= $start; $i-=8) { $bits = str_pad(decbin(hexdec(substr($hex, $i, 8))), 32, '0', STR_PAD_LEFT) . $bits; } if ($start) { // hexdec('') == 0 $bits = str_pad(decbin(hexdec(substr($hex, 0, $start))), 8, '0', STR_PAD_LEFT) . $bits; } $result = $this->precision > 0 ? substr($bits, -$this->precision) : ltrim($bits, '0'); if ($twos_compliment && $this->compare(new static()) > 0 && $this->precision <= 0) { return '0' . $result; } return $result; } /** * Calculates modular inverses. * * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. * * @param \phpseclib\Math\BigInteger\Engines\Engine $n * @return \phpseclib\Math\BigInteger\Engines\Engine|false * @internal See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=21 HAC 14.64} for more information. */ protected function modInverseHelper(Engine $n) { // $x mod -$n == $x mod $n. $n = $n->abs(); if ($this->compare(static::$zero) < 0) { $temp = $this->abs(); $temp = $temp->modInverse($n); return $this->normalize($n->subtract($temp)); } extract($this->extendedGCD($n)); /** * @var BigInteger $gcd * @var BigInteger $x */ if (!$gcd->equals(static::$one)) { return false; } $x = $x->compare(static::$zero) < 0 ? $x->add($n) : $x; return $this->compare(static::$zero) < 0 ? $this->normalize($n->subtract($x)) : $this->normalize($x); } /** * Serialize * * Will be called, automatically, when serialize() is called on a BigInteger object. * * @return string */ public function serialize() { $val = ['hex' => $this->toHex(true)]; if ($this->precision > 0) { $val['precision'] = $this->precision; } return serialize($val); } /** * Serialize * * Will be called, automatically, when unserialize() is called on a BigInteger object. * * @param string $serialized */ public function unserialize($serialized) { $r = unserialize($serialized); $temp = new static($r['hex'], -16); $this->value = $temp->value; $this->is_negative = $temp->is_negative; if (isset($r['precision'])) { // recalculate $this->bitmask $this->setPrecision($r['precision']); } } /** * Converts a BigInteger to a base-10 number. * * @return string */ public function __toString() { return $this->toString(); } /** * __debugInfo() magic method * * Will be called, automatically, when print_r() or var_dump() are called */ public function __debugInfo() { return [ 'value' => '0x' . $this->toHex(true), 'engine' => basename(static::class) ]; } /** * Set Precision * * Some bitwise operations give different results depending on the precision being used. Examples include left * shift, not, and rotates. * * @param int $bits */ public function setPrecision($bits) { if ($bits < 1) { $this->precision = -1; $this->bitmask = false; return; } $this->precision = $bits; $this->bitmask = static::setBitmask($bits); $temp = $this->normalize($this); $this->value = $temp->value; } /** * Get Precision * * Returns the precision if it exists, -1 if it doesn't * * @return int */ public function getPrecision() { return $this->precision; } /** * Set Bitmask * @return Engine * @param int $bits * @see self::setPrecision() */ protected static function setBitmask($bits) { return new static(chr((1 << ($bits & 0x7)) - 1) . str_repeat(chr(0xFF), $bits >> 3), 256); } /** * Logical Not * * @return Engine|string */ public function bitwise_not() { // calculuate "not" without regard to $this->precision // (will always result in a smaller number. ie. ~1 isn't 1111 1110 - it's 0) $temp = $this->toBytes(); if ($temp == '') { return $this->normalize(static::$zero); } $pre_msb = decbin(ord($temp[0])); $temp = ~$temp; $msb = decbin(ord($temp[0])); if (strlen($msb) == 8) { $msb = substr($msb, strpos($msb, '0')); } $temp[0] = chr(bindec($msb)); // see if we need to add extra leading 1's $current_bits = strlen($pre_msb) + 8 * strlen($temp) - 8; $new_bits = $this->precision - $current_bits; if ($new_bits <= 0) { return $this->normalize(new static($temp, 256)); } // generate as many leading 1's as we need to. $leading_ones = chr((1 << ($new_bits & 0x7)) - 1) . str_repeat(chr(0xFF), $new_bits >> 3); self::base256_lshift($leading_ones, $current_bits); $temp = str_pad($temp, strlen($leading_ones), chr(0), STR_PAD_LEFT); return $this->normalize(new static($leading_ones | $temp, 256)); } /** * Logical Left Shift * * Shifts binary strings $shift bits, essentially multiplying by 2**$shift. * * @param $x String * @param $shift Integer * @return string */ protected static function base256_lshift(&$x, $shift) { if ($shift == 0) { return; } $num_bytes = $shift >> 3; // eg. floor($shift/8) $shift &= 7; // eg. $shift % 8 $carry = 0; for ($i = strlen($x) - 1; $i >= 0; --$i) { $temp = ord($x[$i]) << $shift | $carry; $x[$i] = chr($temp); $carry = $temp >> 8; } $carry = ($carry != 0) ? chr($carry) : ''; $x = $carry . $x . str_repeat(chr(0), $num_bytes); } /** * Logical Left Rotate * * Instead of the top x bits being dropped they're appended to the shifted bit string. * * @param int $shift * @return \phpseclib\Math\BigInteger\Engines\Engine */ public function bitwise_leftRotate($shift) { $bits = $this->toBytes(); if ($this->precision > 0) { $precision = $this->precision; if (static::FAST_BITWISE) { $mask = $this->bitmask->toBytes(); } else { $mask = $this->bitmask->subtract(new static(1)); $mask = $mask->toBytes(); } } else { $temp = ord($bits[0]); for ($i = 0; $temp >> $i; ++$i) { } $precision = 8 * strlen($bits) - 8 + $i; $mask = chr((1 << ($precision & 0x7)) - 1) . str_repeat(chr(0xFF), $precision >> 3); } if ($shift < 0) { $shift+= $precision; } $shift%= $precision; if (!$shift) { return clone $this; } $left = $this->bitwise_leftShift($shift); $left = $left->bitwise_and(new static($mask, 256)); $right = $this->bitwise_rightShift($precision - $shift); $result = static::FAST_BITWISE ? $left->bitwise_or($right) : $left->add($right); return $this->normalize($result); } /** * Logical Right Rotate * * Instead of the bottom x bits being dropped they're prepended to the shifted bit string. * * @param int $shift * @return \phpseclib\Math\BigInteger\Engines\Engine */ public function bitwise_rightRotate($shift) { return $this->bitwise_leftRotate(-$shift); } /** * Returns the smallest and largest n-bit number * * @param int $bits * @return \phpseclib\Math\BigInteger\Engines\Engine[] */ public static function minMaxBits($bits) { $bytes = $bits >> 3; $min = str_repeat(chr(0), $bytes); $max = str_repeat(chr(0xFF), $bytes); $msb = $bits & 7; if ($msb) { $min = chr(1 << ($msb - 1)) . $min; $max = chr((1 << $msb) - 1) . $max; } else { $min[0] = chr(0x80); } return [ 'min' => new static($min, 256), 'max' => new static($max, 256) ]; } /** * Return the size of a BigInteger in bits * * @return int */ public function getLength() { return strlen($this->toBits()); } /** * Return the size of a BigInteger in bytes * * @return int */ public function getLengthInBytes() { return strlen($this->toBytes()); } /** * Performs some pre-processing for powMod * * @param Engine $e * @param Engine $n * @return bool|Engine */ protected function powModOuter(Engine $e, Engine $n) { $n = $this->bitmask !== false && $this->bitmask->compare($n) < 0 ? $this->bitmask : $n->abs(); if ($e->compare(new static()) < 0) { $e = $e->abs(); $temp = $this->modInverse($n); if ($temp === false) { return false; } return $this->normalize($temp->powModInner($e, $n)); } return $this->powModInner($e, $n); } /** * Sliding Window k-ary Modular Exponentiation * * Based on {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=27 HAC 14.85} / * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=210 MPM 7.7}. In a departure from those algorithims, * however, this function performs a modular reduction after every multiplication and squaring operation. * As such, this function has the same preconditions that the reductions being used do. * * @param \phpseclib\Math\BigInteger\Engines\Engine $x * @param \phpseclib\Math\BigInteger\Engines\Engine $e * @param \phpseclib\Math\BigInteger\Engines\Engine $n * @param string $class * @return \phpseclib\Math\BigInteger\Engines\Engine */ protected static function slidingWindow(Engine $x, Engine $e, Engine $n, $class) { static $window_ranges = [7, 25, 81, 241, 673, 1793]; // from BigInteger.java's oddModPow function //static $window_ranges = [0, 7, 36, 140, 450, 1303, 3529]; // from MPM 7.3.1 $e_bits = $e->toBits(); $e_length = strlen($e_bits); // calculate the appropriate window size. // $window_size == 3 if $window_ranges is between 25 and 81, for example. for ($i = 0, $window_size = 1; $i < count($window_ranges) && $e_length > $window_ranges[$i]; ++$window_size, ++$i) { } $n_value = $n->value; if (method_exists(static::class, 'generateCustomReduction')) { static::generateCustomReduction($n, $class); } // precompute $this^0 through $this^$window_size $powers = []; $powers[1] = static::prepareReduce($x->value, $n_value, $class); $powers[2] = static::squareReduce($powers[1], $n_value, $class); // we do every other number since substr($e_bits, $i, $j+1) (see below) is supposed to end // in a 1. ie. it's supposed to be odd. $temp = 1 << ($window_size - 1); for ($i = 1; $i < $temp; ++$i) { $i2 = $i << 1; $powers[$i2 + 1] = static::multiplyReduce($powers[$i2 - 1], $powers[2], $n_value, $class); } $result = new $class(1); $result = static::prepareReduce($result->value, $n_value, $class); for ($i = 0; $i < $e_length;) { if (!$e_bits[$i]) { $result = static::squareReduce($result, $n_value, $class); ++$i; } else { for ($j = $window_size - 1; $j > 0; --$j) { if (!empty($e_bits[$i + $j])) { break; } } // eg. the length of substr($e_bits, $i, $j + 1) for ($k = 0; $k <= $j; ++$k) { $result = static::squareReduce($result, $n_value, $class); } $result = static::multiplyReduce($result, $powers[bindec(substr($e_bits, $i, $j + 1))], $n_value, $class); $i += $j + 1; } } $temp = new $class(); $temp->value = static::reduce($result, $n_value, $class); return $temp; } /** * Generates a random number of a certain size * * Bit length is equal to $size * * @param int $size * @return \phpseclib\Math\BigInteger\Engines\Engine */ public static function random($size) { extract(static::minMaxBits($size)); /** * @var BigInteger $min * @var BigInteger $max */ return static::randomRange($min, $max); } /** * Generates a random prime number of a certain size * * Bit length is equal to $size * * @param int $size * @return \phpseclib\Math\BigInteger\Engines\Engine */ public static function randomPrime($size) { extract(static::minMaxBits($size)); /** * @var BigInteger $min * @var BigInteger $max */ return static::randomRangePrime($min, $max); } /** * Performs some pre-processing for randomRangePrime * * @param Engine $min * @param Engine $max * @return bool|Engine */ protected static function randomRangePrimeOuter(Engine $min, Engine $max) { $compare = $max->compare($min); if (!$compare) { return $min->isPrime() ? $min : false; } elseif ($compare < 0) { // if $min is bigger then $max, swap $min and $max $temp = $max; $max = $min; $min = $temp; } $x = static::randomRange($min, $max); return static::randomRangePrimeInner($x, $min, $max); } /** * Generate a random number between a range * * Returns a random number between $min and $max where $min and $max * can be defined using one of the two methods: * * BigInteger::randomRange($min, $max) * BigInteger::randomRange($max, $min) * * @param Engine $min * @param Engine $max * @return Engine */ protected static function randomRangeHelper(Engine $min, Engine $max) { $compare = $max->compare($min); if (!$compare) { return $min; } elseif ($compare < 0) { // if $min is bigger then $max, swap $min and $max $temp = $max; $max = $min; $min = $temp; } if (!isset(static::$one)) { static::$one = new static(1); } $max = $max->subtract($min->subtract(static::$one)); $size = strlen(ltrim($max->toBytes(), chr(0))); /* doing $random % $max doesn't work because some numbers will be more likely to occur than others. eg. if $max is 140 and $random's max is 255 then that'd mean both $random = 5 and $random = 145 would produce 5 whereas the only value of random that could produce 139 would be 139. ie. not all numbers would be equally likely. some would be more likely than others. creating a whole new random number until you find one that is within the range doesn't work because, for sufficiently small ranges, the likelihood that you'd get a number within that range would be pretty small. eg. with $random's max being 255 and if your $max being 1 the probability would be pretty high that $random would be greater than $max. phpseclib works around this using the technique described here: http://crypto.stackexchange.com/questions/5708/creating-a-small-number-from-a-cryptographically-secure-random-string */ $random_max = new static(chr(1) . str_repeat("\0", $size), 256); $random = new static(Random::string($size), 256); list($max_multiple) = $random_max->divide($max); $max_multiple = $max_multiple->multiply($max); while ($random->compare($max_multiple) >= 0) { $random = $random->subtract($max_multiple); $random_max = $random_max->subtract($max_multiple); $random = $random->bitwise_leftShift(8); $random = $random->add(new static(Random::string(1), 256)); $random_max = $random_max->bitwise_leftShift(8); list($max_multiple) = $random_max->divide($max); $max_multiple = $max_multiple->multiply($max); } list(, $random) = $random->divide($max); return $random->add($min); } /** * Performs some post-processing for randomRangePrime * * @param Engine $x * @param Engine $min * @param Engine $max * @return bool|Engine */ protected static function randomRangePrimeInner(Engine $x, Engine $min, Engine $max) { if (!isset(static::$two)) { static::$two = new static('2'); } $x->make_odd(); if ($x->compare($max) > 0) { // if $x > $max then $max is even and if $min == $max then no prime number exists between the specified range if ($min->equals($max)) { return false; } $x = clone $min; $x->make_odd(); } $initial_x = clone $x; while (true) { if ($x->isPrime()) { return $x; } $x = $x->add(static::$two); if ($x->compare($max) > 0) { $x = clone $min; if ($x->equals(static::$two)) { return $x; } $x->make_odd(); } if ($x->equals($initial_x)) { return false; } } } /** * Sets the $t parameter for primality testing * * @return int */ protected function setupIsPrime() { $length = $this->getLengthInBytes(); // see HAC 4.49 "Note (controlling the error probability)" // @codingStandardsIgnoreStart if ($length >= 163) { $t = 2; } // floor(1300 / 8) else if ($length >= 106) { $t = 3; } // floor( 850 / 8) else if ($length >= 81 ) { $t = 4; } // floor( 650 / 8) else if ($length >= 68 ) { $t = 5; } // floor( 550 / 8) else if ($length >= 56 ) { $t = 6; } // floor( 450 / 8) else if ($length >= 50 ) { $t = 7; } // floor( 400 / 8) else if ($length >= 43 ) { $t = 8; } // floor( 350 / 8) else if ($length >= 37 ) { $t = 9; } // floor( 300 / 8) else if ($length >= 31 ) { $t = 12; } // floor( 250 / 8) else if ($length >= 25 ) { $t = 15; } // floor( 200 / 8) else if ($length >= 18 ) { $t = 18; } // floor( 150 / 8) else { $t = 27; } // @codingStandardsIgnoreEnd return $t; } /** * Tests Primality * * Uses the {@link http://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test Miller-Rabin primality test}. * See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf#page=8 HAC 4.24} for more info. * * @param int $t * @return bool */ protected function testPrimality($t) { if (!$this->testSmallPrimes()) { return false; } $n = clone $this; $n_1 = $n->subtract(static::$one); $n_2 = $n->subtract(static::$two); $r = clone $n_1; $s = static::scan1divide($r); for ($i = 0; $i < $t; ++$i) { $a = static::randomRange(static::$two, $n_2); $y = $a->modPow($r, $n); if (!$y->equals(static::$one) && !$y->equals($n_1)) { for ($j = 1; $j < $s && !$y->equals($n_1); ++$j) { $y = $y->modPow(static::$two, $n); if ($y->equals(static::$one)) { return false; } } if (!$y->equals($n_1)) { return false; } } } return true; } /** * Checks a numer to see if it's prime * * Assuming the $t parameter is not set, this function has an error rate of 2**-80. The main motivation for the * $t parameter is distributability. BigInteger::randomPrime() can be distributed across multiple pageloads * on a website instead of just one. * * @param int|bool $t * @return bool */ public function isPrime($t = false) { if (!$t) { $t = $this->setupIsPrime(); } return $this->testPrimality($t); } /** * Performs a few preliminary checks on root * * @param int $n * @return \phpseclib\Math\BigInteger\Engines\Engine */ protected function rootHelper($n) { if ($n < 1) { return clone static::$zero; } // we want positive exponents if ($this->compare(static::$one) < 0) { return clone static::$zero; } // we want positive numbers if ($this->compare(static::$two) < 0) { return clone static::$one; } // n-th root of 1 or 2 is 1 return $this->rootInner($n); } /** * Calculates the nth root of a biginteger. * * Returns the nth root of a positive biginteger, where n defaults to 2 * * @param int $n * @return \phpseclib\Math\BigInteger\Engines\Engine * @internal This function is based off of {@link http://mathforum.org/library/drmath/view/52605.html this page} and {@link http://stackoverflow.com/questions/11242920/calculating-nth-root-with-bcmath-in-php this stackoverflow question}. */ protected function rootInner($n) { $n = new static($n); // g is our guess number $g = static::$two; // while (g^n < num) g=g*2 while ($g->pow($n)->compare($this) < 0) { $g = $g->multiply(static::$two); } // if (g^n==num) num is a power of 2, we're lucky, end of job // == 0 bccomp(bcpow($g, $n), $n->value)==0 if ($g->pow($n)->equals($this) > 0) { $root = $g; return $this->normalize($root); } // if we're here num wasn't a power of 2 :( $og = $g; // og means original guess and here is our upper bound $g = $g->divide(static::$two)[0]; // g is set to be our lower bound $step = $og->subtract($g)->divide(static::$two)[0]; // step is the half of upper bound - lower bound $g = $g->add($step); // we start at lower bound + step , basically in the middle of our interval // while step>1 while ($step->compare(static::$one) == 1) { $guess = $g->pow($n); $step = $step->divide(static::$two)[0]; $comp = $guess->compare($this); // compare our guess with real number switch ($comp) { case -1: // if guess is lower we add the new step $g = $g->add($step); break; case 1: // if guess is higher we sub the new step $g = $g->subtract($step); break; case 0: // if guess is exactly the num we're done, we return the value $root = $g; break 2; } } if ($comp == 1) { $g = $g->subtract($step); } // whatever happened, g is the closest guess we can make so return it $root = $g; return $this->normalize($root); } /** * Calculates the nth root of a biginteger. * * @param int $n * @return Engine */ public function root($n = 2) { return $this->rootHelper($n); } /** * Return the minimum BigInteger between an arbitrary number of BigIntegers. * * @param array $nums * @return Engine */ protected static function minHelper(array $nums) { if (count($nums) == 1) { return $nums[0]; } $min = $nums[0]; for ($i = 1; $i < count($nums); $i++) { $min = $min->compare($nums[$i]) > 0 ? $nums[$i] : $min; } return $min; } /** * Return the minimum BigInteger between an arbitrary number of BigIntegers. * * @param array $nums * @return Engine */ protected static function maxHelper(array $nums) { if (count($nums) == 1) { return $nums[0]; } $max = $nums[0]; for ($i = 1; $i < count($nums); $i++) { $max = $max->compare($nums[$i]) < 0 ? $nums[$i] : $max; } return $max; } } <?php /** * Pure-PHP 64-bit BigInteger Engine * * PHP version 5 and 7 * * @category Math * @package BigInteger * @author Jim Wigginton <terrafrost@php.net> * @copyright 2017 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math\BigInteger\Engines; use ParagonIE\ConstantTime\Hex; /** * Pure-PHP 64-bit Engine. * * Uses 64-bit integers if int size is 8 bits * * @package PHP * @author Jim Wigginton <terrafrost@php.net> * @access public */ class PHP64 extends PHP { /**#@+ * Constants used by PHP.php */ const BASE = 31; const BASE_FULL = 0x80000000; const MAX_DIGIT = 0x7FFFFFFF; const MSB = 0x40000000; /** * MAX10 in greatest MAX10LEN satisfying * MAX10 = 10**MAX10LEN <= 2**BASE. */ const MAX10 = 1000000000; /** * MAX10LEN in greatest MAX10LEN satisfying * MAX10 = 10**MAX10LEN <= 2**BASE. */ const MAX10LEN = 9; const MAX_DIGIT2 = 4611686018427387904; /**#@-*/ /** * Modular Exponentiation Engine * * @var string */ protected static $modexpEngine; /** * Engine Validity Flag * * @var bool */ protected static $isValidEngine; /** * Primes > 2 and < 1000 * * @var array */ protected static $primes; /** * BigInteger(0) * * @var \phpseclib\Math\BigInteger\Engines\PHP64 */ protected static $zero; /** * BigInteger(1) * * @var \phpseclib\Math\BigInteger\Engines\PHP64 */ protected static $one; /** * BigInteger(2) * * @var \phpseclib\Math\BigInteger\Engines\PHP64 */ protected static $two; /** * Test for engine validity * * @see parent::__construct() * @return bool */ public static function isValidEngine() { return PHP_INT_SIZE >= 8; } /** * Adds two BigIntegers. * * @param PHP64 $y * @return PHP64 */ public function add(PHP64 $y) { $temp = self::addHelper($this->value, $this->is_negative, $y->value, $y->is_negative); return $this->convertToObj($temp); } /** * Subtracts two BigIntegers. * * @param PHP64 $y * @return PHP64 */ public function subtract(PHP64 $y) { $temp = self::subtractHelper($this->value, $this->is_negative, $y->value, $y->is_negative); return $this->convertToObj($temp); } /** * Multiplies two BigIntegers. * * @param PHP64 $y * @return PHP64 */ public function multiply(PHP64 $y) { $temp = self::multiplyHelper($this->value, $this->is_negative, $y->value, $y->is_negative); return $this->convertToObj($temp); } /** * Divides two BigIntegers. * * Returns an array whose first element contains the quotient and whose second element contains the * "common residue". If the remainder would be positive, the "common residue" and the remainder are the * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder * and the divisor (basically, the "common residue" is the first positive modulo). * * @param PHP64 $y * @return PHP64 */ public function divide(PHP64 $y) { return $this->divideHelper($y); } /** * Calculates modular inverses. * * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. * @param PHP64 $n * @return false|PHP64 */ public function modInverse(PHP64 $n) { return $this->modInverseHelper($n); } /** * Calculates modular inverses. * * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. * @param PHP64 $n * @return PHP64[] */ public function extendedGCD(PHP64 $n) { return $this->extendedGCDHelper($n); } /** * Calculates the greatest common divisor * * Say you have 693 and 609. The GCD is 21. * * @param PHP64 $n * @return PHP64 */ public function gcd(PHP64 $n) { return $this->extendedGCD($n)['gcd']; } /** * Logical And * * @param PHP64 $x * @return PHP64 */ public function bitwise_and(PHP64 $x) { return $this->bitwiseAndHelper($x); } /** * Logical Or * * @param PHP64 $x * @return PHP64 */ public function bitwise_or(PHP64 $x) { return $this->bitwiseOrHelper($x); } /** * Logical Exlusive Or * * @param PHP64 $x * @return PHP64 */ public function bitwise_xor(PHP64 $x) { return $this->bitwiseXorHelper($x); } /** * Compares two numbers. * * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is * demonstrated thusly: * * $x > $y: $x->compare($y) > 0 * $x < $y: $x->compare($y) < 0 * $x == $y: $x->compare($y) == 0 * * Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y). * * @param PHP64 $y * @return int < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal. * @access public * @see self::equals() * @internal Could return $this->subtract($x), but that's not as fast as what we do do. */ public function compare(PHP64 $y) { return parent::compareHelper($this->value, $this->is_negative, $y->value, $y->is_negative); } /** * Tests the equality of two numbers. * * If you need to see if one number is greater than or less than another number, use BigInteger::compare() * * @param PHP64 $x * @return bool */ public function equals(PHP64 $x) { return $this->value === $x->value && $this->is_negative == $x->is_negative; } /** * Performs modular exponentiation. * * @param PHP64 $e * @param PHP64 $n * @return PHP64 */ public function modPow(PHP64 $e, PHP64 $n) { return $this->powModOuter($e, $n); } /** * Performs modular exponentiation. * * Alias for modPow(). * * @param PHP64 $e * @param PHP64 $n * @return PHP64 */ public function powMod(PHP64 $e, PHP64 $n) { return $this->powModOuter($e, $n); } /** * Generate a random prime number between a range * * If there's not a prime within the given range, false will be returned. * * @param PHP64 $min * @param PHP64 $max * @return false|PHP64 */ public static function randomRangePrime(PHP64 $min, PHP64 $max) { return self::randomRangePrimeOuter($min, $max); } /** * Generate a random number between a range * * Returns a random number between $min and $max where $min and $max * can be defined using one of the two methods: * * BigInteger::randomRange($min, $max) * BigInteger::randomRange($max, $min) * * @param PHP64 $min * @param PHP64 $max * @return PHP64 */ public static function randomRange(PHP64 $min, PHP64 $max) { return self::randomRangeHelper($min, $max); } /** * Performs exponentiation. * * @param PHP64 $n * @return PHP64 */ public function pow(PHP64 $n) { return $this->powHelper($n); } /** * Return the minimum BigInteger between an arbitrary number of BigIntegers. * * @param PHP64[] $nums * @return PHP64 */ public static function min(...$nums) { return self::minHelper($nums); } /** * Return the maximum BigInteger between an arbitrary number of BigIntegers. * * @param PHP64[] $nums * @return PHP64 */ public static function max(...$nums) { return self::maxHelper($nums); } /** * Tests BigInteger to see if it is between two integers, inclusive * * @param PHP64 $min * @param PHP64 $max * @return bool */ public function between(PHP64 $min, PHP64 $max) { return $this->compare($min) >= 0 && $this->compare($max) <= 0; } }<?php /** * Common String Functions * * PHP version 5 * * @category Common * @package Functions\Strings * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Common\Functions; use phpseclib\Math\BigInteger; /** * Common String Functions * * @package Functions\Strings * @author Jim Wigginton <terrafrost@php.net> */ abstract class Strings { /** * String Shift * * Inspired by array_shift * * @param string $string * @param int $index * @access public * @return string */ public static function shift(&$string, $index = 1) { $substr = substr($string, 0, $index); $string = substr($string, $index); return $substr; } /** * String Pop * * Inspired by array_pop * * @param string $string * @param int $index * @access public * @return string */ public static function pop(&$string, $index = 1) { $substr = substr($string, -$index); $string = substr($string, 0, -$index); return $substr; } /** * Performs blinded equality testing on strings * * Protects against a particular type of timing attack described. * * See {@link http://codahale.com/a-lesson-in-timing-attacks/ A Lesson In Timing Attacks (or, Don't use MessageDigest.isEquals)} * * Thanks for the heads up singpolyma! * * @access public * @param string $x * @param string $y * @return bool */ public static function equals($x, $y) { if (strlen($x) != strlen($y)) { return false; } $result = 0; for ($i = 0; $i < strlen($x); $i++) { $result |= ord($x[$i]) ^ ord($y[$i]); } return $result == 0; } /** * Parse SSH2-style string * * Returns either an array or a boolean if $data is malformed. * * Valid characters for $format are as follows: * * C = byte * b = boolean (true/false) * N = uint32 * s = string * i = mpint * l = name-list * * uint64 is not supported. * * @param string $format * @param $data * @return mixed * @access public */ public static function unpackSSH2($format, $data) { $result = []; for ($i = 0; $i < strlen($format); $i++) { switch ($format[$i]) { case 'C': case 'b': if (!strlen($data)) { return false; } break; case 'N': case 'i': case 's': case 'l': if (strlen($data) < 4) { return false; } break; default: throw new \InvalidArgumentException('$format contains an invalid character'); } switch ($format[$i]) { case 'C': $result[] = ord(self::shift($data)); continue 2; case 'b': $result[] = ord(self::shift($data)) != 0; continue 2; case 'N': list(, $temp) = unpack('N', self::shift($data, 4)); $result[] = $temp; continue 2; } list(, $length) = unpack('N', self::shift($data, 4)); if (strlen($data) < $length) { return false; } $temp = self::shift($data, $length); switch ($format[$i]) { case 'i': $result[] = new BigInteger($temp, -256); break; case 's': $result[] = $temp; break; case 'l': $result[] = explode(',', $temp); } } return $result; } /** * Create SSH2-style string * * @param $elements[] * @access public * @return mixed */ public static function packSSH2(...$elements) { $format = $elements[0]; array_shift($elements); if (strlen($format) != count($elements)) { throw new \InvalidArgumentException('There must be as many arguments as there are characters in the $format string'); } $result = ''; for ($i = 0; $i < strlen($format); $i++) { $element = $elements[$i]; switch ($format[$i]) { case 'C': if (!is_int($element)) { throw new \InvalidArgumentException('Bytes must be represented as an integer between 0 and 255, inclusive.'); } $result.= pack('C', $element); break; case 'b': if (!is_bool($element)) { throw new \InvalidArgumentException('A boolean parameter was expected.'); } $result.= $element ? "\1" : "\0"; break; case 'N': if (!is_int($element)) { throw new \InvalidArgumentException('An integer was expected.'); } $result.= pack('N', $element); break; case 's': if (!is_string($element)) { throw new \InvalidArgumentException('A string was expected.'); } $result.= pack('Na*', strlen($element), $element); break; case 'i': if (!$element instanceof BigInteger) { throw new \InvalidArgumentException('A phpseclib\Math\BigInteger object was expected.'); } $element = $element->toBytes(true); $result.= pack('Na*', strlen($element), $element); break; case 'l': if (!is_array($element)) { throw new \InvalidArgumentException('An array was expected.'); } $element = implode(',', $element); $result.= pack('Na*', strlen($element), $element); break; default: throw new \InvalidArgumentException('$format contains an invalid character'); } } return $result; } } <?php /** * Common Object Functions * * PHP version 5 * * @category Common * @package Functions\Objects * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Common\Functions; /** * Common Object Functions * * @package Functions\Objects * @author Jim Wigginton <terrafrost@php.net> */ abstract class Objects { /** * Accesses a private variable from an object * * @param object $obj * @param string $var * @return mixed * @access public */ public static function getVar($obj, $var) { $reflection = new \ReflectionClass(get_class($obj)); $prop = $reflection->getProperty($var); $prop->setAccessible(true); return $prop->getValue($obj); } /** * Sets the value of a private variable in an object * * @param object $obj * @param string $var * @param mixed $val * @access public */ public static function setVar($obj, $var, $val) { $reflection = new \ReflectionClass(get_class($obj)); $prop = $reflection->getProperty($var); $prop->setAccessible(true); $prop->setValue($obj, $val); } /** * Accesses a private method from an object * * @param object $obj * @param string $func * @param array $params * @return mixed * @access public */ public static function callFunc($obj, $func, $params = []) { $reflection = new \ReflectionClass(get_class($obj)); $method = $reflection->getMethod($func); $method->setAccessible(true); return $method->invokeArgs($obj, $params); } } <?php /** * Bootstrapping File for phpseclib * * composer isn't a requirement for phpseclib 2.0 but this file isn't really required * either. it's a bonus for those using composer but if you're not phpseclib will * still work * * @license http://www.opensource.org/licenses/mit-license.html MIT License */ if (extension_loaded('mbstring')) { // 2 - MB_OVERLOAD_STRING if (ini_get('mbstring.func_overload') & 2) { throw new UnexpectedValueException( 'Overloading of string functions using mbstring.func_overload ' . 'is not supported by phpseclib.' ); } } <?php /** * Pure-PHP X.509 Parser * * PHP version 5 * * Encode and decode X.509 certificates. * * The extensions are from {@link http://tools.ietf.org/html/rfc5280 RFC5280} and * {@link http://web.archive.org/web/19961027104704/http://www3.netscape.com/eng/security/cert-exts.html Netscape Certificate Extensions}. * * Note that loading an X.509 certificate and resaving it may invalidate the signature. The reason being that the signature is based on a * portion of the certificate that contains optional parameters with default values. ie. if the parameter isn't there the default value is * used. Problem is, if the parameter is there and it just so happens to have the default value there are two ways that that parameter can * be encoded. It can be encoded explicitly or left out all together. This would effect the signature value and thus may invalidate the * the certificate all together unless the certificate is re-signed. * * @category File * @package X509 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2012 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File; use ParagonIE\ConstantTime\Base64; use ParagonIE\ConstantTime\Hex; use phpseclib\Crypt\Hash; use phpseclib\Crypt\Random; use phpseclib\Crypt\RSA; use phpseclib\Exception\UnsupportedAlgorithmException; use phpseclib\File\ASN1\Element; use phpseclib\Math\BigInteger; use phpseclib\File\ASN1\Maps; use DateTime; use DateTimeZone; /** * Pure-PHP X.509 Parser * * @package X509 * @author Jim Wigginton <terrafrost@php.net> * @access public */ class X509 { /** * Flag to only accept signatures signed by certificate authorities * * Not really used anymore but retained all the same to suppress E_NOTICEs from old installs * * @access public */ const VALIDATE_SIGNATURE_BY_CA = 1; /**#@+ * @access public * @see \phpseclib\File\X509::getDN() */ /** * Return internal array representation */ const DN_ARRAY = 0; /** * Return string */ const DN_STRING = 1; /** * Return ASN.1 name string */ const DN_ASN1 = 2; /** * Return OpenSSL compatible array */ const DN_OPENSSL = 3; /** * Return canonical ASN.1 RDNs string */ const DN_CANON = 4; /** * Return name hash for file indexing */ const DN_HASH = 5; /**#@-*/ /**#@+ * @access public * @see \phpseclib\File\X509::saveX509() * @see \phpseclib\File\X509::saveCSR() * @see \phpseclib\File\X509::saveCRL() */ /** * Save as PEM * * ie. a base64-encoded PEM with a header and a footer */ const FORMAT_PEM = 0; /** * Save as DER */ const FORMAT_DER = 1; /** * Save as a SPKAC * * Only works on CSRs. Not currently supported. */ const FORMAT_SPKAC = 2; /** * Auto-detect the format * * Used only by the load*() functions */ const FORMAT_AUTO_DETECT = 3; /**#@-*/ /** * Attribute value disposition. * If disposition is >= 0, this is the index of the target value. */ const ATTR_ALL = -1; // All attribute values (array). const ATTR_APPEND = -2; // Add a value. const ATTR_REPLACE = -3; // Clear first, then add a value. /** * Distinguished Name * * @var array * @access private */ private $dn; /** * Public key * * @var string * @access private */ private $publicKey; /** * Private key * * @var string * @access private */ private $privateKey; /** * Object identifiers for X.509 certificates * * @var array * @access private * @link http://en.wikipedia.org/wiki/Object_identifier */ private $oids; /** * The certificate authorities * * @var array * @access private */ private $CAs; /** * The currently loaded certificate * * @var array * @access private */ private $currentCert; /** * The signature subject * * There's no guarantee \phpseclib\File\X509 is going to re-encode an X.509 cert in the same way it was originally * encoded so we take save the portion of the original cert that the signature would have made for. * * @var string * @access private */ private $signatureSubject; /** * Certificate Start Date * * @var string * @access private */ private $startDate; /** * Certificate End Date * * @var string * @access private */ private $endDate; /** * Serial Number * * @var string * @access private */ private $serialNumber; /** * Key Identifier * * See {@link http://tools.ietf.org/html/rfc5280#section-4.2.1.1 RFC5280#section-4.2.1.1} and * {@link http://tools.ietf.org/html/rfc5280#section-4.2.1.2 RFC5280#section-4.2.1.2}. * * @var string * @access private */ private $currentKeyIdentifier; /** * CA Flag * * @var bool * @access private */ private $caFlag = false; /** * SPKAC Challenge * * @var string * @access private */ private $challenge; /** * OIDs loaded * * @var bool * @access private */ private static $oidsLoaded = false; /** * Default Constructor. * * @return \phpseclib\File\X509 * @access public */ public function __construct() { // Explicitly Tagged Module, 1988 Syntax // http://tools.ietf.org/html/rfc5280#appendix-A.1 if (!self::$oidsLoaded) { // OIDs from RFC5280 and those RFCs mentioned in RFC5280#section-4.1.1.2 ASN1::loadOIDs([ '1.3.6.1.5.5.7' => 'id-pkix', '1.3.6.1.5.5.7.1' => 'id-pe', '1.3.6.1.5.5.7.2' => 'id-qt', '1.3.6.1.5.5.7.3' => 'id-kp', '1.3.6.1.5.5.7.48' => 'id-ad', '1.3.6.1.5.5.7.2.1' => 'id-qt-cps', '1.3.6.1.5.5.7.2.2' => 'id-qt-unotice', '1.3.6.1.5.5.7.48.1' =>'id-ad-ocsp', '1.3.6.1.5.5.7.48.2' => 'id-ad-caIssuers', '1.3.6.1.5.5.7.48.3' => 'id-ad-timeStamping', '1.3.6.1.5.5.7.48.5' => 'id-ad-caRepository', '2.5.4' => 'id-at', '2.5.4.41' => 'id-at-name', '2.5.4.4' => 'id-at-surname', '2.5.4.42' => 'id-at-givenName', '2.5.4.43' => 'id-at-initials', '2.5.4.44' => 'id-at-generationQualifier', '2.5.4.3' => 'id-at-commonName', '2.5.4.7' => 'id-at-localityName', '2.5.4.8' => 'id-at-stateOrProvinceName', '2.5.4.10' => 'id-at-organizationName', '2.5.4.11' => 'id-at-organizationalUnitName', '2.5.4.12' => 'id-at-title', '2.5.4.13' => 'id-at-description', '2.5.4.46' => 'id-at-dnQualifier', '2.5.4.6' => 'id-at-countryName', '2.5.4.5' => 'id-at-serialNumber', '2.5.4.65' => 'id-at-pseudonym', '2.5.4.17' => 'id-at-postalCode', '2.5.4.9' => 'id-at-streetAddress', '2.5.4.45' => 'id-at-uniqueIdentifier', '2.5.4.72' => 'id-at-role', '2.5.4.16' => 'id-at-postalAddress', '0.9.2342.19200300.100.1.25' => 'id-domainComponent', '1.2.840.113549.1.9' => 'pkcs-9', '1.2.840.113549.1.9.1' => 'pkcs-9-at-emailAddress', '2.5.29' => 'id-ce', '2.5.29.35' => 'id-ce-authorityKeyIdentifier', '2.5.29.14' => 'id-ce-subjectKeyIdentifier', '2.5.29.15' => 'id-ce-keyUsage', '2.5.29.16' => 'id-ce-privateKeyUsagePeriod', '2.5.29.32' => 'id-ce-certificatePolicies', '2.5.29.32.0' => 'anyPolicy', '2.5.29.33' => 'id-ce-policyMappings', '2.5.29.17' => 'id-ce-subjectAltName', '2.5.29.18' => 'id-ce-issuerAltName', '2.5.29.9' => 'id-ce-subjectDirectoryAttributes', '2.5.29.19' => 'id-ce-basicConstraints', '2.5.29.30' => 'id-ce-nameConstraints', '2.5.29.36' => 'id-ce-policyConstraints', '2.5.29.31' => 'id-ce-cRLDistributionPoints', '2.5.29.37' => 'id-ce-extKeyUsage', '2.5.29.37.0' => 'anyExtendedKeyUsage', '1.3.6.1.5.5.7.3.1' => 'id-kp-serverAuth', '1.3.6.1.5.5.7.3.2' => 'id-kp-clientAuth', '1.3.6.1.5.5.7.3.3' => 'id-kp-codeSigning', '1.3.6.1.5.5.7.3.4' => 'id-kp-emailProtection', '1.3.6.1.5.5.7.3.8' => 'id-kp-timeStamping', '1.3.6.1.5.5.7.3.9' => 'id-kp-OCSPSigning', '2.5.29.54' => 'id-ce-inhibitAnyPolicy', '2.5.29.46' => 'id-ce-freshestCRL', '1.3.6.1.5.5.7.1.1' => 'id-pe-authorityInfoAccess', '1.3.6.1.5.5.7.1.11' => 'id-pe-subjectInfoAccess', '2.5.29.20' => 'id-ce-cRLNumber', '2.5.29.28' => 'id-ce-issuingDistributionPoint', '2.5.29.27' => 'id-ce-deltaCRLIndicator', '2.5.29.21' => 'id-ce-cRLReasons', '2.5.29.29' => 'id-ce-certificateIssuer', '2.5.29.23' => 'id-ce-holdInstructionCode', '1.2.840.10040.2' => 'holdInstruction', '1.2.840.10040.2.1' => 'id-holdinstruction-none', '1.2.840.10040.2.2' => 'id-holdinstruction-callissuer', '1.2.840.10040.2.3' => 'id-holdinstruction-reject', '2.5.29.24' => 'id-ce-invalidityDate', '1.2.840.113549.2.2' => 'md2', '1.2.840.113549.2.5' => 'md5', '1.3.14.3.2.26' => 'id-sha1', '1.2.840.10040.4.1' => 'id-dsa', '1.2.840.10040.4.3' => 'id-dsa-with-sha1', '1.2.840.113549.1.1' => 'pkcs-1', '1.2.840.113549.1.1.1' => 'rsaEncryption', '1.2.840.113549.1.1.2' => 'md2WithRSAEncryption', '1.2.840.113549.1.1.4' => 'md5WithRSAEncryption', '1.2.840.113549.1.1.5' => 'sha1WithRSAEncryption', '1.2.840.10046.2.1' => 'dhpublicnumber', '2.16.840.1.101.2.1.1.22' => 'id-keyExchangeAlgorithm', '1.2.840.10045' => 'ansi-X9-62', '1.2.840.10045.4' => 'id-ecSigType', '1.2.840.10045.4.1' => 'ecdsa-with-SHA1', '1.2.840.10045.1' => 'id-fieldType', '1.2.840.10045.1.1' => 'prime-field', '1.2.840.10045.1.2' => 'characteristic-two-field', '1.2.840.10045.1.2.3' => 'id-characteristic-two-basis', '1.2.840.10045.1.2.3.1' => 'gnBasis', '1.2.840.10045.1.2.3.2' => 'tpBasis', '1.2.840.10045.1.2.3.3' => 'ppBasis', '1.2.840.10045.2' => 'id-publicKeyType', '1.2.840.10045.2.1' => 'id-ecPublicKey', '1.2.840.10045.3' => 'ellipticCurve', '1.2.840.10045.3.0' => 'c-TwoCurve', '1.2.840.10045.3.0.1' => 'c2pnb163v1', '1.2.840.10045.3.0.2' => 'c2pnb163v2', '1.2.840.10045.3.0.3' => 'c2pnb163v3', '1.2.840.10045.3.0.4' => 'c2pnb176w1', '1.2.840.10045.3.0.5' => 'c2pnb191v1', '1.2.840.10045.3.0.6' => 'c2pnb191v2', '1.2.840.10045.3.0.7' => 'c2pnb191v3', '1.2.840.10045.3.0.8' => 'c2pnb191v4', '1.2.840.10045.3.0.9' => 'c2pnb191v5', '1.2.840.10045.3.0.10' => 'c2pnb208w1', '1.2.840.10045.3.0.11' => 'c2pnb239v1', '1.2.840.10045.3.0.12' => 'c2pnb239v2', '1.2.840.10045.3.0.13' => 'c2pnb239v3', '1.2.840.10045.3.0.14' => 'c2pnb239v4', '1.2.840.10045.3.0.15' => 'c2pnb239v5', '1.2.840.10045.3.0.16' => 'c2pnb272w1', '1.2.840.10045.3.0.17' => 'c2pnb304w1', '1.2.840.10045.3.0.18' => 'c2pnb359v1', '1.2.840.10045.3.0.19' => 'c2pnb368w1', '1.2.840.10045.3.0.20' => 'c2pnb431r1', '1.2.840.10045.3.1' => 'primeCurve', '1.2.840.10045.3.1.1' => 'prime192v1', '1.2.840.10045.3.1.2' => 'prime192v2', '1.2.840.10045.3.1.3' => 'prime192v3', '1.2.840.10045.3.1.4' => 'prime239v1', '1.2.840.10045.3.1.5' => 'prime239v2', '1.2.840.10045.3.1.6' => 'prime239v3', '1.2.840.10045.3.1.7' => 'prime256v1', '1.2.840.113549.1.1.7' => 'id-RSAES-OAEP', '1.2.840.113549.1.1.9' => 'id-pSpecified', '1.2.840.113549.1.1.10' => 'id-RSASSA-PSS', '1.2.840.113549.1.1.8' => 'id-mgf1', '1.2.840.113549.1.1.14' => 'sha224WithRSAEncryption', '1.2.840.113549.1.1.11' => 'sha256WithRSAEncryption', '1.2.840.113549.1.1.12' => 'sha384WithRSAEncryption', '1.2.840.113549.1.1.13' => 'sha512WithRSAEncryption', '2.16.840.1.101.3.4.2.4' => 'id-sha224', '2.16.840.1.101.3.4.2.1' => 'id-sha256', '2.16.840.1.101.3.4.2.2' => 'id-sha384', '2.16.840.1.101.3.4.2.3' => 'id-sha512', '1.2.643.2.2.4' => 'id-GostR3411-94-with-GostR3410-94', '1.2.643.2.2.3' => 'id-GostR3411-94-with-GostR3410-2001', '1.2.643.2.2.20' => 'id-GostR3410-2001', '1.2.643.2.2.19' => 'id-GostR3410-94', // Netscape Object Identifiers from "Netscape Certificate Extensions" '2.16.840.1.113730' => 'netscape', '2.16.840.1.113730.1' => 'netscape-cert-extension', '2.16.840.1.113730.1.1' => 'netscape-cert-type', '2.16.840.1.113730.1.13' => 'netscape-comment', '2.16.840.1.113730.1.8' => 'netscape-ca-policy-url', // the following are X.509 extensions not supported by phpseclib '1.3.6.1.5.5.7.1.12' => 'id-pe-logotype', '1.2.840.113533.7.65.0' => 'entrustVersInfo', '2.16.840.1.113733.1.6.9' => 'verisignPrivate', // for Certificate Signing Requests // see http://tools.ietf.org/html/rfc2985 '1.2.840.113549.1.9.2' => 'pkcs-9-at-unstructuredName', // PKCS #9 unstructured name '1.2.840.113549.1.9.7' => 'pkcs-9-at-challengePassword', // Challenge password for certificate revocations '1.2.840.113549.1.9.14' => 'pkcs-9-at-extensionRequest' // Certificate extension request ]); } } /** * Load X.509 certificate * * Returns an associative array describing the X.509 cert or a false if the cert failed to load * * @param string $cert * @param int $mode * @access public * @return mixed */ public function loadX509($cert, $mode = self::FORMAT_AUTO_DETECT) { if (is_array($cert) && isset($cert['tbsCertificate'])) { unset($this->currentCert); unset($this->currentKeyIdentifier); $this->dn = $cert['tbsCertificate']['subject']; if (!isset($this->dn)) { return false; } $this->currentCert = $cert; $currentKeyIdentifier = $this->getExtension('id-ce-subjectKeyIdentifier'); $this->currentKeyIdentifier = is_string($currentKeyIdentifier) ? $currentKeyIdentifier : null; unset($this->signatureSubject); return $cert; } if ($mode != self::FORMAT_DER) { $newcert = ASN1::extractBER($cert); if ($mode == self::FORMAT_PEM && $cert == $newcert) { return false; } $cert = $newcert; } if ($cert === false) { $this->currentCert = false; return false; } $decoded = ASN1::decodeBER($cert); if (!empty($decoded)) { $x509 = ASN1::asn1map($decoded[0], Maps\Certificate::MAP); } if (!isset($x509) || $x509 === false) { $this->currentCert = false; return false; } $this->signatureSubject = substr($cert, $decoded[0]['content'][0]['start'], $decoded[0]['content'][0]['length']); if ($this->isSubArrayValid($x509, 'tbsCertificate/extensions')) { $this->mapInExtensions($x509, 'tbsCertificate/extensions'); } $this->mapInDNs($x509, 'tbsCertificate/issuer/rdnSequence'); $this->mapInDNs($x509, 'tbsCertificate/subject/rdnSequence'); $key = &$x509['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey']; $key = $this->reformatKey($x509['tbsCertificate']['subjectPublicKeyInfo']['algorithm']['algorithm'], $key); $this->currentCert = $x509; $this->dn = $x509['tbsCertificate']['subject']; $currentKeyIdentifier = $this->getExtension('id-ce-subjectKeyIdentifier'); $this->currentKeyIdentifier = is_string($currentKeyIdentifier) ? $currentKeyIdentifier : null; return $x509; } /** * Save X.509 certificate * * @param array $cert * @param int $format optional * @access public * @return string */ public function saveX509($cert, $format = self::FORMAT_PEM) { if (!is_array($cert) || !isset($cert['tbsCertificate'])) { return false; } switch (true) { // "case !$a: case !$b: break; default: whatever();" is the same thing as "if ($a && $b) whatever()" case !($algorithm = $this->subArray($cert, 'tbsCertificate/subjectPublicKeyInfo/algorithm/algorithm')): case is_object($cert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey']): break; default: switch ($algorithm) { case 'rsaEncryption': $cert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey'] = "\0" . Base64::decode(preg_replace('#-.+-|[\r\n]#', '', $cert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey'])); /* "[For RSA keys] the parameters field MUST have ASN.1 type NULL for this algorithm identifier." -- https://tools.ietf.org/html/rfc3279#section-2.3.1 given that and the fact that RSA keys appear ot be the only key type for which the parameters field can be blank, it seems like perhaps the ASN.1 description ought not say the parameters field is OPTIONAL, but whatever. */ $cert['tbsCertificate']['subjectPublicKeyInfo']['algorithm']['parameters'] = null; // https://tools.ietf.org/html/rfc3279#section-2.2.1 $cert['signatureAlgorithm']['parameters'] = null; $cert['tbsCertificate']['signature']['parameters'] = null; } } $filters = []; $type_utf8_string = ['type' => ASN1::TYPE_UTF8_STRING]; $filters['tbsCertificate']['signature']['parameters'] = $type_utf8_string; $filters['tbsCertificate']['signature']['issuer']['rdnSequence']['value'] = $type_utf8_string; $filters['tbsCertificate']['issuer']['rdnSequence']['value'] = $type_utf8_string; $filters['tbsCertificate']['subject']['rdnSequence']['value'] = $type_utf8_string; $filters['tbsCertificate']['subjectPublicKeyInfo']['algorithm']['parameters'] = $type_utf8_string; $filters['signatureAlgorithm']['parameters'] = $type_utf8_string; $filters['authorityCertIssuer']['directoryName']['rdnSequence']['value'] = $type_utf8_string; //$filters['policyQualifiers']['qualifier'] = $type_utf8_string; $filters['distributionPoint']['fullName']['directoryName']['rdnSequence']['value'] = $type_utf8_string; $filters['directoryName']['rdnSequence']['value'] = $type_utf8_string; /* in the case of policyQualifiers/qualifier, the type has to be \phpseclib\File\ASN1::TYPE_IA5_STRING. \phpseclib\File\ASN1::TYPE_PRINTABLE_STRING will cause OpenSSL's X.509 parser to spit out random characters. */ $filters['policyQualifiers']['qualifier'] = ['type' => ASN1::TYPE_IA5_STRING]; ASN1::setFilters($filters); $this->mapOutExtensions($cert, 'tbsCertificate/extensions'); $this->mapOutDNs($cert, 'tbsCertificate/issuer/rdnSequence'); $this->mapOutDNs($cert, 'tbsCertificate/subject/rdnSequence'); $cert = ASN1::encodeDER($cert, Maps\Certificate::MAP); switch ($format) { case self::FORMAT_DER: return $cert; // case self::FORMAT_PEM: default: return "-----BEGIN CERTIFICATE-----\r\n" . chunk_split(Base64::encode($cert), 64) . '-----END CERTIFICATE-----'; } } /** * Map extension values from octet string to extension-specific internal * format. * * @param &array $root * @param string $path * @access private */ private function mapInExtensions(&$root, $path) { $extensions = &$this->subArrayUnchecked($root, $path); if ($extensions) { for ($i = 0; $i < count($extensions); $i++) { $id = $extensions[$i]['extnId']; $value = &$extensions[$i]['extnValue']; $decoded = ASN1::decodeBER($value); /* [extnValue] contains the DER encoding of an ASN.1 value corresponding to the extension type identified by extnID */ $map = $this->getMapping($id); if (!is_bool($map)) { $mapped = ASN1::asn1map($decoded[0], $map, ['iPAddress' => [$this, 'decodeIP']]); $value = $mapped === false ? $decoded[0] : $mapped; if ($id == 'id-ce-certificatePolicies') { for ($j = 0; $j < count($value); $j++) { if (!isset($value[$j]['policyQualifiers'])) { continue; } for ($k = 0; $k < count($value[$j]['policyQualifiers']); $k++) { $subid = $value[$j]['policyQualifiers'][$k]['policyQualifierId']; $map = $this->getMapping($subid); $subvalue = &$value[$j]['policyQualifiers'][$k]['qualifier']; if ($map !== false) { $decoded = ASN1::decodeBER($subvalue); $mapped = ASN1::asn1map($decoded[0], $map); $subvalue = $mapped === false ? $decoded[0] : $mapped; } } } } } } } } /** * Map extension values from extension-specific internal format to * octet string. * * @param &array Ref $root * @param string $path * @access private */ private function mapOutExtensions(&$root, $path) { $extensions = &$this->subArray($root, $path); if (is_array($extensions)) { $size = count($extensions); for ($i = 0; $i < $size; $i++) { if ($extensions[$i] instanceof Element) { continue; } $id = $extensions[$i]['extnId']; $value = &$extensions[$i]['extnValue']; switch ($id) { case 'id-ce-certificatePolicies': for ($j = 0; $j < count($value); $j++) { if (!isset($value[$j]['policyQualifiers'])) { continue; } for ($k = 0; $k < count($value[$j]['policyQualifiers']); $k++) { $subid = $value[$j]['policyQualifiers'][$k]['policyQualifierId']; $map = $this->getMapping($subid); $subvalue = &$value[$j]['policyQualifiers'][$k]['qualifier']; if ($map !== false) { // by default \phpseclib\File\ASN1 will try to render qualifier as a \phpseclib\File\ASN1::TYPE_IA5_STRING since it's // actual type is \phpseclib\File\ASN1::TYPE_ANY $subvalue = new Element(ASN1::encodeDER($subvalue, $map)); } } } break; case 'id-ce-authorityKeyIdentifier': // use 00 as the serial number instead of an empty string if (isset($value['authorityCertSerialNumber'])) { if ($value['authorityCertSerialNumber']->toBytes() == '') { $temp = chr((ASN1::CLASS_CONTEXT_SPECIFIC << 6) | 2) . "\1\0"; $value['authorityCertSerialNumber'] = new Element($temp); } } } /* [extnValue] contains the DER encoding of an ASN.1 value corresponding to the extension type identified by extnID */ $map = $this->getMapping($id); if (is_bool($map)) { if (!$map) { //user_error($id . ' is not a currently supported extension'); unset($extensions[$i]); } } else { $value = ASN1::encodeDER($value, $map, ['iPAddress' => [$this, 'encodeIP']]); } } } } /** * Map attribute values from ANY type to attribute-specific internal * format. * * @param &array Ref $root * @param string $path * @access private */ private function mapInAttributes(&$root, $path) { $attributes = &$this->subArray($root, $path); if (is_array($attributes)) { for ($i = 0; $i < count($attributes); $i++) { $id = $attributes[$i]['type']; /* $value contains the DER encoding of an ASN.1 value corresponding to the attribute type identified by type */ $map = $this->getMapping($id); if (is_array($attributes[$i]['value'])) { $values = &$attributes[$i]['value']; for ($j = 0; $j < count($values); $j++) { $value = ASN1::encodeDER($values[$j], Maps\AttributeValue::MAP); $decoded = ASN1::decodeBER($value); if (!is_bool($map)) { $mapped = ASN1::asn1map($decoded[0], $map); if ($mapped !== false) { $values[$j] = $mapped; } if ($id == 'pkcs-9-at-extensionRequest' && $this->isSubArrayValid($values, $j)) { $this->mapInExtensions($values, $j); } } elseif ($map) { $values[$j] = $value; } } } } } } /** * Map attribute values from attribute-specific internal format to * ANY type. * * @param &array $root Ref * @param string $path * @access private */ private function mapOutAttributes(&$root, $path) { $attributes = &$this->subArray($root, $path); if (is_array($attributes)) { $size = count($attributes); for ($i = 0; $i < $size; $i++) { /* [value] contains the DER encoding of an ASN.1 value corresponding to the attribute type identified by type */ $id = $attributes[$i]['type']; $map = $this->getMapping($id); if ($map === false) { //user_error($id . ' is not a currently supported attribute', E_USER_NOTICE); unset($attributes[$i]); } elseif (is_array($attributes[$i]['value'])) { $values = &$attributes[$i]['value']; for ($j = 0; $j < count($values); $j++) { switch ($id) { case 'pkcs-9-at-extensionRequest': $this->mapOutExtensions($values, $j); break; } if (!is_bool($map)) { $temp = ASN1::encodeDER($values[$j], $map); $decoded = ASN1::decodeBER($temp); $values[$j] = ASN1::asn1map($decoded[0], Maps\AttributeValue::MAP); } } } } } } /** * Map DN values from ANY type to DN-specific internal * format. * * @param &array $root * @param string $path * @access private */ private function mapInDNs(&$root, $path) { $dns = &$this->subArray($root, $path); if (is_array($dns)) { for ($i = 0; $i < count($dns); $i++) { for ($j = 0; $j < count($dns[$i]); $j++) { $type = $dns[$i][$j]['type']; $value = &$dns[$i][$j]['value']; if (is_object($value) && $value instanceof Element) { $map = $this->getMapping($type); if (!is_bool($map)) { $decoded = ASN1::decodeBER($value); $value = ASN1::asn1map($decoded[0], $map); } } } } } } /** * Map DN values from DN-specific internal format to * ANY type. * * @param &array $root * @param string $path * @access private */ private function mapOutDNs(&$root, $path) { $dns = &$this->subArray($root, $path); if (is_array($dns)) { $size = count($dns); for ($i = 0; $i < $size; $i++) { for ($j = 0; $j < count($dns[$i]); $j++) { $type = $dns[$i][$j]['type']; $value = &$dns[$i][$j]['value']; if (is_object($value) && $value instanceof Element) { continue; } $map = $this->getMapping($type); if (!is_bool($map)) { $value = new Element(ASN1::encodeDER($value, $map)); } } } } } /** * Associate an extension ID to an extension mapping * * @param string $extnId * @access private * @return mixed */ private function getMapping($extnId) { if (!is_string($extnId)) { // eg. if it's a \phpseclib\File\ASN1\Element object return true; } switch ($extnId) { case 'id-ce-keyUsage': return Maps\KeyUsage::MAP; case 'id-ce-basicConstraints': return Maps\BasicConstraints::MAP; case 'id-ce-subjectKeyIdentifier': return Maps\KeyIdentifier::MAP; case 'id-ce-cRLDistributionPoints': return Maps\CRLDistributionPoints::MAP; case 'id-ce-authorityKeyIdentifier': return Maps\AuthorityKeyIdentifier::MAP; case 'id-ce-certificatePolicies': return Maps\CertificatePolicies::MAP; case 'id-ce-extKeyUsage': return Maps\ExtKeyUsageSyntax::MAP; case 'id-pe-authorityInfoAccess': return Maps\AuthorityInfoAccessSyntax::MAP; case 'id-ce-subjectAltName': return Maps\SubjectAltName::MAP; case 'id-ce-subjectDirectoryAttributes': return Maps\SubjectDirectoryAttributes::MAP; case 'id-ce-privateKeyUsagePeriod': return Maps\PrivateKeyUsagePeriod::MAP; case 'id-ce-issuerAltName': return Maps\IssuerAltName::MAP; case 'id-ce-policyMappings': return Maps\PolicyMappings::MAP; case 'id-ce-nameConstraints': return Maps\NameConstraints::MAP; case 'netscape-cert-type': return Maps\netscape_cert_type::MAP; case 'netscape-comment': return Maps\netscape_comment::MAP; case 'netscape-ca-policy-url': return Maps\netscape_ca_policy_url::MAP; // since id-qt-cps isn't a constructed type it will have already been decoded as a string by the time it gets // back around to asn1map() and we don't want it decoded again. //case 'id-qt-cps': // return Maps\CPSuri::MAP; case 'id-qt-unotice': return Maps\UserNotice::MAP; // the following OIDs are unsupported but we don't want them to give notices when calling saveX509(). case 'id-pe-logotype': // http://www.ietf.org/rfc/rfc3709.txt case 'entrustVersInfo': // http://support.microsoft.com/kb/287547 case '1.3.6.1.4.1.311.20.2': // szOID_ENROLL_CERTTYPE_EXTENSION case '1.3.6.1.4.1.311.21.1': // szOID_CERTSRV_CA_VERSION // "SET Secure Electronic Transaction Specification" // http://www.maithean.com/docs/set_bk3.pdf case '2.23.42.7.0': // id-set-hashedRootKey // "Certificate Transparency" // https://tools.ietf.org/html/rfc6962 case '1.3.6.1.4.1.11129.2.4.2': return true; // CSR attributes case 'pkcs-9-at-unstructuredName': return Maps\PKCS9String::MAP; case 'pkcs-9-at-challengePassword': return Maps\DirectoryString::MAP; case 'pkcs-9-at-extensionRequest': return Maps\Extensions::MAP; // CRL extensions. case 'id-ce-cRLNumber': return Maps\CRLNumber::MAP; case 'id-ce-deltaCRLIndicator': return Maps\CRLNumber::MAP; case 'id-ce-issuingDistributionPoint': return Maps\IssuingDistributionPoint::MAP; case 'id-ce-freshestCRL': return Maps\CRLDistributionPoints::MAP; case 'id-ce-cRLReasons': return Maps\CRLReason::MAP; case 'id-ce-invalidityDate': return Maps\InvalidityDate::MAP; case 'id-ce-certificateIssuer': return Maps\CertificateIssuer::MAP; case 'id-ce-holdInstructionCode': return Maps\HoldInstructionCode::MAP; case 'id-at-postalAddress': return Maps\PostalAddress::MAP; } return false; } /** * Load an X.509 certificate as a certificate authority * * @param string $cert * @access public * @return bool */ public function loadCA($cert) { $olddn = $this->dn; $oldcert = $this->currentCert; $oldsigsubj = $this->signatureSubject; $oldkeyid = $this->currentKeyIdentifier; $cert = $this->loadX509($cert); if (!$cert) { $this->dn = $olddn; $this->currentCert = $oldcert; $this->signatureSubject = $oldsigsubj; $this->currentKeyIdentifier = $oldkeyid; return false; } /* From RFC5280 "PKIX Certificate and CRL Profile": If the keyUsage extension is present, then the subject public key MUST NOT be used to verify signatures on certificates or CRLs unless the corresponding keyCertSign or cRLSign bit is set. */ //$keyUsage = $this->getExtension('id-ce-keyUsage'); //if ($keyUsage && !in_array('keyCertSign', $keyUsage)) { // return false; //} /* From RFC5280 "PKIX Certificate and CRL Profile": The cA boolean indicates whether the certified public key may be used to verify certificate signatures. If the cA boolean is not asserted, then the keyCertSign bit in the key usage extension MUST NOT be asserted. If the basic constraints extension is not present in a version 3 certificate, or the extension is present but the cA boolean is not asserted, then the certified public key MUST NOT be used to verify certificate signatures. */ //$basicConstraints = $this->getExtension('id-ce-basicConstraints'); //if (!$basicConstraints || !$basicConstraints['cA']) { // return false; //} $this->CAs[] = $cert; $this->dn = $olddn; $this->currentCert = $oldcert; $this->signatureSubject = $oldsigsubj; return true; } /** * Validate an X.509 certificate against a URL * * From RFC2818 "HTTP over TLS": * * Matching is performed using the matching rules specified by * [RFC2459]. If more than one identity of a given type is present in * the certificate (e.g., more than one dNSName name, a match in any one * of the set is considered acceptable.) Names may contain the wildcard * character * which is considered to match any single domain name * component or component fragment. E.g., *.a.com matches foo.a.com but * not bar.foo.a.com. f*.com matches foo.com but not bar.com. * * @param string $url * @access public * @return bool */ public function validateURL($url) { if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) { return false; } $components = parse_url($url); if (!isset($components['host'])) { return false; } if ($names = $this->getExtension('id-ce-subjectAltName')) { foreach ($names as $name) { foreach ($name as $key => $value) { $value = str_replace(['.', '*'], ['\.', '[^.]*'], $value); switch ($key) { case 'dNSName': /* From RFC2818 "HTTP over TLS": If a subjectAltName extension of type dNSName is present, that MUST be used as the identity. Otherwise, the (most specific) Common Name field in the Subject field of the certificate MUST be used. Although the use of the Common Name is existing practice, it is deprecated and Certification Authorities are encouraged to use the dNSName instead. */ if (preg_match('#^' . $value . '$#', $components['host'])) { return true; } break; case 'iPAddress': /* From RFC2818 "HTTP over TLS": In some cases, the URI is specified as an IP address rather than a hostname. In this case, the iPAddress subjectAltName must be present in the certificate and must exactly match the IP in the URI. */ if (preg_match('#(?:\d{1-3}\.){4}#', $components['host'] . '.') && preg_match('#^' . $value . '$#', $components['host'])) { return true; } } } } return false; } if ($value = $this->getDNProp('id-at-commonName')) { $value = str_replace(['.', '*'], ['\.', '[^.]*'], $value[0]); return preg_match('#^' . $value . '$#', $components['host']); } return false; } /** * Validate a date * * If $date isn't defined it is assumed to be the current date. * * @param int $date optional * @access public * @return boolean */ public function validateDate($date = null) { if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) { return false; } if (!isset($date)) { $date = new DateTime($date, new DateTimeZone(@date_default_timezone_get())); } $notBefore = $this->currentCert['tbsCertificate']['validity']['notBefore']; $notBefore = isset($notBefore['generalTime']) ? $notBefore['generalTime'] : $notBefore['utcTime']; $notAfter = $this->currentCert['tbsCertificate']['validity']['notAfter']; $notAfter = isset($notAfter['generalTime']) ? $notAfter['generalTime'] : $notAfter['utcTime']; switch (true) { case $date < new DateTime($notBefore, new DateTimeZone(@date_default_timezone_get())): case $date > new DateTime($notAfter, new DateTimeZone(@date_default_timezone_get())): return false; } return true; } /** * Validate a signature * * Works on X.509 certs, CSR's and CRL's. * Returns true if the signature is verified, false if it is not correct or null on error * * By default returns false for self-signed certs. Call validateSignature(false) to make this support * self-signed. * * The behavior of this function is inspired by {@link http://php.net/openssl-verify openssl_verify}. * * @param bool $caonly optional * @access public * @return mixed */ public function validateSignature($caonly = true) { if (!is_array($this->currentCert) || !isset($this->signatureSubject)) { return null; } /* TODO: "emailAddress attribute values are not case-sensitive (e.g., "subscriber@example.com" is the same as "SUBSCRIBER@EXAMPLE.COM")." -- http://tools.ietf.org/html/rfc5280#section-4.1.2.6 implement pathLenConstraint in the id-ce-basicConstraints extension */ switch (true) { case isset($this->currentCert['tbsCertificate']): // self-signed cert switch (true) { case !defined('FILE_X509_IGNORE_TYPE') && $this->currentCert['tbsCertificate']['issuer'] === $this->currentCert['tbsCertificate']['subject']: case defined('FILE_X509_IGNORE_TYPE') && $this->getIssuerDN(self::DN_STRING) === $this->getDN(self::DN_STRING): $authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier'); $subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier'); switch (true) { case !is_array($authorityKey): case !$subjectKeyID: case isset($authorityKey['keyIdentifier']) && $authorityKey['keyIdentifier'] === $subjectKeyID: $signingCert = $this->currentCert; // working cert } } if (!empty($this->CAs)) { for ($i = 0; $i < count($this->CAs); $i++) { // even if the cert is a self-signed one we still want to see if it's a CA; // if not, we'll conditionally return an error $ca = $this->CAs[$i]; switch (true) { case !defined('FILE_X509_IGNORE_TYPE') && $this->currentCert['tbsCertificate']['issuer'] === $ca['tbsCertificate']['subject']: case defined('FILE_X509_IGNORE_TYPE') && $this->getDN(self::DN_STRING, $this->currentCert['tbsCertificate']['issuer']) === $this->getDN(self::DN_STRING, $ca['tbsCertificate']['subject']): $authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier'); $subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier', $ca); switch (true) { case !is_array($authorityKey): case !$subjectKeyID: case isset($authorityKey['keyIdentifier']) && $authorityKey['keyIdentifier'] === $subjectKeyID: if (is_array($authorityKey) && isset($authorityKey['authorityCertSerialNumber']) && !$authorityKey['authorityCertSerialNumber']->equals($ca['tbsCertificate']['serialNumber'])) { break 2; // serial mismatch - check other ca } $signingCert = $ca; // working cert break 3; } } } if (count($this->CAs) == $i && $caonly) { return false; } } elseif (!isset($signingCert) || $caonly) { return false; } return $this->validateSignatureHelper( $signingCert['tbsCertificate']['subjectPublicKeyInfo']['algorithm']['algorithm'], $signingCert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey'], $this->currentCert['signatureAlgorithm']['algorithm'], substr($this->currentCert['signature'], 1), $this->signatureSubject ); case isset($this->currentCert['certificationRequestInfo']): return $this->validateSignatureHelper( $this->currentCert['certificationRequestInfo']['subjectPKInfo']['algorithm']['algorithm'], $this->currentCert['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey'], $this->currentCert['signatureAlgorithm']['algorithm'], substr($this->currentCert['signature'], 1), $this->signatureSubject ); case isset($this->currentCert['publicKeyAndChallenge']): return $this->validateSignatureHelper( $this->currentCert['publicKeyAndChallenge']['spki']['algorithm']['algorithm'], $this->currentCert['publicKeyAndChallenge']['spki']['subjectPublicKey'], $this->currentCert['signatureAlgorithm']['algorithm'], substr($this->currentCert['signature'], 1), $this->signatureSubject ); case isset($this->currentCert['tbsCertList']): if (!empty($this->CAs)) { for ($i = 0; $i < count($this->CAs); $i++) { $ca = $this->CAs[$i]; switch (true) { case !defined('FILE_X509_IGNORE_TYPE') && $this->currentCert['tbsCertList']['issuer'] === $ca['tbsCertificate']['subject']: case defined('FILE_X509_IGNORE_TYPE') && $this->getDN(self::DN_STRING, $this->currentCert['tbsCertList']['issuer']) === $this->getDN(self::DN_STRING, $ca['tbsCertificate']['subject']): $authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier'); $subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier', $ca); switch (true) { case !is_array($authorityKey): case !$subjectKeyID: case isset($authorityKey['keyIdentifier']) && $authorityKey['keyIdentifier'] === $subjectKeyID: if (is_array($authorityKey) && isset($authorityKey['authorityCertSerialNumber']) && !$authorityKey['authorityCertSerialNumber']->equals($ca['tbsCertificate']['serialNumber'])) { break 2; // serial mismatch - check other ca } $signingCert = $ca; // working cert break 3; } } } } if (!isset($signingCert)) { return false; } return $this->validateSignatureHelper( $signingCert['tbsCertificate']['subjectPublicKeyInfo']['algorithm']['algorithm'], $signingCert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey'], $this->currentCert['signatureAlgorithm']['algorithm'], substr($this->currentCert['signature'], 1), $this->signatureSubject ); default: return false; } } /** * Validates a signature * * Returns true if the signature is verified and false if it is not correct. * If the algorithms are unsupposed an exception is thrown. * * @param string $publicKeyAlgorithm * @param string $publicKey * @param string $signatureAlgorithm * @param string $signature * @param string $signatureSubject * @access private * @throws \phpseclib\Exception\UnsupportedAlgorithmException if the algorithm is unsupported * @return bool */ private function validateSignatureHelper($publicKeyAlgorithm, $publicKey, $signatureAlgorithm, $signature, $signatureSubject) { switch ($publicKeyAlgorithm) { case 'rsaEncryption': $rsa = new RSA(); $rsa->load($publicKey); //zzzzz $rsa->setPublicKey(); switch ($signatureAlgorithm) { case 'md2WithRSAEncryption': case 'md5WithRSAEncryption': case 'sha1WithRSAEncryption': case 'sha224WithRSAEncryption': case 'sha256WithRSAEncryption': case 'sha384WithRSAEncryption': case 'sha512WithRSAEncryption': $rsa->setHash(preg_replace('#WithRSAEncryption$#', '', $signatureAlgorithm)); if (!@$rsa->verify($signatureSubject, $signature, RSA::PADDING_PKCS1)) { return false; } break; default: throw new UnsupportedAlgorithmException('Signature algorithm unsupported'); } break; default: throw new UnsupportedAlgorithmException('Public key algorithm unsupported'); } return true; } /** * Reformat public keys * * Reformats a public key to a format supported by phpseclib (if applicable) * * @param string $algorithm * @param string $key * @access private * @return string */ private function reformatKey($algorithm, $key) { switch ($algorithm) { case 'rsaEncryption': return "-----BEGIN RSA PUBLIC KEY-----\r\n" . // subjectPublicKey is stored as a bit string in X.509 certs. the first byte of a bit string represents how many bits // in the last byte should be ignored. the following only supports non-zero stuff but as none of the X.509 certs Firefox // uses as a cert authority actually use a non-zero bit I think it's safe to assume that none do. chunk_split(Base64::encode(substr($key, 1)), 64) . '-----END RSA PUBLIC KEY-----'; default: return $key; } } /** * Decodes an IP address * * Takes in a base64 encoded "blob" and returns a human readable IP address * * @param string $ip * @access private * @return string */ public function decodeIP($ip) { return inet_ntop($ip); } /** * Encodes an IP address * * Takes a human readable IP address into a base64-encoded "blob" * * @param string $ip * @access private * @return string */ public function encodeIP($ip) { return inet_pton($ip); } /** * "Normalizes" a Distinguished Name property * * @param string $propName * @access private * @return mixed */ private function translateDNProp($propName) { switch (strtolower($propName)) { case 'id-at-countryname': case 'countryname': case 'c': return 'id-at-countryName'; case 'id-at-organizationname': case 'organizationname': case 'o': return 'id-at-organizationName'; case 'id-at-dnqualifier': case 'dnqualifier': return 'id-at-dnQualifier'; case 'id-at-commonname': case 'commonname': case 'cn': return 'id-at-commonName'; case 'id-at-stateorprovincename': case 'stateorprovincename': case 'state': case 'province': case 'provincename': case 'st': return 'id-at-stateOrProvinceName'; case 'id-at-localityname': case 'localityname': case 'l': return 'id-at-localityName'; case 'id-emailaddress': case 'emailaddress': return 'pkcs-9-at-emailAddress'; case 'id-at-serialnumber': case 'serialnumber': return 'id-at-serialNumber'; case 'id-at-postalcode': case 'postalcode': return 'id-at-postalCode'; case 'id-at-streetaddress': case 'streetaddress': return 'id-at-streetAddress'; case 'id-at-name': case 'name': return 'id-at-name'; case 'id-at-givenname': case 'givenname': return 'id-at-givenName'; case 'id-at-surname': case 'surname': case 'sn': return 'id-at-surname'; case 'id-at-initials': case 'initials': return 'id-at-initials'; case 'id-at-generationqualifier': case 'generationqualifier': return 'id-at-generationQualifier'; case 'id-at-organizationalunitname': case 'organizationalunitname': case 'ou': return 'id-at-organizationalUnitName'; case 'id-at-pseudonym': case 'pseudonym': return 'id-at-pseudonym'; case 'id-at-title': case 'title': return 'id-at-title'; case 'id-at-description': case 'description': return 'id-at-description'; case 'id-at-role': case 'role': return 'id-at-role'; case 'id-at-uniqueidentifier': case 'uniqueidentifier': case 'x500uniqueidentifier': return 'id-at-uniqueIdentifier'; case 'postaladdress': case 'id-at-postaladdress': return 'id-at-postalAddress'; default: return false; } } /** * Set a Distinguished Name property * * @param string $propName * @param mixed $propValue * @param string $type optional * @access public * @return bool */ public function setDNProp($propName, $propValue, $type = 'utf8String') { if (empty($this->dn)) { $this->dn = ['rdnSequence' => []]; } if (($propName = $this->translateDNProp($propName)) === false) { return false; } foreach ((array) $propValue as $v) { if (!is_array($v) && isset($type)) { $v = [$type => $v]; } $this->dn['rdnSequence'][] = [ [ 'type' => $propName, 'value'=> $v ] ]; } return true; } /** * Remove Distinguished Name properties * * @param string $propName * @access public */ public function removeDNProp($propName) { if (empty($this->dn)) { return; } if (($propName = $this->translateDNProp($propName)) === false) { return; } $dn = &$this->dn['rdnSequence']; $size = count($dn); for ($i = 0; $i < $size; $i++) { if ($dn[$i][0]['type'] == $propName) { unset($dn[$i]); } } $dn = array_values($dn); // fix for https://bugs.php.net/75433 affecting PHP 7.2 if (!isset($dn[0])) { $dn = array_splice($dn, 0, 0); } } /** * Get Distinguished Name properties * * @param string $propName * @param array $dn optional * @param bool $withType optional * @return mixed * @access public */ public function getDNProp($propName, $dn = null, $withType = false) { if (!isset($dn)) { $dn = $this->dn; } if (empty($dn)) { return false; } if (($propName = $this->translateDNProp($propName)) === false) { return false; } $filters = []; $filters['value'] = ['type' => ASN1::TYPE_UTF8_STRING]; ASN1::setFilters($filters); $this->mapOutDNs($dn, 'rdnSequence'); $dn = $dn['rdnSequence']; $result = []; for ($i = 0; $i < count($dn); $i++) { if ($dn[$i][0]['type'] == $propName) { $v = $dn[$i][0]['value']; if (!$withType) { if (is_array($v)) { foreach ($v as $type => $s) { $type = array_search($type, ASN1::ANY_MAP); if ($type !== false && array_key_exists($type, ASN1::STRING_TYPE_SIZE)) { $s = ASN1::convert($s, $type); if ($s !== false) { $v = $s; break; } } } if (is_array($v)) { $v = array_pop($v); // Always strip data type. } } elseif (is_object($v) && $v instanceof Element) { $map = $this->getMapping($propName); if (!is_bool($map)) { $decoded = ASN1::decodeBER($v); $v = ASN1::asn1map($decoded[0], $map); } } } $result[] = $v; } } return $result; } /** * Set a Distinguished Name * * @param mixed $dn * @param bool $merge optional * @param string $type optional * @access public * @return bool */ public function setDN($dn, $merge = false, $type = 'utf8String') { if (!$merge) { $this->dn = null; } if (is_array($dn)) { if (isset($dn['rdnSequence'])) { $this->dn = $dn; // No merge here. return true; } // handles stuff generated by openssl_x509_parse() foreach ($dn as $prop => $value) { if (!$this->setDNProp($prop, $value, $type)) { return false; } } return true; } // handles everything else $results = preg_split('#((?:^|, *|/)(?:C=|O=|OU=|CN=|L=|ST=|SN=|postalCode=|streetAddress=|emailAddress=|serialNumber=|organizationalUnitName=|title=|description=|role=|x500UniqueIdentifier=|postalAddress=))#', $dn, -1, PREG_SPLIT_DELIM_CAPTURE); for ($i = 1; $i < count($results); $i+=2) { $prop = trim($results[$i], ', =/'); $value = $results[$i + 1]; if (!$this->setDNProp($prop, $value, $type)) { return false; } } return true; } /** * Get the Distinguished Name for a certificates subject * * @param mixed $format optional * @param array $dn optional * @access public * @return array|bool */ public function getDN($format = self::DN_ARRAY, $dn = null) { if (!isset($dn)) { $dn = isset($this->currentCert['tbsCertList']) ? $this->currentCert['tbsCertList']['issuer'] : $this->dn; } switch ((int) $format) { case self::DN_ARRAY: return $dn; case self::DN_ASN1: $filters = []; $filters['rdnSequence']['value'] = ['type' => ASN1::TYPE_UTF8_STRING]; ASN1::setFilters($filters); $this->mapOutDNs($dn, 'rdnSequence'); return ASN1::encodeDER($dn, Maps\Name::MAP); case self::DN_CANON: // No SEQUENCE around RDNs and all string values normalized as // trimmed lowercase UTF-8 with all spacing as one blank. // constructed RDNs will not be canonicalized $filters = []; $filters['value'] = ['type' => ASN1::TYPE_UTF8_STRING]; ASN1::setFilters($filters); $result = ''; $this->mapOutDNs($dn, 'rdnSequence'); foreach ($dn['rdnSequence'] as $rdn) { foreach ($rdn as $i => $attr) { $attr = &$rdn[$i]; if (is_array($attr['value'])) { foreach ($attr['value'] as $type => $v) { $type = array_search($type, ASN1::ANY_MAP, true); if ($type !== false && array_key_exists($type, ASN1::STRING_TYPE_SIZE)) { $v = ASN1::convert($v, $type); if ($v !== false) { $v = preg_replace('/\s+/', ' ', $v); $attr['value'] = strtolower(trim($v)); break; } } } } } $result .= ASN1::encodeDER($rdn, Maps\RelativeDistinguishedName::MAP); } return $result; case self::DN_HASH: $dn = $this->getDN(self::DN_CANON, $dn); $hash = new Hash('sha1'); $hash = $hash->hash($dn); extract(unpack('Vhash', $hash)); return strtolower(Hex::encode(pack('N', $hash))); } // Default is to return a string. $start = true; $output = ''; $result = []; $filters = []; $filters['rdnSequence']['value'] = ['type' => ASN1::TYPE_UTF8_STRING]; ASN1::setFilters($filters); $this->mapOutDNs($dn, 'rdnSequence'); foreach ($dn['rdnSequence'] as $field) { $prop = $field[0]['type']; $value = $field[0]['value']; $delim = ', '; switch ($prop) { case 'id-at-countryName': $desc = 'C'; break; case 'id-at-stateOrProvinceName': $desc = 'ST'; break; case 'id-at-organizationName': $desc = 'O'; break; case 'id-at-organizationalUnitName': $desc = 'OU'; break; case 'id-at-commonName': $desc = 'CN'; break; case 'id-at-localityName': $desc = 'L'; break; case 'id-at-surname': $desc = 'SN'; break; case 'id-at-uniqueIdentifier': $delim = '/'; $desc = 'x500UniqueIdentifier'; break; case 'id-at-postalAddress': $delim = '/'; $desc = 'postalAddress'; break; default: $delim = '/'; $desc = preg_replace('#.+-([^-]+)$#', '$1', $prop); } if (!$start) { $output.= $delim; } if (is_array($value)) { foreach ($value as $type => $v) { $type = array_search($type, ASN1::ANY_MAP, true); if ($type !== false && array_key_exists($type, ASN1::STRING_TYPE_SIZE)) { $v = ASN1::convert($v, $type); if ($v !== false) { $value = $v; break; } } } if (is_array($value)) { $value = array_pop($value); // Always strip data type. } } elseif (is_object($value) && $value instanceof Element) { $callback = function($x) { return '\x' . bin2hex($x[0]); }; $value = strtoupper(preg_replace_callback('#[^\x20-\x7E]#', $callback, $value->element)); } $output.= $desc . '=' . $value; $result[$desc] = isset($result[$desc]) ? array_merge((array) $dn[$prop], [$value]) : $value; $start = false; } return $format == self::DN_OPENSSL ? $result : $output; } /** * Get the Distinguished Name for a certificate/crl issuer * * @param int $format optional * @access public * @return mixed */ public function getIssuerDN($format = self::DN_ARRAY) { switch (true) { case !isset($this->currentCert) || !is_array($this->currentCert): break; case isset($this->currentCert['tbsCertificate']): return $this->getDN($format, $this->currentCert['tbsCertificate']['issuer']); case isset($this->currentCert['tbsCertList']): return $this->getDN($format, $this->currentCert['tbsCertList']['issuer']); } return false; } /** * Get the Distinguished Name for a certificate/csr subject * Alias of getDN() * * @param int $format optional * @access public * @return mixed */ public function getSubjectDN($format = self::DN_ARRAY) { switch (true) { case !empty($this->dn): return $this->getDN($format); case !isset($this->currentCert) || !is_array($this->currentCert): break; case isset($this->currentCert['tbsCertificate']): return $this->getDN($format, $this->currentCert['tbsCertificate']['subject']); case isset($this->currentCert['certificationRequestInfo']): return $this->getDN($format, $this->currentCert['certificationRequestInfo']['subject']); } return false; } /** * Get an individual Distinguished Name property for a certificate/crl issuer * * @param string $propName * @param bool $withType optional * @access public * @return mixed */ public function getIssuerDNProp($propName, $withType = false) { switch (true) { case !isset($this->currentCert) || !is_array($this->currentCert): break; case isset($this->currentCert['tbsCertificate']): return $this->getDNProp($propName, $this->currentCert['tbsCertificate']['issuer'], $withType); case isset($this->currentCert['tbsCertList']): return $this->getDNProp($propName, $this->currentCert['tbsCertList']['issuer'], $withType); } return false; } /** * Get an individual Distinguished Name property for a certificate/csr subject * * @param string $propName * @param bool $withType optional * @access public * @return mixed */ public function getSubjectDNProp($propName, $withType = false) { switch (true) { case !empty($this->dn): return $this->getDNProp($propName, null, $withType); case !isset($this->currentCert) || !is_array($this->currentCert): break; case isset($this->currentCert['tbsCertificate']): return $this->getDNProp($propName, $this->currentCert['tbsCertificate']['subject'], $withType); case isset($this->currentCert['certificationRequestInfo']): return $this->getDNProp($propName, $this->currentCert['certificationRequestInfo']['subject'], $withType); } return false; } /** * Get the certificate chain for the current cert * * @access public * @return mixed */ public function getChain() { $chain = [$this->currentCert]; if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) { return false; } if (empty($this->CAs)) { return $chain; } while (true) { $currentCert = $chain[count($chain) - 1]; for ($i = 0; $i < count($this->CAs); $i++) { $ca = $this->CAs[$i]; if ($currentCert['tbsCertificate']['issuer'] === $ca['tbsCertificate']['subject']) { $authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier', $currentCert); $subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier', $ca); switch (true) { case !is_array($authorityKey): case is_array($authorityKey) && isset($authorityKey['keyIdentifier']) && $authorityKey['keyIdentifier'] === $subjectKeyID: if ($currentCert === $ca) { break 3; } $chain[] = $ca; break 2; } } } if ($i == count($this->CAs)) { break; } } foreach ($chain as $key => $value) { $chain[$key] = new X509(); $chain[$key]->loadX509($value); } return $chain; } /** * Set public key * * Key needs to be a \phpseclib\Crypt\RSA object * * @param object $key * @access public * @return bool */ public function setPublicKey($key) { $key->setPublicKey(); $this->publicKey = $key; } /** * Set private key * * Key needs to be a \phpseclib\Crypt\RSA object * * @param object $key * @access public */ public function setPrivateKey($key) { $this->privateKey = $key; } /** * Set challenge * * Used for SPKAC CSR's * * @param string $challenge * @access public */ public function setChallenge($challenge) { $this->challenge = $challenge; } /** * Gets the public key * * Returns a \phpseclib\Crypt\RSA object or a false. * * @access public * @return mixed */ public function getPublicKey() { if (isset($this->publicKey)) { return $this->publicKey; } if (isset($this->currentCert) && is_array($this->currentCert)) { foreach (['tbsCertificate/subjectPublicKeyInfo', 'certificationRequestInfo/subjectPKInfo'] as $path) { $keyinfo = $this->subArray($this->currentCert, $path); if (!empty($keyinfo)) { break; } } } if (empty($keyinfo)) { return false; } $key = $keyinfo['subjectPublicKey']; switch ($keyinfo['algorithm']['algorithm']) { case 'rsaEncryption': $publicKey = new RSA(); $publicKey->load($key); $publicKey->setPublicKey(); break; default: return false; } return $publicKey; } /** * Load a Certificate Signing Request * * @param string $csr * @param int $mode * @return mixed * @access public */ public function loadCSR($csr, $mode = self::FORMAT_AUTO_DETECT) { if (is_array($csr) && isset($csr['certificationRequestInfo'])) { unset($this->currentCert); unset($this->currentKeyIdentifier); unset($this->signatureSubject); $this->dn = $csr['certificationRequestInfo']['subject']; if (!isset($this->dn)) { return false; } $this->currentCert = $csr; return $csr; } // see http://tools.ietf.org/html/rfc2986 if ($mode != self::FORMAT_DER) { $newcsr = ASN1::extractBER($csr); if ($mode == self::FORMAT_PEM && $csr == $newcsr) { return false; } $csr = $newcsr; } $orig = $csr; if ($csr === false) { $this->currentCert = false; return false; } $decoded = ASN1::decodeBER($csr); if (empty($decoded)) { $this->currentCert = false; return false; } $csr = ASN1::asn1map($decoded[0], Maps\CertificationRequest::MAP); if (!isset($csr) || $csr === false) { $this->currentCert = false; return false; } $this->mapInAttributes($csr, 'certificationRequestInfo/attributes'); $this->mapInDNs($csr, 'certificationRequestInfo/subject/rdnSequence'); $this->dn = $csr['certificationRequestInfo']['subject']; $this->signatureSubject = substr($orig, $decoded[0]['content'][0]['start'], $decoded[0]['content'][0]['length']); $algorithm = &$csr['certificationRequestInfo']['subjectPKInfo']['algorithm']['algorithm']; $key = &$csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey']; $key = $this->reformatKey($algorithm, $key); switch ($algorithm) { case 'rsaEncryption': $this->publicKey = new RSA(); $this->publicKey->load($key); $this->publicKey->setPublicKey(); break; default: $this->publicKey = null; } $this->currentKeyIdentifier = null; $this->currentCert = $csr; return $csr; } /** * Save CSR request * * @param array $csr * @param int $format optional * @access public * @return string */ public function saveCSR($csr, $format = self::FORMAT_PEM) { if (!is_array($csr) || !isset($csr['certificationRequestInfo'])) { return false; } switch (true) { case !($algorithm = $this->subArray($csr, 'certificationRequestInfo/subjectPKInfo/algorithm/algorithm')): case is_object($csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey']): break; default: switch ($algorithm) { case 'rsaEncryption': $csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey'] = "\0" . Base64::decode(preg_replace('#-.+-|[\r\n]#', '', $csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey'])); $csr['certificationRequestInfo']['subjectPKInfo']['algorithm']['parameters'] = null; $csr['signatureAlgorithm']['parameters'] = null; $csr['certificationRequestInfo']['signature']['parameters'] = null; } } $filters = []; $filters['certificationRequestInfo']['subject']['rdnSequence']['value'] = ['type' => ASN1::TYPE_UTF8_STRING]; ASN1::setFilters($filters); $this->mapOutDNs($csr, 'certificationRequestInfo/subject/rdnSequence'); $this->mapOutAttributes($csr, 'certificationRequestInfo/attributes'); $csr = ASN1::encodeDER($csr, Maps\CertificationRequest::MAP); switch ($format) { case self::FORMAT_DER: return $csr; // case self::FORMAT_PEM: default: return "-----BEGIN CERTIFICATE REQUEST-----\r\n" . chunk_split(Base64::encode($csr), 64) . '-----END CERTIFICATE REQUEST-----'; } } /** * Load a SPKAC CSR * * SPKAC's are produced by the HTML5 keygen element: * * https://developer.mozilla.org/en-US/docs/HTML/Element/keygen * * @param string $spkac * @access public * @return mixed */ public function loadSPKAC($spkac) { if (is_array($spkac) && isset($spkac['publicKeyAndChallenge'])) { unset($this->currentCert); unset($this->currentKeyIdentifier); unset($this->signatureSubject); $this->currentCert = $spkac; return $spkac; } // see http://www.w3.org/html/wg/drafts/html/master/forms.html#signedpublickeyandchallenge // OpenSSL produces SPKAC's that are preceded by the string SPKAC= $temp = preg_replace('#(?:SPKAC=)|[ \r\n\\\]#', '', $spkac); $temp = preg_match('#^[a-zA-Z\d/+]*={0,2}$#', $temp) ? Base64::decode($temp) : false; if ($temp != false) { $spkac = $temp; } $orig = $spkac; if ($spkac === false) { $this->currentCert = false; return false; } $decoded = ASN1::decodeBER($spkac); if (empty($decoded)) { $this->currentCert = false; return false; } $spkac = ASN1::asn1map($decoded[0], Maps\SignedPublicKeyAndChallenge::MAP); if (!isset($spkac) || $spkac === false) { $this->currentCert = false; return false; } $this->signatureSubject = substr($orig, $decoded[0]['content'][0]['start'], $decoded[0]['content'][0]['length']); $algorithm = &$spkac['publicKeyAndChallenge']['spki']['algorithm']['algorithm']; $key = &$spkac['publicKeyAndChallenge']['spki']['subjectPublicKey']; $key = $this->reformatKey($algorithm, $key); switch ($algorithm) { case 'rsaEncryption': $this->publicKey = new RSA(); $this->publicKey->load($key); break; default: $this->publicKey = null; } $this->currentKeyIdentifier = null; $this->currentCert = $spkac; return $spkac; } /** * Save a SPKAC CSR request * * @param array $spkac * @param int $format optional * @access public * @return string */ public function saveSPKAC($spkac, $format = self::FORMAT_PEM) { if (!is_array($spkac) || !isset($spkac['publicKeyAndChallenge'])) { return false; } $algorithm = $this->subArray($spkac, 'publicKeyAndChallenge/spki/algorithm/algorithm'); switch (true) { case !$algorithm: case is_object($spkac['publicKeyAndChallenge']['spki']['subjectPublicKey']): break; default: switch ($algorithm) { case 'rsaEncryption': $spkac['publicKeyAndChallenge']['spki']['subjectPublicKey'] = "\0" . Base64::decode(preg_replace('#-.+-|[\r\n]#', '', $spkac['publicKeyAndChallenge']['spki']['subjectPublicKey'])); } } $spkac = ASN1::encodeDER($spkac, Maps\SignedPublicKeyAndChallenge::MAP); switch ($format) { case self::FORMAT_DER: return $spkac; // case self::FORMAT_PEM: default: // OpenSSL's implementation of SPKAC requires the SPKAC be preceded by SPKAC= and since there are pretty much // no other SPKAC decoders phpseclib will use that same format return 'SPKAC=' . Base64::encode($spkac); } } /** * Load a Certificate Revocation List * * @param string $crl * @param int $mode * @return mixed * @access public */ public function loadCRL($crl, $mode = self::FORMAT_AUTO_DETECT) { if (is_array($crl) && isset($crl['tbsCertList'])) { $this->currentCert = $crl; unset($this->signatureSubject); return $crl; } if ($mode != self::FORMAT_DER) { $newcrl = ASN1::extractBER($crl); if ($mode == self::FORMAT_PEM && $crl == $newcrl) { return false; } $crl = $newcrl; } $orig = $crl; if ($crl === false) { $this->currentCert = false; return false; } $decoded = ASN1::decodeBER($crl); if (empty($decoded)) { $this->currentCert = false; return false; } $crl = ASN1::asn1map($decoded[0], Maps\CertificateList::MAP); if (!isset($crl) || $crl === false) { $this->currentCert = false; return false; } $this->signatureSubject = substr($orig, $decoded[0]['content'][0]['start'], $decoded[0]['content'][0]['length']); $this->mapInDNs($crl, 'tbsCertList/issuer/rdnSequence'); if ($this->isSubArrayValid($crl, 'tbsCertList/crlExtensions')) { $this->mapInExtensions($crl, 'tbsCertList/crlExtensions'); } if ($this->isSubArrayValid($crl, 'tbsCertList/revokedCertificates')) { $rclist_ref = &$this->subArrayUnchecked($crl, 'tbsCertList/revokedCertificates'); if ($rclist_ref) { $rclist = $crl['tbsCertList']['revokedCertificates']; foreach ($rclist as $i => $extension) { if ($this->isSubArrayValid($rclist, "$i/crlEntryExtensions")) { $this->mapInExtensions($rclist_ref, "$i/crlEntryExtensions"); } } } } $this->currentKeyIdentifier = null; $this->currentCert = $crl; return $crl; } /** * Save Certificate Revocation List. * * @param array $crl * @param int $format optional * @access public * @return string */ public function saveCRL($crl, $format = self::FORMAT_PEM) { if (!is_array($crl) || !isset($crl['tbsCertList'])) { return false; } $filters = []; $filters['tbsCertList']['issuer']['rdnSequence']['value'] = ['type' => ASN1::TYPE_UTF8_STRING]; $filters['tbsCertList']['signature']['parameters'] = ['type' => ASN1::TYPE_UTF8_STRING]; $filters['signatureAlgorithm']['parameters'] = ['type' => ASN1::TYPE_UTF8_STRING]; if (empty($crl['tbsCertList']['signature']['parameters'])) { $filters['tbsCertList']['signature']['parameters'] = ['type' => ASN1::TYPE_NULL]; } if (empty($crl['signatureAlgorithm']['parameters'])) { $filters['signatureAlgorithm']['parameters'] = ['type' => ASN1::TYPE_NULL]; } ASN1::setFilters($filters); $this->mapOutDNs($crl, 'tbsCertList/issuer/rdnSequence'); $this->mapOutExtensions($crl, 'tbsCertList/crlExtensions'); $rclist = &$this->subArray($crl, 'tbsCertList/revokedCertificates'); if (is_array($rclist)) { foreach ($rclist as $i => $extension) { $this->mapOutExtensions($rclist, "$i/crlEntryExtensions"); } } $crl = ASN1::encodeDER($crl, Maps\CertificateList::MAP); switch ($format) { case self::FORMAT_DER: return $crl; // case self::FORMAT_PEM: default: return "-----BEGIN X509 CRL-----\r\n" . chunk_split(Base64::encode($crl), 64) . '-----END X509 CRL-----'; } } /** * Helper function to build a time field according to RFC 3280 section * - 4.1.2.5 Validity * - 5.1.2.4 This Update * - 5.1.2.5 Next Update * - 5.1.2.6 Revoked Certificates * by choosing utcTime iff year of date given is before 2050 and generalTime else. * * @param string $date in format date('D, d M Y H:i:s O') * @access private * @return array|Element */ private function timeField($date) { if ($date instanceof Element) { return $date; } $dateObj = new DateTime($date, new DateTimeZone('GMT')); $year = $dateObj->format('Y'); // the same way ASN1.php parses this if ($year < 2050) { return ['utcTime' => $date]; } else { return ['generalTime' => $date]; } } /** * Sign an X.509 certificate * * $issuer's private key needs to be loaded. * $subject can be either an existing X.509 cert (if you want to resign it), * a CSR or something with the DN and public key explicitly set. * * @param \phpseclib\File\X509 $issuer * @param \phpseclib\File\X509 $subject * @param string $signatureAlgorithm optional * @access public * @return mixed */ public function sign($issuer, $subject, $signatureAlgorithm = 'sha256WithRSAEncryption') { if (!is_object($issuer->privateKey) || empty($issuer->dn)) { return false; } if (isset($subject->publicKey) && !($subjectPublicKey = $subject->formatSubjectPublicKey())) { return false; } $currentCert = isset($this->currentCert) ? $this->currentCert : null; $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject: null; if (isset($subject->currentCert) && is_array($subject->currentCert) && isset($subject->currentCert['tbsCertificate'])) { $this->currentCert = $subject->currentCert; $this->currentCert['tbsCertificate']['signature']['algorithm'] = $signatureAlgorithm; $this->currentCert['signatureAlgorithm']['algorithm'] = $signatureAlgorithm; if (!empty($this->startDate)) { $this->currentCert['tbsCertificate']['validity']['notBefore'] = $this->timeField($this->startDate); } if (!empty($this->endDate)) { $this->currentCert['tbsCertificate']['validity']['notAfter'] = $this->timeField($this->endDate); } if (!empty($this->serialNumber)) { $this->currentCert['tbsCertificate']['serialNumber'] = $this->serialNumber; } if (!empty($subject->dn)) { $this->currentCert['tbsCertificate']['subject'] = $subject->dn; } if (!empty($subject->publicKey)) { $this->currentCert['tbsCertificate']['subjectPublicKeyInfo'] = $subjectPublicKey; } $this->removeExtension('id-ce-authorityKeyIdentifier'); if (isset($subject->domains)) { $this->removeExtension('id-ce-subjectAltName'); } } elseif (isset($subject->currentCert) && is_array($subject->currentCert) && isset($subject->currentCert['tbsCertList'])) { return false; } else { if (!isset($subject->publicKey)) { return false; } $startDate = new DateTime('now', new DateTimeZone(@date_default_timezone_get())); $startDate = !empty($this->startDate) ? $this->startDate : $startDate->format('D, d M Y H:i:s O'); $endDate = new DateTime('+1 year', new DateTimeZone(@date_default_timezone_get())); $endDate = !empty($this->endDate) ? $this->endDate : $endDate->format('D, d M Y H:i:s O'); /* "The serial number MUST be a positive integer" "Conforming CAs MUST NOT use serialNumber values longer than 20 octets." -- https://tools.ietf.org/html/rfc5280#section-4.1.2.2 for the integer to be positive the leading bit needs to be 0 hence the application of a bitmap */ $serialNumber = !empty($this->serialNumber) ? $this->serialNumber : new BigInteger(Random::string(20) & ("\x7F" . str_repeat("\xFF", 19)), 256); $this->currentCert = [ 'tbsCertificate' => [ 'version' => 'v3', 'serialNumber' => $serialNumber, // $this->setserialNumber() 'signature' => ['algorithm' => $signatureAlgorithm], 'issuer' => false, // this is going to be overwritten later 'validity' => [ 'notBefore' => $this->timeField($startDate), // $this->setStartDate() 'notAfter' => $this->timeField($endDate) // $this->setEndDate() ], 'subject' => $subject->dn, 'subjectPublicKeyInfo' => $subjectPublicKey ], 'signatureAlgorithm' => ['algorithm' => $signatureAlgorithm], 'signature' => false // this is going to be overwritten later ]; // Copy extensions from CSR. $csrexts = $subject->getAttribute('pkcs-9-at-extensionRequest', 0); if (!empty($csrexts)) { $this->currentCert['tbsCertificate']['extensions'] = $csrexts; } } $this->currentCert['tbsCertificate']['issuer'] = $issuer->dn; if (isset($issuer->currentKeyIdentifier)) { $this->setExtension('id-ce-authorityKeyIdentifier', [ //'authorityCertIssuer' => array( // array( // 'directoryName' => $issuer->dn // ) //), 'keyIdentifier' => $issuer->currentKeyIdentifier ]); //$extensions = &$this->currentCert['tbsCertificate']['extensions']; //if (isset($issuer->serialNumber)) { // $extensions[count($extensions) - 1]['authorityCertSerialNumber'] = $issuer->serialNumber; //} //unset($extensions); } if (isset($subject->currentKeyIdentifier)) { $this->setExtension('id-ce-subjectKeyIdentifier', $subject->currentKeyIdentifier); } $altName = []; if (isset($subject->domains) && count($subject->domains)) { $altName = array_map(['\phpseclib\File\X509', 'dnsName'], $subject->domains); } if (isset($subject->ipAddresses) && count($subject->ipAddresses)) { // should an IP address appear as the CN if no domain name is specified? idk //$ips = count($subject->domains) ? $subject->ipAddresses : array_slice($subject->ipAddresses, 1); $ipAddresses = []; foreach ($subject->ipAddresses as $ipAddress) { $encoded = $subject->ipAddress($ipAddress); if ($encoded !== false) { $ipAddresses[] = $encoded; } } if (count($ipAddresses)) { $altName = array_merge($altName, $ipAddresses); } } if (!empty($altName)) { $this->setExtension('id-ce-subjectAltName', $altName); } if ($this->caFlag) { $keyUsage = $this->getExtension('id-ce-keyUsage'); if (!$keyUsage) { $keyUsage = []; } $this->setExtension( 'id-ce-keyUsage', array_values(array_unique(array_merge($keyUsage, ['cRLSign', 'keyCertSign']))) ); $basicConstraints = $this->getExtension('id-ce-basicConstraints'); if (!$basicConstraints) { $basicConstraints = []; } $this->setExtension( 'id-ce-basicConstraints', array_unique(array_merge(['cA' => true], $basicConstraints)), true ); if (!isset($subject->currentKeyIdentifier)) { $this->setExtension('id-ce-subjectKeyIdentifier', $this->computeKeyIdentifier($this->currentCert), false, false); } } // resync $this->signatureSubject // save $tbsCertificate in case there are any \phpseclib\File\ASN1\Element objects in it $tbsCertificate = $this->currentCert['tbsCertificate']; $this->loadX509($this->saveX509($this->currentCert)); $result = $this->signHelper($issuer->privateKey, $signatureAlgorithm); $result['tbsCertificate'] = $tbsCertificate; $this->currentCert = $currentCert; $this->signatureSubject = $signatureSubject; return $result; } /** * Sign a CSR * * @access public * @param string $signatureAlgorithm * @return mixed */ public function signCSR($signatureAlgorithm = 'sha1WithRSAEncryption') { if (!is_object($this->privateKey) || empty($this->dn)) { return false; } $origPublicKey = $this->publicKey; $class = get_class($this->privateKey); $this->publicKey = new $class(); $this->publicKey->load($this->privateKey->getPublicKey()); $this->publicKey->setPublicKey(); if (!($publicKey = $this->formatSubjectPublicKey())) { return false; } $this->publicKey = $origPublicKey; $currentCert = isset($this->currentCert) ? $this->currentCert : null; $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject: null; if (isset($this->currentCert) && is_array($this->currentCert) && isset($this->currentCert['certificationRequestInfo'])) { $this->currentCert['signatureAlgorithm']['algorithm'] = $signatureAlgorithm; if (!empty($this->dn)) { $this->currentCert['certificationRequestInfo']['subject'] = $this->dn; } $this->currentCert['certificationRequestInfo']['subjectPKInfo'] = $publicKey; } else { $this->currentCert = [ 'certificationRequestInfo' => [ 'version' => 'v1', 'subject' => $this->dn, 'subjectPKInfo' => $publicKey ], 'signatureAlgorithm' => ['algorithm' => $signatureAlgorithm], 'signature' => false // this is going to be overwritten later ]; } // resync $this->signatureSubject // save $certificationRequestInfo in case there are any \phpseclib\File\ASN1\Element objects in it $certificationRequestInfo = $this->currentCert['certificationRequestInfo']; $this->loadCSR($this->saveCSR($this->currentCert)); $result = $this->signHelper($this->privateKey, $signatureAlgorithm); $result['certificationRequestInfo'] = $certificationRequestInfo; $this->currentCert = $currentCert; $this->signatureSubject = $signatureSubject; return $result; } /** * Sign a SPKAC * * @access public * @param string $signatureAlgorithm * @return mixed */ public function signSPKAC($signatureAlgorithm = 'sha1WithRSAEncryption') { if (!is_object($this->privateKey)) { return false; } $origPublicKey = $this->publicKey; $class = get_class($this->privateKey); $this->publicKey = new $class(); $this->publicKey->load($this->privateKey->getPublicKey()); $this->publicKey->setPublicKey(); $publicKey = $this->formatSubjectPublicKey(); if (!$publicKey) { return false; } $this->publicKey = $origPublicKey; $currentCert = isset($this->currentCert) ? $this->currentCert : null; $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject: null; // re-signing a SPKAC seems silly but since everything else supports re-signing why not? if (isset($this->currentCert) && is_array($this->currentCert) && isset($this->currentCert['publicKeyAndChallenge'])) { $this->currentCert['signatureAlgorithm']['algorithm'] = $signatureAlgorithm; $this->currentCert['publicKeyAndChallenge']['spki'] = $publicKey; if (!empty($this->challenge)) { // the bitwise AND ensures that the output is a valid IA5String $this->currentCert['publicKeyAndChallenge']['challenge'] = $this->challenge & str_repeat("\x7F", strlen($this->challenge)); } } else { $this->currentCert = [ 'publicKeyAndChallenge' => [ 'spki' => $publicKey, // quoting <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/keygen>, // "A challenge string that is submitted along with the public key. Defaults to an empty string if not specified." // both Firefox and OpenSSL ("openssl spkac -key private.key") behave this way // we could alternatively do this instead if we ignored the specs: // Random::string(8) & str_repeat("\x7F", 8) 'challenge' => !empty($this->challenge) ? $this->challenge : '' ], 'signatureAlgorithm' => ['algorithm' => $signatureAlgorithm], 'signature' => false // this is going to be overwritten later ]; } // resync $this->signatureSubject // save $publicKeyAndChallenge in case there are any \phpseclib\File\ASN1\Element objects in it $publicKeyAndChallenge = $this->currentCert['publicKeyAndChallenge']; $this->loadSPKAC($this->saveSPKAC($this->currentCert)); $result = $this->signHelper($this->privateKey, $signatureAlgorithm); $result['publicKeyAndChallenge'] = $publicKeyAndChallenge; $this->currentCert = $currentCert; $this->signatureSubject = $signatureSubject; return $result; } /** * Sign a CRL * * $issuer's private key needs to be loaded. * * @param \phpseclib\File\X509 $issuer * @param \phpseclib\File\X509 $crl * @param string $signatureAlgorithm optional * @access public * @return mixed */ public function signCRL($issuer, $crl, $signatureAlgorithm = 'sha1WithRSAEncryption') { if (!is_object($issuer->privateKey) || empty($issuer->dn)) { return false; } $currentCert = isset($this->currentCert) ? $this->currentCert : null; $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject : null; $thisUpdate = new DateTime('now', new DateTimeZone(@date_default_timezone_get())); $thisUpdate = !empty($this->startDate) ? $this->startDate : $thisUpdate->format('D, d M Y H:i:s O'); if (isset($crl->currentCert) && is_array($crl->currentCert) && isset($crl->currentCert['tbsCertList'])) { $this->currentCert = $crl->currentCert; $this->currentCert['tbsCertList']['signature']['algorithm'] = $signatureAlgorithm; $this->currentCert['signatureAlgorithm']['algorithm'] = $signatureAlgorithm; } else { $this->currentCert = [ 'tbsCertList' => [ 'version' => 'v2', 'signature' => ['algorithm' => $signatureAlgorithm], 'issuer' => false, // this is going to be overwritten later 'thisUpdate' => $this->timeField($thisUpdate) // $this->setStartDate() ], 'signatureAlgorithm' => ['algorithm' => $signatureAlgorithm], 'signature' => false // this is going to be overwritten later ]; } $tbsCertList = &$this->currentCert['tbsCertList']; $tbsCertList['issuer'] = $issuer->dn; $tbsCertList['thisUpdate'] = $this->timeField($thisUpdate); if (!empty($this->endDate)) { $tbsCertList['nextUpdate'] = $this->timeField($this->endDate); // $this->setEndDate() } else { unset($tbsCertList['nextUpdate']); } if (!empty($this->serialNumber)) { $crlNumber = $this->serialNumber; } else { $crlNumber = $this->getExtension('id-ce-cRLNumber'); // "The CRL number is a non-critical CRL extension that conveys a // monotonically increasing sequence number for a given CRL scope and // CRL issuer. This extension allows users to easily determine when a // particular CRL supersedes another CRL." // -- https://tools.ietf.org/html/rfc5280#section-5.2.3 $crlNumber = $crlNumber !== false ? $crlNumber->add(new BigInteger(1)) : null; } $this->removeExtension('id-ce-authorityKeyIdentifier'); $this->removeExtension('id-ce-issuerAltName'); // Be sure version >= v2 if some extension found. $version = isset($tbsCertList['version']) ? $tbsCertList['version'] : 0; if (!$version) { if (!empty($tbsCertList['crlExtensions'])) { $version = 1; // v2. } elseif (!empty($tbsCertList['revokedCertificates'])) { foreach ($tbsCertList['revokedCertificates'] as $cert) { if (!empty($cert['crlEntryExtensions'])) { $version = 1; // v2. } } } if ($version) { $tbsCertList['version'] = $version; } } // Store additional extensions. if (!empty($tbsCertList['version'])) { // At least v2. if (!empty($crlNumber)) { $this->setExtension('id-ce-cRLNumber', $crlNumber); } if (isset($issuer->currentKeyIdentifier)) { $this->setExtension('id-ce-authorityKeyIdentifier', [ //'authorityCertIssuer' => array( // ] // 'directoryName' => $issuer->dn // ] //), 'keyIdentifier' => $issuer->currentKeyIdentifier ]); //$extensions = &$tbsCertList['crlExtensions']; //if (isset($issuer->serialNumber)) { // $extensions[count($extensions) - 1]['authorityCertSerialNumber'] = $issuer->serialNumber; //} //unset($extensions); } $issuerAltName = $this->getExtension('id-ce-subjectAltName', $issuer->currentCert); if ($issuerAltName !== false) { $this->setExtension('id-ce-issuerAltName', $issuerAltName); } } if (empty($tbsCertList['revokedCertificates'])) { unset($tbsCertList['revokedCertificates']); } unset($tbsCertList); // resync $this->signatureSubject // save $tbsCertList in case there are any \phpseclib\File\ASN1\Element objects in it $tbsCertList = $this->currentCert['tbsCertList']; $this->loadCRL($this->saveCRL($this->currentCert)); $result = $this->signHelper($issuer->privateKey, $signatureAlgorithm); $result['tbsCertList'] = $tbsCertList; $this->currentCert = $currentCert; $this->signatureSubject = $signatureSubject; return $result; } /** * X.509 certificate signing helper function. * * @param object $key * @param string $signatureAlgorithm * @access public * @throws \phpseclib\Exception\UnsupportedAlgorithmException if the algorithm is unsupported * @return mixed */ private function signHelper($key, $signatureAlgorithm) { if ($key instanceof RSA) { switch ($signatureAlgorithm) { case 'md2WithRSAEncryption': case 'md5WithRSAEncryption': case 'sha1WithRSAEncryption': case 'sha224WithRSAEncryption': case 'sha256WithRSAEncryption': case 'sha384WithRSAEncryption': case 'sha512WithRSAEncryption': $key->setHash(preg_replace('#WithRSAEncryption$#', '', $signatureAlgorithm)); $this->currentCert['signature'] = "\0" . $key->sign($this->signatureSubject, RSA::PADDING_PKCS1); return $this->currentCert; default: throw new UnsupportedAlgorithmException('Signature algorithm unsupported'); } } throw new UnsupportedAlgorithmException('Unsupported public key algorithm'); } /** * Set certificate start date * * @param string $date * @access public */ public function setStartDate($date) { if (!is_object($date) || !is_a($date, 'DateTime')) { $date = new DateTime($date, new DateTimeZone(@date_default_timezone_get())); } $this->startDate = $date->format('D, d M Y H:i:s O'); } /** * Set certificate end date * * @param string $date * @access public */ public function setEndDate($date) { /* To indicate that a certificate has no well-defined expiration date, the notAfter SHOULD be assigned the GeneralizedTime value of 99991231235959Z. -- http://tools.ietf.org/html/rfc5280#section-4.1.2.5 */ if (strtolower($date) == 'lifetime') { $temp = '99991231235959Z'; $temp = chr(ASN1::TYPE_GENERALIZED_TIME) . ASN1::encodeLength(strlen($temp)) . $temp; $this->endDate = new Element($temp); } else { if (!is_object($date) || !is_a($date, 'DateTime')) { $date = new DateTime($date, new DateTimeZone(@date_default_timezone_get())); } $this->endDate = $date->format('D, d M Y H:i:s O'); } } /** * Set Serial Number * * @param string $serial * @param $base integer Optional * @access public */ public function setSerialNumber($serial, $base = -256) { $this->serialNumber = new BigInteger($serial, $base); } /** * Turns the certificate into a certificate authority * * @access public */ public function makeCA() { $this->caFlag = true; } /** * Check for validity of subarray * * This is intended for use in conjunction with _subArrayUnchecked(), * implementing the checks included in _subArray() but without copying * a potentially large array by passing its reference by-value to is_array(). * * @param array $root * @param string $path * @return boolean * @access private */ private function isSubArrayValid($root, $path) { if (!is_array($root)) { return false; } foreach (explode('/', $path) as $i) { if (!is_array($root)) { return false; } if (!isset($root[$i])) { return true; } $root = $root[$i]; } return true; } /** * Get a reference to a subarray * * This variant of _subArray() does no is_array() checking, * so $root should be checked with _isSubArrayValid() first. * * This is here for performance reasons: * Passing a reference (i.e. $root) by-value (i.e. to is_array()) * creates a copy. If $root is an especially large array, this is expensive. * * @param array $root * @param string $path absolute path with / as component separator * @param bool $create optional * @access private * @return array|false */ private function &subArrayUnchecked(&$root, $path, $create = false) { $false = false; foreach (explode('/', $path) as $i) { if (!isset($root[$i])) { if (!$create) { return $false; } $root[$i] = []; } $root = &$root[$i]; } return $root; } /** * Get a reference to a subarray * * @param array $root * @param string $path absolute path with / as component separator * @param bool $create optional * @access private * @return array|false */ private function &subArray(&$root, $path, $create = false) { $false = false; if (!is_array($root)) { return $false; } foreach (explode('/', $path) as $i) { if (!is_array($root)) { return $false; } if (!isset($root[$i])) { if (!$create) { return $false; } $root[$i] = []; } $root = &$root[$i]; } return $root; } /** * Get a reference to an extension subarray * * @param array $root * @param string $path optional absolute path with / as component separator * @param bool $create optional * @access private * @return array|false */ private function &extensions(&$root, $path = null, $create = false) { if (!isset($root)) { $root = $this->currentCert; } switch (true) { case !empty($path): case !is_array($root): break; case isset($root['tbsCertificate']): $path = 'tbsCertificate/extensions'; break; case isset($root['tbsCertList']): $path = 'tbsCertList/crlExtensions'; break; case isset($root['certificationRequestInfo']): $pth = 'certificationRequestInfo/attributes'; $attributes = &$this->subArray($root, $pth, $create); if (is_array($attributes)) { foreach ($attributes as $key => $value) { if ($value['type'] == 'pkcs-9-at-extensionRequest') { $path = "$pth/$key/value/0"; break 2; } } if ($create) { $key = count($attributes); $attributes[] = ['type' => 'pkcs-9-at-extensionRequest', 'value' => []]; $path = "$pth/$key/value/0"; } } break; } $extensions = &$this->subArray($root, $path, $create); if (!is_array($extensions)) { $false = false; return $false; } return $extensions; } /** * Remove an Extension * * @param string $id * @param string $path optional * @access private * @return bool */ private function removeExtensionHelper($id, $path = null) { $extensions = &$this->extensions($this->currentCert, $path); if (!is_array($extensions)) { return false; } $result = false; foreach ($extensions as $key => $value) { if ($value['extnId'] == $id) { unset($extensions[$key]); $result = true; } } $extensions = array_values($extensions); // fix for https://bugs.php.net/75433 affecting PHP 7.2 if (!isset($extensions[0])) { $extensions = array_splice($extensions, 0, 0); } return $result; } /** * Get an Extension * * Returns the extension if it exists and false if not * * @param string $id * @param array $cert optional * @param string $path optional * @access private * @return mixed */ private function getExtensionHelper($id, $cert = null, $path = null) { $extensions = $this->extensions($cert, $path); if (!is_array($extensions)) { return false; } foreach ($extensions as $key => $value) { if ($value['extnId'] == $id) { return $value['extnValue']; } } return false; } /** * Returns a list of all extensions in use * * @param array $cert optional * @param string $path optional * @access private * @return array */ private function getExtensionsHelper($cert = null, $path = null) { $exts = $this->extensions($cert, $path); $extensions = []; if (is_array($exts)) { foreach ($exts as $extension) { $extensions[] = $extension['extnId']; } } return $extensions; } /** * Set an Extension * * @param string $id * @param mixed $value * @param bool $critical optional * @param bool $replace optional * @param string $path optional * @access private * @return bool */ private function setExtensionHelper($id, $value, $critical = false, $replace = true, $path = null) { $extensions = &$this->extensions($this->currentCert, $path, true); if (!is_array($extensions)) { return false; } $newext = ['extnId' => $id, 'critical' => $critical, 'extnValue' => $value]; foreach ($extensions as $key => $value) { if ($value['extnId'] == $id) { if (!$replace) { return false; } $extensions[$key] = $newext; return true; } } $extensions[] = $newext; return true; } /** * Remove a certificate, CSR or CRL Extension * * @param string $id * @access public * @return bool */ public function removeExtension($id) { return $this->removeExtensionHelper($id); } /** * Get a certificate, CSR or CRL Extension * * Returns the extension if it exists and false if not * * @param string $id * @param array $cert optional * @param string $path * @access public * @return mixed */ public function getExtension($id, $cert = null, $path=null) { return $this->getExtensionHelper($id, $cert, $path); } /** * Returns a list of all extensions in use in certificate, CSR or CRL * * @param array $cert optional * @param string $path optional * @access public * @return array */ public function getExtensions($cert = null, $path = null) { return $this->getExtensionsHelper($cert, $path); } /** * Set a certificate, CSR or CRL Extension * * @param string $id * @param mixed $value * @param bool $critical optional * @param bool $replace optional * @access public * @return bool */ public function setExtension($id, $value, $critical = false, $replace = true) { return $this->setExtensionHelper($id, $value, $critical, $replace); } /** * Remove a CSR attribute. * * @param string $id * @param int $disposition optional * @access public * @return bool */ public function removeAttribute($id, $disposition = self::ATTR_ALL) { $attributes = &$this->subArray($this->currentCert, 'certificationRequestInfo/attributes'); if (!is_array($attributes)) { return false; } $result = false; foreach ($attributes as $key => $attribute) { if ($attribute['type'] == $id) { $n = count($attribute['value']); switch (true) { case $disposition == self::ATTR_APPEND: case $disposition == self::ATTR_REPLACE: return false; case $disposition >= $n: $disposition -= $n; break; case $disposition == self::ATTR_ALL: case $n == 1: unset($attributes[$key]); $result = true; break; default: unset($attributes[$key]['value'][$disposition]); $attributes[$key]['value'] = array_values($attributes[$key]['value']); $result = true; break; } if ($result && $disposition != self::ATTR_ALL) { break; } } } $attributes = array_values($attributes); return $result; } /** * Get a CSR attribute * * Returns the attribute if it exists and false if not * * @param string $id * @param int $disposition optional * @param array $csr optional * @access public * @return mixed */ public function getAttribute($id, $disposition = self::ATTR_ALL, $csr = null) { if (empty($csr)) { $csr = $this->currentCert; } $attributes = $this->subArray($csr, 'certificationRequestInfo/attributes'); if (!is_array($attributes)) { return false; } foreach ($attributes as $key => $attribute) { if ($attribute['type'] == $id) { $n = count($attribute['value']); switch (true) { case $disposition == self::ATTR_APPEND: case $disposition == self::ATTR_REPLACE: return false; case $disposition == self::ATTR_ALL: return $attribute['value']; case $disposition >= $n: $disposition -= $n; break; default: return $attribute['value'][$disposition]; } } } return false; } /** * Returns a list of all CSR attributes in use * * @param array $csr optional * @access public * @return array */ public function getAttributes($csr = null) { if (empty($csr)) { $csr = $this->currentCert; } $attributes = $this->subArray($csr, 'certificationRequestInfo/attributes'); $attrs = []; if (is_array($attributes)) { foreach ($attributes as $attribute) { $attrs[] = $attribute['type']; } } return $attrs; } /** * Set a CSR attribute * * @param string $id * @param mixed $value * @param int $disposition optional * @access public * @return bool */ public function setAttribute($id, $value, $disposition = self::ATTR_ALL) { $attributes = &$this->subArray($this->currentCert, 'certificationRequestInfo/attributes', true); if (!is_array($attributes)) { return false; } switch ($disposition) { case self::ATTR_REPLACE: $disposition = self::ATTR_APPEND; case self::ATTR_ALL: $this->removeAttribute($id); break; } foreach ($attributes as $key => $attribute) { if ($attribute['type'] == $id) { $n = count($attribute['value']); switch (true) { case $disposition == self::ATTR_APPEND: $last = $key; break; case $disposition >= $n: $disposition -= $n; break; default: $attributes[$key]['value'][$disposition] = $value; return true; } } } switch (true) { case $disposition >= 0: return false; case isset($last): $attributes[$last]['value'][] = $value; break; default: $attributes[] = ['type' => $id, 'value' => $disposition == self::ATTR_ALL ? $value: [$value]]; break; } return true; } /** * Sets the subject key identifier * * This is used by the id-ce-authorityKeyIdentifier and the id-ce-subjectKeyIdentifier extensions. * * @param string $value * @access public */ public function setKeyIdentifier($value) { if (empty($value)) { unset($this->currentKeyIdentifier); } else { $this->currentKeyIdentifier = $value; } } /** * Compute a public key identifier. * * Although key identifiers may be set to any unique value, this function * computes key identifiers from public key according to the two * recommended methods (4.2.1.2 RFC 3280). * Highly polymorphic: try to accept all possible forms of key: * - Key object * - \phpseclib\File\X509 object with public or private key defined * - Certificate or CSR array * - \phpseclib\File\ASN1\Element object * - PEM or DER string * * @param mixed $key optional * @param int $method optional * @access public * @return string binary key identifier */ public function computeKeyIdentifier($key = null, $method = 1) { if (is_null($key)) { $key = $this; } switch (true) { case is_string($key): break; case is_array($key) && isset($key['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey']): return $this->computeKeyIdentifier($key['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey'], $method); case is_array($key) && isset($key['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey']): return $this->computeKeyIdentifier($key['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey'], $method); case !is_object($key): return false; case $key instanceof Element: // Assume the element is a bitstring-packed key. $decoded = ASN1::decodeBER($key->element); if (empty($decoded)) { return false; } $raw = ASN1::asn1map($decoded[0], ['type' => ASN1::TYPE_BIT_STRING]); if (empty($raw)) { return false; } // If the key is private, compute identifier from its corresponding public key. $key = new RSA(); if (!$key->load($raw)) { return false; // Not an unencrypted RSA key. } if ($key->getPrivateKey() !== false) { // If private. return $this->computeKeyIdentifier($key, $method); } $key = $raw; // Is a public key. break; case $key instanceof X509: if (isset($key->publicKey)) { return $this->computeKeyIdentifier($key->publicKey, $method); } if (isset($key->privateKey)) { return $this->computeKeyIdentifier($key->privateKey, $method); } if (isset($key->currentCert['tbsCertificate']) || isset($key->currentCert['certificationRequestInfo'])) { return $this->computeKeyIdentifier($key->currentCert, $method); } return false; default: // Should be a key object (i.e.: \phpseclib\Crypt\RSA). $key = $key->getPublicKey(); break; } // If in PEM format, convert to binary. $key = ASN1::extractBER($key); // Now we have the key string: compute its sha-1 sum. $hash = new Hash('sha1'); $hash = $hash->hash($key); if ($method == 2) { $hash = substr($hash, -8); $hash[0] = chr((ord($hash[0]) & 0x0F) | 0x40); } return $hash; } /** * Format a public key as appropriate * * @access private * @return array|bool */ private function formatSubjectPublicKey() { if ($this->publicKey instanceof RSA) { // the following two return statements do the same thing. i dunno.. i just prefer the later for some reason. // the former is a good example of how to do fuzzing on the public key //return new Element(preg_replace('#-.+-|[\r\n]#', '', $this->publicKey->getPublicKey())); return [ 'algorithm' => ['algorithm' => 'rsaEncryption'], 'subjectPublicKey' => $this->publicKey->getPublicKey('PKCS1') ]; } return false; } /** * Set the domain name's which the cert is to be valid for * * @param $domains[] * @access public * @return array */ public function setDomain(...$domains) { $this->domains = $domains; $this->removeDNProp('id-at-commonName'); $this->setDNProp('id-at-commonName', $this->domains[0]); } /** * Set the IP Addresses's which the cert is to be valid for * * @access public * @param $ipAddresses[] optional */ public function setIPAddress(...$ipAddresses) { $this->ipAddresses = $ipAddresses; /* if (!isset($this->domains)) { $this->removeDNProp('id-at-commonName'); $this->setDNProp('id-at-commonName', $this->ipAddresses[0]); } */ } /** * Helper function to build domain array * * @access private * @param string $domain * @return array */ private function dnsName($domain) { return ['dNSName' => $domain]; } /** * Helper function to build IP Address array * * (IPv6 is not currently supported) * * @access private * @param string $address * @return array */ private function iPAddress($address) { return ['iPAddress' => $address]; } /** * Get the index of a revoked certificate. * * @param array $rclist * @param string $serial * @param bool $create optional * @access private * @return int|false */ private function revokedCertificate(&$rclist, $serial, $create = false) { $serial = new BigInteger($serial); foreach ($rclist as $i => $rc) { if (!($serial->compare($rc['userCertificate']))) { return $i; } } if (!$create) { return false; } $i = count($rclist); $revocationDate = new DateTime('now', new DateTimeZone(@date_default_timezone_get())); $rclist[] = ['userCertificate' => $serial, 'revocationDate' => $this->timeField($revocationDate->format('D, d M Y H:i:s O'))]; return $i; } /** * Revoke a certificate. * * @param string $serial * @param string $date optional * @access public * @return bool */ public function revoke($serial, $date = null) { if (isset($this->currentCert['tbsCertList'])) { if (is_array($rclist = &$this->subArray($this->currentCert, 'tbsCertList/revokedCertificates', true))) { if ($this->revokedCertificate($rclist, $serial) === false) { // If not yet revoked if (($i = $this->revokedCertificate($rclist, $serial, true)) !== false) { if (!empty($date)) { $rclist[$i]['revocationDate'] = $this->timeField($date); } return true; } } } } return false; } /** * Unrevoke a certificate. * * @param string $serial * @access public * @return bool */ public function unrevoke($serial) { if (is_array($rclist = &$this->subArray($this->currentCert, 'tbsCertList/revokedCertificates'))) { if (($i = $this->revokedCertificate($rclist, $serial)) !== false) { unset($rclist[$i]); $rclist = array_values($rclist); return true; } } return false; } /** * Get a revoked certificate. * * @param string $serial * @access public * @return mixed */ public function getRevoked($serial) { if (is_array($rclist = $this->subArray($this->currentCert, 'tbsCertList/revokedCertificates'))) { if (($i = $this->revokedCertificate($rclist, $serial)) !== false) { return $rclist[$i]; } } return false; } /** * List revoked certificates * * @param array $crl optional * @access public * @return array|bool */ public function listRevoked($crl = null) { if (!isset($crl)) { $crl = $this->currentCert; } if (!isset($crl['tbsCertList'])) { return false; } $result = []; if (is_array($rclist = $this->subArray($crl, 'tbsCertList/revokedCertificates'))) { foreach ($rclist as $rc) { $result[] = $rc['userCertificate']->toString(); } } return $result; } /** * Remove a Revoked Certificate Extension * * @param string $serial * @param string $id * @access public * @return bool */ public function removeRevokedCertificateExtension($serial, $id) { if (is_array($rclist = &$this->subArray($this->currentCert, 'tbsCertList/revokedCertificates'))) { if (($i = $this->revokedCertificate($rclist, $serial)) !== false) { return $this->removeExtensionHelper($id, "tbsCertList/revokedCertificates/$i/crlEntryExtensions"); } } return false; } /** * Get a Revoked Certificate Extension * * Returns the extension if it exists and false if not * * @param string $serial * @param string $id * @param array $crl optional * @access public * @return mixed */ public function getRevokedCertificateExtension($serial, $id, $crl = null) { if (!isset($crl)) { $crl = $this->currentCert; } if (is_array($rclist = $this->subArray($crl, 'tbsCertList/revokedCertificates'))) { if (($i = $this->revokedCertificate($rclist, $serial)) !== false) { return $this->getExtension($id, $crl, "tbsCertList/revokedCertificates/$i/crlEntryExtensions"); } } return false; } /** * Returns a list of all extensions in use for a given revoked certificate * * @param string $serial * @param array $crl optional * @access public * @return array|bool */ public function getRevokedCertificateExtensions($serial, $crl = null) { if (!isset($crl)) { $crl = $this->currentCert; } if (is_array($rclist = $this->subArray($crl, 'tbsCertList/revokedCertificates'))) { if (($i = $this->revokedCertificate($rclist, $serial)) !== false) { return $this->getExtensions($crl, "tbsCertList/revokedCertificates/$i/crlEntryExtensions"); } } return false; } /** * Set a Revoked Certificate Extension * * @param string $serial * @param string $id * @param mixed $value * @param bool $critical optional * @param bool $replace optional * @access public * @return bool */ public function setRevokedCertificateExtension($serial, $id, $value, $critical = false, $replace = true) { if (isset($this->currentCert['tbsCertList'])) { if (is_array($rclist = &$this->subArray($this->currentCert, 'tbsCertList/revokedCertificates', true))) { if (($i = $this->revokedCertificate($rclist, $serial, true)) !== false) { return $this->setExtensionHelper($id, $value, $critical, $replace, "tbsCertList/revokedCertificates/$i/crlEntryExtensions"); } } } return false; } } <?php /** * Pure-PHP ANSI Decoder * * PHP version 5 * * If you call read() in \phpseclib\Net\SSH2 you may get {@link http://en.wikipedia.org/wiki/ANSI_escape_code ANSI escape codes} back. * They'd look like chr(0x1B) . '[00m' or whatever (0x1B = ESC). They tell a * {@link http://en.wikipedia.org/wiki/Terminal_emulator terminal emulator} how to format the characters, what * color to display them in, etc. \phpseclib\File\ANSI is a {@link http://en.wikipedia.org/wiki/VT100 VT100} terminal emulator. * * @category File * @package ANSI * @author Jim Wigginton <terrafrost@php.net> * @copyright 2012 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File; /** * Pure-PHP ANSI Decoder * * @package ANSI * @author Jim Wigginton <terrafrost@php.net> * @access public */ class ANSI { /** * Max Width * * @var int * @access private */ private $max_x; /** * Max Height * * @var int * @access private */ private $max_y; /** * Max History * * @var int * @access private */ private $max_history; /** * History * * @var array * @access private */ private $history; /** * History Attributes * * @var array * @access private */ private $history_attrs; /** * Current Column * * @var int * @access private */ private $x; /** * Current Row * * @var int * @access private */ private $y; /** * Old Column * * @var int * @access private */ private $old_x; /** * Old Row * * @var int * @access private */ private $old_y; /** * An empty attribute cell * * @var object * @access private */ private $base_attr_cell; /** * The current attribute cell * * @var object * @access private */ private $attr_cell; /** * An empty attribute row * * @var array * @access private */ private $attr_row; /** * The current screen text * * @var array * @access private */ private $screen; /** * The current screen attributes * * @var array * @access private */ private $attrs; /** * Current ANSI code * * @var string * @access private */ private $ansi; /** * Tokenization * * @var array * @access private */ private $tokenization; /** * Default Constructor. * * @return \phpseclib\File\ANSI * @access public */ public function __construct() { $attr_cell = new \stdClass(); $attr_cell->bold = false; $attr_cell->underline = false; $attr_cell->blink = false; $attr_cell->background = 'black'; $attr_cell->foreground = 'white'; $attr_cell->reverse = false; $this->base_attr_cell = clone $attr_cell; $this->attr_cell = clone $attr_cell; $this->setHistory(200); $this->setDimensions(80, 24); } /** * Set terminal width and height * * Resets the screen as well * * @param int $x * @param int $y * @access public */ public function setDimensions($x, $y) { $this->max_x = $x - 1; $this->max_y = $y - 1; $this->x = $this->y = 0; $this->history = $this->history_attrs = []; $this->attr_row = array_fill(0, $this->max_x + 2, $this->base_attr_cell); $this->screen = array_fill(0, $this->max_y + 1, ''); $this->attrs = array_fill(0, $this->max_y + 1, $this->attr_row); $this->ansi = ''; } /** * Set the number of lines that should be logged past the terminal height * * @param int $history * @access public */ public function setHistory($history) { $this->max_history = $history; } /** * Load a string * * @param string $source * @access public */ public function loadString($source) { $this->setDimensions($this->max_x + 1, $this->max_y + 1); $this->appendString($source); } /** * Appdend a string * * @param string $source * @access public */ public function appendString($source) { $this->tokenization = ['']; for ($i = 0; $i < strlen($source); $i++) { if (strlen($this->ansi)) { $this->ansi.= $source[$i]; $chr = ord($source[$i]); // http://en.wikipedia.org/wiki/ANSI_escape_code#Sequence_elements // single character CSI's not currently supported switch (true) { case $this->ansi == "\x1B=": $this->ansi = ''; continue 2; case strlen($this->ansi) == 2 && $chr >= 64 && $chr <= 95 && $chr != ord('['): case strlen($this->ansi) > 2 && $chr >= 64 && $chr <= 126: break; default: continue 2; } $this->tokenization[] = $this->ansi; $this->tokenization[] = ''; // http://ascii-table.com/ansi-escape-sequences-vt-100.php switch ($this->ansi) { case "\x1B[H": // Move cursor to upper left corner $this->old_x = $this->x; $this->old_y = $this->y; $this->x = $this->y = 0; break; case "\x1B[J": // Clear screen from cursor down $this->history = array_merge($this->history, array_slice(array_splice($this->screen, $this->y + 1), 0, $this->old_y)); $this->screen = array_merge($this->screen, array_fill($this->y, $this->max_y, '')); $this->history_attrs = array_merge($this->history_attrs, array_slice(array_splice($this->attrs, $this->y + 1), 0, $this->old_y)); $this->attrs = array_merge($this->attrs, array_fill($this->y, $this->max_y, $this->attr_row)); if (count($this->history) == $this->max_history) { array_shift($this->history); array_shift($this->history_attrs); } case "\x1B[K": // Clear screen from cursor right $this->screen[$this->y] = substr($this->screen[$this->y], 0, $this->x); array_splice($this->attrs[$this->y], $this->x + 1, $this->max_x - $this->x, array_fill($this->x, $this->max_x - $this->x - 1, $this->base_attr_cell)); break; case "\x1B[2K": // Clear entire line $this->screen[$this->y] = str_repeat(' ', $this->x); $this->attrs[$this->y] = $this->attr_row; break; case "\x1B[?1h": // set cursor key to application case "\x1B[?25h": // show the cursor case "\x1B(B": // set united states g0 character set break; case "\x1BE": // Move to next line $this->newLine(); $this->x = 0; break; default: switch (true) { case preg_match('#\x1B\[(\d+)B#', $this->ansi, $match): // Move cursor down n lines $this->old_y = $this->y; $this->y+= $match[1]; break; case preg_match('#\x1B\[(\d+);(\d+)H#', $this->ansi, $match): // Move cursor to screen location v,h $this->old_x = $this->x; $this->old_y = $this->y; $this->x = $match[2] - 1; $this->y = $match[1] - 1; break; case preg_match('#\x1B\[(\d+)C#', $this->ansi, $match): // Move cursor right n lines $this->old_x = $this->x; $this->x+= $match[1]; break; case preg_match('#\x1B\[(\d+)D#', $this->ansi, $match): // Move cursor left n lines $this->old_x = $this->x; $this->x-= $match[1]; if ($this->x < 0) { $this->x = 0; } break; case preg_match('#\x1B\[(\d+);(\d+)r#', $this->ansi, $match): // Set top and bottom lines of a window break; case preg_match('#\x1B\[(\d*(?:;\d*)*)m#', $this->ansi, $match): // character attributes $attr_cell = &$this->attr_cell; $mods = explode(';', $match[1]); foreach ($mods as $mod) { switch ($mod) { case 0: // Turn off character attributes $attr_cell = clone $this->base_attr_cell; break; case 1: // Turn bold mode on $attr_cell->bold = true; break; case 4: // Turn underline mode on $attr_cell->underline = true; break; case 5: // Turn blinking mode on $attr_cell->blink = true; break; case 7: // Turn reverse video on $attr_cell->reverse = !$attr_cell->reverse; $temp = $attr_cell->background; $attr_cell->background = $attr_cell->foreground; $attr_cell->foreground = $temp; break; default: // set colors //$front = $attr_cell->reverse ? &$attr_cell->background : &$attr_cell->foreground; $front = &$attr_cell->{ $attr_cell->reverse ? 'background' : 'foreground' }; //$back = $attr_cell->reverse ? &$attr_cell->foreground : &$attr_cell->background; $back = &$attr_cell->{ $attr_cell->reverse ? 'foreground' : 'background' }; switch ($mod) { // @codingStandardsIgnoreStart case 30: $front = 'black'; break; case 31: $front = 'red'; break; case 32: $front = 'green'; break; case 33: $front = 'yellow'; break; case 34: $front = 'blue'; break; case 35: $front = 'magenta'; break; case 36: $front = 'cyan'; break; case 37: $front = 'white'; break; case 40: $back = 'black'; break; case 41: $back = 'red'; break; case 42: $back = 'green'; break; case 43: $back = 'yellow'; break; case 44: $back = 'blue'; break; case 45: $back = 'magenta'; break; case 46: $back = 'cyan'; break; case 47: $back = 'white'; break; // @codingStandardsIgnoreEnd default: //user_error('Unsupported attribute: ' . $mod); $this->ansi = ''; break 2; } } } break; default: //user_error("{$this->ansi} is unsupported\r\n"); } } $this->ansi = ''; continue; } $this->tokenization[count($this->tokenization) - 1].= $source[$i]; switch ($source[$i]) { case "\r": $this->x = 0; break; case "\n": $this->newLine(); break; case "\x08": // backspace if ($this->x) { $this->x--; $this->attrs[$this->y][$this->x] = clone $this->base_attr_cell; $this->screen[$this->y] = substr_replace( $this->screen[$this->y], $source[$i], $this->x, 1 ); } break; case "\x0F": // shift break; case "\x1B": // start ANSI escape code $this->tokenization[count($this->tokenization) - 1] = substr($this->tokenization[count($this->tokenization) - 1], 0, -1); //if (!strlen($this->tokenization[count($this->tokenization) - 1])) { // array_pop($this->tokenization); //} $this->ansi.= "\x1B"; break; default: $this->attrs[$this->y][$this->x] = clone $this->attr_cell; if ($this->x > strlen($this->screen[$this->y])) { $this->screen[$this->y] = str_repeat(' ', $this->x); } $this->screen[$this->y] = substr_replace( $this->screen[$this->y], $source[$i], $this->x, 1 ); if ($this->x > $this->max_x) { $this->x = 0; $this->newLine(); } else { $this->x++; } } } } /** * Add a new line * * Also update the $this->screen and $this->history buffers * * @access private */ private function newLine() { //if ($this->y < $this->max_y) { // $this->y++; //} while ($this->y >= $this->max_y) { $this->history = array_merge($this->history, [array_shift($this->screen)]); $this->screen[] = ''; $this->history_attrs = array_merge($this->history_attrs, [array_shift($this->attrs)]); $this->attrs[] = $this->attr_row; if (count($this->history) >= $this->max_history) { array_shift($this->history); array_shift($this->history_attrs); } $this->y--; } $this->y++; } /** * Returns the current coordinate without preformating * * @access private * @param \stdClass $last_attr * @param \stdClass $cur_attr * @param string $char * @return string */ private function processCoordinate($last_attr, $cur_attr, $char) { $output = ''; if ($last_attr != $cur_attr) { $close = $open = ''; if ($last_attr->foreground != $cur_attr->foreground) { if ($cur_attr->foreground != 'white') { $open.= '<span style="color: ' . $cur_attr->foreground . '">'; } if ($last_attr->foreground != 'white') { $close = '</span>' . $close; } } if ($last_attr->background != $cur_attr->background) { if ($cur_attr->background != 'black') { $open.= '<span style="background: ' . $cur_attr->background . '">'; } if ($last_attr->background != 'black') { $close = '</span>' . $close; } } if ($last_attr->bold != $cur_attr->bold) { if ($cur_attr->bold) { $open.= '<b>'; } else { $close = '</b>' . $close; } } if ($last_attr->underline != $cur_attr->underline) { if ($cur_attr->underline) { $open.= '<u>'; } else { $close = '</u>' . $close; } } if ($last_attr->blink != $cur_attr->blink) { if ($cur_attr->blink) { $open.= '<blink>'; } else { $close = '</blink>' . $close; } } $output.= $close . $open; } $output.= htmlspecialchars($char); return $output; } /** * Returns the current screen without preformating * * @access private * @return string */ private function getScreenHelper() { $output = ''; $last_attr = $this->base_attr_cell; for ($i = 0; $i <= $this->max_y; $i++) { for ($j = 0; $j <= $this->max_x; $j++) { $cur_attr = $this->attrs[$i][$j]; $output.= $this->processCoordinate($last_attr, $cur_attr, isset($this->screen[$i][$j]) ? $this->screen[$i][$j] : ''); $last_attr = $this->attrs[$i][$j]; } $output.= "\r\n"; } $output = substr($output, 0, -2); // close any remaining open tags $output.= $this->processCoordinate($last_attr, $this->base_attr_cell, ''); return rtrim($output); } /** * Returns the current screen * * @access public * @return string */ public function getScreen() { return '<pre width="' . ($this->max_x + 1) . '" style="color: white; background: black">' . $this->getScreenHelper() . '</pre>'; } /** * Returns the current screen and the x previous lines * * @access public * @return string */ public function getHistory() { $scrollback = ''; $last_attr = $this->base_attr_cell; for ($i = 0; $i < count($this->history); $i++) { for ($j = 0; $j <= $this->max_x + 1; $j++) { $cur_attr = $this->history_attrs[$i][$j]; $scrollback.= $this->processCoordinate($last_attr, $cur_attr, isset($this->history[$i][$j]) ? $this->history[$i][$j] : ''); $last_attr = $this->history_attrs[$i][$j]; } $scrollback.= "\r\n"; } $base_attr_cell = $this->base_attr_cell; $this->base_attr_cell = $last_attr; $scrollback.= $this->getScreen(); $this->base_attr_cell = $base_attr_cell; return '<pre width="' . ($this->max_x + 1) . '" style="color: white; background: black">' . $scrollback . '</span></pre>'; } } <?php /** * ASN.1 Raw Element * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2012 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1; /** * ASN.1 Raw Element * * An ASN.1 ANY mapping will return an ASN1\Element object. Use of this object * will also bypass the normal encoding rules in ASN1::encodeDER() * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ class Element { /** * Raw element value * * @var string * @access private */ public $element; /** * Constructor * * @param string $encoded * @return \phpseclib\File\ASN1\Element * @access public */ public function __construct($encoded) { $this->element = $encoded; } } <?php /** * OrganizationName * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * OrganizationName * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class OrganizationName { const MAP = ['type' => ASN1::TYPE_PRINTABLE_STRING]; } <?php /** * PrivateDomainName * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PrivateDomainName * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PrivateDomainName { const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'numeric' => ['type' => ASN1::TYPE_NUMERIC_STRING], 'printable' => ['type' => ASN1::TYPE_PRINTABLE_STRING] ] ]; } <?php /** * PBKDF2params * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PBKDF2params * * from https://tools.ietf.org/html/rfc2898#appendix-A.3 * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PBKDF2params { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ // technically, this is a CHOICE in RFC2898 but the other "choice" is, currently, more of a placeholder // in the RFC 'salt'=> ['type' => ASN1::TYPE_OCTET_STRING], 'iterationCount'=> ['type' => ASN1::TYPE_INTEGER], 'keyLength' => [ 'type' => ASN1::TYPE_INTEGER, 'optional' => true ], 'prf' => AlgorithmIdentifier::MAP + ['optional' => true] ] ]; } <?php /** * GeneralName * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * GeneralName * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class GeneralName { const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'otherName' => [ 'constant' => 0, 'optional' => true, 'implicit' => true ] + AnotherName::MAP, 'rfc822Name' => [ 'type' => ASN1::TYPE_IA5_STRING, 'constant' => 1, 'optional' => true, 'implicit' => true ], 'dNSName' => [ 'type' => ASN1::TYPE_IA5_STRING, 'constant' => 2, 'optional' => true, 'implicit' => true ], 'x400Address' => [ 'constant' => 3, 'optional' => true, 'implicit' => true ] + ORAddress::MAP, 'directoryName' => [ 'constant' => 4, 'optional' => true, 'explicit' => true ] + Name::MAP, 'ediPartyName' => [ 'constant' => 5, 'optional' => true, 'implicit' => true ] + EDIPartyName::MAP, 'uniformResourceIdentifier' => [ 'type' => ASN1::TYPE_IA5_STRING, 'constant' => 6, 'optional' => true, 'implicit' => true ], 'iPAddress' => [ 'type' => ASN1::TYPE_OCTET_STRING, 'constant' => 7, 'optional' => true, 'implicit' => true ], 'registeredID' => [ 'type' => ASN1::TYPE_OBJECT_IDENTIFIER, 'constant' => 8, 'optional' => true, 'implicit' => true ] ] ]; } <?php /** * PBES2params * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PBES2params * * from https://tools.ietf.org/html/rfc2898#appendix-A.3 * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PBES2params { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'keyDerivationFunc'=> AlgorithmIdentifier::MAP, 'encryptionScheme' => AlgorithmIdentifier::MAP ] ]; } <?php /** * RSAPrivateKey * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * RSAPrivateKey * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class RSAPrivateKey { // version must be multi if otherPrimeInfos present const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'version' => [ 'type' => ASN1::TYPE_INTEGER, 'mapping' => ['two-prime', 'multi'] ], 'modulus' => ['type' => ASN1::TYPE_INTEGER], // n 'publicExponent' => ['type' => ASN1::TYPE_INTEGER], // e 'privateExponent' => ['type' => ASN1::TYPE_INTEGER], // d 'prime1' => ['type' => ASN1::TYPE_INTEGER], // p 'prime2' => ['type' => ASN1::TYPE_INTEGER], // q 'exponent1' => ['type' => ASN1::TYPE_INTEGER], // d mod (p-1) 'exponent2' => ['type' => ASN1::TYPE_INTEGER], // d mod (q-1) 'coefficient' => ['type' => ASN1::TYPE_INTEGER], // (inverse of q) mod p 'otherPrimeInfos' => OtherPrimeInfos::MAP + ['optional' => true] ] ]; } <?php /** * EDIPartyName * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * EDIPartyName * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class EDIPartyName { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'nameAssigner' => [ 'constant' => 0, 'optional' => true, 'implicit' => true ] + DirectoryString::MAP, // partyName is technically required but \phpseclib\File\ASN1 doesn't currently support non-optional constants and // setting it to optional gets the job done in any event. 'partyName' => [ 'constant' => 1, 'optional' => true, 'implicit' => true ] + DirectoryString::MAP ] ]; } <?php /** * SubjectDirectoryAttributes * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * SubjectDirectoryAttributes * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class SubjectDirectoryAttributes { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => Attribute::MAP ]; } <?php /** * UserNotice * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * UserNotice * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class UserNotice { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'noticeRef' => [ 'optional' => true, 'implicit' => true ] + NoticeReference::MAP, 'explicitText' => [ 'optional' => true, 'implicit' => true ] + DisplayText::MAP ] ]; } <?php /** * PostalAddress * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PostalAddress * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PostalAddress { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'optional' => true, 'min' => 1, 'max' => -1, 'children' => DirectoryString::MAP ]; } <?php /** * NetworkAddress * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * NetworkAddress * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class NetworkAddress { const MAP = ['type' => ASN1::TYPE_NUMERIC_STRING]; } <?php /** * AlgorithmIdentifier * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * AlgorithmIdentifier * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class AlgorithmIdentifier { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'algorithm' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'parameters' => [ 'type' => ASN1::TYPE_ANY, 'optional' => true ] ] ]; } <?php /** * PolicyQualifierInfo * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PolicyQualifierInfo * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PolicyQualifierInfo { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'policyQualifierId' => PolicyQualifierId::MAP, 'qualifier' => ['type' => ASN1::TYPE_ANY] ] ]; } <?php /** * PublicKeyAndChallenge * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PublicKeyAndChallenge * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PublicKeyAndChallenge { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'spki' => SubjectPublicKeyInfo::MAP, 'challenge' => ['type' => ASN1::TYPE_IA5_STRING] ] ]; } <?php /** * PrivateKeyUsagePeriod * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PrivateKeyUsagePeriod * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PrivateKeyUsagePeriod { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'notBefore' => [ 'constant' => 0, 'optional' => true, 'implicit' => true, 'type' => ASN1::TYPE_GENERALIZED_TIME], 'notAfter' => [ 'constant' => 1, 'optional' => true, 'implicit' => true, 'type' => ASN1::TYPE_GENERALIZED_TIME] ] ]; } <?php /** * Name * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * Name * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Name { const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'rdnSequence' => RDNSequence::MAP ] ]; } <?php /** * NameConstraints * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * NameConstraints * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class NameConstraints { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'permittedSubtrees' => [ 'constant' => 0, 'optional' => true, 'implicit' => true ] + GeneralSubtrees::MAP, 'excludedSubtrees' => [ 'constant' => 1, 'optional' => true, 'implicit' => true ] + GeneralSubtrees::MAP ] ]; } <?php /** * DistributionPointName * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * DistributionPointName * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class DistributionPointName { const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'fullName' => [ 'constant' => 0, 'optional' => true, 'implicit' => true ] + GeneralNames::MAP, 'nameRelativeToCRLIssuer' => [ 'constant' => 1, 'optional' => true, 'implicit' => true ] + RelativeDistinguishedName::MAP ] ]; } <?php /** * CertPolicyId * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * CertPolicyId * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class CertPolicyId { const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; } <?php /** * netscape_ca_policy_url * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * netscape_ca_policy_url * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class netscape_ca_policy_url { const MAP = ['type' => ASN1::TYPE_IA5_STRING]; } <?php /** * DssSigValue * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * DssSigValue * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class DssSigValue { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'r' => ['type' => ASN1::TYPE_INTEGER], 's' => ['type' => ASN1::TYPE_INTEGER] ] ]; } <?php /** * Time * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * Time * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Time { const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'utcTime' => ['type' => ASN1::TYPE_UTC_TIME], 'generalTime' => ['type' => ASN1::TYPE_GENERALIZED_TIME] ] ]; } <?php /** * netscape_cert_type * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * netscape_cert_type * * mapping is from <http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn3.html> * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class netscape_cert_type { const MAP = [ 'type' => ASN1::TYPE_BIT_STRING, 'mapping' => [ 'SSLClient', 'SSLServer', 'Email', 'ObjectSigning', 'Reserved', 'SSLCA', 'EmailCA', 'ObjectSigningCA' ] ]; } <?php /** * PrivateKeyInfo * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PrivateKeyInfo * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PrivateKeyInfo { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'version' => [ 'type' => ASN1::TYPE_INTEGER, 'mapping' => ['v1'] ], 'privateKeyAlgorithm'=> AlgorithmIdentifier::MAP, 'privateKey' => PrivateKey::MAP, 'attributes' => [ 'constant' => 0, 'optional' => true, 'implicit' => true ] + Attributes::MAP ] ]; } <?php /** * PublicKeyInfo * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PublicKeyInfo * * this format is not formally defined anywhere but is none-the-less the form you * get when you do "openssl rsa -in private.pem -outform PEM -pubout" * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PublicKeyInfo { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'publicKeyAlgorithm'=> AlgorithmIdentifier::MAP, 'publicKey' => ['type' => ASN1::TYPE_BIT_STRING] ] ]; } <?php /** * Extensions * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * Extensions * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Extensions { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, // technically, it's MAX, but we'll assume anything < 0 is MAX 'max' => -1, // if 'children' isn't an array then 'min' and 'max' must be defined 'children' => Extension::MAP ]; } <?php /** * AnotherName * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * AnotherName * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class AnotherName { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'type-id' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'value' => [ 'type' => ASN1::TYPE_ANY, 'constant' => 0, 'optional' => true, 'explicit' => true ] ] ]; } <?php /** * AttributeValue * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * AttributeValue * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class AttributeValue { const MAP = ['type' => ASN1::TYPE_ANY]; } <?php /** * DistributionPoint * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * DistributionPoint * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class DistributionPoint { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'distributionPoint' => [ 'constant' => 0, 'optional' => true, 'explicit' => true ] + DistributionPointName::MAP, 'reasons' => [ 'constant' => 1, 'optional' => true, 'implicit' => true ] + ReasonFlags::MAP, 'cRLIssuer' => [ 'constant' => 2, 'optional' => true, 'implicit' => true ] + GeneralNames::MAP ] ]; } <?php /** * Attributes * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * Attributes * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Attributes { const MAP = [ 'type' => ASN1::TYPE_SET, 'min' => 1, 'max' => -1, 'children' => Attribute::MAP ]; } <?php /** * NoticeReference * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * NoticeReference * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class NoticeReference { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'organization' => DisplayText::MAP, 'noticeNumbers' => [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => 200, 'children' => ['type' => ASN1::TYPE_INTEGER] ] ] ]; } <?php /** * TBSCertificate * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * TBSCertificate * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class TBSCertificate { // assert($TBSCertificate['children']['signature'] == $Certificate['children']['signatureAlgorithm']) const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ // technically, default implies optional, but we'll define it as being optional, none-the-less, just to // reenforce that fact 'version' => [ 'type' => ASN1::TYPE_INTEGER, 'constant' => 0, 'optional' => true, 'explicit' => true, 'mapping' => ['v1', 'v2', 'v3'], 'default' => 'v1' ], 'serialNumber' => CertificateSerialNumber::MAP, 'signature' => AlgorithmIdentifier::MAP, 'issuer' => Name::MAP, 'validity' => Validity::MAP, 'subject' => Name::MAP, 'subjectPublicKeyInfo' => SubjectPublicKeyInfo::MAP, // implicit means that the T in the TLV structure is to be rewritten, regardless of the type 'issuerUniqueID' => [ 'constant' => 1, 'optional' => true, 'implicit' => true ] + UniqueIdentifier::MAP, 'subjectUniqueID' => [ 'constant' => 2, 'optional' => true, 'implicit' => true ] + UniqueIdentifier::MAP, // <http://tools.ietf.org/html/rfc2459#page-74> doesn't use the EXPLICIT keyword but if // it's not IMPLICIT, it's EXPLICIT 'extensions' => [ 'constant' => 3, 'optional' => true, 'explicit' => true ] + Extensions::MAP ] ]; } <?php /** * RevokedCertificate * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * RevokedCertificate * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class RevokedCertificate { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'userCertificate' => CertificateSerialNumber::MAP, 'revocationDate' => Time::MAP, 'crlEntryExtensions' => [ 'optional' => true ] + Extensions::MAP ] ]; } <?php /** * BuiltInDomainDefinedAttributes * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * BuiltInDomainDefinedAttributes * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class BuiltInDomainDefinedAttributes { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => 4, // ub-domain-defined-attributes 'children' => BuiltInDomainDefinedAttribute::MAP ]; } <?php /** * PrivateKey * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PrivateKey * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PrivateKey { const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; } <?php /** * DisplayText * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * DisplayText * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class DisplayText { const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'ia5String' => ['type' => ASN1::TYPE_IA5_STRING], 'visibleString' => ['type' => ASN1::TYPE_VISIBLE_STRING], 'bmpString' => ['type' => ASN1::TYPE_BMP_STRING], 'utf8String' => ['type' => ASN1::TYPE_UTF8_STRING] ] ]; } <?php /** * RelativeDistinguishedName * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * RelativeDistinguishedName * * In practice, RDNs containing multiple name-value pairs (called "multivalued RDNs") are rare, * but they can be useful at times when either there is no unique attribute in the entry or you * want to ensure that the entry's DN contains some useful identifying information. * * - https://www.opends.org/wiki/page/DefinitionRelativeDistinguishedName * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class RelativeDistinguishedName { const MAP = [ 'type' => ASN1::TYPE_SET, 'min' => 1, 'max' => -1, 'children' => AttributeTypeAndValue::MAP ]; } <?php /** * CRLDistributionPoints * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * CRLDistributionPoints * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class CRLDistributionPoints { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => DistributionPoint::MAP ]; } <?php /** * AuthorityKeyIdentifier * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * AuthorityKeyIdentifier * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class AuthorityKeyIdentifier { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'keyIdentifier' => [ 'constant' => 0, 'optional' => true, 'implicit' => true ] + KeyIdentifier::MAP, 'authorityCertIssuer' => [ 'constant' => 1, 'optional' => true, 'implicit' => true ] + GeneralNames::MAP, 'authorityCertSerialNumber' => [ 'constant' => 2, 'optional' => true, 'implicit' => true ] + CertificateSerialNumber::MAP ] ]; } <?php /** * CRLReason * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * CRLReason * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class CRLReason { const MAP = [ 'type' => ASN1::TYPE_ENUMERATED, 'mapping' => [ 'unspecified', 'keyCompromise', 'cACompromise', 'affiliationChanged', 'superseded', 'cessationOfOperation', 'certificateHold', // Value 7 is not used. 8 => 'removeFromCRL', 'privilegeWithdrawn', 'aACompromise' ] ]; } <?php /** * DigestInfo * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * DigestInfo * * from https://tools.ietf.org/html/rfc2898#appendix-A.3 * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class DigestInfo { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'digestAlgorithm' => AlgorithmIdentifier::MAP, 'digest' => ['type' => ASN1::TYPE_OCTET_STRING] ] ]; } <?php /** * CertificatePolicies * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * CertificatePolicies * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class CertificatePolicies { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => PolicyInformation::MAP ]; } <?php /** * PolicyInformation * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PolicyInformation * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PolicyInformation { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'policyIdentifier' => CertPolicyId::MAP, 'policyQualifiers' => [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 0, 'max' => -1, 'optional' => true, 'children' => PolicyQualifierInfo::MAP ] ] ]; } <?php /** * BuiltInStandardAttributes * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * BuiltInStandardAttributes * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class BuiltInStandardAttributes { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'country-name' => ['optional' => true] + CountryName::MAP, 'administration-domain-name' => ['optional' => true] + AdministrationDomainName::MAP, 'network-address' => [ 'constant' => 0, 'optional' => true, 'implicit' => true ] + NetworkAddress::MAP, 'terminal-identifier' => [ 'constant' => 1, 'optional' => true, 'implicit' => true ] + TerminalIdentifier::MAP, 'private-domain-name' => [ 'constant' => 2, 'optional' => true, 'explicit' => true ] + PrivateDomainName::MAP, 'organization-name' => [ 'constant' => 3, 'optional' => true, 'implicit' => true ] + OrganizationName::MAP, 'numeric-user-identifier' => [ 'constant' => 4, 'optional' => true, 'implicit' => true ] + NumericUserIdentifier::MAP, 'personal-name' => [ 'constant' => 5, 'optional' => true, 'implicit' => true ] + PersonalName::MAP, 'organizational-unit-names' => [ 'constant' => 6, 'optional' => true, 'implicit' => true ] + OrganizationalUnitNames::MAP ] ]; } <?php /** * SignedPublicKeyAndChallenge * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * SignedPublicKeyAndChallenge * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class SignedPublicKeyAndChallenge { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'publicKeyAndChallenge' => PublicKeyAndChallenge::MAP, 'signatureAlgorithm' => AlgorithmIdentifier::MAP, 'signature' => ['type' => ASN1::TYPE_BIT_STRING] ] ]; } <?php /** * EncryptedPrivateKeyInfo * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * EncryptedPrivateKeyInfo * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class EncryptedPrivateKeyInfo { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'encryptionAlgorithm' => AlgorithmIdentifier::MAP, 'encryptedData' => EncryptedData::MAP ] ]; } <?php /** * CRLNumber * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * CRLNumber * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class CRLNumber { const MAP = ['type' => ASN1::TYPE_INTEGER]; } <?php /** * NumericUserIdentifier * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * NumericUserIdentifier * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class NumericUserIdentifier { const MAP = ['type' => ASN1::TYPE_NUMERIC_STRING]; } <?php /** * ExtensionAttributes * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * ExtensionAttributes * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class ExtensionAttributes { const MAP = [ 'type' => ASN1::TYPE_SET, 'min' => 1, 'max' => 256, // ub-extension-attributes 'children' => ExtensionAttribute::MAP ]; } <?php /** * PKCS9String * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PKCS9String * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PKCS9String { const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'ia5String' => ['type' => ASN1::TYPE_IA5_STRING], 'directoryString' => DirectoryString::MAP ] ]; } <?php /** * PolicyMappings * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PolicyMappings * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PolicyMappings { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'issuerDomainPolicy' => CertPolicyId::MAP, 'subjectDomainPolicy' => CertPolicyId::MAP ] ] ]; } <?php /** * CertificateList * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * CertificateList * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class CertificateList { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'tbsCertList' => TBSCertList::MAP, 'signatureAlgorithm' => AlgorithmIdentifier::MAP, 'signature' => ['type' => ASN1::TYPE_BIT_STRING] ] ]; } <?php /** * CertificationRequest * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * CertificationRequest * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class CertificationRequest { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'certificationRequestInfo' => CertificationRequestInfo::MAP, 'signatureAlgorithm' => AlgorithmIdentifier::MAP, 'signature' => ['type' => ASN1::TYPE_BIT_STRING] ] ]; } <?php /** * KeyUsage * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * KeyUsage * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class KeyUsage { const MAP = [ 'type' => ASN1::TYPE_BIT_STRING, 'mapping' => [ 'digitalSignature', 'nonRepudiation', 'keyEncipherment', 'dataEncipherment', 'keyAgreement', 'keyCertSign', 'cRLSign', 'encipherOnly', 'decipherOnly' ] ]; } <?php /** * ExtensionAttribute * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * ExtensionAttribute * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class ExtensionAttribute { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'extension-attribute-type' => [ 'type' => ASN1::TYPE_PRINTABLE_STRING, 'constant' => 0, 'optional' => true, 'implicit' => true ], 'extension-attribute-value' => [ 'type' => ASN1::TYPE_ANY, 'constant' => 1, 'optional' => true, 'explicit' => true ] ] ]; } <?php /** * ExtKeyUsageSyntax * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * ExtKeyUsageSyntax * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class ExtKeyUsageSyntax { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => KeyPurposeId::MAP ]; } <?php /** * CertificateSerialNumber * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * CertificateSerialNumber * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class CertificateSerialNumber { const MAP = ['type' => ASN1::TYPE_INTEGER]; } <?php /** * DirectoryString * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * DirectoryString * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class DirectoryString { const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'teletexString' => ['type' => ASN1::TYPE_TELETEX_STRING], 'printableString' => ['type' => ASN1::TYPE_PRINTABLE_STRING], 'universalString' => ['type' => ASN1::TYPE_UNIVERSAL_STRING], 'utf8String' => ['type' => ASN1::TYPE_UTF8_STRING], 'bmpString' => ['type' => ASN1::TYPE_BMP_STRING] ] ]; } <?php /** * Certificate * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * Certificate * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Certificate { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'tbsCertificate' => TBSCertificate::MAP, 'signatureAlgorithm' => AlgorithmIdentifier::MAP, 'signature' => ['type' => ASN1::TYPE_BIT_STRING] ] ]; } <?php /** * EncryptedData * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * EncryptedData * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class EncryptedData { const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; } <?php /** * HoldInstructionCode * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * HoldInstructionCode * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class HoldInstructionCode { const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; } <?php /** * OtherPrimeInfo * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * OtherPrimeInfo * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class OtherPrimeInfo { // version must be multi if otherPrimeInfos present const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'prime' => ['type' => ASN1::TYPE_INTEGER], // ri 'exponent' => ['type' => ASN1::TYPE_INTEGER], // di 'coefficient' => ['type' => ASN1::TYPE_INTEGER] // ti ] ]; } <?php /** * RSAPublicKey * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * RSAPublicKey * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class RSAPublicKey { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'modulus' => ['type' => ASN1::TYPE_INTEGER], 'publicExponent' => ['type' => ASN1::TYPE_INTEGER] ] ]; } <?php /** * PBEParameter * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PBEParameter * * from https://tools.ietf.org/html/rfc2898#appendix-A.3 * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PBEParameter { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'salt' => ['type' => ASN1::TYPE_OCTET_STRING], 'iterationCount' => ['type' => ASN1::TYPE_INTEGER] ] ]; } <?php /** * TBSCertList * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * TBSCertList * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class TBSCertList { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'version' => [ 'type' => ASN1::TYPE_INTEGER, 'mapping' => ['v1', 'v2', 'v3'], 'optional' => true, 'default' => 'v2' ], 'signature' => AlgorithmIdentifier::MAP, 'issuer' => Name::MAP, 'thisUpdate' => Time::MAP, 'nextUpdate' => [ 'optional' => true ] + Time::MAP, 'revokedCertificates' => [ 'type' => ASN1::TYPE_SEQUENCE, 'optional' => true, 'min' => 0, 'max' => -1, 'children' => RevokedCertificate::MAP ], 'crlExtensions' => [ 'constant' => 0, 'optional' => true, 'explicit' => true ] + Extensions::MAP ] ]; } <?php /** * BaseDistance * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * BaseDistance * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class BaseDistance { const MAP = ['type' => ASN1::TYPE_INTEGER]; } <?php /** * GeneralSubtrees * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * GeneralSubtrees * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class GeneralSubtrees { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => GeneralSubtree::MAP ]; } <?php /** * DSAParams * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * DSAParams * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class DSAParams { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'p' => ['type' => ASN1::TYPE_INTEGER], 'q' => ['type' => ASN1::TYPE_INTEGER], 'g' => ['type' => ASN1::TYPE_INTEGER] ] ]; } <?php /** * OtherPrimeInfos * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * OtherPrimeInfos * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class OtherPrimeInfos { // version must be multi if otherPrimeInfos present const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => OtherPrimeInfo::MAP ]; } <?php /** * ReasonFlags * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * ReasonFlags * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class ReasonFlags { const MAP = [ 'type' => ASN1::TYPE_BIT_STRING, 'mapping' => [ 'unused', 'keyCompromise', 'cACompromise', 'affiliationChanged', 'superseded', 'cessationOfOperation', 'certificateHold', 'privilegeWithdrawn', 'aACompromise' ] ]; } <?php /** * Validity * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * Validity * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Validity { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'notBefore' => Time::MAP, 'notAfter' => Time::MAP ] ]; } <?php /** * AuthorityInfoAccessSyntax * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * AuthorityInfoAccessSyntax * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class AuthorityInfoAccessSyntax { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => AccessDescription::MAP ]; } <?php /** * AccessDescription * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * AccessDescription * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class AccessDescription { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'accessMethod' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'accessLocation' => GeneralName::MAP ] ]; } <?php /** * DSAPublicKey * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * DSAPublicKey * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class DSAPublicKey { const MAP = ['type' => ASN1::TYPE_INTEGER]; } <?php /** * OrganizationalUnitNames * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * OrganizationalUnitNames * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class OrganizationalUnitNames { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => 4, // ub-organizational-units 'children' => ['type' => ASN1::TYPE_PRINTABLE_STRING] ]; } <?php /** * AdministrationDomainName * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * AdministrationDomainName * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class AdministrationDomainName { const MAP = [ 'type' => ASN1::TYPE_CHOICE, // if class isn't present it's assumed to be \phpseclib\File\ASN1::CLASS_UNIVERSAL or // (if constant is present) \phpseclib\File\ASN1::CLASS_CONTEXT_SPECIFIC 'class' => ASN1::CLASS_APPLICATION, 'cast' => 2, 'children' => [ 'numeric' => ['type' => ASN1::TYPE_NUMERIC_STRING], 'printable' => ['type' => ASN1::TYPE_PRINTABLE_STRING] ] ]; } <?php /** * ORAddress * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * ORAddress * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class ORAddress { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'built-in-standard-attributes' => BuiltInStandardAttributes::MAP, 'built-in-domain-defined-attributes' => ['optional' => true] + BuiltInDomainDefinedAttributes::MAP, 'extension-attributes' => ['optional' => true] + ExtensionAttributes::MAP ] ]; } <?php /** * BuiltInDomainDefinedAttribute * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * BuiltInDomainDefinedAttribute * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class BuiltInDomainDefinedAttribute { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'type' => ['type' => ASN1::TYPE_PRINTABLE_STRING], 'value' => ['type' => ASN1::TYPE_PRINTABLE_STRING] ] ]; } <?php /** * PolicyQualifierId * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PolicyQualifierId * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PolicyQualifierId { const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; } <?php /** * Extension * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * Extension * * A certificate using system MUST reject the certificate if it encounters * a critical extension it does not recognize; however, a non-critical * extension may be ignored if it is not recognized. * * http://tools.ietf.org/html/rfc5280#section-4.2 * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Extension { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'extnId' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'critical' => [ 'type' => ASN1::TYPE_BOOLEAN, 'optional' => true, 'default' => false ], 'extnValue' => ['type' => ASN1::TYPE_OCTET_STRING] ] ]; } <?php /** * BasicConstraints * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * BasicConstraints * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class BasicConstraints { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'cA' => [ 'type' => ASN1::TYPE_BOOLEAN, 'optional' => true, 'default' => false ], 'pathLenConstraint' => [ 'type' => ASN1::TYPE_INTEGER, 'optional' => true ] ] ]; } <?php /** * SubjectAltName * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * SubjectAltName * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class SubjectAltName { const MAP = GeneralNames::MAP; } <?php /** * AttributeTypeAndValue * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * AttributeTypeAndValue * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class AttributeTypeAndValue { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'type' => AttributeType::MAP, 'value'=> AttributeValue::MAP ] ]; } <?php /** * CertificateIssuer * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * CertificateIssuer * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class CertificateIssuer { const MAP = GeneralNames::MAP; } <?php /** * AttributeType * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * AttributeType * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class AttributeType { const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; } <?php /** * GeneralSubtree * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * GeneralSubtree * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class GeneralSubtree { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'base' => GeneralName::MAP, 'minimum' => [ 'constant' => 0, 'optional' => true, 'implicit' => true, 'default' => '0' ] + BaseDistance::MAP, 'maximum' => [ 'constant' => 1, 'optional' => true, 'implicit' => true, ] + BaseDistance::MAP ] ]; } <?php /** * InvalidityDate * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * InvalidityDate * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class InvalidityDate { const MAP = ['type' => ASN1::TYPE_GENERALIZED_TIME]; } <?php /** * TerminalIdentifier * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * TerminalIdentifier * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class TerminalIdentifier { const MAP = ['type' => ASN1::TYPE_PRINTABLE_STRING]; } <?php /** * RC2CBCParameter * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * RC2CBCParameter * * from https://tools.ietf.org/html/rfc2898#appendix-A.3 * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class RC2CBCParameter { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'rc2ParametersVersion'=> [ 'type' => ASN1::TYPE_INTEGER, 'optional' => true ], 'iv'=> ['type' => ASN1::TYPE_OCTET_STRING] ] ]; } <?php /** * KeyPurposeId * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * KeyPurposeId * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class KeyPurposeId { const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; } <?php /** * IssuingDistributionPoint * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * IssuingDistributionPoint * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class IssuingDistributionPoint { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'distributionPoint' => [ 'constant' => 0, 'optional' => true, 'explicit' => true ] + DistributionPointName::MAP, 'onlyContainsUserCerts' => [ 'type' => ASN1::TYPE_BOOLEAN, 'constant' => 1, 'optional' => true, 'default' => false, 'implicit' => true ], 'onlyContainsCACerts' => [ 'type' => ASN1::TYPE_BOOLEAN, 'constant' => 2, 'optional' => true, 'default' => false, 'implicit' => true ], 'onlySomeReasons' => [ 'constant' => 3, 'optional' => true, 'implicit' => true ] + ReasonFlags::MAP, 'indirectCRL' => [ 'type' => ASN1::TYPE_BOOLEAN, 'constant' => 4, 'optional' => true, 'default' => false, 'implicit' => true ], 'onlyContainsAttributeCerts' =>[ 'type' => ASN1::TYPE_BOOLEAN, 'constant' => 5, 'optional' => true, 'default' => false, 'implicit' => true ] ] ]; } <?php /** * CertificationRequestInfo * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * CertificationRequestInfo * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class CertificationRequestInfo { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'version' => [ 'type' => ASN1::TYPE_INTEGER, 'mapping' => ['v1'] ], 'subject' => Name::MAP, 'subjectPKInfo' => SubjectPublicKeyInfo::MAP, 'attributes' => [ 'constant' => 0, 'optional' => true, 'implicit' => true ] + Attributes::MAP, ] ]; } <?php /** * GeneralNames * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * GeneralNames * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class GeneralNames { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => GeneralName::MAP ]; } <?php /** * PersonalName * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PersonalName * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PersonalName { const MAP = [ 'type' => ASN1::TYPE_SET, 'children' => [ 'surname' => [ 'type' => ASN1::TYPE_PRINTABLE_STRING, 'constant' => 0, 'optional' => true, 'implicit' => true ], 'given-name' => [ 'type' => ASN1::TYPE_PRINTABLE_STRING, 'constant' => 1, 'optional' => true, 'implicit' => true ], 'initials' => [ 'type' => ASN1::TYPE_PRINTABLE_STRING, 'constant' => 2, 'optional' => true, 'implicit' => true ], 'generation-qualifier' => [ 'type' => ASN1::TYPE_PRINTABLE_STRING, 'constant' => 3, 'optional' => true, 'implicit' => true ] ] ]; } <?php /** * RDNSequence * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * RDNSequence * * In practice, RDNs containing multiple name-value pairs (called "multivalued RDNs") are rare, * but they can be useful at times when either there is no unique attribute in the entry or you * want to ensure that the entry's DN contains some useful identifying information. * * - https://www.opends.org/wiki/page/DefinitionRelativeDistinguishedName * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class RDNSequence { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, // RDNSequence does not define a min or a max, which means it doesn't have one 'min' => 0, 'max' => -1, 'children' => RelativeDistinguishedName::MAP ]; } <?php /** * SubjectPublicKeyInfo * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * SubjectPublicKeyInfo * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class SubjectPublicKeyInfo { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'algorithm' => AlgorithmIdentifier::MAP, 'subjectPublicKey' => ['type' => ASN1::TYPE_BIT_STRING] ] ]; } <?php /** * netscape_comment * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * netscape_comment * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class netscape_comment { const MAP = ['type' => ASN1::TYPE_IA5_STRING]; } <?php /** * CPSuri * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * CPSuri * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class CPSuri { const MAP = ['type' => ASN1::TYPE_IA5_STRING]; } <?php /** * UniqueIdentifier * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * UniqueIdentifier * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class UniqueIdentifier { const MAP = ['type' => ASN1::TYPE_BIT_STRING]; } <?php /** * KeyIdentifier * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * KeyIdentifier * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class KeyIdentifier { const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; } <?php /** * IssuerAltName * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * IssuerAltName * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class IssuerAltName { const MAP = GeneralNames::MAP; } <?php /** * CountryName * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * CountryName * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class CountryName { const MAP = [ 'type' => ASN1::TYPE_CHOICE, // if class isn't present it's assumed to be \phpseclib\File\ASN1::CLASS_UNIVERSAL or // (if constant is present) \phpseclib\File\ASN1::CLASS_CONTEXT_SPECIFIC 'class' => ASN1::CLASS_APPLICATION, 'cast' => 1, 'children' => [ 'x121-dcc-code' => ['type' => ASN1::TYPE_NUMERIC_STRING], 'iso-3166-alpha2-code' => ['type' => ASN1::TYPE_PRINTABLE_STRING] ] ]; } <?php /** * Attribute * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * Attribute * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class Attribute { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'type' => AttributeType::MAP, 'value'=> [ 'type' => ASN1::TYPE_SET, 'min' => 1, 'max' => -1, 'children' => AttributeValue::MAP ] ] ]; } <?php /** * DSAPrivateKey * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * DSAPrivateKey * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class DSAPrivateKey { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'version' => ['type' => ASN1::TYPE_INTEGER], 'p' => ['type' => ASN1::TYPE_INTEGER], 'q' => ['type' => ASN1::TYPE_INTEGER], 'g' => ['type' => ASN1::TYPE_INTEGER], 'y' => ['type' => ASN1::TYPE_INTEGER], 'x' => ['type' => ASN1::TYPE_INTEGER] ] ]; }<?php /** * PBMAC1params * * PHP version 5 * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2016 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File\ASN1\Maps; use phpseclib\File\ASN1; /** * PBMAC1params * * from https://tools.ietf.org/html/rfc2898#appendix-A.3 * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class PBMAC1params { const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'keyDerivationFunc'=> AlgorithmIdentifier::MAP, 'messageAuthScheme'=> AlgorithmIdentifier::MAP ] ]; } <?php /** * Pure-PHP ASN.1 Parser * * PHP version 5 * * ASN.1 provides the semantics for data encoded using various schemes. The most commonly * utilized scheme is DER or the "Distinguished Encoding Rules". PEM's are base64 encoded * DER blobs. * * \phpseclib\File\ASN1 decodes and encodes DER formatted messages and places them in a semantic context. * * Uses the 1988 ASN.1 syntax. * * @category File * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2012 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\File; use ParagonIE\ConstantTime\Base64; use phpseclib\File\ASN1\Element; use phpseclib\Math\BigInteger; use phpseclib\Common\Functions\Strings; use DateTime; use DateTimeZone; /** * Pure-PHP ASN.1 Parser * * @package ASN1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ abstract class ASN1 { /**#@+ * Tag Classes * * @access private * @link http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=12 */ const CLASS_UNIVERSAL = 0; const CLASS_APPLICATION = 1; const CLASS_CONTEXT_SPECIFIC = 2; const CLASS_PRIVATE = 3; /**#@-*/ /**#@+ * Tag Classes * * @access private * @link http://www.obj-sys.com/asn1tutorial/node124.html */ const TYPE_BOOLEAN = 1; const TYPE_INTEGER = 2; const TYPE_BIT_STRING = 3; const TYPE_OCTET_STRING = 4; const TYPE_NULL = 5; const TYPE_OBJECT_IDENTIFIER = 6; //const TYPE_OBJECT_DESCRIPTOR = 7; //const TYPE_INSTANCE_OF = 8; // EXTERNAL const TYPE_REAL = 9; const TYPE_ENUMERATED = 10; //const TYPE_EMBEDDED = 11; const TYPE_UTF8_STRING = 12; //const TYPE_RELATIVE_OID = 13; const TYPE_SEQUENCE = 16; // SEQUENCE OF const TYPE_SET = 17; // SET OF /**#@-*/ /**#@+ * More Tag Classes * * @access private * @link http://www.obj-sys.com/asn1tutorial/node10.html */ const TYPE_NUMERIC_STRING = 18; const TYPE_PRINTABLE_STRING = 19; const TYPE_TELETEX_STRING = 20; // T61String const TYPE_VIDEOTEX_STRING = 21; const TYPE_IA5_STRING = 22; const TYPE_UTC_TIME = 23; const TYPE_GENERALIZED_TIME = 24; const TYPE_GRAPHIC_STRING = 25; const TYPE_VISIBLE_STRING = 26; // ISO646String const TYPE_GENERAL_STRING = 27; const TYPE_UNIVERSAL_STRING = 28; //const TYPE_CHARACTER_STRING = 29; const TYPE_BMP_STRING = 30; /**#@-*/ /**#@+ * Tag Aliases * * These tags are kinda place holders for other tags. * * @access private */ const TYPE_CHOICE = -1; const TYPE_ANY = -2; /**#@-*/ /** * ASN.1 object identifiers * * @var array * @access private * @link http://en.wikipedia.org/wiki/Object_identifier */ private static $oids = []; /** * ASN.1 object identifier reverse mapping * * @var array * @access private */ private static $reverseOIDs = []; /** * Default date format * * @var string * @access private * @link http://php.net/class.datetime */ private static $format = 'D, d M Y H:i:s O'; /** * Filters * * If the mapping type is self::TYPE_ANY what do we actually encode it as? * * @var array * @access private * @see self::encode_der() */ private static $filters; /** * Current Location of most recent ASN.1 encode process * * Useful for debug purposes * * @var array * @access private * @see self::encode_der() */ private static $location; /** * DER Encoded String * * In case we need to create ASN1\Element object's.. * * @var string * @access private * @see self::decodeDER() */ private static $encoded; /** * Type mapping table for the ANY type. * * Structured or unknown types are mapped to a \phpseclib\File\ASN1\Element. * Unambiguous types get the direct mapping (int/real/bool). * Others are mapped as a choice, with an extra indexing level. * * @var array * @access public */ const ANY_MAP = [ self::TYPE_BOOLEAN => true, self::TYPE_INTEGER => true, self::TYPE_BIT_STRING => 'bitString', self::TYPE_OCTET_STRING => 'octetString', self::TYPE_NULL => 'null', self::TYPE_OBJECT_IDENTIFIER => 'objectIdentifier', self::TYPE_REAL => true, self::TYPE_ENUMERATED => 'enumerated', self::TYPE_UTF8_STRING => 'utf8String', self::TYPE_NUMERIC_STRING => 'numericString', self::TYPE_PRINTABLE_STRING => 'printableString', self::TYPE_TELETEX_STRING => 'teletexString', self::TYPE_VIDEOTEX_STRING => 'videotexString', self::TYPE_IA5_STRING => 'ia5String', self::TYPE_UTC_TIME => 'utcTime', self::TYPE_GENERALIZED_TIME => 'generalTime', self::TYPE_GRAPHIC_STRING => 'graphicString', self::TYPE_VISIBLE_STRING => 'visibleString', self::TYPE_GENERAL_STRING => 'generalString', self::TYPE_UNIVERSAL_STRING => 'universalString', //self::TYPE_CHARACTER_STRING => 'characterString', self::TYPE_BMP_STRING => 'bmpString' ]; /** * String type to character size mapping table. * * Non-convertable types are absent from this table. * size == 0 indicates variable length encoding. * * @var array * @access public */ const STRING_TYPE_SIZE = [ self::TYPE_UTF8_STRING => 0, self::TYPE_BMP_STRING => 2, self::TYPE_UNIVERSAL_STRING => 4, self::TYPE_PRINTABLE_STRING => 1, self::TYPE_TELETEX_STRING => 1, self::TYPE_IA5_STRING => 1, self::TYPE_VISIBLE_STRING => 1, ]; /** * Parse BER-encoding * * Serves a similar purpose to openssl's asn1parse * * @param string $encoded * @return array * @access public */ public static function decodeBER($encoded) { if ($encoded instanceof Element) { $encoded = $encoded->element; } self::$encoded = $encoded; $decoded = [self::decode_ber($encoded)]; // encapsulate in an array for BC with the old decodeBER return $decoded; } /** * Parse BER-encoding (Helper function) * * Sometimes we want to get the BER encoding of a particular tag. $start lets us do that without having to reencode. * $encoded is passed by reference for the recursive calls done for self::TYPE_BIT_STRING and * self::TYPE_OCTET_STRING. In those cases, the indefinite length is used. * * @param string $encoded * @param int $start * @param int $encoded_pos * @return array|bool * @access private */ private static function decode_ber($encoded, $start = 0, $encoded_pos = 0) { $current = ['start' => $start]; $type = ord($encoded[$encoded_pos++]); $start++; $constructed = ($type >> 5) & 1; $tag = $type & 0x1F; if ($tag == 0x1F) { $tag = 0; // process septets (since the eighth bit is ignored, it's not an octet) do { $loop = ord($encoded[0]) >> 7; $tag <<= 7; $tag |= ord($encoded[$encoded_pos++]) & 0x7F; $start++; } while ($loop); } // Length, as discussed in paragraph 8.1.3 of X.690-0207.pdf#page=13 $length = ord($encoded[$encoded_pos++]); $start++; if ($length == 0x80) { // indefinite length // "[A sender shall] use the indefinite form (see 8.1.3.6) if the encoding is constructed and is not all // immediately available." -- paragraph 8.1.3.2.c $length = strlen($encoded) - $encoded_pos; } elseif ($length & 0x80) { // definite length, long form // technically, the long form of the length can be represented by up to 126 octets (bytes), but we'll only // support it up to four. $length&= 0x7F; $temp = substr($encoded, $encoded_pos, $length); $encoded_pos += $length; // tags of indefinte length don't really have a header length; this length includes the tag $current+= ['headerlength' => $length + 2]; $start+= $length; extract(unpack('Nlength', substr(str_pad($temp, 4, chr(0), STR_PAD_LEFT), -4))); /** @var integer $length */ } else { $current+= ['headerlength' => 2]; } if ($length > (strlen($encoded) - $encoded_pos)) { return false; } $content = substr($encoded, $encoded_pos, $length); $content_pos = 0; // at this point $length can be overwritten. it's only accurate for definite length things as is /* Class is UNIVERSAL, APPLICATION, PRIVATE, or CONTEXT-SPECIFIC. The UNIVERSAL class is restricted to the ASN.1 built-in types. It defines an application-independent data type that must be distinguishable from all other data types. The other three classes are user defined. The APPLICATION class distinguishes data types that have a wide, scattered use within a particular presentation context. PRIVATE distinguishes data types within a particular organization or country. CONTEXT-SPECIFIC distinguishes members of a sequence or set, the alternatives of a CHOICE, or universally tagged set members. Only the class number appears in braces for this data type; the term CONTEXT-SPECIFIC does not appear. -- http://www.obj-sys.com/asn1tutorial/node12.html */ $class = ($type >> 6) & 3; switch ($class) { case self::CLASS_APPLICATION: case self::CLASS_PRIVATE: case self::CLASS_CONTEXT_SPECIFIC: if (!$constructed) { return [ 'type' => $class, 'constant' => $tag, 'content' => $content, 'length' => $length + $start - $current['start'] ] + $current; } $newcontent = []; $remainingLength = $length; while ($remainingLength > 0) { $temp = self::decode_ber($content, $start, $content_pos); $length = $temp['length']; // end-of-content octets - see paragraph 8.1.5 if (substr($content, $content_pos + $length, 2) == "\0\0") { $length+= 2; $start+= $length; $newcontent[] = $temp; break; } $start+= $length; $remainingLength-= $length; $newcontent[] = $temp; $content_pos += $length; } return [ 'type' => $class, 'constant' => $tag, // the array encapsulation is for BC with the old format 'content' => $newcontent, // the only time when $content['headerlength'] isn't defined is when the length is indefinite. // the absence of $content['headerlength'] is how we know if something is indefinite or not. // technically, it could be defined to be 2 and then another indicator could be used but whatever. 'length' => $start - $current['start'] ] + $current; } $current+= ['type' => $tag]; // decode UNIVERSAL tags switch ($tag) { case self::TYPE_BOOLEAN: // "The contents octets shall consist of a single octet." -- paragraph 8.2.1 //if (strlen($content) != 1) { // return false; //} $current['content'] = (bool) ord($content[$content_pos]); break; case self::TYPE_INTEGER: case self::TYPE_ENUMERATED: $current['content'] = new BigInteger(substr($content, $content_pos), -256); break; case self::TYPE_REAL: // not currently supported return false; case self::TYPE_BIT_STRING: // The initial octet shall encode, as an unsigned binary integer with bit 1 as the least significant bit, // the number of unused bits in the final subsequent octet. The number shall be in the range zero to // seven. if (!$constructed) { $current['content'] = substr($content, $content_pos); } else { $temp = self::decode_ber($content, $start, $content_pos); $length-= (strlen($content) - $content_pos); $last = count($temp) - 1; for ($i = 0; $i < $last; $i++) { // all subtags should be bit strings //if ($temp[$i]['type'] != self::TYPE_BIT_STRING) { // return false; //} $current['content'].= substr($temp[$i]['content'], 1); } // all subtags should be bit strings //if ($temp[$last]['type'] != self::TYPE_BIT_STRING) { // return false; //} $current['content'] = $temp[$last]['content'][0] . $current['content'] . substr($temp[$i]['content'], 1); } break; case self::TYPE_OCTET_STRING: if (!$constructed) { $current['content'] = substr($content, $content_pos); } else { $current['content'] = ''; $length = 0; while (substr($content, $content_pos, 2) != "\0\0") { $temp = self::decode_ber($content, $length + $start, $content_pos); $content_pos += $temp['length']; // all subtags should be octet strings //if ($temp['type'] != self::TYPE_OCTET_STRING) { // return false; //} $current['content'].= $temp['content']; $length+= $temp['length']; } if (substr($content, $content_pos, 2) == "\0\0") { $length+= 2; // +2 for the EOC } } break; case self::TYPE_NULL: // "The contents octets shall not contain any octets." -- paragraph 8.8.2 //if (strlen($content)) { // return false; //} break; case self::TYPE_SEQUENCE: case self::TYPE_SET: $offset = 0; $current['content'] = []; $content_len = strlen($content); while ($content_pos < $content_len) { // if indefinite length construction was used and we have an end-of-content string next // see paragraphs 8.1.1.3, 8.1.3.2, 8.1.3.6, 8.1.5, and (for an example) 8.6.4.2 if (!isset($current['headerlength']) && substr($content, $content_pos, 2) == "\0\0") { $length = $offset + 2; // +2 for the EOC break 2; } $temp = self::decode_ber($content, $start + $offset, $content_pos); $content_pos += $temp['length']; $current['content'][] = $temp; $offset+= $temp['length']; } break; case self::TYPE_OBJECT_IDENTIFIER: $temp = ord($content[$content_pos++]); $current['content'] = sprintf('%d.%d', floor($temp / 40), $temp % 40); $valuen = 0; // process septets $content_len = strlen($content); while ($content_pos < $content_len) { $temp = ord($content[$content_pos++]); $valuen <<= 7; $valuen |= $temp & 0x7F; if (~$temp & 0x80) { $current['content'].= ".$valuen"; $valuen = 0; } } // the eighth bit of the last byte should not be 1 //if ($temp >> 7) { // return false; //} break; /* Each character string type shall be encoded as if it had been declared: [UNIVERSAL x] IMPLICIT OCTET STRING -- X.690-0207.pdf#page=23 (paragraph 8.21.3) Per that, we're not going to do any validation. If there are any illegal characters in the string, we don't really care */ case self::TYPE_NUMERIC_STRING: // 0,1,2,3,4,5,6,7,8,9, and space case self::TYPE_PRINTABLE_STRING: // Upper and lower case letters, digits, space, apostrophe, left/right parenthesis, plus sign, comma, // hyphen, full stop, solidus, colon, equal sign, question mark case self::TYPE_TELETEX_STRING: // The Teletex character set in CCITT's T61, space, and delete // see http://en.wikipedia.org/wiki/Teletex#Character_sets case self::TYPE_VIDEOTEX_STRING: // The Videotex character set in CCITT's T.100 and T.101, space, and delete case self::TYPE_VISIBLE_STRING: // Printing character sets of international ASCII, and space case self::TYPE_IA5_STRING: // International Alphabet 5 (International ASCII) case self::TYPE_GRAPHIC_STRING: // All registered G sets, and space case self::TYPE_GENERAL_STRING: // All registered C and G sets, space and delete case self::TYPE_UTF8_STRING: // ???? case self::TYPE_BMP_STRING: $current['content'] = substr($content, $content_pos); break; case self::TYPE_UTC_TIME: case self::TYPE_GENERALIZED_TIME: $current['content'] = self::decodeTime(substr($content, $content_pos), $tag); default: } $start+= $length; // ie. length is the length of the full TLV encoding - it's not just the length of the value return $current + ['length' => $start - $current['start']]; } /** * ASN.1 Map * * Provides an ASN.1 semantic mapping ($mapping) from a parsed BER-encoding to a human readable format. * * "Special" mappings may be applied on a per tag-name basis via $special. * * @param array $decoded * @param array $mapping * @param array $special * @return array|bool|Element * @access public */ public static function asn1map($decoded, $mapping, $special = []) { if (isset($mapping['explicit']) && is_array($decoded['content'])) { $decoded = $decoded['content'][0]; } switch (true) { case $mapping['type'] == self::TYPE_ANY: $intype = $decoded['type']; // !isset(self::ANY_MAP[$intype]) produces a fatal error on PHP 5.6 if (isset($decoded['constant']) || !array_key_exists($intype, self::ANY_MAP) || (ord(self::$encoded[$decoded['start']]) & 0x20)) { return new Element(substr(self::$encoded, $decoded['start'], $decoded['length'])); } $inmap = self::ANY_MAP[$intype]; if (is_string($inmap)) { return [$inmap => self::asn1map($decoded, ['type' => $intype] + $mapping, $special)]; } break; case $mapping['type'] == self::TYPE_CHOICE: foreach ($mapping['children'] as $key => $option) { switch (true) { case isset($option['constant']) && $option['constant'] == $decoded['constant']: case !isset($option['constant']) && $option['type'] == $decoded['type']: $value = self::asn1map($decoded, $option, $special); break; case !isset($option['constant']) && $option['type'] == self::TYPE_CHOICE: $v = self::asn1map($decoded, $option, $special); if (isset($v)) { $value = $v; } } if (isset($value)) { if (isset($special[$key])) { $value = call_user_func($special[$key], $value); } return [$key => $value]; } } return null; case isset($mapping['implicit']): case isset($mapping['explicit']): case $decoded['type'] == $mapping['type']: break; default: // if $decoded['type'] and $mapping['type'] are both strings, but different types of strings, // let it through switch (true) { case $decoded['type'] < 18: // self::TYPE_NUMERIC_STRING == 18 case $decoded['type'] > 30: // self::TYPE_BMP_STRING == 30 case $mapping['type'] < 18: case $mapping['type'] > 30: return null; } } if (isset($mapping['implicit'])) { $decoded['type'] = $mapping['type']; } switch ($decoded['type']) { case self::TYPE_SEQUENCE: $map = []; // ignore the min and max if (isset($mapping['min']) && isset($mapping['max'])) { $child = $mapping['children']; foreach ($decoded['content'] as $content) { if (($map[] = self::asn1map($content, $child, $special)) === null) { return null; } } return $map; } $n = count($decoded['content']); $i = 0; foreach ($mapping['children'] as $key => $child) { $maymatch = $i < $n; // Match only existing input. if ($maymatch) { $temp = $decoded['content'][$i]; if ($child['type'] != self::TYPE_CHOICE) { // Get the mapping and input class & constant. $childClass = $tempClass = self::CLASS_UNIVERSAL; $constant = null; if (isset($temp['constant'])) { $tempClass = isset($temp['class']) ? $temp['class'] : self::CLASS_CONTEXT_SPECIFIC; } if (isset($child['class'])) { $childClass = $child['class']; $constant = $child['cast']; } elseif (isset($child['constant'])) { $childClass = self::CLASS_CONTEXT_SPECIFIC; $constant = $child['constant']; } if (isset($constant) && isset($temp['constant'])) { // Can only match if constants and class match. $maymatch = $constant == $temp['constant'] && $childClass == $tempClass; } else { // Can only match if no constant expected and type matches or is generic. $maymatch = !isset($child['constant']) && array_search($child['type'], [$temp['type'], self::TYPE_ANY, self::TYPE_CHOICE]) !== false; } } } if ($maymatch) { // Attempt submapping. $candidate = self::asn1map($temp, $child, $special); $maymatch = $candidate !== null; } if ($maymatch) { // Got the match: use it. if (isset($special[$key])) { $candidate = call_user_func($special[$key], $candidate); } $map[$key] = $candidate; $i++; } elseif (isset($child['default'])) { switch ($child['type']) { case ASN1::TYPE_INTEGER: $map[$key] = new BigInteger($child['default']); break; //case ASN1::TYPE_BOOLEAN: default: $map[$key] = $child['type']; } } elseif (!isset($child['optional'])) { return null; // Syntax error. } } // Fail mapping if all input items have not been consumed. return $i < $n ? null: $map; // the main diff between sets and sequences is the encapsulation of the foreach in another for loop case self::TYPE_SET: $map = []; // ignore the min and max if (isset($mapping['min']) && isset($mapping['max'])) { $child = $mapping['children']; foreach ($decoded['content'] as $content) { if (($map[] = self::asn1map($content, $child, $special)) === null) { return null; } } return $map; } for ($i = 0; $i < count($decoded['content']); $i++) { $temp = $decoded['content'][$i]; $tempClass = self::CLASS_UNIVERSAL; if (isset($temp['constant'])) { $tempClass = isset($temp['class']) ? $temp['class'] : self::CLASS_CONTEXT_SPECIFIC; } foreach ($mapping['children'] as $key => $child) { if (isset($map[$key])) { continue; } $maymatch = true; if ($child['type'] != self::TYPE_CHOICE) { $childClass = self::CLASS_UNIVERSAL; $constant = null; if (isset($child['class'])) { $childClass = $child['class']; $constant = $child['cast']; } elseif (isset($child['constant'])) { $childClass = self::CLASS_CONTEXT_SPECIFIC; $constant = $child['constant']; } if (isset($constant) && isset($temp['constant'])) { // Can only match if constants and class match. $maymatch = $constant == $temp['constant'] && $childClass == $tempClass; } else { // Can only match if no constant expected and type matches or is generic. $maymatch = !isset($child['constant']) && array_search($child['type'], [$temp['type'], self::TYPE_ANY, self::TYPE_CHOICE]) !== false; } } if ($maymatch) { // Attempt submapping. $candidate = self::asn1map($temp, $child, $special); $maymatch = $candidate !== null; } if (!$maymatch) { break; } // Got the match: use it. if (isset($special[$key])) { $candidate = call_user_func($special[$key], $candidate); } $map[$key] = $candidate; break; } } foreach ($mapping['children'] as $key => $child) { if (!isset($map[$key])) { if (isset($child['default'])) { $map[$key] = $child['default']; } elseif (!isset($child['optional'])) { return null; } } } return $map; case self::TYPE_OBJECT_IDENTIFIER: return isset(self::$oids[$decoded['content']]) ? self::$oids[$decoded['content']] : $decoded['content']; case self::TYPE_UTC_TIME: case self::TYPE_GENERALIZED_TIME: if (isset($mapping['implicit'])) { $decoded['content'] = self::decodeTime($decoded['content'], $decoded['type']); } return $decoded['content'] ? $decoded['content']->format(self::$format) : false; case self::TYPE_BIT_STRING: if (isset($mapping['mapping'])) { $offset = ord($decoded['content'][0]); $size = (strlen($decoded['content']) - 1) * 8 - $offset; /* From X.680-0207.pdf#page=46 (21.7): "When a "NamedBitList" is used in defining a bitstring type ASN.1 encoding rules are free to add (or remove) arbitrarily any trailing 0 bits to (or from) values that are being encoded or decoded. Application designers should therefore ensure that different semantics are not associated with such values which differ only in the number of trailing 0 bits." */ $bits = count($mapping['mapping']) == $size ? [] : array_fill(0, count($mapping['mapping']) - $size, false); for ($i = strlen($decoded['content']) - 1; $i > 0; $i--) { $current = ord($decoded['content'][$i]); for ($j = $offset; $j < 8; $j++) { $bits[] = (bool) ($current & (1 << $j)); } $offset = 0; } $values = []; $map = array_reverse($mapping['mapping']); foreach ($map as $i => $value) { if ($bits[$i]) { $values[] = $value; } } return $values; } case self::TYPE_OCTET_STRING: return $decoded['content']; case self::TYPE_NULL: return ''; case self::TYPE_BOOLEAN: return $decoded['content']; case self::TYPE_NUMERIC_STRING: case self::TYPE_PRINTABLE_STRING: case self::TYPE_TELETEX_STRING: case self::TYPE_VIDEOTEX_STRING: case self::TYPE_IA5_STRING: case self::TYPE_GRAPHIC_STRING: case self::TYPE_VISIBLE_STRING: case self::TYPE_GENERAL_STRING: case self::TYPE_UNIVERSAL_STRING: case self::TYPE_UTF8_STRING: case self::TYPE_BMP_STRING: return $decoded['content']; case self::TYPE_INTEGER: case self::TYPE_ENUMERATED: $temp = $decoded['content']; if (isset($mapping['implicit'])) { $temp = new BigInteger($decoded['content'], -256); } if (isset($mapping['mapping'])) { $temp = (int) $temp->toString(); return isset($mapping['mapping'][$temp]) ? $mapping['mapping'][$temp] : false; } return $temp; } } /** * ASN.1 Encode * * DER-encodes an ASN.1 semantic mapping ($mapping). Some libraries would probably call this function * an ASN.1 compiler. * * "Special" mappings can be applied via $special. * * @param string $source * @param array $mapping * @param array $special * @return string * @access public */ public static function encodeDER($source, $mapping, $special = []) { self::$location = []; return self::encode_der($source, $mapping, null, $special); } /** * ASN.1 Encode (Helper function) * * @param string $source * @param array $mapping * @param int $idx * @param array $special * @return string * @access private */ private static function encode_der($source, $mapping, $idx = null, $special = []) { if ($source instanceof Element) { return $source->element; } // do not encode (implicitly optional) fields with value set to default if (isset($mapping['default']) && $source === $mapping['default']) { return ''; } if (isset($idx)) { if (isset($special[$idx])) { $source = call_user_func($special[$idx], $source); } self::$location[] = $idx; } $tag = $mapping['type']; switch ($tag) { case self::TYPE_SET: // Children order is not important, thus process in sequence. case self::TYPE_SEQUENCE: $tag|= 0x20; // set the constructed bit // ignore the min and max if (isset($mapping['min']) && isset($mapping['max'])) { $value = []; $child = $mapping['children']; foreach ($source as $content) { $temp = self::encode_der($content, $child, null, $special); if ($temp === false) { return false; } $value[]= $temp; } /* "The encodings of the component values of a set-of value shall appear in ascending order, the encodings being compared as octet strings with the shorter components being padded at their trailing end with 0-octets. NOTE - The padding octets are for comparison purposes only and do not appear in the encodings." -- sec 11.6 of http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf */ if ($mapping['type'] == self::TYPE_SET) { sort($value); } $value = implode($value, ''); break; } $value = ''; foreach ($mapping['children'] as $key => $child) { if (!array_key_exists($key, $source)) { if (!isset($child['optional'])) { return false; } continue; } $temp = self::encode_der($source[$key], $child, $key, $special); if ($temp === false) { return false; } // An empty child encoding means it has been optimized out. // Else we should have at least one tag byte. if ($temp === '') { continue; } // if isset($child['constant']) is true then isset($child['optional']) should be true as well if (isset($child['constant'])) { /* From X.680-0207.pdf#page=58 (30.6): "The tagging construction specifies explicit tagging if any of the following holds: ... c) the "Tag Type" alternative is used and the value of "TagDefault" for the module is IMPLICIT TAGS or AUTOMATIC TAGS, but the type defined by "Type" is an untagged choice type, an untagged open type, or an untagged "DummyReference" (see ITU-T Rec. X.683 | ISO/IEC 8824-4, 8.3)." */ if (isset($child['explicit']) || $child['type'] == self::TYPE_CHOICE) { $subtag = chr((self::CLASS_CONTEXT_SPECIFIC << 6) | 0x20 | $child['constant']); $temp = $subtag . self::encodeLength(strlen($temp)) . $temp; } else { $subtag = chr((self::CLASS_CONTEXT_SPECIFIC << 6) | (ord($temp[0]) & 0x20) | $child['constant']); $temp = $subtag . substr($temp, 1); } } $value.= $temp; } break; case self::TYPE_CHOICE: $temp = false; foreach ($mapping['children'] as $key => $child) { if (!isset($source[$key])) { continue; } $temp = self::encode_der($source[$key], $child, $key, $special); if ($temp === false) { return false; } // An empty child encoding means it has been optimized out. // Else we should have at least one tag byte. if ($temp === '') { continue; } $tag = ord($temp[0]); // if isset($child['constant']) is true then isset($child['optional']) should be true as well if (isset($child['constant'])) { if (isset($child['explicit']) || $child['type'] == self::TYPE_CHOICE) { $subtag = chr((self::CLASS_CONTEXT_SPECIFIC << 6) | 0x20 | $child['constant']); $temp = $subtag . self::encodeLength(strlen($temp)) . $temp; } else { $subtag = chr((self::CLASS_CONTEXT_SPECIFIC << 6) | (ord($temp[0]) & 0x20) | $child['constant']); $temp = $subtag . substr($temp, 1); } } } if (isset($idx)) { array_pop(self::$location); } if ($temp && isset($mapping['cast'])) { $temp[0] = chr(($mapping['class'] << 6) | ($tag & 0x20) | $mapping['cast']); } return $temp; case self::TYPE_INTEGER: case self::TYPE_ENUMERATED: if (!isset($mapping['mapping'])) { if (is_numeric($source)) { $source = new BigInteger($source); } $value = $source->toBytes(true); } else { $value = array_search($source, $mapping['mapping']); if ($value === false) { return false; } $value = new BigInteger($value); $value = $value->toBytes(true); } if (!strlen($value)) { $value = chr(0); } break; case self::TYPE_UTC_TIME: case self::TYPE_GENERALIZED_TIME: $format = $mapping['type'] == self::TYPE_UTC_TIME ? 'y' : 'Y'; $format.= 'mdHis'; $date = new DateTime($source, new DateTimeZone('GMT')); $value = $date->format($format) . 'Z'; break; case self::TYPE_BIT_STRING: if (isset($mapping['mapping'])) { $bits = array_fill(0, count($mapping['mapping']), 0); $size = 0; for ($i = 0; $i < count($mapping['mapping']); $i++) { if (in_array($mapping['mapping'][$i], $source)) { $bits[$i] = 1; $size = $i; } } if (isset($mapping['min']) && $mapping['min'] >= 1 && $size < $mapping['min']) { $size = $mapping['min'] - 1; } $offset = 8 - (($size + 1) & 7); $offset = $offset !== 8 ? $offset : 0; $value = chr($offset); for ($i = $size + 1; $i < count($mapping['mapping']); $i++) { unset($bits[$i]); } $bits = implode('', array_pad($bits, $size + $offset + 1, 0)); $bytes = explode(' ', rtrim(chunk_split($bits, 8, ' '))); foreach ($bytes as $byte) { $value.= chr(bindec($byte)); } break; } case self::TYPE_OCTET_STRING: /* The initial octet shall encode, as an unsigned binary integer with bit 1 as the least significant bit, the number of unused bits in the final subsequent octet. The number shall be in the range zero to seven. -- http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=16 */ $value = $source; break; case self::TYPE_OBJECT_IDENTIFIER: if (!preg_match('#(?:\d+\.)+#', $source)) { $oid = isset(self::$reverseOIDs[$source]) ? self::$reverseOIDs[$source] : false; } else { $oid = $source; } if ($oid === false) { throw new \RuntimeException('Invalid OID'); } $value = ''; $parts = explode('.', $oid); $value = chr(40 * $parts[0] + $parts[1]); for ($i = 2; $i < count($parts); $i++) { $temp = ''; if (!$parts[$i]) { $temp = "\0"; } else { while ($parts[$i]) { $temp = chr(0x80 | ($parts[$i] & 0x7F)) . $temp; $parts[$i] >>= 7; } $temp[strlen($temp) - 1] = $temp[strlen($temp) - 1] & chr(0x7F); } $value.= $temp; } break; case self::TYPE_ANY: $loc = self::$location; if (isset($idx)) { array_pop(self::$location); } switch (true) { case !isset($source): return self::encode_der(null, ['type' => self::TYPE_NULL] + $mapping, null, $special); case is_int($source): case $source instanceof BigInteger: return self::encode_der($source, ['type' => self::TYPE_INTEGER] + $mapping, null, $special); case is_float($source): return self::encode_der($source, ['type' => self::TYPE_REAL] + $mapping, null, $special); case is_bool($source): return self::encode_der($source, ['type' => self::TYPE_BOOLEAN] + $mapping, null, $special); case is_array($source) && count($source) == 1: $typename = implode('', array_keys($source)); $outtype = array_search($typename, self::ANY_MAP, true); if ($outtype !== false) { return self::encode_der($source[$typename], ['type' => $outtype] + $mapping, null, $special); } } $filters = self::$filters; foreach ($loc as $part) { if (!isset($filters[$part])) { $filters = false; break; } $filters = $filters[$part]; } if ($filters === false) { throw new \RuntimeException('No filters defined for ' . implode('/', $loc)); } return self::encode_der($source, $filters + $mapping, null, $special); case self::TYPE_NULL: $value = ''; break; case self::TYPE_NUMERIC_STRING: case self::TYPE_TELETEX_STRING: case self::TYPE_PRINTABLE_STRING: case self::TYPE_UNIVERSAL_STRING: case self::TYPE_UTF8_STRING: case self::TYPE_BMP_STRING: case self::TYPE_IA5_STRING: case self::TYPE_VISIBLE_STRING: case self::TYPE_VIDEOTEX_STRING: case self::TYPE_GRAPHIC_STRING: case self::TYPE_GENERAL_STRING: $value = $source; break; case self::TYPE_BOOLEAN: $value = $source ? "\xFF" : "\x00"; break; default: throw new \RuntimeException('Mapping provides no type definition for ' . implode('/', self::$location)); } if (isset($idx)) { array_pop(self::$location); } if (isset($mapping['cast'])) { if (isset($mapping['explicit']) || $mapping['type'] == self::TYPE_CHOICE) { $value = chr($tag) . self::encodeLength(strlen($value)) . $value; $tag = ($mapping['class'] << 6) | 0x20 | $mapping['cast']; } else { $tag = ($mapping['class'] << 6) | (ord($temp[0]) & 0x20) | $mapping['cast']; } } return chr($tag) . self::encodeLength(strlen($value)) . $value; } /** * BER-decode the time * * Called by _decode_ber() and in the case of implicit tags asn1map(). * * @access private * @param string $content * @param int $tag * @return string */ private static function decodeTime($content, $tag) { /* UTCTime: http://tools.ietf.org/html/rfc5280#section-4.1.2.5.1 http://www.obj-sys.com/asn1tutorial/node15.html GeneralizedTime: http://tools.ietf.org/html/rfc5280#section-4.1.2.5.2 http://www.obj-sys.com/asn1tutorial/node14.html */ $format = 'YmdHis'; if ($tag == self::TYPE_UTC_TIME) { // https://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=28 says "the seconds // element shall always be present" but none-the-less I've seen X509 certs where it isn't and if the // browsers parse it phpseclib ought to too if (preg_match('#^(\d{10})(Z|[+-]\d{4})$#', $content, $matches)) { $content = $matches[1] . '00' . $matches[2]; } $prefix = substr($content, 0, 2) >= 50 ? '19' : '20'; $content = $prefix . $content; } elseif (strpos($content, '.') !== false) { $format.= '.u'; } if ($content[strlen($content) - 1] == 'Z') { $content = substr($content, 0, -1) . '+0000'; } if (strpos($content, '-') !== false || strpos($content, '+') !== false) { $format.= 'O'; } // error supression isn't necessary as of PHP 7.0: // http://php.net/manual/en/migration70.other-changes.php return @DateTime::createFromFormat($format, $content); } /** * Set the time format * * Sets the time / date format for asn1map(). * * @access public * @param string $format */ public static function setTimeFormat($format) { self::$format = $format; } /** * Load OIDs * * Load the relevant OIDs for a particular ASN.1 semantic mapping. * Previously loaded OIDs are retained. * * @access public * @param array $oids */ public static function loadOIDs($oids) { self::$oids+= $oids; self::$reverseOIDs = array_flip(self::$oids); } /** * Set filters * * See \phpseclib\File\X509, etc, for an example. * Previously loaded filters are not retained. * * @access public * @param array $filters */ public static function setFilters($filters) { self::$filters = $filters; } /** * String type conversion * * This is a lazy conversion, dealing only with character size. * No real conversion table is used. * * @param string $in * @param int $from * @param int $to * @return string * @access public */ public static function convert($in, $from = self::TYPE_UTF8_STRING, $to = self::TYPE_UTF8_STRING) { // isset(self::STRING_TYPE_SIZE[$from] returns a fatal error on PHP 5.6 if (!array_key_exists($from, self::STRING_TYPE_SIZE) || !array_key_exists($to, self::STRING_TYPE_SIZE)) { return false; } $insize = self::STRING_TYPE_SIZE[$from]; $outsize = self::STRING_TYPE_SIZE[$to]; $inlength = strlen($in); $out = ''; for ($i = 0; $i < $inlength;) { if ($inlength - $i < $insize) { return false; } // Get an input character as a 32-bit value. $c = ord($in[$i++]); switch (true) { case $insize == 4: $c = ($c << 8) | ord($in[$i++]); $c = ($c << 8) | ord($in[$i++]); case $insize == 2: $c = ($c << 8) | ord($in[$i++]); case $insize == 1: break; case ($c & 0x80) == 0x00: break; case ($c & 0x40) == 0x00: return false; default: $bit = 6; do { if ($bit > 25 || $i >= $inlength || (ord($in[$i]) & 0xC0) != 0x80) { return false; } $c = ($c << 6) | (ord($in[$i++]) & 0x3F); $bit += 5; $mask = 1 << $bit; } while ($c & $bit); $c &= $mask - 1; break; } // Convert and append the character to output string. $v = ''; switch (true) { case $outsize == 4: $v .= chr($c & 0xFF); $c >>= 8; $v .= chr($c & 0xFF); $c >>= 8; case $outsize == 2: $v .= chr($c & 0xFF); $c >>= 8; case $outsize == 1: $v .= chr($c & 0xFF); $c >>= 8; if ($c) { return false; } break; case ($c & 0x80000000) != 0: return false; case $c >= 0x04000000: $v .= chr(0x80 | ($c & 0x3F)); $c = ($c >> 6) | 0x04000000; case $c >= 0x00200000: $v .= chr(0x80 | ($c & 0x3F)); $c = ($c >> 6) | 0x00200000; case $c >= 0x00010000: $v .= chr(0x80 | ($c & 0x3F)); $c = ($c >> 6) | 0x00010000; case $c >= 0x00000800: $v .= chr(0x80 | ($c & 0x3F)); $c = ($c >> 6) | 0x00000800; case $c >= 0x00000080: $v .= chr(0x80 | ($c & 0x3F)); $c = ($c >> 6) | 0x000000C0; default: $v .= chr($c); break; } $out .= strrev($v); } return $out; } /** * Extract raw BER from Base64 encoding * * @access private * @param string $str * @return string */ public static function extractBER($str) { /* X.509 certs are assumed to be base64 encoded but sometimes they'll have additional things in them * above and beyond the ceritificate. * ie. some may have the following preceding the -----BEGIN CERTIFICATE----- line: * * Bag Attributes * localKeyID: 01 00 00 00 * subject=/O=organization/OU=org unit/CN=common name * issuer=/O=organization/CN=common name */ $temp = preg_replace('#.*?^-+[^-]+-+[\r\n ]*$#ms', '', $str, 1); // remove the -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- stuff $temp = preg_replace('#-+[^-]+-+#', '', $temp); // remove new lines $temp = str_replace(["\r", "\n", ' '], '', $temp); $temp = preg_match('#^[a-zA-Z\d/+]*={0,2}$#', $temp) ? Base64::decode($temp) : false; return $temp != false ? $temp : $str; } /** * DER-encode the length * * DER supports lengths up to (2**8)**127, however, we'll only support lengths up to (2**8)**4. See * {@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 paragraph 8.1.3} for more information. * * @access public * @param int $length * @return string */ public static function encodeLength($length) { if ($length <= 0x7F) { return chr($length); } $temp = ltrim(pack('N', $length), chr(0)); return pack('Ca*', 0x80 | strlen($temp), $temp); } /** * Returns the OID corresponding to a name * * What's returned in the associative array returned by loadX509() (or load*()) is either a name or an OID if * no OID to name mapping is available. The problem with this is that what may be an unmapped OID in one version * of phpseclib may not be unmapped in the next version, so apps that are looking at this OID may not be able * to work from version to version. * * This method will return the OID if a name is passed to it and if no mapping is avialable it'll assume that * what's being passed to it already is an OID and return that instead. A few examples. * * getOID('2.16.840.1.101.3.4.2.1') == '2.16.840.1.101.3.4.2.1' * getOID('id-sha256') == '2.16.840.1.101.3.4.2.1' * getOID('zzz') == 'zzz' * * @access public * @param string $name * @return string */ static function getOID($name) { return isset(self::$reverseOIDs[$name]) ? self::$reverseOIDs[$name] : $name; } } <?php /** * NoSupportedAlgorithmsException * * PHP version 5 * * @category Exception * @package NoSupportedAlgorithmsException * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Exception; /** * NoSupportedAlgorithmsException * * @package NoSupportedAlgorithmsException * @author Jim Wigginton <terrafrost@php.net> */ class NoSupportedAlgorithmsException extends \RuntimeException { } <?php /** * UnsupportedAlgorithmException * * PHP version 5 * * @category Exception * @package UnsupportedAlgorithmException * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Exception; /** * UnsupportedAlgorithmException * * @package UnsupportedAlgorithmException * @author Jim Wigginton <terrafrost@php.net> */ class UnsupportedAlgorithmException extends \RuntimeException { } <?php /** * BadConfigurationException * * PHP version 5 * * @category Exception * @package BadConfigurationException * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Exception; /** * BadConfigurationException * * @package BadConfigurationException * @author Jim Wigginton <terrafrost@php.net> */ class BadConfigurationException extends \RuntimeException { } <?php /** * NoKeyLoadedException * * PHP version 5 * * @category Exception * @package NoKeyLoadedException * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Exception; /** * NoKeyLoadedException * * @package NoKeyLoadedException * @author Jim Wigginton <terrafrost@php.net> */ class NoKeyLoadedException extends \RuntimeException { } <?php /** * FileNotFoundException * * PHP version 5 * * @category Exception * @package FileNotFoundException * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Exception; /** * FileNotFoundException * * @package FileNotFoundException * @author Jim Wigginton <terrafrost@php.net> */ class FileNotFoundException extends \RuntimeException { } <?php /** * UnsupportedOperationException * * PHP version 5 * * @category Exception * @package UnsupportedOperationException * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Exception; /** * UnsupportedOperationException * * @package UnsupportedOperationException * @author Jim Wigginton <terrafrost@php.net> */ class UnsupportedOperationException extends \RuntimeException { } <?php /** * Pure-PHP implementation of SSHv2. * * PHP version 5 * * Here are some examples of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * $ssh = new \phpseclib\Net\SSH2('www.domain.tld'); * if (!$ssh->login('username', 'password')) { * exit('Login Failed'); * } * * echo $ssh->exec('pwd'); * echo $ssh->exec('ls -la'); * ?> * </code> * * <code> * <?php * include 'vendor/autoload.php'; * * $key = new \phpseclib\Crypt\RSA(); * //$key->setPassword('whatever'); * $key->load(file_get_contents('privatekey')); * * $ssh = new \phpseclib\Net\SSH2('www.domain.tld'); * if (!$ssh->login('username', $key)) { * exit('Login Failed'); * } * * echo $ssh->read('username@username:~$'); * $ssh->write("ls -la\n"); * echo $ssh->read('username@username:~$'); * ?> * </code> * * @category Net * @package SSH2 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2007 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Net; use ParagonIE\ConstantTime\Base64; use phpseclib\Crypt\Blowfish; use phpseclib\Crypt\Hash; use phpseclib\Crypt\Random; use phpseclib\Crypt\RC4; use phpseclib\Crypt\Rijndael; use phpseclib\Crypt\RSA; use phpseclib\Crypt\TripleDES; use phpseclib\Crypt\Twofish; use phpseclib\Math\BigInteger; // Used to do Diffie-Hellman key exchange and DSA/RSA signature verification. use phpseclib\System\SSH\Agent; use phpseclib\Exception\NoSupportedAlgorithmsException; use phpseclib\Common\Functions\Strings; use phpseclib\Common\Functions\Objects; /** * Pure-PHP implementation of SSHv2. * * @package SSH2 * @author Jim Wigginton <terrafrost@php.net> * @access public */ class SSH2 { /**#@+ * Execution Bitmap Masks * * @see \phpseclib\Net\SSH2::bitmap * @access private */ const MASK_CONSTRUCTOR = 0x00000001; const MASK_CONNECTED = 0x00000002; const MASK_LOGIN_REQ = 0x00000004; const MASK_LOGIN = 0x00000008; const MASK_SHELL = 0x00000010; const MASK_WINDOW_ADJUST = 0x00000020; /**#@-*/ /**#@+ * Channel constants * * RFC4254 refers not to client and server channels but rather to sender and recipient channels. we don't refer * to them in that way because RFC4254 toggles the meaning. the client sends a SSH_MSG_CHANNEL_OPEN message with * a sender channel and the server sends a SSH_MSG_CHANNEL_OPEN_CONFIRMATION in response, with a sender and a * recepient channel. at first glance, you might conclude that SSH_MSG_CHANNEL_OPEN_CONFIRMATION's sender channel * would be the same thing as SSH_MSG_CHANNEL_OPEN's sender channel, but it's not, per this snipet: * The 'recipient channel' is the channel number given in the original * open request, and 'sender channel' is the channel number allocated by * the other side. * * @see \phpseclib\Net\SSH2::_send_channel_packet() * @see \phpseclib\Net\SSH2::_get_channel_packet() * @access private */ const CHANNEL_EXEC = 1; // PuTTy uses 0x100 const CHANNEL_SHELL = 2; const CHANNEL_SUBSYSTEM = 3; const CHANNEL_AGENT_FORWARD = 4; /**#@-*/ /**#@+ * @access public * @see \phpseclib\Net\SSH2::getLog() */ /** * Returns the message numbers */ const LOG_SIMPLE = 1; /** * Returns the message content */ const LOG_COMPLEX = 2; /** * Outputs the content real-time */ const LOG_REALTIME = 3; /** * Dumps the content real-time to a file */ const LOG_REALTIME_FILE = 4; /** * Make sure that the log never gets larger than this */ const LOG_MAX_SIZE = 1048576; // 1024 * 1024 /**#@-*/ /**#@+ * @access public * @see \phpseclib\Net\SSH2::read() */ /** * Returns when a string matching $expect exactly is found */ const READ_SIMPLE = 1; /** * Returns when a string matching the regular expression $expect is found */ const READ_REGEX = 2; /** * Returns when a string matching the regular expression $expect is found */ const READ_NEXT = 3; /**#@-*/ /** * The SSH identifier * * @var string * @access private */ private $identifier; /** * The Socket Object * * @var object * @access private */ private $fsock; /** * Execution Bitmap * * The bits that are set represent functions that have been called already. This is used to determine * if a requisite function has been successfully executed. If not, an error should be thrown. * * @var int * @access private */ protected $bitmap = 0; /** * Error information * * @see self::getErrors() * @see self::getLastError() * @var array * @access private */ private $errors = []; /** * Server Identifier * * @see self::getServerIdentification() * @var array|false * @access private */ private $server_identifier = false; /** * Key Exchange Algorithms * * @see self::getKexAlgorithims() * @var array|false * @access private */ private $kex_algorithms = false; /** * Minimum Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods * * @see self::_key_exchange() * @var int * @access private */ private $kex_dh_group_size_min = 1536; /** * Preferred Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods * * @see self::_key_exchange() * @var int * @access private */ private $kex_dh_group_size_preferred = 2048; /** * Maximum Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods * * @see self::_key_exchange() * @var int * @access private */ private $kex_dh_group_size_max = 4096; /** * Server Host Key Algorithms * * @see self::getServerHostKeyAlgorithms() * @var array|false * @access private */ private $server_host_key_algorithms = false; /** * Encryption Algorithms: Client to Server * * @see self::getEncryptionAlgorithmsClient2Server() * @var array|false * @access private */ private $encryption_algorithms_client_to_server = false; /** * Encryption Algorithms: Server to Client * * @see self::getEncryptionAlgorithmsServer2Client() * @var array|false * @access private */ private $encryption_algorithms_server_to_client = false; /** * MAC Algorithms: Client to Server * * @see self::getMACAlgorithmsClient2Server() * @var array|false * @access private */ private $mac_algorithms_client_to_server = false; /** * MAC Algorithms: Server to Client * * @see self::getMACAlgorithmsServer2Client() * @var array|false * @access private */ private $mac_algorithms_server_to_client = false; /** * Compression Algorithms: Client to Server * * @see self::getCompressionAlgorithmsClient2Server() * @var array|false * @access private */ private $compression_algorithms_client_to_server = false; /** * Compression Algorithms: Server to Client * * @see self::getCompressionAlgorithmsServer2Client() * @var array|false * @access private */ private $compression_algorithms_server_to_client = false; /** * Languages: Server to Client * * @see self::getLanguagesServer2Client() * @var array|false * @access private */ private $languages_server_to_client = false; /** * Languages: Client to Server * * @see self::getLanguagesClient2Server() * @var array|false * @access private */ private $languages_client_to_server = false; /** * Block Size for Server to Client Encryption * * "Note that the length of the concatenation of 'packet_length', * 'padding_length', 'payload', and 'random padding' MUST be a multiple * of the cipher block size or 8, whichever is larger. This constraint * MUST be enforced, even when using stream ciphers." * * -- http://tools.ietf.org/html/rfc4253#section-6 * * @see self::__construct() * @see self::_send_binary_packet() * @var int * @access private */ private $encrypt_block_size = 8; /** * Block Size for Client to Server Encryption * * @see self::__construct() * @see self::_get_binary_packet() * @var int * @access private */ private $decrypt_block_size = 8; /** * Server to Client Encryption Object * * @see self::_get_binary_packet() * @var object * @access private */ private $decrypt = false; /** * Client to Server Encryption Object * * @see self::_send_binary_packet() * @var object * @access private */ private $encrypt = false; /** * Client to Server HMAC Object * * @see self::_send_binary_packet() * @var object * @access private */ private $hmac_create = false; /** * Server to Client HMAC Object * * @see self::_get_binary_packet() * @var object * @access private */ private $hmac_check = false; /** * Size of server to client HMAC * * We need to know how big the HMAC will be for the server to client direction so that we know how many bytes to read. * For the client to server side, the HMAC object will make the HMAC as long as it needs to be. All we need to do is * append it. * * @see self::_get_binary_packet() * @var int * @access private */ private $hmac_size = false; /** * Server Public Host Key * * @see self::getServerPublicHostKey() * @var string * @access private */ private $server_public_host_key; /** * Session identifier * * "The exchange hash H from the first key exchange is additionally * used as the session identifier, which is a unique identifier for * this connection." * * -- http://tools.ietf.org/html/rfc4253#section-7.2 * * @see self::_key_exchange() * @var string * @access private */ private $session_id = false; /** * Exchange hash * * The current exchange hash * * @see self::_key_exchange() * @var string * @access private */ private $exchange_hash = false; /** * Message Numbers * * @see self::__construct() * @var array * @access private */ private $message_numbers = []; /** * Disconnection Message 'reason codes' defined in RFC4253 * * @see self::__construct() * @var array * @access private */ private $disconnect_reasons = []; /** * SSH_MSG_CHANNEL_OPEN_FAILURE 'reason codes', defined in RFC4254 * * @see self::__construct() * @var array * @access private */ private $channel_open_failure_reasons = []; /** * Terminal Modes * * @link http://tools.ietf.org/html/rfc4254#section-8 * @see self::__construct() * @var array * @access private */ private $terminal_modes = []; /** * SSH_MSG_CHANNEL_EXTENDED_DATA's data_type_codes * * @link http://tools.ietf.org/html/rfc4254#section-5.2 * @see self::__construct() * @var array * @access private */ private $channel_extended_data_type_codes = []; /** * Send Sequence Number * * See 'Section 6.4. Data Integrity' of rfc4253 for more info. * * @see self::_send_binary_packet() * @var int * @access private */ private $send_seq_no = 0; /** * Get Sequence Number * * See 'Section 6.4. Data Integrity' of rfc4253 for more info. * * @see self::_get_binary_packet() * @var int * @access private */ private $get_seq_no = 0; /** * Server Channels * * Maps client channels to server channels * * @see self::_get_channel_packet() * @see self::exec() * @var array * @access private */ protected $server_channels = []; /** * Channel Buffers * * If a client requests a packet from one channel but receives two packets from another those packets should * be placed in a buffer * * @see self::_get_channel_packet() * @see self::exec() * @var array * @access private */ private $channel_buffers = []; /** * Channel Status * * Contains the type of the last sent message * * @see self::_get_channel_packet() * @var array * @access private */ protected $channel_status = []; /** * Packet Size * * Maximum packet size indexed by channel * * @see self::_send_channel_packet() * @var array * @access private */ private $packet_size_client_to_server = []; /** * Message Number Log * * @see self::getLog() * @var array * @access private */ private $message_number_log = []; /** * Message Log * * @see self::getLog() * @var array * @access private */ private $message_log = []; /** * The Window Size * * Bytes the other party can send before it must wait for the window to be adjusted (0x7FFFFFFF = 2GB) * * @var int * @see self::_send_channel_packet() * @see self::exec() * @access private */ protected $window_size = 0x7FFFFFFF; /** * Window size, server to client * * Window size indexed by channel * * @see self::_send_channel_packet() * @var array * @access private */ protected $window_size_server_to_client = []; /** * Window size, client to server * * Window size indexed by channel * * @see self::_get_channel_packet() * @var array * @access private */ private $window_size_client_to_server = []; /** * Server signature * * Verified against $this->session_id * * @see self::getServerPublicHostKey() * @var string * @access private */ private $signature = ''; /** * Server signature format * * ssh-rsa or ssh-dss. * * @see self::getServerPublicHostKey() * @var string * @access private */ private $signature_format = ''; /** * Interactive Buffer * * @see self::read() * @var array * @access private */ private $interactiveBuffer = ''; /** * Current log size * * Should never exceed self::LOG_MAX_SIZE * * @see self::_send_binary_packet() * @see self::_get_binary_packet() * @var int * @access private */ private $log_size; /** * Timeout * * @see self::setTimeout() * @access private */ private $timeout; /** * Current Timeout * * @see self::_get_channel_packet() * @access private */ protected $curTimeout; /** * Real-time log file pointer * * @see self::_append_log() * @var resource * @access private */ private $realtime_log_file; /** * Real-time log file size * * @see self::_append_log() * @var int * @access private */ private $realtime_log_size; /** * Has the signature been validated? * * @see self::getServerPublicHostKey() * @var bool * @access private */ private $signature_validated = false; /** * Real-time log file wrap boolean * * @see self::_append_log() * @access private */ private $realtime_log_wrap; /** * Flag to suppress stderr from output * * @see self::enableQuietMode() * @access private */ private $quiet_mode = false; /** * Time of first network activity * * @var int * @access private */ private $last_packet; /** * Exit status returned from ssh if any * * @var int * @access private */ private $exit_status; /** * Flag to request a PTY when using exec() * * @var bool * @see self::enablePTY() * @access private */ private $request_pty = false; /** * Flag set while exec() is running when using enablePTY() * * @var bool * @access private */ private $in_request_pty_exec = false; /** * Flag set after startSubsystem() is called * * @var bool * @access private */ private $in_subsystem; /** * Contents of stdError * * @var string * @access private */ private $stdErrorLog; /** * The Last Interactive Response * * @see self::_keyboard_interactive_process() * @var string * @access private */ private $last_interactive_response = ''; /** * Keyboard Interactive Request / Responses * * @see self::_keyboard_interactive_process() * @var array * @access private */ private $keyboard_requests_responses = []; /** * Banner Message * * Quoting from the RFC, "in some jurisdictions, sending a warning message before * authentication may be relevant for getting legal protection." * * @see self::_filter() * @see self::getBannerMessage() * @var string * @access private */ private $banner_message = ''; /** * Did read() timeout or return normally? * * @see self::isTimeout() * @var bool * @access private */ private $is_timeout = false; /** * Log Boundary * * @see self::_format_log() * @var string * @access private */ private $log_boundary = ':'; /** * Log Long Width * * @see self::_format_log() * @var int * @access private */ private $log_long_width = 65; /** * Log Short Width * * @see self::_format_log() * @var int * @access private */ private $log_short_width = 16; /** * Hostname * * @see self::__construct() * @see self::_connect() * @var string * @access private */ private $host; /** * Port Number * * @see self::__construct() * @see self::_connect() * @var int * @access private */ private $port; /** * Number of columns for terminal window size * * @see self::getWindowColumns() * @see self::setWindowColumns() * @see self::setWindowSize() * @var int * @access private */ private $windowColumns = 80; /** * Number of columns for terminal window size * * @see self::getWindowRows() * @see self::setWindowRows() * @see self::setWindowSize() * @var int * @access private */ private $windowRows = 24; /** * Crypto Engine * * @see self::setCryptoEngine() * @see self::_key_exchange() * @var int * @access private */ private $crypto_engine = false; /** * A System_SSH_Agent for use in the SSH2 Agent Forwarding scenario * * @var \phpseclib\System\Ssh\Agent * @access private */ private $agent; /** * Connection storage to replicates ssh2 extension functionality: * {@link http://php.net/manual/en/wrappers.ssh2.php#refsect1-wrappers.ssh2-examples} * * @var SSH2[] */ private static $connections; /** * Send the identification string first? * * @var bool * @access private */ private $send_id_string_first = true; /** * Send the key exchange initiation packet first? * * @var bool * @access private */ private $send_kex_first = true; /** * Some versions of OpenSSH incorrectly calculate the key size * * @var bool * @access private */ private $bad_key_size_fix = false; /** * The selected decryption algorithm * * @var string * @access private */ private $decrypt_algorithm = ''; /** * Should we try to re-connect to re-establish keys? * * @var bool * @access private */ private $retry_connect = false; /** * Binary Packet Buffer * * @var string|false * @access private */ private $binary_packet_buffer = false; /** * Default Constructor. * * $host can either be a string, representing the host, or a stream resource. * * @param mixed $host * @param int $port * @param int $timeout * @see self::login() * @return SSH2|void * @access public */ public function __construct($host, $port = 22, $timeout = 10) { $this->message_numbers = [ 1 => 'NET_SSH2_MSG_DISCONNECT', 2 => 'NET_SSH2_MSG_IGNORE', 3 => 'NET_SSH2_MSG_UNIMPLEMENTED', 4 => 'NET_SSH2_MSG_DEBUG', 5 => 'NET_SSH2_MSG_SERVICE_REQUEST', 6 => 'NET_SSH2_MSG_SERVICE_ACCEPT', 20 => 'NET_SSH2_MSG_KEXINIT', 21 => 'NET_SSH2_MSG_NEWKEYS', 30 => 'NET_SSH2_MSG_KEXDH_INIT', 31 => 'NET_SSH2_MSG_KEXDH_REPLY', 50 => 'NET_SSH2_MSG_USERAUTH_REQUEST', 51 => 'NET_SSH2_MSG_USERAUTH_FAILURE', 52 => 'NET_SSH2_MSG_USERAUTH_SUCCESS', 53 => 'NET_SSH2_MSG_USERAUTH_BANNER', 80 => 'NET_SSH2_MSG_GLOBAL_REQUEST', 81 => 'NET_SSH2_MSG_REQUEST_SUCCESS', 82 => 'NET_SSH2_MSG_REQUEST_FAILURE', 90 => 'NET_SSH2_MSG_CHANNEL_OPEN', 91 => 'NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION', 92 => 'NET_SSH2_MSG_CHANNEL_OPEN_FAILURE', 93 => 'NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST', 94 => 'NET_SSH2_MSG_CHANNEL_DATA', 95 => 'NET_SSH2_MSG_CHANNEL_EXTENDED_DATA', 96 => 'NET_SSH2_MSG_CHANNEL_EOF', 97 => 'NET_SSH2_MSG_CHANNEL_CLOSE', 98 => 'NET_SSH2_MSG_CHANNEL_REQUEST', 99 => 'NET_SSH2_MSG_CHANNEL_SUCCESS', 100 => 'NET_SSH2_MSG_CHANNEL_FAILURE' ]; $this->disconnect_reasons = [ 1 => 'NET_SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT', 2 => 'NET_SSH2_DISCONNECT_PROTOCOL_ERROR', 3 => 'NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED', 4 => 'NET_SSH2_DISCONNECT_RESERVED', 5 => 'NET_SSH2_DISCONNECT_MAC_ERROR', 6 => 'NET_SSH2_DISCONNECT_COMPRESSION_ERROR', 7 => 'NET_SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE', 8 => 'NET_SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED', 9 => 'NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE', 10 => 'NET_SSH2_DISCONNECT_CONNECTION_LOST', 11 => 'NET_SSH2_DISCONNECT_BY_APPLICATION', 12 => 'NET_SSH2_DISCONNECT_TOO_MANY_CONNECTIONS', 13 => 'NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER', 14 => 'NET_SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE', 15 => 'NET_SSH2_DISCONNECT_ILLEGAL_USER_NAME' ]; $this->channel_open_failure_reasons = [ 1 => 'NET_SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED' ]; $this->terminal_modes = [ 0 => 'NET_SSH2_TTY_OP_END' ]; $this->channel_extended_data_type_codes = [ 1 => 'NET_SSH2_EXTENDED_DATA_STDERR' ]; $this->define_array( $this->message_numbers, $this->disconnect_reasons, $this->channel_open_failure_reasons, $this->terminal_modes, $this->channel_extended_data_type_codes, [60 => 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ'], [60 => 'NET_SSH2_MSG_USERAUTH_PK_OK'], [60 => 'NET_SSH2_MSG_USERAUTH_INFO_REQUEST', 61 => 'NET_SSH2_MSG_USERAUTH_INFO_RESPONSE'], // RFC 4419 - diffie-hellman-group-exchange-sha{1,256} [30 => 'NET_SSH2_MSG_KEXDH_GEX_REQUEST_OLD', 31 => 'NET_SSH2_MSG_KEXDH_GEX_GROUP', 32 => 'NET_SSH2_MSG_KEXDH_GEX_INIT', 33 => 'NET_SSH2_MSG_KEXDH_GEX_REPLY', 34 => 'NET_SSH2_MSG_KEXDH_GEX_REQUEST'], // RFC 5656 - Elliptic Curves (for curve25519-sha256@libssh.org) [30 => 'NET_SSH2_MSG_KEX_ECDH_INIT', 31 => 'NET_SSH2_MSG_KEX_ECDH_REPLY'] ); self::$connections[$this->getResourceId()] = $this; if (is_resource($host)) { $this->fsock = $host; return; } if (is_string($host)) { $this->host = $host; $this->port = $port; $this->timeout = $timeout; } } /** * Set Crypto Engine Mode * * Possible $engine values: * OpenSSL, mcrypt, Eval, PHP * * @param int $engine * @access public */ public function setCryptoEngine($engine) { $this->crypto_engine = $engine; } /** * Send Identification String First * * https://tools.ietf.org/html/rfc4253#section-4.2 says "when the connection has been established, * both sides MUST send an identification string". It does not say which side sends it first. In * theory it shouldn't matter but it is a fact of life that some SSH servers are simply buggy * * @access public */ public function sendIdentificationStringFirst() { $this->send_id_string_first = true; } /** * Send Identification String Last * * https://tools.ietf.org/html/rfc4253#section-4.2 says "when the connection has been established, * both sides MUST send an identification string". It does not say which side sends it first. In * theory it shouldn't matter but it is a fact of life that some SSH servers are simply buggy * * @access public */ public function sendIdentificationStringLast() { $this->send_id_string_first = false; } /** * Send SSH_MSG_KEXINIT First * * https://tools.ietf.org/html/rfc4253#section-7.1 says "key exchange begins by each sending * sending the [SSH_MSG_KEXINIT] packet". It does not say which side sends it first. In theory * it shouldn't matter but it is a fact of life that some SSH servers are simply buggy * * @access public */ public function sendKEXINITFirst() { $this->send_kex_first = true; } /** * Send SSH_MSG_KEXINIT Last * * https://tools.ietf.org/html/rfc4253#section-7.1 says "key exchange begins by each sending * sending the [SSH_MSG_KEXINIT] packet". It does not say which side sends it first. In theory * it shouldn't matter but it is a fact of life that some SSH servers are simply buggy * * @access public */ public function sendKEXINITLast() { $this->send_kex_first = false; } /** * Connect to an SSHv2 server * * @return bool * @throws \UnexpectedValueException on receipt of unexpected packets * @throws \RuntimeException on other errors * @access private */ private function connect() { if ($this->bitmap & self::MASK_CONSTRUCTOR) { return false; } $this->bitmap |= self::MASK_CONSTRUCTOR; $this->curTimeout = $this->timeout; $this->last_packet = microtime(true); if (!is_resource($this->fsock)) { $start = microtime(true); // with stream_select a timeout of 0 means that no timeout takes place; // with fsockopen a timeout of 0 means that you instantly timeout // to resolve this incompatibility a timeout of 100,000 will be used for fsockopen if timeout is 0 $this->fsock = @fsockopen($this->host, $this->port, $errno, $errstr, $this->curTimeout == 0 ? 100000 : $this->curTimeout); if (!$this->fsock) { $host = $this->host . ':' . $this->port; throw new \RuntimeException(rtrim("Cannot connect to $host. Error $errno. $errstr")); } $elapsed = microtime(true) - $start; $this->curTimeout-= $elapsed; if ($this->curTimeout <= 0) { $this->is_timeout = true; return false; } } $this->identifier = $this->generate_identifier(); if ($this->send_id_string_first) { fputs($this->fsock, $this->identifier . "\r\n"); } /* According to the SSH2 specs, "The server MAY send other lines of data before sending the version string. Each line SHOULD be terminated by a Carriage Return and Line Feed. Such lines MUST NOT begin with "SSH-", and SHOULD be encoded in ISO-10646 UTF-8 [RFC3629] (language is not specified). Clients MUST be able to process such lines." */ $data = ''; while (!feof($this->fsock) && !preg_match('#(.*)^(SSH-(\d\.\d+).*)#ms', $data, $matches)) { $line = ''; while (true) { if ($this->curTimeout) { if ($this->curTimeout < 0) { $this->is_timeout = true; return false; } $read = [$this->fsock]; $write = $except = null; $start = microtime(true); $sec = floor($this->curTimeout); $usec = 1000000 * ($this->curTimeout - $sec); // on windows this returns a "Warning: Invalid CRT parameters detected" error // the !count() is done as a workaround for <https://bugs.php.net/42682> if (!@stream_select($read, $write, $except, $sec, $usec) && !count($read)) { $this->is_timeout = true; return false; } $elapsed = microtime(true) - $start; $this->curTimeout-= $elapsed; } $temp = stream_get_line($this->fsock, 255, "\n"); if (strlen($temp) == 255) { continue; } $line.= "$temp\n"; // quoting RFC4253, "Implementers who wish to maintain // compatibility with older, undocumented versions of this protocol may // want to process the identification string without expecting the // presence of the carriage return character for reasons described in // Section 5 of this document." //if (substr($line, -2) == "\r\n") { // break; //} break; } $data.= $line; } if (feof($this->fsock)) { throw new \RuntimeException('Connection closed by server'); } $extra = $matches[1]; if (defined('NET_SSH2_LOGGING')) { $this->append_log('<-', $matches[0]); $this->append_log('->', $this->identifier . "\r\n"); } $this->server_identifier = trim($temp, "\r\n"); if (strlen($extra)) { $this->errors[] = utf8_decode($data); } if (version_compare($matches[3], '1.99', '<')) { throw new \RuntimeException("Cannot connect to SSH $matches[3] servers"); } if (!$this->send_id_string_first) { fputs($this->fsock, $this->identifier . "\r\n"); } if (!$this->send_kex_first) { $response = $this->get_binary_packet(); if ($response === false) { throw new \RuntimeException('Connection closed by server'); } if (!strlen($response) || ord($response[0]) != NET_SSH2_MSG_KEXINIT) { throw new \UnexpectedValueException('Expected SSH_MSG_KEXINIT'); } if (!$this->key_exchange($response)) { return false; } } if ($this->send_kex_first && !$this->key_exchange()) { return false; } $this->bitmap|= self::MASK_CONNECTED; return true; } /** * Generates the SSH identifier * * You should overwrite this method in your own class if you want to use another identifier * * @access protected * @return string */ private function generate_identifier() { $identifier = 'SSH-2.0-phpseclib_2.0'; $ext = []; if (function_exists('\\Sodium\\library_version_major')) { $ext[] = 'libsodium'; } if (extension_loaded('openssl')) { $ext[] = 'openssl'; } elseif (extension_loaded('mcrypt')) { $ext[] = 'mcrypt'; } if (extension_loaded('gmp')) { $ext[] = 'gmp'; } elseif (extension_loaded('bcmath')) { $ext[] = 'bcmath'; } if (!empty($ext)) { $identifier .= ' (' . implode(', ', $ext) . ')'; } return $identifier; } /** * Key Exchange * @return bool * @param string|bool $kexinit_payload_server optional * @throws \UnexpectedValueException on receipt of unexpected packets * @throws \RuntimeException on other errors * @throws \phpseclib\Exception\NoSupportedAlgorithmsException when none of the algorithms phpseclib has loaded are compatible * @access private */ private function key_exchange($kexinit_payload_server = false) { $kex_algorithms = [ // Elliptic Curve Diffie-Hellman Key Agreement (ECDH) using // Curve25519. See doc/curve25519-sha256@libssh.org.txt in the // libssh repository for more information. 'curve25519-sha256@libssh.org', // Diffie-Hellman Key Agreement (DH) using integer modulo prime // groups. 'diffie-hellman-group1-sha1', // REQUIRED 'diffie-hellman-group14-sha1', // REQUIRED 'diffie-hellman-group-exchange-sha1', // RFC 4419 'diffie-hellman-group-exchange-sha256', // RFC 4419 ]; if (!function_exists('\\Sodium\\library_version_major')) { $kex_algorithms = array_diff( $kex_algorithms, ['curve25519-sha256@libssh.org'] ); } $server_host_key_algorithms = [ 'ssh-rsa', // RECOMMENDED sign Raw RSA Key 'ssh-dss' // REQUIRED sign Raw DSS Key ]; $encryption_algorithms = [ // from <http://tools.ietf.org/html/rfc4345#section-4>: 'arcfour256', 'arcfour128', //'arcfour', // OPTIONAL the ARCFOUR stream cipher with a 128-bit key // CTR modes from <http://tools.ietf.org/html/rfc4344#section-4>: 'aes128-ctr', // RECOMMENDED AES (Rijndael) in SDCTR mode, with 128-bit key 'aes192-ctr', // RECOMMENDED AES with 192-bit key 'aes256-ctr', // RECOMMENDED AES with 256-bit key 'twofish128-ctr', // OPTIONAL Twofish in SDCTR mode, with 128-bit key 'twofish192-ctr', // OPTIONAL Twofish with 192-bit key 'twofish256-ctr', // OPTIONAL Twofish with 256-bit key 'aes128-cbc', // RECOMMENDED AES with a 128-bit key 'aes192-cbc', // OPTIONAL AES with a 192-bit key 'aes256-cbc', // OPTIONAL AES in CBC mode, with a 256-bit key 'twofish128-cbc', // OPTIONAL Twofish with a 128-bit key 'twofish192-cbc', // OPTIONAL Twofish with a 192-bit key 'twofish256-cbc', 'twofish-cbc', // OPTIONAL alias for "twofish256-cbc" // (this is being retained for historical reasons) 'blowfish-ctr', // OPTIONAL Blowfish in SDCTR mode 'blowfish-cbc', // OPTIONAL Blowfish in CBC mode '3des-ctr', // RECOMMENDED Three-key 3DES in SDCTR mode '3des-cbc', // REQUIRED three-key 3DES in CBC mode //'none' // OPTIONAL no encryption; NOT RECOMMENDED ]; if (extension_loaded('openssl') && !extension_loaded('mcrypt')) { // OpenSSL does not support arcfour256 in any capacity and arcfour128 / arcfour support is limited to // instances that do not use continuous buffers $encryption_algorithms = array_diff( $encryption_algorithms, ['arcfour256', 'arcfour128', 'arcfour'] ); } if (class_exists('\phpseclib\Crypt\RC4') === false) { $encryption_algorithms = array_diff( $encryption_algorithms, ['arcfour256', 'arcfour128', 'arcfour'] ); } if (class_exists('\phpseclib\Crypt\Rijndael') === false) { $encryption_algorithms = array_diff( $encryption_algorithms, ['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-cbc', 'aes192-cbc', 'aes256-cbc'] ); } if (class_exists('\phpseclib\Crypt\Twofish') === false) { $encryption_algorithms = array_diff( $encryption_algorithms, ['twofish128-ctr', 'twofish192-ctr', 'twofish256-ctr', 'twofish128-cbc', 'twofish192-cbc', 'twofish256-cbc', 'twofish-cbc'] ); } if (class_exists('\phpseclib\Crypt\Blowfish') === false) { $encryption_algorithms = array_diff( $encryption_algorithms, ['blowfish-ctr', 'blowfish-cbc'] ); } if (class_exists('\phpseclib\Crypt\TripleDES') === false) { $encryption_algorithms = array_diff( $encryption_algorithms, ['3des-ctr', '3des-cbc'] ); } $encryption_algorithms = array_values($encryption_algorithms); $mac_algorithms = [ // from <http://www.ietf.org/rfc/rfc6668.txt>: 'hmac-sha2-256',// RECOMMENDED HMAC-SHA256 (digest length = key length = 32) 'hmac-sha1-96', // RECOMMENDED first 96 bits of HMAC-SHA1 (digest length = 12, key length = 20) 'hmac-sha1', // REQUIRED HMAC-SHA1 (digest length = key length = 20) 'hmac-md5-96', // OPTIONAL first 96 bits of HMAC-MD5 (digest length = 12, key length = 16) 'hmac-md5', // OPTIONAL HMAC-MD5 (digest length = key length = 16) //'none' // OPTIONAL no MAC; NOT RECOMMENDED ]; $compression_algorithms = [ 'none' // REQUIRED no compression //'zlib' // OPTIONAL ZLIB (LZ77) compression ]; // some SSH servers have buggy implementations of some of the above algorithms switch (true) { case $this->server_identifier == 'SSH-2.0-SSHD': case substr($this->server_identifier, 0, 13) == 'SSH-2.0-DLINK': $mac_algorithms = array_values(array_diff( $mac_algorithms, ['hmac-sha1-96', 'hmac-md5-96'] )); } $str_kex_algorithms = implode(',', $kex_algorithms); $str_server_host_key_algorithms = implode(',', $server_host_key_algorithms); $encryption_algorithms_server_to_client = $encryption_algorithms_client_to_server = implode(',', $encryption_algorithms); $mac_algorithms_server_to_client = $mac_algorithms_client_to_server = implode(',', $mac_algorithms); $compression_algorithms_server_to_client = $compression_algorithms_client_to_server = implode(',', $compression_algorithms); $client_cookie = Random::string(16); $kexinit_payload_client = pack( 'Ca*Na*Na*Na*Na*Na*Na*Na*Na*Na*Na*CN', NET_SSH2_MSG_KEXINIT, $client_cookie, strlen($str_kex_algorithms), $str_kex_algorithms, strlen($str_server_host_key_algorithms), $str_server_host_key_algorithms, strlen($encryption_algorithms_client_to_server), $encryption_algorithms_client_to_server, strlen($encryption_algorithms_server_to_client), $encryption_algorithms_server_to_client, strlen($mac_algorithms_client_to_server), $mac_algorithms_client_to_server, strlen($mac_algorithms_server_to_client), $mac_algorithms_server_to_client, strlen($compression_algorithms_client_to_server), $compression_algorithms_client_to_server, strlen($compression_algorithms_server_to_client), $compression_algorithms_server_to_client, 0, '', 0, '', 0, 0 ); if ($this->send_kex_first) { if (!$this->send_binary_packet($kexinit_payload_client)) { return false; } $kexinit_payload_server = $this->get_binary_packet(); if ($kexinit_payload_server === false) { throw new \RuntimeException('Connection closed by server'); } if (!strlen($kexinit_payload_server) || ord($kexinit_payload_server[0]) != NET_SSH2_MSG_KEXINIT) { throw new \UnexpectedValueException('Expected SSH_MSG_KEXINIT'); } } $response = $kexinit_payload_server; Strings::shift($response, 1); // skip past the message number (it should be SSH_MSG_KEXINIT) $server_cookie = Strings::shift($response, 16); if (strlen($response) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($response, 4)); $this->kex_algorithms = explode(',', Strings::shift($response, $temp['length'])); if (strlen($response) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($response, 4)); $this->server_host_key_algorithms = explode(',', Strings::shift($response, $temp['length'])); if (strlen($response) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($response, 4)); $this->encryption_algorithms_client_to_server = explode(',', Strings::shift($response, $temp['length'])); if (strlen($response) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($response, 4)); $this->encryption_algorithms_server_to_client = explode(',', Strings::shift($response, $temp['length'])); if (strlen($response) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($response, 4)); $this->mac_algorithms_client_to_server = explode(',', Strings::shift($response, $temp['length'])); if (strlen($response) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($response, 4)); $this->mac_algorithms_server_to_client = explode(',', Strings::shift($response, $temp['length'])); if (strlen($response) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($response, 4)); $this->compression_algorithms_client_to_server = explode(',', Strings::shift($response, $temp['length'])); if (strlen($response) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($response, 4)); $this->compression_algorithms_server_to_client = explode(',', Strings::shift($response, $temp['length'])); if (strlen($response) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($response, 4)); $this->languages_client_to_server = explode(',', Strings::shift($response, $temp['length'])); if (strlen($response) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($response, 4)); $this->languages_server_to_client = explode(',', Strings::shift($response, $temp['length'])); if (!strlen($response)) { return false; } extract(unpack('Cfirst_kex_packet_follows', Strings::shift($response, 1))); /** @var integer $first_kex_packet_follows */ $first_kex_packet_follows = $first_kex_packet_follows != 0; if (!$this->send_kex_first && !$this->send_binary_packet($kexinit_payload_client)) { return false; } // we need to decide upon the symmetric encryption algorithms before we do the diffie-hellman key exchange // we don't initialize any crypto-objects, yet - we do that, later. for now, we need the lengths to make the // diffie-hellman key exchange as fast as possible $decrypt = $this->array_intersect_first($encryption_algorithms, $this->encryption_algorithms_server_to_client); $decryptKeyLength = $this->encryption_algorithm_to_key_size($decrypt); if ($decryptKeyLength === null) { $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); throw new NoSupportedAlgorithmsException('No compatible server to client encryption algorithms found'); } $encrypt = $this->array_intersect_first($encryption_algorithms, $this->encryption_algorithms_client_to_server); $encryptKeyLength = $this->encryption_algorithm_to_key_size($encrypt); if ($encryptKeyLength === null) { $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); throw new NoSupportedAlgorithmsException('No compatible client to server encryption algorithms found'); } // through diffie-hellman key exchange a symmetric key is obtained $kex_algorithm = $this->array_intersect_first($kex_algorithms, $this->kex_algorithms); if ($kex_algorithm === false) { $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); throw new NoSupportedAlgorithmsException('No compatible key exchange algorithms found'); } // Only relevant in diffie-hellman-group-exchange-sha{1,256}, otherwise empty. $exchange_hash_rfc4419 = ''; if ($kex_algorithm === 'curve25519-sha256@libssh.org') { $x = Random::string(32); $eBytes = \Sodium\crypto_box_publickey_from_secretkey($x); $clientKexInitMessage = NET_SSH2_MSG_KEX_ECDH_INIT; $serverKexReplyMessage = NET_SSH2_MSG_KEX_ECDH_REPLY; $kexHash = new Hash('sha256'); } else { if (strpos($kex_algorithm, 'diffie-hellman-group-exchange') === 0) { $dh_group_sizes_packed = pack( 'NNN', $this->kex_dh_group_size_min, $this->kex_dh_group_size_preferred, $this->kex_dh_group_size_max ); $packet = pack( 'Ca*', NET_SSH2_MSG_KEXDH_GEX_REQUEST, $dh_group_sizes_packed ); if (!$this->send_binary_packet($packet)) { return false; } $response = $this->get_binary_packet(); if ($response === false) { throw new \RuntimeException('Connection closed by server'); } extract(unpack('Ctype', Strings::shift($response, 1))); /** @var integer $type */ if ($type != NET_SSH2_MSG_KEXDH_GEX_GROUP) { throw new \RuntimeException('Expected SSH_MSG_KEX_DH_GEX_GROUP'); } if (strlen($response) < 4) { return false; } extract(unpack('NprimeLength', Strings::shift($response, 4))); /** @var integer $primeLength*/ $primeBytes = Strings::shift($response, $primeLength); $prime = new BigInteger($primeBytes, -256); if (strlen($response) < 4) { return false; } extract(unpack('NgLength', Strings::shift($response, 4))); /** @var integer $gLength */ $gBytes = Strings::shift($response, $gLength); $g = new BigInteger($gBytes, -256); $exchange_hash_rfc4419 = pack( 'a*Na*Na*', $dh_group_sizes_packed, $primeLength, $primeBytes, $gLength, $gBytes ); $clientKexInitMessage = NET_SSH2_MSG_KEXDH_GEX_INIT; $serverKexReplyMessage = NET_SSH2_MSG_KEXDH_GEX_REPLY; } else { switch ($kex_algorithm) { // see http://tools.ietf.org/html/rfc2409#section-6.2 and // http://tools.ietf.org/html/rfc2412, appendex E case 'diffie-hellman-group1-sha1': $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF'; break; // see http://tools.ietf.org/html/rfc3526#section-3 case 'diffie-hellman-group14-sha1': $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' . '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' . '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' . 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' . '3995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF'; break; } // For both diffie-hellman-group1-sha1 and diffie-hellman-group14-sha1 // the generator field element is 2 (decimal) and the hash function is sha1. $g = new BigInteger(2); $prime = new BigInteger($prime, 16); $clientKexInitMessage = NET_SSH2_MSG_KEXDH_INIT; $serverKexReplyMessage = NET_SSH2_MSG_KEXDH_REPLY; } switch ($kex_algorithm) { case 'diffie-hellman-group-exchange-sha256': $kexHash = new Hash('sha256'); break; default: $kexHash = new Hash('sha1'); } /* To increase the speed of the key exchange, both client and server may reduce the size of their private exponents. It should be at least twice as long as the key material that is generated from the shared secret. For more details, see the paper by van Oorschot and Wiener [VAN-OORSCHOT]. -- http://tools.ietf.org/html/rfc4419#section-6.2 */ $one = new BigInteger(1); $keyLength = min($kexHash->getLengthInBytes(), max($encryptKeyLength, $decryptKeyLength)); $max = $one->bitwise_leftShift(16 * $keyLength); // 2 * 8 * $keyLength $max = $max->subtract($one); $x = BigInteger::randomRange($one, $max); $e = $g->modPow($x, $prime); $eBytes = $e->toBytes(true); } $data = pack('CNa*', $clientKexInitMessage, strlen($eBytes), $eBytes); if (!$this->send_binary_packet($data)) { throw new \RuntimeException('Connection closed by server'); } $response = $this->get_binary_packet(); if ($response === false) { throw new \RuntimeException('Connection closed by server'); } if (!strlen($response)) { return false; } extract(unpack('Ctype', Strings::shift($response, 1))); /** @var integer $type */ if ($type != $serverKexReplyMessage) { throw new \UnexpectedValueException('Expected SSH_MSG_KEXDH_REPLY'); } if (strlen($response) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($response, 4)); $this->server_public_host_key = $server_public_host_key = Strings::shift($response, $temp['length']); if (strlen($server_public_host_key) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($server_public_host_key, 4)); $public_key_format = Strings::shift($server_public_host_key, $temp['length']); if (strlen($response) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($response, 4)); $fBytes = Strings::shift($response, $temp['length']); if (strlen($response) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($response, 4)); $this->signature = Strings::shift($response, $temp['length']); if (strlen($this->signature) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($this->signature, 4)); $this->signature_format = Strings::shift($this->signature, $temp['length']); if ($kex_algorithm === 'curve25519-sha256@libssh.org') { if (strlen($fBytes) !== 32) { throw new \RuntimeException('Received curve25519 public key of invalid length.'); return false; } $key = new BigInteger(\Sodium\crypto_scalarmult($x, $fBytes), 256); \Sodium\memzero($x); } else { $f = new BigInteger($fBytes, -256); $key = $f->modPow($x, $prime); } $keyBytes = $key->toBytes(true); $this->exchange_hash = pack( 'Na*Na*Na*Na*Na*a*Na*Na*Na*', strlen($this->identifier), $this->identifier, strlen($this->server_identifier), $this->server_identifier, strlen($kexinit_payload_client), $kexinit_payload_client, strlen($kexinit_payload_server), $kexinit_payload_server, strlen($this->server_public_host_key), $this->server_public_host_key, $exchange_hash_rfc4419, strlen($eBytes), $eBytes, strlen($fBytes), $fBytes, strlen($keyBytes), $keyBytes ); $this->exchange_hash = $kexHash->hash($this->exchange_hash); if ($this->session_id === false) { $this->session_id = $this->exchange_hash; } $server_host_key_algorithm = $this->array_intersect_first($server_host_key_algorithms, $this->server_host_key_algorithms); if ($server_host_key_algorithm === false) { $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); throw new NoSupportedAlgorithmsException('No compatible server host key algorithms found'); } if ($public_key_format != $server_host_key_algorithm || $this->signature_format != $server_host_key_algorithm) { $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); throw new \RuntimeException('Server Host Key Algorithm Mismatch'); } $packet = pack( 'C', NET_SSH2_MSG_NEWKEYS ); if (!$this->send_binary_packet($packet)) { return false; } $response = $this->get_binary_packet(); if ($response === false) { throw new \RuntimeException('Connection closed by server'); } if (!strlen($response)) { return false; } extract(unpack('Ctype', Strings::shift($response, 1))); /** @var integer $type */ if ($type != NET_SSH2_MSG_NEWKEYS) { throw new \UnexpectedValueException('Expected SSH_MSG_NEWKEYS'); } $this->decrypt_algorithm = $decrypt; $keyBytes = pack('Na*', strlen($keyBytes), $keyBytes); $this->encrypt = $this->encryption_algorithm_to_crypt_instance($encrypt); if ($this->encrypt) { if ($this->crypto_engine) { $this->encrypt->setPreferredEngine($this->crypto_engine); } if ($this->encrypt->getBlockLengthInBytes()) { $this->encrypt_block_size = $this->encrypt->getBlockLengthInBytes(); } $this->encrypt->enableContinuousBuffer(); $this->encrypt->disablePadding(); if ($this->encrypt->usesIV()) { $iv = $kexHash->hash($keyBytes . $this->exchange_hash . 'A' . $this->session_id); while ($this->encrypt_block_size > strlen($iv)) { $iv.= $kexHash->hash($keyBytes . $this->exchange_hash . $iv); } $this->encrypt->setIV(substr($iv, 0, $this->encrypt_block_size)); } $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'C' . $this->session_id); while ($encryptKeyLength > strlen($key)) { $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key); } $this->encrypt->setKey(substr($key, 0, $encryptKeyLength)); } $this->decrypt = $this->encryption_algorithm_to_crypt_instance($decrypt); if ($this->decrypt) { if ($this->crypto_engine) { $this->decrypt->setPreferredEngine($this->crypto_engine); } if ($this->decrypt->getBlockLengthInBytes()) { $this->decrypt_block_size = $this->decrypt->getBlockLengthInBytes(); } $this->decrypt->enableContinuousBuffer(); $this->decrypt->disablePadding(); if ($this->decrypt->usesIV()) { $iv = $kexHash->hash($keyBytes . $this->exchange_hash . 'B' . $this->session_id); while ($this->decrypt_block_size > strlen($iv)) { $iv.= $kexHash->hash($keyBytes . $this->exchange_hash . $iv); } $this->decrypt->setIV(substr($iv, 0, $this->decrypt_block_size)); } $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'D' . $this->session_id); while ($decryptKeyLength > strlen($key)) { $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key); } $this->decrypt->setKey(substr($key, 0, $decryptKeyLength)); } /* The "arcfour128" algorithm is the RC4 cipher, as described in [SCHNEIER], using a 128-bit key. The first 1536 bytes of keystream generated by the cipher MUST be discarded, and the first byte of the first encrypted packet MUST be encrypted using the 1537th byte of keystream. -- http://tools.ietf.org/html/rfc4345#section-4 */ if ($encrypt == 'arcfour128' || $encrypt == 'arcfour256') { $this->encrypt->encrypt(str_repeat("\0", 1536)); } if ($decrypt == 'arcfour128' || $decrypt == 'arcfour256') { $this->decrypt->decrypt(str_repeat("\0", 1536)); } $mac_algorithm = $this->array_intersect_first($mac_algorithms, $this->mac_algorithms_client_to_server); if ($mac_algorithm === false) { $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); throw new NoSupportedAlgorithmsException('No compatible client to server message authentication algorithms found'); } $createKeyLength = 0; // ie. $mac_algorithm == 'none' switch ($mac_algorithm) { case 'hmac-sha2-256': $this->hmac_create = new Hash('sha256'); $createKeyLength = 32; break; case 'hmac-sha1': $this->hmac_create = new Hash('sha1'); $createKeyLength = 20; break; case 'hmac-sha1-96': $this->hmac_create = new Hash('sha1-96'); $createKeyLength = 20; break; case 'hmac-md5': $this->hmac_create = new Hash('md5'); $createKeyLength = 16; break; case 'hmac-md5-96': $this->hmac_create = new Hash('md5-96'); $createKeyLength = 16; } $mac_algorithm = $this->array_intersect_first($mac_algorithms, $this->mac_algorithms_server_to_client); if ($mac_algorithm === false) { $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); throw new NoSupportedAlgorithmsException('No compatible server to client message authentication algorithms found'); } $checkKeyLength = 0; $this->hmac_size = 0; switch ($mac_algorithm) { case 'hmac-sha2-256': $this->hmac_check = new Hash('sha256'); $checkKeyLength = 32; $this->hmac_size = 32; break; case 'hmac-sha1': $this->hmac_check = new Hash('sha1'); $checkKeyLength = 20; $this->hmac_size = 20; break; case 'hmac-sha1-96': $this->hmac_check = new Hash('sha1-96'); $checkKeyLength = 20; $this->hmac_size = 12; break; case 'hmac-md5': $this->hmac_check = new Hash('md5'); $checkKeyLength = 16; $this->hmac_size = 16; break; case 'hmac-md5-96': $this->hmac_check = new Hash('md5-96'); $checkKeyLength = 16; $this->hmac_size = 12; } $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'E' . $this->session_id); while ($createKeyLength > strlen($key)) { $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key); } $this->hmac_create->setKey(substr($key, 0, $createKeyLength)); $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'F' . $this->session_id); while ($checkKeyLength > strlen($key)) { $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key); } $this->hmac_check->setKey(substr($key, 0, $checkKeyLength)); $compression_algorithm = $this->array_intersect_first($compression_algorithms, $this->compression_algorithms_server_to_client); if ($compression_algorithm === false) { $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); throw new NoSupportedAlgorithmsException('No compatible server to client compression algorithms found'); } $this->decompress = $compression_algorithm == 'zlib'; $compression_algorithm = $this->array_intersect_first($compression_algorithms, $this->compression_algorithms_client_to_server); if ($compression_algorithm === false) { $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); throw new NoSupportedAlgorithmsException('No compatible client to server compression algorithms found'); } $this->compress = $compression_algorithm == 'zlib'; return true; } /** * Maps an encryption algorithm name to the number of key bytes. * * @param string $algorithm Name of the encryption algorithm * @return int|null Number of bytes as an integer or null for unknown * @access private */ private function encryption_algorithm_to_key_size($algorithm) { if ($this->bad_key_size_fix && $this->bad_algorithm_candidate($algorithm)) { return 16; } switch ($algorithm) { case 'none': return 0; case 'aes128-cbc': case 'aes128-ctr': case 'arcfour': case 'arcfour128': case 'blowfish-cbc': case 'blowfish-ctr': case 'twofish128-cbc': case 'twofish128-ctr': return 16; case '3des-cbc': case '3des-ctr': case 'aes192-cbc': case 'aes192-ctr': case 'twofish192-cbc': case 'twofish192-ctr': return 24; case 'aes256-cbc': case 'aes256-ctr': case 'arcfour256': case 'twofish-cbc': case 'twofish256-cbc': case 'twofish256-ctr': return 32; } return null; } /** * Maps an encryption algorithm name to an instance of a subclass of * \phpseclib\Crypt\Base. * * @param string $algorithm Name of the encryption algorithm * @return mixed Instance of \phpseclib\Crypt\Base or null for unknown * @access private */ private function encryption_algorithm_to_crypt_instance($algorithm) { switch ($algorithm) { case '3des-cbc': return new TripleDES('cbc'); case '3des-ctr': return new TripleDES('ctr'); case 'aes256-cbc': case 'aes192-cbc': case 'aes128-cbc': return new Rijndael('cbc'); case 'aes256-ctr': case 'aes192-ctr': case 'aes128-ctr': return new Rijndael('ctr'); case 'blowfish-cbc': return new Blowfish('cbc'); case 'blowfish-ctr': return new Blowfish('ctr'); case 'twofish128-cbc': case 'twofish192-cbc': case 'twofish256-cbc': case 'twofish-cbc': return new Twofish('cbc'); case 'twofish128-ctr': case 'twofish192-ctr': case 'twofish256-ctr': return new Twofish('ctr'); case 'arcfour': case 'arcfour128': case 'arcfour256': return new RC4(); } return null; } /* * Tests whether or not proposed algorithm has a potential for issues * * @link https://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/ssh2-aesctr-openssh.html * @link https://bugzilla.mindrot.org/show_bug.cgi?id=1291 * @param string $algorithm Name of the encryption algorithm * @return bool * @access private */ private function bad_algorithm_candidate($algorithm) { switch ($algorithm) { case 'arcfour256': case 'aes192-ctr': case 'aes256-ctr': return true; } return false; } /** * Login * * The $password parameter can be a plaintext password, a \phpseclib\Crypt\RSA object or an array * * @param string $username * @param $args[] param mixed $password * @return bool * @see self::_login() * @access public */ public function login($username,...$args) { return $this->sublogin($username,...$args); } /** * Login Helper * * @param string $username * @param $args[] param mixed $password * @return bool * @see self::_login_helper() * @access private */ protected function sublogin($username,...$args) { if (!($this->bitmap & self::MASK_CONSTRUCTOR)) { if (!$this->connect()) { return false; } } if (empty($args)) { return $this->login_helper($username); } foreach ($args as $arg) { if ($this->login_helper($username, $arg)) { return true; } } return false; } /** * Login Helper * * @param string $username * @param string $password * @return bool * @throws \UnexpectedValueException on receipt of unexpected packets * @throws \RuntimeException on other errors * @access private * @internal It might be worthwhile, at some point, to protect against {@link http://tools.ietf.org/html/rfc4251#section-9.3.9 traffic analysis} * by sending dummy SSH_MSG_IGNORE messages. */ private function login_helper($username, $password = null) { if (!($this->bitmap & self::MASK_CONNECTED)) { return false; } if (!($this->bitmap & self::MASK_LOGIN_REQ)) { $packet = pack( 'CNa*', NET_SSH2_MSG_SERVICE_REQUEST, strlen('ssh-userauth'), 'ssh-userauth' ); if (!$this->send_binary_packet($packet)) { return false; } $response = $this->get_binary_packet(); if ($response === false) { if ($this->retry_connect) { $this->retry_connect = false; if (!$this->connect()) { return false; } return $this->login_helper($username, $password); } throw new \RuntimeException('Connection closed by server'); } if (strlen($response) < 4) { return false; } extract(unpack('Ctype', Strings::shift($response, 1))); /** @var integer $type */ if ($type != NET_SSH2_MSG_SERVICE_ACCEPT) { throw new \UnexpectedValueException('Expected SSH_MSG_SERVICE_ACCEPT'); } $this->bitmap |= self::MASK_LOGIN_REQ; } if (strlen($this->last_interactive_response)) { return !is_string($password) && !is_array($password) ? false : $this->keyboard_interactive_process($password); } if ($password instanceof RSA) { return $this->privatekey_login($username, $password); } elseif ($password instanceof Agent) { return $this->ssh_agent_login($username, $password); } if (is_array($password)) { if ($this->keyboard_interactive_login($username, $password)) { $this->bitmap |= self::MASK_LOGIN; return true; } return false; } if (!isset($password)) { $packet = pack( 'CNa*Na*Na*', NET_SSH2_MSG_USERAUTH_REQUEST, strlen($username), $username, strlen('ssh-connection'), 'ssh-connection', strlen('none'), 'none' ); if (!$this->send_binary_packet($packet)) { return false; } $response = $this->get_binary_packet(); if ($response === false) { throw new \RuntimeException('Connection closed by server'); } if (!strlen($response)) { return false; } extract(unpack('Ctype', Strings::shift($response, 1))); /** @var integer $type */ switch ($type) { case NET_SSH2_MSG_USERAUTH_SUCCESS: $this->bitmap |= self::MASK_LOGIN; return true; //case NET_SSH2_MSG_USERAUTH_FAILURE: default: return false; } } $packet = pack( 'CNa*Na*Na*CNa*', NET_SSH2_MSG_USERAUTH_REQUEST, strlen($username), $username, strlen('ssh-connection'), 'ssh-connection', strlen('password'), 'password', 0, strlen($password), $password ); // remove the username and password from the logged packet if (!defined('NET_SSH2_LOGGING')) { $logged = null; } else { $logged = pack( 'CNa*Na*Na*CNa*', NET_SSH2_MSG_USERAUTH_REQUEST, strlen('username'), 'username', strlen('ssh-connection'), 'ssh-connection', strlen('password'), 'password', 0, strlen('password'), 'password' ); } if (!$this->send_binary_packet($packet, $logged)) { return false; } $response = $this->get_binary_packet(); if ($response === false) { throw new \RuntimeException('Connection closed by server'); } if (!strlen($response)) { return false; } extract(unpack('Ctype', Strings::shift($response, 1))); /** @var integer $type */ switch ($type) { case NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ: // in theory, the password can be changed if (defined('NET_SSH2_LOGGING')) { $this->message_number_log[count($this->message_number_log) - 1] = 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ'; } if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ $this->errors[] = 'SSH_MSG_USERAUTH_PASSWD_CHANGEREQ: ' . utf8_decode(Strings::shift($response, $length)); return $this->disconnect_helper(NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER); case NET_SSH2_MSG_USERAUTH_FAILURE: // can we use keyboard-interactive authentication? if not then either the login is bad or the server employees // multi-factor authentication if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ $auth_methods = explode(',', Strings::shift($response, $length)); if (!strlen($response)) { return false; } extract(unpack('Cpartial_success', Strings::shift($response, 1))); /** @var integer $partial_success */ $partial_success = $partial_success != 0; if (!$partial_success && in_array('keyboard-interactive', $auth_methods)) { if ($this->keyboard_interactive_login($username, $password)) { $this->bitmap |= self::MASK_LOGIN; return true; } return false; } return false; case NET_SSH2_MSG_USERAUTH_SUCCESS: $this->bitmap |= self::MASK_LOGIN; return true; } return false; } /** * Login via keyboard-interactive authentication * * See {@link http://tools.ietf.org/html/rfc4256 RFC4256} for details. This is not a full-featured keyboard-interactive authenticator. * * @param string $username * @param string $password * @return bool * @access private */ private function keyboard_interactive_login($username, $password) { $packet = pack( 'CNa*Na*Na*Na*Na*', NET_SSH2_MSG_USERAUTH_REQUEST, strlen($username), $username, strlen('ssh-connection'), 'ssh-connection', strlen('keyboard-interactive'), 'keyboard-interactive', 0, '', 0, '' ); if (!$this->send_binary_packet($packet)) { return false; } return $this->keyboard_interactive_process($password); } /** * Handle the keyboard-interactive requests / responses. * * @param $responses[] * @return bool * @throws \RuntimeException on connection error * @access private */ private function keyboard_interactive_process(...$responses) { if (strlen($this->last_interactive_response)) { $response = $this->last_interactive_response; } else { $orig = $response = $this->get_binary_packet(); if ($response === false) { throw new \RuntimeException('Connection closed by server'); } } if (!strlen($response)) { return false; } extract(unpack('Ctype', Strings::shift($response, 1))); /** @var integer $type */ switch ($type) { case NET_SSH2_MSG_USERAUTH_INFO_REQUEST: if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ Strings::shift($response, $length); // name; may be empty if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ Strings::shift($response, $length); // instruction; may be empty if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ Strings::shift($response, $length); // language tag; may be empty if (strlen($response) < 4) { return false; } extract(unpack('Nnum_prompts', Strings::shift($response, 4))); /** @var integer $num_prompts */ for ($i = 0; $i < count($responses); $i++) { if (is_array($responses[$i])) { foreach ($responses[$i] as $key => $value) { $this->keyboard_requests_responses[$key] = $value; } unset($responses[$i]); } } $responses = array_values($responses); if (isset($this->keyboard_requests_responses)) { for ($i = 0; $i < $num_prompts; $i++) { if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ // prompt - ie. "Password: "; must not be empty $prompt = Strings::shift($response, $length); //$echo = Strings::shift($response) != chr(0); foreach ($this->keyboard_requests_responses as $key => $value) { if (substr($prompt, 0, strlen($key)) == $key) { $responses[] = $value; break; } } } } // see http://tools.ietf.org/html/rfc4256#section-3.2 if (strlen($this->last_interactive_response)) { $this->last_interactive_response = ''; } elseif (defined('NET_SSH2_LOGGING')) { $this->message_number_log[count($this->message_number_log) - 1] = str_replace( 'UNKNOWN', 'NET_SSH2_MSG_USERAUTH_INFO_REQUEST', $this->message_number_log[count($this->message_number_log) - 1] ); } if (!count($responses) && $num_prompts) { $this->last_interactive_response = $orig; return false; } /* After obtaining the requested information from the user, the client MUST respond with an SSH_MSG_USERAUTH_INFO_RESPONSE message. */ // see http://tools.ietf.org/html/rfc4256#section-3.4 $packet = $logged = pack('CN', NET_SSH2_MSG_USERAUTH_INFO_RESPONSE, count($responses)); for ($i = 0; $i < count($responses); $i++) { $packet.= pack('Na*', strlen($responses[$i]), $responses[$i]); $logged.= pack('Na*', strlen('dummy-answer'), 'dummy-answer'); } if (!$this->send_binary_packet($packet, $logged)) { return false; } if (defined('NET_SSH2_LOGGING') && NET_SSH2_LOGGING == self::LOG_COMPLEX) { $this->message_number_log[count($this->message_number_log) - 1] = str_replace( 'UNKNOWN', 'NET_SSH2_MSG_USERAUTH_INFO_RESPONSE', $this->message_number_log[count($this->message_number_log) - 1] ); } /* After receiving the response, the server MUST send either an SSH_MSG_USERAUTH_SUCCESS, SSH_MSG_USERAUTH_FAILURE, or another SSH_MSG_USERAUTH_INFO_REQUEST message. */ // maybe phpseclib should force close the connection after x request / responses? unless something like that is done // there could be an infinite loop of request / responses. return $this->keyboard_interactive_process(); case NET_SSH2_MSG_USERAUTH_SUCCESS: return true; case NET_SSH2_MSG_USERAUTH_FAILURE: return false; } return false; } /** * Login with an ssh-agent provided key * * @param string $username * @param \phpseclib\System\SSH\Agent $agent * @return bool * @access private */ private function ssh_agent_login($username, $agent) { $this->agent = $agent; $keys = $agent->requestIdentities(); foreach ($keys as $key) { if ($this->privatekey_login($username, $key)) { return true; } } return false; } /** * Login with an RSA private key * * @param string $username * @param \phpseclib\Crypt\RSA $password * @return bool * @throws \RuntimeException on connection error * @access private * @internal It might be worthwhile, at some point, to protect against {@link http://tools.ietf.org/html/rfc4251#section-9.3.9 traffic analysis} * by sending dummy SSH_MSG_IGNORE messages. */ private function privatekey_login($username, $privatekey) { // see http://tools.ietf.org/html/rfc4253#page-15 $publickey = $privatekey->getPublicKey('Raw'); if ($publickey === false) { return false; } $publickey = [ 'e' => $publickey['e']->toBytes(true), 'n' => $publickey['n']->toBytes(true) ]; $publickey = pack( 'Na*Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($publickey['e']), $publickey['e'], strlen($publickey['n']), $publickey['n'] ); $part1 = pack( 'CNa*Na*Na*', NET_SSH2_MSG_USERAUTH_REQUEST, strlen($username), $username, strlen('ssh-connection'), 'ssh-connection', strlen('publickey'), 'publickey' ); $part2 = pack('Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($publickey), $publickey); $packet = $part1 . chr(0) . $part2; if (!$this->send_binary_packet($packet)) { return false; } $response = $this->get_binary_packet(); if ($response === false) { throw new \RuntimeException('Connection closed by server'); } if (!strlen($response)) { return false; } extract(unpack('Ctype', Strings::shift($response, 1))); /** @var integer $type */ switch ($type) { case NET_SSH2_MSG_USERAUTH_FAILURE: if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ $this->errors[] = 'SSH_MSG_USERAUTH_FAILURE: ' . Strings::shift($response, $length); return false; case NET_SSH2_MSG_USERAUTH_PK_OK: // we'll just take it on faith that the public key blob and the public key algorithm name are as // they should be if (defined('NET_SSH2_LOGGING') && NET_SSH2_LOGGING == self::LOG_COMPLEX) { $this->message_number_log[count($this->message_number_log) - 1] = str_replace( 'UNKNOWN', 'NET_SSH2_MSG_USERAUTH_PK_OK', $this->message_number_log[count($this->message_number_log) - 1] ); } } $packet = $part1 . chr(1) . $part2; $privatekey->setHash('sha1'); $signature = $privatekey->sign(pack('Na*a*', strlen($this->session_id), $this->session_id, $packet), RSA::PADDING_PKCS1); $signature = pack('Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($signature), $signature); $packet.= pack('Na*', strlen($signature), $signature); if (!$this->send_binary_packet($packet)) { return false; } $response = $this->get_binary_packet(); if ($response === false) { throw new \RuntimeException('Connection closed by server'); } if (!strlen($response)) { return false; } extract(unpack('Ctype', Strings::shift($response, 1))); /** @var integer $type */ switch ($type) { case NET_SSH2_MSG_USERAUTH_FAILURE: // either the login is bad or the server employs multi-factor authentication return false; case NET_SSH2_MSG_USERAUTH_SUCCESS: $this->bitmap |= self::MASK_LOGIN; return true; } return false; } /** * Set Timeout * * $ssh->exec('ping 127.0.0.1'); on a Linux host will never return and will run indefinitely. setTimeout() makes it so it'll timeout. * Setting $timeout to false or 0 will mean there is no timeout. * * @param mixed $timeout * @access public */ public function setTimeout($timeout) { $this->timeout = $this->curTimeout = $timeout; } /** * Get the output from stdError * * @access public */ public function getStdError() { return $this->stdErrorLog; } /** * Execute Command * * If $callback is set to false then \phpseclib\Net\SSH2::_get_channel_packet(self::CHANNEL_EXEC) will need to be called manually. * In all likelihood, this is not a feature you want to be taking advantage of. * * @param string $command * @param Callback $callback * @return string * @throws \RuntimeException on connection error * @access public */ public function exec($command, $callback = null) { $this->curTimeout = $this->timeout; $this->is_timeout = false; $this->stdErrorLog = ''; if (!$this->isAuthenticated()) { return false; } if ($this->in_request_pty_exec) { throw new \RuntimeException('If you want to run multiple exec()\'s you will need to disable (and re-enable if appropriate) a PTY for each one.'); } // RFC4254 defines the (client) window size as "bytes the other party can send before it must wait for the window to // be adjusted". 0x7FFFFFFF is, at 2GB, the max size. technically, it should probably be decremented, but, // honestly, if you're transferring more than 2GB, you probably shouldn't be using phpseclib, anyway. // see http://tools.ietf.org/html/rfc4254#section-5.2 for more info $this->window_size_server_to_client[self::CHANNEL_EXEC] = $this->window_size; // 0x8000 is the maximum max packet size, per http://tools.ietf.org/html/rfc4253#section-6.1, although since PuTTy // uses 0x4000, that's what will be used here, as well. $packet_size = 0x4000; $packet = pack( 'CNa*N3', NET_SSH2_MSG_CHANNEL_OPEN, strlen('session'), 'session', self::CHANNEL_EXEC, $this->window_size_server_to_client[self::CHANNEL_EXEC], $packet_size ); if (!$this->send_binary_packet($packet)) { return false; } $this->channel_status[self::CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_OPEN; $response = $this->get_channel_packet(self::CHANNEL_EXEC); if ($response === false) { return false; } if ($this->request_pty === true) { $terminal_modes = pack('C', NET_SSH2_TTY_OP_END); $packet = pack( 'CNNa*CNa*N5a*', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[self::CHANNEL_EXEC], strlen('pty-req'), 'pty-req', 1, strlen('vt100'), 'vt100', $this->windowColumns, $this->windowRows, 0, 0, strlen($terminal_modes), $terminal_modes ); if (!$this->send_binary_packet($packet)) { return false; } $response = $this->get_binary_packet(); if ($response === false) { throw new \RuntimeException('Connection closed by server'); } if (!strlen($response)) { return false; } list(, $type) = unpack('C', Strings::shift($response, 1)); switch ($type) { case NET_SSH2_MSG_CHANNEL_SUCCESS: break; case NET_SSH2_MSG_CHANNEL_FAILURE: default: $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); throw new \RuntimeException('Unable to request pseudo-terminal'); } $this->in_request_pty_exec = true; } // sending a pty-req SSH_MSG_CHANNEL_REQUEST message is unnecessary and, in fact, in most cases, slows things // down. the one place where it might be desirable is if you're doing something like \phpseclib\Net\SSH2::exec('ping localhost &'). // with a pty-req SSH_MSG_CHANNEL_REQUEST, exec() will return immediately and the ping process will then // then immediately terminate. without such a request exec() will loop indefinitely. the ping process won't end but // neither will your script. // although, in theory, the size of SSH_MSG_CHANNEL_REQUEST could exceed the maximum packet size established by // SSH_MSG_CHANNEL_OPEN_CONFIRMATION, RFC4254#section-5.1 states that the "maximum packet size" refers to the // "maximum size of an individual data packet". ie. SSH_MSG_CHANNEL_DATA. RFC4254#section-5.2 corroborates. $packet = pack( 'CNNa*CNa*', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[self::CHANNEL_EXEC], strlen('exec'), 'exec', 1, strlen($command), $command ); if (!$this->send_binary_packet($packet)) { return false; } $this->channel_status[self::CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_REQUEST; $response = $this->get_channel_packet(self::CHANNEL_EXEC); if ($response === false) { return false; } $this->channel_status[self::CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_DATA; if ($callback === false || $this->in_request_pty_exec) { return true; } $output = ''; while (true) { $temp = $this->get_channel_packet(self::CHANNEL_EXEC); switch (true) { case $temp === true: return is_callable($callback) ? true : $output; case $temp === false: return false; default: if (is_callable($callback)) { if (call_user_func($callback, $temp) === true) { $this->close_channel(self::CHANNEL_EXEC); return true; } } else { $output.= $temp; } } } } /** * Creates an interactive shell * * @see self::read() * @see self::write() * @return bool * @throws \UnexpectedValueException on receipt of unexpected packets * @throws \RuntimeException on other errors * @access private */ private function initShell() { if ($this->in_request_pty_exec === true) { return true; } $this->window_size_server_to_client[self::CHANNEL_SHELL] = $this->window_size; $packet_size = 0x4000; $packet = pack( 'CNa*N3', NET_SSH2_MSG_CHANNEL_OPEN, strlen('session'), 'session', self::CHANNEL_SHELL, $this->window_size_server_to_client[self::CHANNEL_SHELL], $packet_size ); if (!$this->send_binary_packet($packet)) { return false; } $this->channel_status[self::CHANNEL_SHELL] = NET_SSH2_MSG_CHANNEL_OPEN; $response = $this->get_channel_packet(self::CHANNEL_SHELL); if ($response === false) { return false; } $terminal_modes = pack('C', NET_SSH2_TTY_OP_END); $packet = pack( 'CNNa*CNa*N5a*', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[self::CHANNEL_SHELL], strlen('pty-req'), 'pty-req', 1, strlen('vt100'), 'vt100', $this->windowColumns, $this->windowRows, 0, 0, strlen($terminal_modes), $terminal_modes ); if (!$this->send_binary_packet($packet)) { return false; } $response = $this->get_binary_packet(); if ($response === false) { throw new \RuntimeException('Connection closed by server'); } if (!strlen($response)) { return false; } list(, $type) = unpack('C', Strings::shift($response, 1)); switch ($type) { case NET_SSH2_MSG_CHANNEL_SUCCESS: // if a pty can't be opened maybe commands can still be executed case NET_SSH2_MSG_CHANNEL_FAILURE: break; default: $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); throw new \UnexpectedValueException('Unable to request pseudo-terminal'); } $packet = pack( 'CNNa*C', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[self::CHANNEL_SHELL], strlen('shell'), 'shell', 1 ); if (!$this->send_binary_packet($packet)) { return false; } $this->channel_status[self::CHANNEL_SHELL] = NET_SSH2_MSG_CHANNEL_REQUEST; $response = $this->get_channel_packet(self::CHANNEL_SHELL); if ($response === false) { return false; } $this->channel_status[self::CHANNEL_SHELL] = NET_SSH2_MSG_CHANNEL_DATA; $this->bitmap |= self::MASK_SHELL; return true; } /** * Return the channel to be used with read() / write() * * @see self::read() * @see self::write() * @return int * @access public */ private function get_interactive_channel() { switch (true) { case $this->in_subsystem: return self::CHANNEL_SUBSYSTEM; case $this->in_request_pty_exec: return self::CHANNEL_EXEC; default: return self::CHANNEL_SHELL; } } /** * Return an available open channel * * @return int * @access public */ private function get_open_channel() { $channel = self::CHANNEL_EXEC; do { if (isset($this->channel_status[$channel]) && $this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_OPEN) { return $channel; } } while ($channel++ < self::CHANNEL_SUBSYSTEM); return false; } /** * Returns the output of an interactive shell * * Returns when there's a match for $expect, which can take the form of a string literal or, * if $mode == self::READ_REGEX, a regular expression. * * @see self::write() * @param string $expect * @param int $mode * @return string * @throws \RuntimeException on connection error * @access public */ public function read($expect = '', $mode = self::READ_SIMPLE) { $this->curTimeout = $this->timeout; $this->is_timeout = false; if (!$this->isAuthenticated()) { throw new \RuntimeException('Operation disallowed prior to login()'); } if (!($this->bitmap & self::MASK_SHELL) && !$this->initShell()) { throw new \RuntimeException('Unable to initiate an interactive shell session'); } $channel = $this->get_interactive_channel(); if ($mode == self::READ_NEXT) { return $this->_get_channel_packet($channel); } $match = $expect; while (true) { if ($mode == self::READ_REGEX) { preg_match($expect, substr($this->interactiveBuffer, -1024), $matches); $match = isset($matches[0]) ? $matches[0] : ''; } $pos = strlen($match) ? strpos($this->interactiveBuffer, $match) : false; if ($pos !== false) { return Strings::shift($this->interactiveBuffer, $pos + strlen($match)); } $response = $this->get_channel_packet($channel); if (is_bool($response)) { $this->in_request_pty_exec = false; return $response ? Strings::shift($this->interactiveBuffer, strlen($this->interactiveBuffer)) : false; } $this->interactiveBuffer.= $response; } } /** * Inputs a command into an interactive shell. * * @see self::read() * @param string $cmd * @return bool * @throws \RuntimeException on connection error * @access public */ public function write($cmd) { if (!$this->isAuthenticated()) { throw new \RuntimeException('Operation disallowed prior to login()'); } if (!($this->bitmap & self::MASK_SHELL) && !$this->initShell()) { throw new \RuntimeException('Unable to initiate an interactive shell session'); } return $this->send_channel_packet($this->get_interactive_channel(), $cmd); } /** * Start a subsystem. * * Right now only one subsystem at a time is supported. To support multiple subsystem's stopSubsystem() could accept * a string that contained the name of the subsystem, but at that point, only one subsystem of each type could be opened. * To support multiple subsystem's of the same name maybe it'd be best if startSubsystem() generated a new channel id and * returns that and then that that was passed into stopSubsystem() but that'll be saved for a future date and implemented * if there's sufficient demand for such a feature. * * @see self::stopSubsystem() * @param string $subsystem * @return bool * @access public */ public function startSubsystem($subsystem) { $this->window_size_server_to_client[self::CHANNEL_SUBSYSTEM] = $this->window_size; $packet = pack( 'CNa*N3', NET_SSH2_MSG_CHANNEL_OPEN, strlen('session'), 'session', self::CHANNEL_SUBSYSTEM, $this->window_size, 0x4000 ); if (!$this->send_binary_packet($packet)) { return false; } $this->channel_status[self::CHANNEL_SUBSYSTEM] = NET_SSH2_MSG_CHANNEL_OPEN; $response = $this->get_channel_packet(self::CHANNEL_SUBSYSTEM); if ($response === false) { return false; } $packet = pack( 'CNNa*CNa*', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[self::CHANNEL_SUBSYSTEM], strlen('subsystem'), 'subsystem', 1, strlen($subsystem), $subsystem ); if (!$this->send_binary_packet($packet)) { return false; } $this->channel_status[self::CHANNEL_SUBSYSTEM] = NET_SSH2_MSG_CHANNEL_REQUEST; $response = $this->get_channel_packet(self::CHANNEL_SUBSYSTEM); if ($response === false) { return false; } $this->channel_status[self::CHANNEL_SUBSYSTEM] = NET_SSH2_MSG_CHANNEL_DATA; $this->bitmap |= self::MASK_SHELL; $this->in_subsystem = true; return true; } /** * Stops a subsystem. * * @see self::startSubsystem() * @return bool * @access public */ public function stopSubsystem() { $this->in_subsystem = false; $this->close_channel(self::CHANNEL_SUBSYSTEM); return true; } /** * Closes a channel * * If read() timed out you might want to just close the channel and have it auto-restart on the next read() call * * @access public */ public function reset() { $this->close_channel($this->get_interactive_channel()); } /** * Is timeout? * * Did exec() or read() return because they timed out or because they encountered the end? * * @access public */ public function isTimeout() { return $this->is_timeout; } /** * Disconnect * * @access public */ public function disconnect() { $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); if (isset($this->realtime_log_file) && is_resource($this->realtime_log_file)) { fclose($this->realtime_log_file); } unset(self::$connections[$this->getResourceId()]); } /** * Destructor. * * Will be called, automatically, if you're supporting just PHP5. If you're supporting PHP4, you'll need to call * disconnect(). * * @access public */ public function __destruct() { $this->disconnect(); } /** * Is the connection still active? * * @return bool * @access public */ public function isConnected() { return (bool) ($this->bitmap & self::MASK_CONNECTED); } /** * Have you successfully been logged in? * * @return bool * @access public */ public function isAuthenticated() { return (bool) ($this->bitmap & self::MASK_LOGIN); } /** * Resets a connection for re-use * * @param int $reason * @access private */ private function reset_connection($reason) { $this->disconnect_helper($reason); $this->decrypt = $this->encrypt = false; $this->decrypt_block_size = $this->encrypt_block_size = 8; $this->hmac_check = $this->hmac_create = false; $this->hmac_size = false; $this->session_id = false; $this->retry_connect = true; $this->get_seq_no = $this->send_seq_no = 0; } /** * Gets Binary Packets * * See '6. Binary Packet Protocol' of rfc4253 for more info. * * @see self::_send_binary_packet() * @param bool $filter_channel_packets * @return string * @access private */ private function get_binary_packet($skip_channel_filter = false) { if (!is_resource($this->fsock) || feof($this->fsock)) { $this->bitmap = 0; throw new \RuntimeException('Connection closed prematurely'); } $start = microtime(true); $raw = stream_get_contents($this->fsock, $this->decrypt_block_size); if (!strlen($raw)) { return ''; } if ($this->decrypt !== false) { $raw = $this->decrypt->decrypt($raw); } if (strlen($raw) < 5) { return false; } extract(unpack('Npacket_length/Cpadding_length', Strings::shift($raw, 5))); /** * @var integer $packet_length * @var integer $padding_length */ $remaining_length = $packet_length + 4 - $this->decrypt_block_size; // quoting <http://tools.ietf.org/html/rfc4253#section-6.1>, // "implementations SHOULD check that the packet length is reasonable" // PuTTY uses 0x9000 as the actual max packet size and so to shall we if ($remaining_length < -$this->decrypt_block_size || $remaining_length > 0x9000 || $remaining_length % $this->decrypt_block_size != 0) { if (!$this->bad_key_size_fix && $this->bad_algorithm_candidate($this->decrypt_algorithm) && !($this->bitmap & SSH2::MASK_LOGIN)) { $this->bad_key_size_fix = true; $this->reset_connection(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); return false; } throw new \RuntimeException('Invalid size'); } $buffer = ''; while ($remaining_length > 0) { $temp = stream_get_contents($this->fsock, $remaining_length); if ($temp === false || feof($this->fsock)) { $this->bitmap = 0; throw new \RuntimeException('Error reading from socket'); } $buffer.= $temp; $remaining_length-= strlen($temp); } $stop = microtime(true); if (strlen($buffer)) { $raw.= $this->decrypt !== false ? $this->decrypt->decrypt($buffer) : $buffer; } $payload = Strings::shift($raw, $packet_length - $padding_length - 1); $padding = Strings::shift($raw, $padding_length); // should leave $raw empty if ($this->hmac_check !== false) { $hmac = stream_get_contents($this->fsock, $this->hmac_size); if ($hmac === false || strlen($hmac) != $this->hmac_size) { $this->bitmap = 0; throw new \RuntimeException('Error reading socket'); } elseif ($hmac != $this->hmac_check->hash(pack('NNCa*', $this->get_seq_no, $packet_length, $padding_length, $payload . $padding))) { throw new \RuntimeException('Invalid HMAC'); } } //if ($this->decompress) { // $payload = gzinflate(substr($payload, 2)); //} $this->get_seq_no++; if (defined('NET_SSH2_LOGGING')) { $current = microtime(true); $message_number = isset($this->message_numbers[ord($payload[0])]) ? $this->message_numbers[ord($payload[0])] : 'UNKNOWN (' . ord($payload[0]) . ')'; $message_number = '<- ' . $message_number . ' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)'; $this->append_log($message_number, $payload); $this->last_packet = $current; } return $this->filter($payload, $skip_channel_filter); } /** * Filter Binary Packets * * Because some binary packets need to be ignored... * * @see self::_get_binary_packet() * @param string $payload * @param bool $filter_channel_packets * @return string * @access private */ private function filter($payload, $skip_channel_filter) { switch (ord($payload[0])) { case NET_SSH2_MSG_DISCONNECT: Strings::shift($payload, 1); if (strlen($payload) < 8) { return false; } extract(unpack('Nreason_code/Nlength', Strings::shift($payload, 8))); /** * @var integer $reason_code * @var integer $length */ $this->errors[] = 'SSH_MSG_DISCONNECT: ' . $this->disconnect_reasons[$reason_code] . "\r\n" . utf8_decode(Strings::shift($payload, $length)); $this->bitmap = 0; return false; case NET_SSH2_MSG_IGNORE: $payload = $this->get_binary_packet($skip_channel_filter); break; case NET_SSH2_MSG_DEBUG: Strings::shift($payload, 2); if (strlen($payload) < 4) { return false; } extract(unpack('Nlength', Strings::shift($payload, 4))); /** @var integer $length */ $this->errors[] = 'SSH_MSG_DEBUG: ' . utf8_decode(Strings::shift($payload, $length)); $payload = $this->get_binary_packet($skip_channel_filter); break; case NET_SSH2_MSG_UNIMPLEMENTED: return false; case NET_SSH2_MSG_KEXINIT: if ($this->session_id !== false) { if (!$this->key_exchange($payload)) { $this->bitmap = 0; return false; } $payload = $this->get_binary_packet($skip_channel_filter); } } // see http://tools.ietf.org/html/rfc4252#section-5.4; only called when the encryption has been activated and when we haven't already logged in if (($this->bitmap & self::MASK_CONNECTED) && !$this->isAuthenticated() && ord($payload[0]) == NET_SSH2_MSG_USERAUTH_BANNER) { Strings::shift($payload, 1); if (strlen($payload) < 4) { return false; } extract(unpack('Nlength', Strings::shift($payload, 4))); /** @var integer $length */ $this->banner_message = utf8_decode(Strings::shift($payload, $length)); $payload = $this->get_binary_packet(); } // only called when we've already logged in if (($this->bitmap & self::MASK_CONNECTED) && $this->isAuthenticated()) { switch (ord($payload[0])) { case NET_SSH2_MSG_CHANNEL_DATA: case NET_SSH2_MSG_CHANNEL_EXTENDED_DATA: case NET_SSH2_MSG_CHANNEL_REQUEST: case NET_SSH2_MSG_CHANNEL_CLOSE: case NET_SSH2_MSG_CHANNEL_EOF: if (!$skip_channel_filter && !empty($this->server_channels)) { $this->binary_packet_buffer = $payload; $this->get_channel_packet(true); $payload = $this->get_binary_packet(); } break; case NET_SSH2_MSG_GLOBAL_REQUEST: // see http://tools.ietf.org/html/rfc4254#section-4 if (strlen($payload) < 4) { return false; } extract(unpack('Nlength', Strings::shift($payload, 4))); /** @var integer $length */ $this->errors[] = 'SSH_MSG_GLOBAL_REQUEST: ' . Strings::shift($payload, $length); if (!$this->send_binary_packet(pack('C', NET_SSH2_MSG_REQUEST_FAILURE))) { return $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); } $payload = $this->get_binary_packet($skip_channel_filter); break; case NET_SSH2_MSG_CHANNEL_OPEN: // see http://tools.ietf.org/html/rfc4254#section-5.1 Strings::shift($payload, 1); if (strlen($payload) < 4) { return false; } extract(unpack('Nlength', Strings::shift($payload, 4))); /** @var integer $length */ $data = Strings::shift($payload, $length); if (strlen($payload) < 4) { return false; } extract(unpack('Nserver_channel', Strings::shift($payload, 4))); /** @var integer $server_channel */ switch ($data) { case 'auth-agent': case 'auth-agent@openssh.com': if (isset($this->agent)) { $new_channel = self::CHANNEL_AGENT_FORWARD; if (strlen($payload) < 8) { return false; } extract(unpack('Nremote_window_size', Strings::shift($payload, 4))); /** @var integer $remote_window_size */ extract(unpack('Nremote_maximum_packet_size', Strings::shift($payload, 4))); /** @var integer $remote_maximum_packet_size*/ $this->packet_size_client_to_server[$new_channel] = $remote_window_size; $this->window_size_server_to_client[$new_channel] = $remote_maximum_packet_size; $this->window_size_client_to_server[$new_channel] = $this->window_size; $packet_size = 0x4000; $packet = pack( 'CN4', NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, $server_channel, $new_channel, $packet_size, $packet_size ); $this->server_channels[$new_channel] = $server_channel; $this->channel_status[$new_channel] = NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION; if (!$this->send_binary_packet($packet)) { return false; } } break; default: $packet = pack( 'CN3a*Na*', NET_SSH2_MSG_REQUEST_FAILURE, $server_channel, NET_SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED, 0, '', 0, '' ); if (!$this->send_binary_packet($packet)) { return $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); } } $payload = $this->get_binary_packet($skip_channel_filter); break; case NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST: Strings::shift($payload, 1); if (strlen($payload) < 8) { return false; } extract(unpack('Nchannel', Strings::shift($payload, 4))); /** @var integer $channel */ extract(unpack('Nwindow_size', Strings::shift($payload, 4))); /** @var integer $window_size */ $this->window_size_client_to_server[$channel]+= $window_size; $payload = ($this->bitmap & self::MASK_WINDOW_ADJUST) ? true : $this->get_binary_packet($skip_channel_filter); } } return $payload; } /** * Enable Quiet Mode * * Suppress stderr from output * * @access public */ public function enableQuietMode() { $this->quiet_mode = true; } /** * Disable Quiet Mode * * Show stderr in output * * @access public */ public function disableQuietMode() { $this->quiet_mode = false; } /** * Returns whether Quiet Mode is enabled or not * * @see self::enableQuietMode() * @see self::disableQuietMode() * @access public * @return bool */ public function isQuietModeEnabled() { return $this->quiet_mode; } /** * Enable request-pty when using exec() * * @access public */ public function enablePTY() { $this->request_pty = true; } /** * Disable request-pty when using exec() * * @access public */ public function disablePTY() { if ($this->in_request_pty_exec) { $this->close_channel(self::CHANNEL_EXEC); $this->in_request_pty_exec = false; } $this->request_pty = false; } /** * Returns whether request-pty is enabled or not * * @see self::enablePTY() * @see self::disablePTY() * @access public * @return bool */ public function isPTYEnabled() { return $this->request_pty; } /** * Gets channel data * * Returns the data as a string if it's available and false if not. * * @param int $client_channel * @param bool $skip_extended * @return mixed * @throws \RuntimeException on connection error * @access private */ protected function get_channel_packet($client_channel, $skip_extended = false) { if (!empty($this->channel_buffers[$client_channel])) { return array_shift($this->channel_buffers[$client_channel]); } while (true) { if ($this->binary_packet_buffer !== false) { $response = $this->binary_packet_buffer; $this->binary_packet_buffer = false; } else { if ($this->curTimeout) { if ($this->curTimeout < 0) { $this->is_timeout = true; return true; } $read = [$this->fsock]; $write = $except = null; $start = microtime(true); $sec = floor($this->curTimeout); $usec = 1000000 * ($this->curTimeout - $sec); // on windows this returns a "Warning: Invalid CRT parameters detected" error if (!@stream_select($read, $write, $except, $sec, $usec) && !count($read)) { $this->is_timeout = true; return true; } $elapsed = microtime(true) - $start; $this->curTimeout-= $elapsed; } $response = $this->get_binary_packet(true); if ($response === false) { throw new \RuntimeException('Connection closed by server'); } } if ($client_channel == -1 && $response === true) { return true; } if (!strlen($response)) { return ''; } if (!strlen($response)) { return false; } extract(unpack('Ctype', Strings::shift($response, 1))); /** @var integer $type */ if (strlen($response) < 4) { return false; } if ($type == NET_SSH2_MSG_CHANNEL_OPEN) { extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ } else { extract(unpack('Nchannel', Strings::shift($response, 4))); /** @var integer $channel */ } // will not be setup yet on incoming channel open request if (isset($channel) && isset($this->channel_status[$channel]) && isset($this->window_size_server_to_client[$channel])) { $this->window_size_server_to_client[$channel]-= strlen($response); // resize the window, if appropriate if ($this->window_size_server_to_client[$channel] < 0) { $packet = pack('CNN', NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST, $this->server_channels[$channel], $this->window_size); if (!$this->send_binary_packet($packet)) { return false; } $this->window_size_server_to_client[$channel]+= $this->window_size; } switch ($type) { case NET_SSH2_MSG_CHANNEL_EXTENDED_DATA: /* if ($client_channel == NET_SSH2_CHANNEL_EXEC) { $this->_send_channel_packet($client_channel, chr(0)); } */ // currently, there's only one possible value for $data_type_code: NET_SSH2_EXTENDED_DATA_STDERR if (strlen($response) < 8) { return false; } extract(unpack('Ndata_type_code/Nlength', Strings::shift($response, 8))); $data = Strings::shift($response, $length); $this->stdErrorLog.= $data; if ($skip_extended || $this->quiet_mode) { continue 2; } if ($client_channel == $channel && $this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_DATA) { return $data; } if (!isset($this->channel_buffers[$channel])) { $this->channel_buffers[$channel] = array(); } $this->channel_buffers[$channel][] = $data; continue 2; case NET_SSH2_MSG_CHANNEL_REQUEST: if ($this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_CLOSE) { continue 2; } if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); $value = Strings::shift($response, $length); switch ($value) { case 'exit-signal': Strings::shift($response, 1); if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ $this->errors[] = 'SSH_MSG_CHANNEL_REQUEST (exit-signal): ' . Strings::shift($response, $length); $this->_string_shift($response, 1); if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ if ($length) { $this->errors[count($this->errors)].= "\r\n" . Strings::shift($response, $length); } $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel])); $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_EOF; continue 3; case 'exit-status': if (strlen($response) < 5) { return false; } extract(unpack('Cfalse/Nexit_status', Strings::shift($response, 5))); /** * @var integer $false * @var integer $exit_status */ $this->exit_status = $exit_status; // "The client MAY ignore these messages." // -- http://tools.ietf.org/html/rfc4254#section-6.10 continue 3; default: // "Some systems may not implement signals, in which case they SHOULD ignore this message." // -- http://tools.ietf.org/html/rfc4254#section-6.9 continue 3; } } switch ($this->channel_status[$channel]) { case NET_SSH2_MSG_CHANNEL_OPEN: switch ($type) { case NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION: if (strlen($response) < 4) { return false; } extract(unpack('Nserver_channel', Strings::shift($response, 4))); /** @var integer $server_channel */ $this->server_channels[$channel] = $server_channel; if (strlen($response) < 4) { return false; } extract(unpack('Nwindow_size', Strings::shift($response, 4))); /** @var integer $window_size */ if ($window_size < 0) { $window_size&= 0x7FFFFFFF; $window_size+= 0x80000000; } $this->window_size_client_to_server[$channel] = $window_size; if (strlen($response) < 4) { return false; } $temp = unpack('Npacket_size_client_to_server', Strings::shift($response, 4)); $this->packet_size_client_to_server[$channel] = $temp['packet_size_client_to_server']; $result = $client_channel == $channel ? true : $this->get_channel_packet($client_channel, $skip_extended); $this->on_channel_open(); return $result; //case NET_SSH2_MSG_CHANNEL_OPEN_FAILURE: default: $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); throw new \RuntimeException('Unable to open channel'); } break; case NET_SSH2_MSG_CHANNEL_REQUEST: switch ($type) { case NET_SSH2_MSG_CHANNEL_SUCCESS: return true; case NET_SSH2_MSG_CHANNEL_FAILURE: return false; default: $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); throw new \RuntimeException('Unable to fulfill channel request'); } case NET_SSH2_MSG_CHANNEL_CLOSE: return $type == NET_SSH2_MSG_CHANNEL_CLOSE ? true : $this->get_channel_packet($client_channel, $skip_extended); } } // ie. $this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_DATA switch ($type) { case NET_SSH2_MSG_CHANNEL_DATA: /* if ($channel == self::CHANNEL_EXEC) { // SCP requires null packets, such as this, be sent. further, in the case of the ssh.com SSH server // this actually seems to make things twice as fast. more to the point, the message right after // SSH_MSG_CHANNEL_DATA (usually SSH_MSG_IGNORE) won't block for as long as it would have otherwise. // in OpenSSH it slows things down but only by a couple thousandths of a second. $this->send_channel_packet($channel, chr(0)); } */ if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ $data = Strings::shift($response, $length); if ($channel == self::CHANNEL_AGENT_FORWARD) { $agent_response = Objects::callFunc($this->agent, 'forward_data', [$data]); if (!is_bool($agent_response)) { $this->send_channel_packet($channel, $agent_response); } break; } if ($client_channel == $channel) { return $data; } if (!isset($this->channel_buffers[$channel])) { $this->channel_buffers[$channel] = []; } $this->channel_buffers[$channel][] = $data; break; case NET_SSH2_MSG_CHANNEL_CLOSE: $this->curTimeout = 0; if ($this->bitmap & self::MASK_SHELL) { $this->bitmap&= ~self::MASK_SHELL; } if ($this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_EOF) { $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); } $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_CLOSE; if ($client_channel == $channel) { return true; } case NET_SSH2_MSG_CHANNEL_EOF: break; default: $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); throw new \RuntimeException('Error reading channel data'); } } } /** * Sends Binary Packets * * See '6. Binary Packet Protocol' of rfc4253 for more info. * * @param string $data * @param string $logged * @see self::_get_binary_packet() * @return bool * @access private */ protected function send_binary_packet($data, $logged = null) { if (!is_resource($this->fsock) || feof($this->fsock)) { $this->bitmap = 0; throw new \RuntimeException('Connection closed prematurely'); } //if ($this->compress) { // // the -4 removes the checksum: // // http://php.net/function.gzcompress#57710 // $data = substr(gzcompress($data), 0, -4); //} // 4 (packet length) + 1 (padding length) + 4 (minimal padding amount) == 9 $packet_length = strlen($data) + 9; // round up to the nearest $this->encrypt_block_size $packet_length+= (($this->encrypt_block_size - 1) * $packet_length) % $this->encrypt_block_size; // subtracting strlen($data) is obvious - subtracting 5 is necessary because of packet_length and padding_length $padding_length = $packet_length - strlen($data) - 5; $padding = Random::string($padding_length); // we subtract 4 from packet_length because the packet_length field isn't supposed to include itself $packet = pack('NCa*', $packet_length - 4, $padding_length, $data . $padding); $hmac = $this->hmac_create !== false ? $this->hmac_create->hash(pack('Na*', $this->send_seq_no, $packet)) : ''; $this->send_seq_no++; if ($this->encrypt !== false) { $packet = $this->encrypt->encrypt($packet); } $packet.= $hmac; $start = microtime(true); $result = strlen($packet) == fputs($this->fsock, $packet); $stop = microtime(true); if (defined('NET_SSH2_LOGGING')) { $current = microtime(true); $message_number = isset($this->message_numbers[ord($data[0])]) ? $this->message_numbers[ord($data[0])] : 'UNKNOWN (' . ord($data[0]) . ')'; $message_number = '-> ' . $message_number . ' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)'; $this->append_log($message_number, isset($logged) ? $logged : $data); $this->last_packet = $current; } return $result; } /** * Logs data packets * * Makes sure that only the last 1MB worth of packets will be logged * * @param string $message_number * @param string $message * @access private */ private function append_log($message_number, $message) { // remove the byte identifying the message type from all but the first two messages (ie. the identification strings) if (strlen($message_number) > 2) { Strings::shift($message); } switch (NET_SSH2_LOGGING) { // useful for benchmarks case self::LOG_SIMPLE: $this->message_number_log[] = $message_number; break; // the most useful log for SSH2 case self::LOG_COMPLEX: $this->message_number_log[] = $message_number; $this->log_size+= strlen($message); $this->message_log[] = $message; while ($this->log_size > self::LOG_MAX_SIZE) { $this->log_size-= strlen(array_shift($this->message_log)); array_shift($this->message_number_log); } break; // dump the output out realtime; packets may be interspersed with non packets, // passwords won't be filtered out and select other packets may not be correctly // identified case self::LOG_REALTIME: switch (PHP_SAPI) { case 'cli': $start = $stop = "\r\n"; break; default: $start = '<pre>'; $stop = '</pre>'; } echo $start . $this->format_log([$message], [$message_number]) . $stop; @flush(); @ob_flush(); break; // basically the same thing as self::LOG_REALTIME with the caveat that NET_SSH2_LOG_REALTIME_FILENAME // needs to be defined and that the resultant log file will be capped out at self::LOG_MAX_SIZE. // the earliest part of the log file is denoted by the first <<< START >>> and is not going to necessarily // at the beginning of the file case self::LOG_REALTIME_FILE: if (!isset($this->realtime_log_file)) { // PHP doesn't seem to like using constants in fopen() $filename = NET_SSH2_LOG_REALTIME_FILENAME; $fp = fopen($filename, 'w'); $this->realtime_log_file = $fp; } if (!is_resource($this->realtime_log_file)) { break; } $entry = $this->format_log([$message], [$message_number]); if ($this->realtime_log_wrap) { $temp = "<<< START >>>\r\n"; $entry.= $temp; fseek($this->realtime_log_file, ftell($this->realtime_log_file) - strlen($temp)); } $this->realtime_log_size+= strlen($entry); if ($this->realtime_log_size > self::LOG_MAX_SIZE) { fseek($this->realtime_log_file, 0); $this->realtime_log_size = strlen($entry); $this->realtime_log_wrap = true; } fputs($this->realtime_log_file, $entry); } } /** * Sends channel data * * Spans multiple SSH_MSG_CHANNEL_DATAs if appropriate * * @param int $client_channel * @param string $data * @return bool * @access private */ protected function send_channel_packet($client_channel, $data) { while (strlen($data)) { if (!$this->window_size_client_to_server[$client_channel]) { $this->bitmap^= self::MASK_WINDOW_ADJUST; // using an invalid channel will let the buffers be built up for the valid channels $this->get_channel_packet(-1); $this->bitmap^= self::MASK_WINDOW_ADJUST; } /* The maximum amount of data allowed is determined by the maximum packet size for the channel, and the current window size, whichever is smaller. -- http://tools.ietf.org/html/rfc4254#section-5.2 */ $max_size = min( $this->packet_size_client_to_server[$client_channel], $this->window_size_client_to_server[$client_channel] ); $temp = Strings::shift($data, $max_size); $packet = pack( 'CN2a*', NET_SSH2_MSG_CHANNEL_DATA, $this->server_channels[$client_channel], strlen($temp), $temp ); $this->window_size_client_to_server[$client_channel]-= strlen($temp); if (!$this->send_binary_packet($packet)) { return false; } } return true; } /** * Closes and flushes a channel * * \phpseclib\Net\SSH2 doesn't properly close most channels. For exec() channels are normally closed by the server * and for SFTP channels are presumably closed when the client disconnects. This functions is intended * for SCP more than anything. * * @param int $client_channel * @param bool $want_reply * @return bool * @access private */ private function close_channel($client_channel, $want_reply = false) { // see http://tools.ietf.org/html/rfc4254#section-5.3 $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel])); if (!$want_reply) { $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel])); } $this->channel_status[$client_channel] = NET_SSH2_MSG_CHANNEL_CLOSE; $this->curTimeout = 0; while (!is_bool($this->get_channel_packet($client_channel))) { } if ($want_reply) { $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel])); } if ($this->bitmap & self::MASK_SHELL) { $this->bitmap&= ~self::MASK_SHELL; } } /** * Disconnect * * @param int $reason * @return bool * @access protected */ protected function disconnect_helper($reason) { if ($this->bitmap & self::MASK_CONNECTED) { $data = pack('CNNa*Na*', NET_SSH2_MSG_DISCONNECT, $reason, 0, '', 0, ''); $this->send_binary_packet($data); $this->bitmap = 0; fclose($this->fsock); return false; } } /** * Define Array * * Takes any number of arrays whose indices are integers and whose values are strings and defines a bunch of * named constants from it, using the value as the name of the constant and the index as the value of the constant. * If any of the constants that would be defined already exists, none of the constants will be defined. * * @param $args[] * @access protected */ protected function define_array(...$args) { foreach ($args as $arg) { foreach ($arg as $key => $value) { if (!defined($value)) { define($value, $key); } else { break 2; } } } } /** * Returns a log of the packets that have been sent and received. * * Returns a string if NET_SSH2_LOGGING == self::LOG_COMPLEX, an array if NET_SSH2_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SSH2_LOGGING') * * @access public * @return array|false|string */ public function getLog() { if (!defined('NET_SSH2_LOGGING')) { return false; } switch (NET_SSH2_LOGGING) { case self::LOG_SIMPLE: return $this->message_number_log; case self::LOG_COMPLEX: $log = $this->format_log($this->message_log, $this->message_number_log); return PHP_SAPI == 'cli' ? $log : '<pre>' . $log . '</pre>'; default: return false; } } /** * Formats a log for printing * * @param array $message_log * @param array $message_number_log * @access private * @return string */ protected function format_log($message_log, $message_number_log) { $output = ''; for ($i = 0; $i < count($message_log); $i++) { $output.= $message_number_log[$i] . "\r\n"; $current_log = $message_log[$i]; $j = 0; do { if (strlen($current_log)) { $output.= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0 '; } $fragment = Strings::shift($current_log, $this->log_short_width); $hex = substr(preg_replace_callback('#.#s', [$this, 'format_log_helper'], $fragment), strlen($this->log_boundary)); // replace non ASCII printable characters with dots // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters // also replace < with a . since < messes up the output on web browsers $raw = preg_replace('#[^\x20-\x7E]|<#', '.', $fragment); $output.= str_pad($hex, $this->log_long_width - $this->log_short_width, ' ') . $raw . "\r\n"; $j++; } while (strlen($current_log)); $output.= "\r\n"; } return $output; } /** * Helper function for _format_log * * For use with preg_replace_callback() * * @param array $matches * @access private * @return string */ private function format_log_helper($matches) { return $this->log_boundary . str_pad(dechex(ord($matches[0])), 2, '0', STR_PAD_LEFT); } /** * Helper function for agent->on_channel_open() * * Used when channels are created to inform agent * of said channel opening. Must be called after * channel open confirmation received * * @access private */ private function on_channel_open() { if (isset($this->agent)) { Objects::callFunc($this->agent, 'on_channel_open', [$this]); } } /** * Returns the first value of the intersection of two arrays or false if * the intersection is empty. The order is defined by the first parameter. * * @param array $array1 * @param array $array2 * @return mixed False if intersection is empty, else intersected value. * @access private */ private function array_intersect_first($array1, $array2) { foreach ($array1 as $value) { if (in_array($value, $array2)) { return $value; } } return false; } /** * Returns all errors * * @return string[] * @access public */ public function getErrors() { return $this->errors; } /** * Returns the last error * * @return string * @access public */ public function getLastError() { $count = count($this->errors); if ($count > 0) { return $this->errors[$count - 1]; } } /** * Return the server identification. * * @return string * @access public */ public function getServerIdentification() { $this->connect(); return $this->server_identifier; } /** * Return a list of the key exchange algorithms the server supports. * * @return array * @access public */ public function getKexAlgorithms() { $this->connect(); return $this->kex_algorithms; } /** * Return a list of the host key (public key) algorithms the server supports. * * @return array * @access public */ public function getServerHostKeyAlgorithms() { $this->connect(); return $this->server_host_key_algorithms; } /** * Return a list of the (symmetric key) encryption algorithms the server supports, when receiving stuff from the client. * * @return array * @access public */ public function getEncryptionAlgorithmsClient2Server() { $this->connect(); return $this->encryption_algorithms_client_to_server; } /** * Return a list of the (symmetric key) encryption algorithms the server supports, when sending stuff to the client. * * @return array * @access public */ public function getEncryptionAlgorithmsServer2Client() { $this->connect(); return $this->encryption_algorithms_server_to_client; } /** * Return a list of the MAC algorithms the server supports, when receiving stuff from the client. * * @return array * @access public */ public function getMACAlgorithmsClient2Server() { $this->connect(); return $this->mac_algorithms_client_to_server; } /** * Return a list of the MAC algorithms the server supports, when sending stuff to the client. * * @return array * @access public */ public function getMACAlgorithmsServer2Client() { $this->connect(); return $this->mac_algorithms_server_to_client; } /** * Return a list of the compression algorithms the server supports, when receiving stuff from the client. * * @return array * @access public */ public function getCompressionAlgorithmsClient2Server() { $this->connect(); return $this->compression_algorithms_client_to_server; } /** * Return a list of the compression algorithms the server supports, when sending stuff to the client. * * @return array * @access public */ public function getCompressionAlgorithmsServer2Client() { $this->connect(); return $this->compression_algorithms_server_to_client; } /** * Return a list of the languages the server supports, when sending stuff to the client. * * @return array * @access public */ public function getLanguagesServer2Client() { $this->connect(); return $this->languages_server_to_client; } /** * Return a list of the languages the server supports, when receiving stuff from the client. * * @return array * @access public */ public function getLanguagesClient2Server() { $this->connect(); return $this->languages_client_to_server; } /** * Returns the banner message. * * Quoting from the RFC, "in some jurisdictions, sending a warning message before * authentication may be relevant for getting legal protection." * * @return string * @access public */ public function getBannerMessage() { return $this->banner_message; } /** * Returns the server public host key. * * Caching this the first time you connect to a server and checking the result on subsequent connections * is recommended. Returns false if the server signature is not signed correctly with the public host key. * * @return mixed * @throws \RuntimeException on badly formatted keys * @throws \phpseclib\Exception\NoSupportedAlgorithmsException when the key isn't in a supported format * @access public */ public function getServerPublicHostKey() { if (!($this->bitmap & self::MASK_CONSTRUCTOR)) { if (!$this->connect()) { return false; } } $signature = $this->signature; $server_public_host_key = $this->server_public_host_key; if (strlen($server_public_host_key) < 4) { return false; } extract(unpack('Nlength', Strings::shift($server_public_host_key, 4))); /** @var integer $length */ Strings::shift($server_public_host_key, $length); if ($this->signature_validated) { return $this->bitmap ? $this->signature_format . ' ' . Base64::encode($this->server_public_host_key) : false; } $this->signature_validated = true; switch ($this->signature_format) { case 'ssh-dss': $zero = new BigInteger(); if (strlen($server_public_host_key) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($server_public_host_key, 4)); $p = new BigInteger(Strings::shift($server_public_host_key, $temp['length']), -256); if (strlen($server_public_host_key) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($server_public_host_key, 4)); $q = new BigInteger(Strings::shift($server_public_host_key, $temp['length']), -256); if (strlen($server_public_host_key) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($server_public_host_key, 4)); $g = new BigInteger(Strings::shift($server_public_host_key, $temp['length']), -256); if (strlen($server_public_host_key) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($server_public_host_key, 4)); $y = new BigInteger(Strings::shift($server_public_host_key, $temp['length']), -256); /* The value for 'dss_signature_blob' is encoded as a string containing r, followed by s (which are 160-bit integers, without lengths or padding, unsigned, and in network byte order). */ $temp = unpack('Nlength', Strings::shift($signature, 4)); if ($temp['length'] != 40) { $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); throw new \RuntimeException('Invalid signature'); } $r = new BigInteger(Strings::shift($signature, 20), 256); $s = new BigInteger(Strings::shift($signature, 20), 256); switch (true) { case $r->equals($zero): case $r->compare($q) >= 0: case $s->equals($zero): case $s->compare($q) >= 0: $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); throw new \RuntimeException('Invalid signature'); } $w = $s->modInverse($q); $u1 = $w->multiply(new BigInteger(sha1($this->exchange_hash), 16)); list(, $u1) = $u1->divide($q); $u2 = $w->multiply($r); list(, $u2) = $u2->divide($q); $g = $g->modPow($u1, $p); $y = $y->modPow($u2, $p); $v = $g->multiply($y); list(, $v) = $v->divide($p); list(, $v) = $v->divide($q); if (!$v->equals($r)) { //user_error('Bad server signature'); return $this->disconnect_helper(NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE); } break; case 'ssh-rsa': if (strlen($server_public_host_key) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($server_public_host_key, 4)); $e = new BigInteger(Strings::shift($server_public_host_key, $temp['length']), -256); if (strlen($server_public_host_key) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($server_public_host_key, 4)); $rawN = Strings::shift($server_public_host_key, $temp['length']); $n = new BigInteger($rawN, -256); $nLength = strlen(ltrim($rawN, "\0")); /* if (strlen($signature) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($signature, 4)); $signature = Strings::shift($signature, $temp['length']); $rsa = new RSA(); $rsa->load(['e' => $e, 'n' => $n], 'raw'); $rsa->setHash('sha1'); if (!$rsa->verify($this->exchange_hash, $signature, RSA::PADDING_PKCS1)) { //user_error('Bad server signature'); return $this->disconnect_helper(NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE); } */ if (strlen($signature) < 4) { return false; } $temp = unpack('Nlength', Strings::shift($signature, 4)); $s = new BigInteger(Strings::shift($signature, $temp['length']), 256); // validate an RSA signature per "8.2 RSASSA-PKCS1-v1_5", "5.2.2 RSAVP1", and "9.1 EMSA-PSS" in the // following URL: // ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1.pdf // also, see SSHRSA.c (rsa2_verifysig) in PuTTy's source. if ($s->compare(new BigInteger()) < 0 || $s->compare($n->subtract(new BigInteger(1))) > 0) { $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); throw new \RuntimeException('Invalid signature'); } $s = $s->modPow($e, $n); $s = $s->toBytes(); $h = pack('N4H*', 0x00302130, 0x0906052B, 0x0E03021A, 0x05000414, sha1($this->exchange_hash)); $h = chr(0x01) . str_repeat(chr(0xFF), $nLength - 2 - strlen($h)) . $h; if ($s != $h) { //user_error('Bad server signature'); return $this->disconnect_helper(NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE); } break; default: $this->disconnect_helper(NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE); throw new NoSupportedAlgorithmsException('Unsupported signature format'); } return $this->signature_format . ' ' . Base64::encode($this->server_public_host_key); } /** * Returns the exit status of an SSH command or false. * * @return false|int * @access public */ public function getExitStatus() { if (is_null($this->exit_status)) { return false; } return $this->exit_status; } /** * Returns the number of columns for the terminal window size. * * @return int * @access public */ public function getWindowColumns() { return $this->windowColumns; } /** * Returns the number of rows for the terminal window size. * * @return int * @access public */ public function getWindowRows() { return $this->windowRows; } /** * Sets the number of columns for the terminal window size. * * @param int $value * @access public */ public function setWindowColumns($value) { $this->windowColumns = $value; } /** * Sets the number of rows for the terminal window size. * * @param int $value * @access public */ public function setWindowRows($value) { $this->windowRows = $value; } /** * Sets the number of columns and rows for the terminal window size. * * @param int $columns * @param int $rows * @access public */ public function setWindowSize($columns = 80, $rows = 24) { $this->windowColumns = $columns; $this->windowRows = $rows; } /** * To String Magic Method * * @return string * @access public */ public function __toString() { return $this->getResourceId(); } /** * Get Resource ID * * We use {} because that symbols should not be in URL according to * {@link http://tools.ietf.org/html/rfc3986#section-2 RFC}. * It will safe us from any conflicts, because otherwise regexp will * match all alphanumeric domains. * * @return string */ public function getResourceId() { return '{' . spl_object_hash($this) . '}'; } /** * Return existing connection * * @param string $id * * @return bool|SSH2 will return false if no such connection */ public static function getConnectionByResourceId($id) { return isset(self::$connections[$id]) ? self::$connections[$id] : false; } /** * Return all excising connections * * @return SSH2[] */ public static function getConnections() { return self::$connections; } } <?php /** * Pure-PHP implementation of SSHv1. * * PHP version 5 * * Here's a short example of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * $ssh = new \phpseclib\Net\SSH1('www.domain.tld'); * if (!$ssh->login('username', 'password')) { * exit('Login Failed'); * } * * echo $ssh->exec('ls -la'); * ?> * </code> * * Here's another short example: * <code> * <?php * include 'vendor/autoload.php'; * * $ssh = new \phpseclib\Net\SSH1('www.domain.tld'); * if (!$ssh->login('username', 'password')) { * exit('Login Failed'); * } * * echo $ssh->read('username@username:~$'); * $ssh->write("ls -la\n"); * echo $ssh->read('username@username:~$'); * ?> * </code> * * More information on the SSHv1 specification can be found by reading * {@link http://www.snailbook.com/docs/protocol-1.5.txt protocol-1.5.txt}. * * @category Net * @package SSH1 * @author Jim Wigginton <terrafrost@php.net> * @copyright 2007 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Net; use ParagonIE\ConstantTime\Hex; use phpseclib\Crypt\DES; use phpseclib\Crypt\Random; use phpseclib\Crypt\TripleDES; use phpseclib\Math\BigInteger; use phpseclib\Common\Functions\Strings; /** * Pure-PHP implementation of SSHv1. * * @package SSH1 * @author Jim Wigginton <terrafrost@php.net> * @access public */ class SSH1 { /**#@+ * Encryption Methods * * @see \phpseclib\Net\SSH1::getSupportedCiphers() * @access public */ /** * No encryption * * Not supported. */ const CIPHER_NONE = 0; /** * IDEA in CFB mode * * Not supported. */ const CIPHER_IDEA = 1; /** * DES in CBC mode */ const CIPHER_DES = 2; /** * Triple-DES in CBC mode * * All implementations are required to support this */ const CIPHER_3DES = 3; /** * TRI's Simple Stream encryption CBC * * Not supported nor is it defined in the official SSH1 specs. OpenSSH, however, does define it (see cipher.h), * although it doesn't use it (see cipher.c) */ const CIPHER_BROKEN_TSS = 4; /** * RC4 * * Not supported. * * @internal According to the SSH1 specs: * * "The first 16 bytes of the session key are used as the key for * the server to client direction. The remaining 16 bytes are used * as the key for the client to server direction. This gives * independent 128-bit keys for each direction." * * This library currently only supports encryption when the same key is being used for both directions. This is * because there's only one $crypto object. Two could be added ($encrypt and $decrypt, perhaps). */ const CIPHER_RC4 = 5; /** * Blowfish * * Not supported nor is it defined in the official SSH1 specs. OpenSSH, however, defines it (see cipher.h) and * uses it (see cipher.c) */ const CIPHER_BLOWFISH = 6; /**#@-*/ /**#@+ * Authentication Methods * * @see \phpseclib\Net\SSH1::getSupportedAuthentications() * @access public */ /** * .rhosts or /etc/hosts.equiv */ const AUTH_RHOSTS = 1; /** * pure RSA authentication */ const AUTH_RSA = 2; /** * password authentication * * This is the only method that is supported by this library. */ const AUTH_PASSWORD = 3; /** * .rhosts with RSA host authentication */ const AUTH_RHOSTS_RSA = 4; /**#@-*/ /**#@+ * Terminal Modes * * @link http://3sp.com/content/developer/maverick-net/docs/Maverick.SSH.PseudoTerminalModesMembers.html * @access private */ const TTY_OP_END = 0; /**#@-*/ /** * The Response Type * * @see \phpseclib\Net\SSH1::_get_binary_packet() * @access private */ const RESPONSE_TYPE = 1; /** * The Response Data * * @see \phpseclib\Net\SSH1::_get_binary_packet() * @access private */ const RESPONSE_DATA = 2; /**#@+ * Execution Bitmap Masks * * @see \phpseclib\Net\SSH1::bitmap * @access private */ const MASK_CONSTRUCTOR = 0x00000001; const MASK_CONNECTED = 0x00000002; const MASK_LOGIN = 0x00000004; const MASK_SHELL = 0x00000008; /**#@-*/ /**#@+ * @access public * @see \phpseclib\Net\SSH1::getLog() */ /** * Returns the message numbers */ const LOG_SIMPLE = 1; /** * Returns the message content */ const LOG_COMPLEX = 2; /** * Outputs the content real-time */ const LOG_REALTIME = 3; /** * Dumps the content real-time to a file */ const LOG_REALTIME_FILE = 4; /**#@-*/ /**#@+ * @access public * @see \phpseclib\Net\SSH1::read() */ /** * Returns when a string matching $expect exactly is found */ const READ_SIMPLE = 1; /** * Returns when a string matching the regular expression $expect is found */ const READ_REGEX = 2; /**#@-*/ /** * The SSH identifier * * @var string * @access private */ private $identifier = 'SSH-1.5-phpseclib'; /** * The Socket Object * * @var resource * @access private */ private $fsock; /** * The cryptography object * * @var object * @access private */ private $crypto = false; /** * Execution Bitmap * * The bits that are set represent functions that have been called already. This is used to determine * if a requisite function has been successfully executed. If not, an error should be thrown. * * @var int * @access private */ private $bitmap = 0; /** * The Server Key Public Exponent * * Logged for debug purposes * * @see self::getServerKeyPublicExponent() * @var string * @access private */ private $server_key_public_exponent; /** * The Server Key Public Modulus * * Logged for debug purposes * * @see self::getServerKeyPublicModulus() * @var string * @access private */ private $server_key_public_modulus; /** * The Host Key Public Exponent * * Logged for debug purposes * * @see self::getHostKeyPublicExponent() * @var string * @access private */ private $host_key_public_exponent; /** * The Host Key Public Modulus * * Logged for debug purposes * * @see self::getHostKeyPublicModulus() * @var string * @access private */ private $host_key_public_modulus; /** * Supported Ciphers * * Logged for debug purposes * * @see self::getSupportedCiphers() * @var array * @access private */ private $supported_ciphers = [ self::CIPHER_NONE => 'No encryption', self::CIPHER_IDEA => 'IDEA in CFB mode', self::CIPHER_DES => 'DES in CBC mode', self::CIPHER_3DES => 'Triple-DES in CBC mode', self::CIPHER_BROKEN_TSS => 'TRI\'s Simple Stream encryption CBC', self::CIPHER_RC4 => 'RC4', self::CIPHER_BLOWFISH => 'Blowfish' ]; /** * Supported Authentications * * Logged for debug purposes * * @see self::getSupportedAuthentications() * @var array * @access private */ private $supported_authentications = [ self::AUTH_RHOSTS => '.rhosts or /etc/hosts.equiv', self::AUTH_RSA => 'pure RSA authentication', self::AUTH_PASSWORD => 'password authentication', self::AUTH_RHOSTS_RSA => '.rhosts with RSA host authentication' ]; /** * Server Identification * * @see self::getServerIdentification() * @var string * @access private */ private $server_identification = ''; /** * Protocol Flags * * @see self::__construct() * @var array * @access private */ private $protocol_flags = []; /** * Protocol Flag Log * * @see self::getLog() * @var array * @access private */ private $protocol_flag_log = []; /** * Message Log * * @see self::getLog() * @var array * @access private */ private $message_log = []; /** * Real-time log file pointer * * @see self::_append_log() * @var resource * @access private */ private $realtime_log_file; /** * Real-time log file size * * @see self::_append_log() * @var int * @access private */ private $realtime_log_size; /** * Real-time log file wrap boolean * * @see self::_append_log() * @var bool * @access private */ private $realtime_log_wrap; /** * Interactive Buffer * * @see self::read() * @var array * @access private */ private $interactiveBuffer = ''; /** * Timeout * * @see self::setTimeout() * @access private */ private $timeout; /** * Current Timeout * * @see self::_get_channel_packet() * @access private */ private $curTimeout; /** * Log Boundary * * @see self::_format_log() * @access private */ private $log_boundary = ':'; /** * Log Long Width * * @see self::_format_log() * @access private */ private $log_long_width = 65; /** * Log Short Width * * @see self::_format_log() * @access private */ private $log_short_width = 16; /** * Hostname * * @see self::__construct() * @see self::_connect() * @var string * @access private */ private $host; /** * Port Number * * @see self::__construct() * @see self::_connect() * @var int * @access private */ private $port; /** * Timeout for initial connection * * Set by the constructor call. Calling setTimeout() is optional. If it's not called functions like * exec() won't timeout unless some PHP setting forces it too. The timeout specified in the constructor, * however, is non-optional. There will be a timeout, whether or not you set it. If you don't it'll be * 10 seconds. It is used by fsockopen() in that function. * * @see self::__construct() * @see self::_connect() * @var int * @access private */ private $connectionTimeout; /** * Default cipher * * @see self::__construct() * @see self::_connect() * @var int * @access private */ private $cipher; /** * Default Constructor. * * Connects to an SSHv1 server * * @param string $host * @param int $port * @param int $timeout * @param int $cipher * @return \phpseclib\Net\SSH1 * @access public */ public function __construct($host, $port = 22, $timeout = 10, $cipher = self::CIPHER_3DES) { $this->protocol_flags = [ 1 => 'NET_SSH1_MSG_DISCONNECT', 2 => 'NET_SSH1_SMSG_PUBLIC_KEY', 3 => 'NET_SSH1_CMSG_SESSION_KEY', 4 => 'NET_SSH1_CMSG_USER', 9 => 'NET_SSH1_CMSG_AUTH_PASSWORD', 10 => 'NET_SSH1_CMSG_REQUEST_PTY', 12 => 'NET_SSH1_CMSG_EXEC_SHELL', 13 => 'NET_SSH1_CMSG_EXEC_CMD', 14 => 'NET_SSH1_SMSG_SUCCESS', 15 => 'NET_SSH1_SMSG_FAILURE', 16 => 'NET_SSH1_CMSG_STDIN_DATA', 17 => 'NET_SSH1_SMSG_STDOUT_DATA', 18 => 'NET_SSH1_SMSG_STDERR_DATA', 19 => 'NET_SSH1_CMSG_EOF', 20 => 'NET_SSH1_SMSG_EXITSTATUS', 33 => 'NET_SSH1_CMSG_EXIT_CONFIRMATION' ]; $this->define_array($this->protocol_flags); $this->host = $host; $this->port = $port; $this->connectionTimeout = $timeout; $this->cipher = $cipher; } /** * Connect to an SSHv1 server * * @return bool * @throws \UnexpectedValueException on receipt of unexpected packets * @throws \RuntimeException on other errors * @access private */ private function connect() { $this->fsock = @fsockopen($this->host, $this->port, $errno, $errstr, $this->connectionTimeout); if (!$this->fsock) { throw new \RuntimeException(rtrim("Cannot connect to $this->host. Error $errno. $errstr")); } $this->server_identification = $init_line = fgets($this->fsock, 255); if (defined('NET_SSH1_LOGGING')) { $this->append_log('<-', $this->server_identification); $this->append_log('->', $this->identifier . "\r\n"); } if (!preg_match('#SSH-([0-9\.]+)-(.+)#', $init_line, $parts)) { throw new \RuntimeException('Can only connect to SSH servers'); } if ($parts[1][0] != 1) { throw new \RuntimeException("Cannot connect to $parts[1] servers"); } fputs($this->fsock, $this->identifier."\r\n"); $response = $this->get_binary_packet(); if ($response[self::RESPONSE_TYPE] != NET_SSH1_SMSG_PUBLIC_KEY) { throw new \UnexpectedValueException('Expected SSH_SMSG_PUBLIC_KEY'); } $anti_spoofing_cookie = Strings::shift($response[self::RESPONSE_DATA], 8); Strings::shift($response[self::RESPONSE_DATA], 4); if (strlen($response[self::RESPONSE_DATA]) < 2) { return false; } $temp = unpack('nlen', Strings::shift($response[self::RESPONSE_DATA], 2)); $server_key_public_exponent = new BigInteger(Strings::shift($response[self::RESPONSE_DATA], ceil($temp['len'] / 8)), 256); $this->server_key_public_exponent = $server_key_public_exponent; if (strlen($response[self::RESPONSE_DATA]) < 2) { return false; } $temp = unpack('nlen', Strings::shift($response[self::RESPONSE_DATA], 2)); $server_key_public_modulus = new BigInteger(Strings::shift($response[self::RESPONSE_DATA], ceil($temp['len'] / 8)), 256); $this->server_key_public_modulus = $server_key_public_modulus; Strings::shift($response[self::RESPONSE_DATA], 4); if (strlen($response[self::RESPONSE_DATA]) < 2) { return false; } $temp = unpack('nlen', Strings::shift($response[self::RESPONSE_DATA], 2)); $host_key_public_exponent = new BigInteger(Strings::shift($response[self::RESPONSE_DATA], ceil($temp['len'] / 8)), 256); $this->host_key_public_exponent = $host_key_public_exponent; if (strlen($response[self::RESPONSE_DATA]) < 2) { return false; } $temp = unpack('nlen', Strings::shift($response[self::RESPONSE_DATA], 2)); $host_key_public_modulus = new BigInteger(Strings::shift($response[self::RESPONSE_DATA], ceil($temp['len'] / 8)), 256); $this->host_key_public_modulus = $host_key_public_modulus; Strings::shift($response[self::RESPONSE_DATA], 4); // get a list of the supported ciphers if (strlen($response[self::RESPONSE_DATA]) < 4) { return false; } extract(unpack('Nsupported_ciphers_mask', Strings::shift($response[self::RESPONSE_DATA], 4))); /** @var integer $supported_ciphers_mask */ foreach ($this->supported_ciphers as $mask => $name) { if (($supported_ciphers_mask & (1 << $mask)) == 0) { unset($this->supported_ciphers[$mask]); } } // get a list of the supported authentications if (strlen($response[self::RESPONSE_DATA]) < 4) { return false; } extract(unpack('Nsupported_authentications_mask', Strings::shift($response[self::RESPONSE_DATA], 4))); /** @var integer $supported_authentications_mask */ foreach ($this->supported_authentications as $mask => $name) { if (($supported_authentications_mask & (1 << $mask)) == 0) { unset($this->supported_authentications[$mask]); } } $session_id = md5($host_key_public_modulus->toBytes() . $server_key_public_modulus->toBytes() . $anti_spoofing_cookie, true); $session_key = Random::string(32); $double_encrypted_session_key = $session_key ^ str_pad($session_id, 32, chr(0)); if ($server_key_public_modulus->compare($host_key_public_modulus) < 0) { $double_encrypted_session_key = $this->rsa_crypt( $double_encrypted_session_key, [ $server_key_public_exponent, $server_key_public_modulus ] ); $double_encrypted_session_key = $this->rsa_crypt( $double_encrypted_session_key, [ $host_key_public_exponent, $host_key_public_modulus ] ); } else { $double_encrypted_session_key = $this->rsa_crypt( $double_encrypted_session_key, [ $host_key_public_exponent, $host_key_public_modulus ] ); $double_encrypted_session_key = $this->rsa_crypt( $double_encrypted_session_key, [ $server_key_public_exponent, $server_key_public_modulus ] ); } $cipher = isset($this->supported_ciphers[$this->cipher]) ? $this->cipher : self::CIPHER_3DES; $data = pack('C2a*na*N', NET_SSH1_CMSG_SESSION_KEY, $cipher, $anti_spoofing_cookie, 8 * strlen($double_encrypted_session_key), $double_encrypted_session_key, 0); if (!$this->send_binary_packet($data)) { throw new \RuntimeException('Error sending SSH_CMSG_SESSION_KEY'); } switch ($cipher) { //case self::CIPHER_NONE: // $this->crypto = new \phpseclib\Crypt\Null(); // break; case self::CIPHER_DES: $this->crypto = new DES('cbc'); $this->crypto->disablePadding(); $this->crypto->enableContinuousBuffer(); $this->crypto->setKey(substr($session_key, 0, 8)); // "The iv (initialization vector) is initialized to all zeroes." $this->crypto->setIV(str_repeat("\0", 8)); break; case self::CIPHER_3DES: $this->crypto = new TripleDES('3cbc'); $this->crypto->disablePadding(); $this->crypto->enableContinuousBuffer(); $this->crypto->setKey(substr($session_key, 0, 24)); // "All three initialization vectors are initialized to zero." $this->crypto->setIV(str_repeat("\0", 8)); break; //case self::CIPHER_RC4: // $this->crypto = new RC4(); // $this->crypto->enableContinuousBuffer(); // $this->crypto->setKey(substr($session_key, 0, 16)); // break; } $response = $this->get_binary_packet(); if ($response[self::RESPONSE_TYPE] != NET_SSH1_SMSG_SUCCESS) { throw new \UnexpectedValueException('Expected SSH_SMSG_SUCCESS'); } $this->bitmap = self::MASK_CONNECTED; return true; } /** * Login * * @param string $username * @param string $password * @return bool * @throws \UnexpectedValueException on receipt of unexpected packets * @throws \RuntimeException on other errors * @access public */ public function login($username, $password = '') { if (!($this->bitmap & self::MASK_CONSTRUCTOR)) { $this->bitmap |= self::MASK_CONSTRUCTOR; if (!$this->connect()) { return false; } } if (!($this->bitmap & self::MASK_CONNECTED)) { return false; } $data = pack('CNa*', NET_SSH1_CMSG_USER, strlen($username), $username); if (!$this->send_binary_packet($data)) { throw new \RuntimeException('Error sending SSH_CMSG_USER'); } $response = $this->get_binary_packet(); if ($response === true) { return false; } if ($response[self::RESPONSE_TYPE] == NET_SSH1_SMSG_SUCCESS) { $this->bitmap |= self::MASK_LOGIN; return true; } elseif ($response[self::RESPONSE_TYPE] != NET_SSH1_SMSG_FAILURE) { throw new \UnexpectedValueException('Expected SSH_SMSG_SUCCESS or SSH_SMSG_FAILURE'); } $data = pack('CNa*', NET_SSH1_CMSG_AUTH_PASSWORD, strlen($password), $password); if (!$this->send_binary_packet($data)) { throw new \RuntimeException('Error sending SSH_CMSG_AUTH_PASSWORD'); } // remove the username and password from the last logged packet if (defined('NET_SSH1_LOGGING') && NET_SSH1_LOGGING == self::LOG_COMPLEX) { $data = pack('CNa*', NET_SSH1_CMSG_AUTH_PASSWORD, strlen('password'), 'password'); $this->message_log[count($this->message_log) - 1] = $data; } $response = $this->get_binary_packet(); if ($response === true) { return false; } if ($response[self::RESPONSE_TYPE] == NET_SSH1_SMSG_SUCCESS) { $this->bitmap |= self::MASK_LOGIN; return true; } elseif ($response[self::RESPONSE_TYPE] == NET_SSH1_SMSG_FAILURE) { return false; } else { throw new \UnexpectedValueException('Expected SSH_SMSG_SUCCESS or SSH_SMSG_FAILURE'); } } /** * Set Timeout * * $ssh->exec('ping 127.0.0.1'); on a Linux host will never return and will run indefinitely. setTimeout() makes it so it'll timeout. * Setting $timeout to false or 0 will mean there is no timeout. * * @param mixed $timeout */ public function setTimeout($timeout) { $this->timeout = $this->curTimeout = $timeout; } /** * Executes a command on a non-interactive shell, returns the output, and quits. * * An SSH1 server will close the connection after a command has been executed on a non-interactive shell. SSH2 * servers don't, however, this isn't an SSH2 client. The way this works, on the server, is by initiating a * shell with the -s option, as discussed in the following links: * * {@link http://www.faqs.org/docs/bashman/bashref_65.html http://www.faqs.org/docs/bashman/bashref_65.html} * {@link http://www.faqs.org/docs/bashman/bashref_62.html http://www.faqs.org/docs/bashman/bashref_62.html} * * To execute further commands, a new \phpseclib\Net\SSH1 object will need to be created. * * Returns false on failure and the output, otherwise. * * @see self::interactiveRead() * @see self::interactiveWrite() * @param string $cmd * @param bool $block * @return mixed * @access public */ public function exec($cmd, $block = true) { if (!($this->bitmap & self::MASK_LOGIN)) { throw new \RuntimeException('Operation disallowed prior to login()'); } $data = pack('CNa*', NET_SSH1_CMSG_EXEC_CMD, strlen($cmd), $cmd); if (!$this->send_binary_packet($data)) { throw new \RuntimeException('Error sending SSH_CMSG_EXEC_CMD'); } if (!$block) { return true; } $output = ''; $response = $this->get_binary_packet(); if ($response !== false) { do { $output.= substr($response[self::RESPONSE_DATA], 4); $response = $this->get_binary_packet(); } while (is_array($response) && $response[self::RESPONSE_TYPE] != NET_SSH1_SMSG_EXITSTATUS); } $data = pack('C', NET_SSH1_CMSG_EXIT_CONFIRMATION); // i don't think it's really all that important if this packet gets sent or not. $this->send_binary_packet($data); fclose($this->fsock); // reset the execution bitmap - a new \phpseclib\Net\SSH1 object needs to be created. $this->bitmap = 0; return $output; } /** * Creates an interactive shell * * @see self::interactiveRead() * @see self::interactiveWrite() * @return bool * @throws \UnexpectedValueException on receipt of unexpected packets * @throws \RuntimeException on other errors * @access private */ private function initShell() { // connect using the sample parameters in protocol-1.5.txt. // according to wikipedia.org's entry on text terminals, "the fundamental type of application running on a text // terminal is a command line interpreter or shell". thus, opening a terminal session to run the shell. $data = pack('CNa*N4C', NET_SSH1_CMSG_REQUEST_PTY, strlen('vt100'), 'vt100', 24, 80, 0, 0, self::TTY_OP_END); if (!$this->send_binary_packet($data)) { throw new \RuntimeException('Error sending SSH_CMSG_REQUEST_PTY'); } $response = $this->get_binary_packet(); if ($response === true) { return false; } if ($response[self::RESPONSE_TYPE] != NET_SSH1_SMSG_SUCCESS) { throw new \UnexpectedValueException('Expected SSH_SMSG_SUCCESS'); } $data = pack('C', NET_SSH1_CMSG_EXEC_SHELL); if (!$this->send_binary_packet($data)) { throw new \RuntimeException('Error sending SSH_CMSG_EXEC_SHELL'); } $this->bitmap |= self::MASK_SHELL; //stream_set_blocking($this->fsock, 0); return true; } /** * Inputs a command into an interactive shell. * * @see self::interactiveWrite() * @param string $cmd * @return bool * @access public */ public function write($cmd) { return $this->interactiveWrite($cmd); } /** * Returns the output of an interactive shell when there's a match for $expect * * $expect can take the form of a string literal or, if $mode == self::READ_REGEX, * a regular expression. * * @see self::write() * @param string $expect * @param int $mode * @return bool * @throws \RuntimeException on connection error * @access public */ public function read($expect, $mode = self::READ_SIMPLE) { if (!($this->bitmap & self::MASK_LOGIN)) { throw new \RuntimeException('Operation disallowed prior to login()'); } if (!($this->bitmap & self::MASK_SHELL) && !$this->initShell()) { throw new \RuntimeException('Unable to initiate an interactive shell session'); } $match = $expect; while (true) { if ($mode == self::READ_REGEX) { preg_match($expect, $this->interactiveBuffer, $matches); $match = isset($matches[0]) ? $matches[0] : ''; } $pos = strlen($match) ? strpos($this->interactiveBuffer, $match) : false; if ($pos !== false) { return Strings::shift($this->interactiveBuffer, $pos + strlen($match)); } $response = $this->get_binary_packet(); if ($response === true) { return Strings::shift($this->interactiveBuffer, strlen($this->interactiveBuffer)); } $this->interactiveBuffer.= substr($response[self::RESPONSE_DATA], 4); } } /** * Inputs a command into an interactive shell. * * @see self::interactiveRead() * @param string $cmd * @return bool * @throws \RuntimeException on connection error * @access public */ public function interactiveWrite($cmd) { if (!($this->bitmap & self::MASK_LOGIN)) { throw new \RuntimeException('Operation disallowed prior to login()'); } if (!($this->bitmap & self::MASK_SHELL) && !$this->initShell()) { throw new \RuntimeException('Unable to initiate an interactive shell session'); } $data = pack('CNa*', NET_SSH1_CMSG_STDIN_DATA, strlen($cmd), $cmd); if (!$this->send_binary_packet($data)) { throw new \RuntimeException('Error sending SSH_CMSG_STDIN'); } return true; } /** * Returns the output of an interactive shell when no more output is available. * * Requires PHP 4.3.0 or later due to the use of the stream_select() function. If you see stuff like * "^[[00m", you're seeing ANSI escape codes. According to * {@link http://support.microsoft.com/kb/101875 How to Enable ANSI.SYS in a Command Window}, "Windows NT * does not support ANSI escape sequences in Win32 Console applications", so if you're a Windows user, * there's not going to be much recourse. * * @see self::interactiveRead() * @return string * @throws \RuntimeException on connection error * @access public */ public function interactiveRead() { if (!($this->bitmap & self::MASK_LOGIN)) { throw new \RuntimeException('Operation disallowed prior to login()'); } if (!($this->bitmap & self::MASK_SHELL) && !$this->initShell()) { throw new \RuntimeException('Unable to initiate an interactive shell session'); } $read = [$this->fsock]; $write = $except = null; if (stream_select($read, $write, $except, 0)) { $response = $this->get_binary_packet(); return substr($response[self::RESPONSE_DATA], 4); } else { return ''; } } /** * Disconnect * * @access public */ public function disconnect() { $this->disconnect_helper(); } /** * Destructor. * * Will be called, automatically, if you're supporting just PHP5. If you're supporting PHP4, you'll need to call * disconnect(). * * @access public */ public function __destruct() { $this->disconnect_helper(); } /** * Disconnect * * @param string $msg * @access private */ private function disconnect_helper($msg = 'Client Quit') { if ($this->bitmap) { $data = pack('C', NET_SSH1_CMSG_EOF); $this->send_binary_packet($data); /* $response = $this->get_binary_packet(); if ($response === true) { $response = [self::RESPONSE_TYPE => -1]; } switch ($response[self::RESPONSE_TYPE]) { case NET_SSH1_SMSG_EXITSTATUS: $data = pack('C', NET_SSH1_CMSG_EXIT_CONFIRMATION); break; default: $data = pack('CNa*', NET_SSH1_MSG_DISCONNECT, strlen($msg), $msg); } */ $data = pack('CNa*', NET_SSH1_MSG_DISCONNECT, strlen($msg), $msg); $this->send_binary_packet($data); fclose($this->fsock); $this->bitmap = 0; } } /** * Gets Binary Packets * * See 'The Binary Packet Protocol' of protocol-1.5.txt for more info. * * Also, this function could be improved upon by adding detection for the following exploit: * http://www.securiteam.com/securitynews/5LP042K3FY.html * * @see self::_send_binary_packet() * @return array|bool * @access private */ private function get_binary_packet() { if (feof($this->fsock)) { //user_error('connection closed prematurely'); return false; } if ($this->curTimeout) { $read = [$this->fsock]; $write = $except = null; $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 $sec = floor($this->curTimeout); $usec = 1000000 * ($this->curTimeout - $sec); // on windows this returns a "Warning: Invalid CRT parameters detected" error if (!@stream_select($read, $write, $except, $sec, $usec) && !count($read)) { //$this->disconnect_helper('Timeout'); return true; } $elapsed = strtok(microtime(), ' ') + strtok('') - $start; $this->curTimeout-= $elapsed; } $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 $data = fread($this->fsock, 4); if (strlen($data) < 4) { return false; } $temp = unpack('Nlength', $data); $padding_length = 8 - ($temp['length'] & 7); $length = $temp['length'] + $padding_length; $raw = ''; while ($length > 0) { $temp = fread($this->fsock, $length); $raw.= $temp; $length-= strlen($temp); } $stop = strtok(microtime(), ' ') + strtok(''); if (strlen($raw) && $this->crypto !== false) { $raw = $this->crypto->decrypt($raw); } $padding = substr($raw, 0, $padding_length); $type = $raw[$padding_length]; $data = substr($raw, $padding_length + 1, -4); if (strlen($raw) < 4) { return false; } $temp = unpack('Ncrc', substr($raw, -4)); //if ( $temp['crc'] != $this->crc($padding . $type . $data) ) { // user_error('Bad CRC in packet from server'); // return false; //} $type = ord($type); if (defined('NET_SSH1_LOGGING')) { $temp = isset($this->protocol_flags[$type]) ? $this->protocol_flags[$type] : 'UNKNOWN'; $temp = '<- ' . $temp . ' (' . round($stop - $start, 4) . 's)'; $this->append_log($temp, $data); } return [ self::RESPONSE_TYPE => $type, self::RESPONSE_DATA => $data ]; } /** * Sends Binary Packets * * Returns true on success, false on failure. * * @see self::_get_binary_packet() * @param string $data * @return bool * @access private */ private function send_binary_packet($data) { if (feof($this->fsock)) { //user_error('connection closed prematurely'); return false; } $length = strlen($data) + 4; $padding = Random::string(8 - ($length & 7)); $orig = $data; $data = $padding . $data; $data.= pack('N', $this->crc($data)); if ($this->crypto !== false) { $data = $this->crypto->encrypt($data); } $packet = pack('Na*', $length, $data); $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 $result = strlen($packet) == fputs($this->fsock, $packet); $stop = strtok(microtime(), ' ') + strtok(''); if (defined('NET_SSH1_LOGGING')) { $temp = isset($this->protocol_flags[ord($orig[0])]) ? $this->protocol_flags[ord($orig[0])] : 'UNKNOWN'; $temp = '-> ' . $temp . ' (' . round($stop - $start, 4) . 's)'; $this->append_log($temp, $orig); } return $result; } /** * Cyclic Redundancy Check (CRC) * * PHP's crc32 function is implemented slightly differently than the one that SSH v1 uses, so * we've reimplemented it. A more detailed discussion of the differences can be found after * $crc_lookup_table's initialization. * * @see self::_get_binary_packet() * @see self::_send_binary_packet() * @param string $data * @return int * @access private */ private function crc($data) { static $crc_lookup_table = [ 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D ]; // For this function to yield the same output as PHP's crc32 function, $crc would have to be // set to 0xFFFFFFFF, initially - not 0x00000000 as it currently is. $crc = 0x00000000; $length = strlen($data); for ($i=0; $i<$length; $i++) { // We AND $crc >> 8 with 0x00FFFFFF because we want the eight newly added bits to all // be zero. PHP, unfortunately, doesn't always do this. 0x80000000 >> 8, as an example, // yields 0xFF800000 - not 0x00800000. The following link elaborates: // http://www.php.net/manual/en/language.operators.bitwise.php#57281 $crc = (($crc >> 8) & 0x00FFFFFF) ^ $crc_lookup_table[($crc & 0xFF) ^ ord($data[$i])]; } // In addition to having to set $crc to 0xFFFFFFFF, initially, the return value must be XOR'd with // 0xFFFFFFFF for this function to return the same thing that PHP's crc32 function would. return $crc; } /** * RSA Encrypt * * Returns mod(pow($m, $e), $n), where $n should be the product of two (large) primes $p and $q and where $e * should be a number with the property that gcd($e, ($p - 1) * ($q - 1)) == 1. Could just make anything that * calls this call modexp, instead, but I think this makes things clearer, maybe... * * @see self::__construct() * @param BigInteger $m * @param array $key * @return BigInteger * @access private */ private function rsa_crypt($m, $key) { /* $rsa = new RSA(); $rsa->load($key, 'raw'); $rsa->setHash('sha1'); return $rsa->encrypt($m, RSA::PADDING_PKCS1); */ // To quote from protocol-1.5.txt: // The most significant byte (which is only partial as the value must be // less than the public modulus, which is never a power of two) is zero. // // The next byte contains the value 2 (which stands for public-key // encrypted data in the PKCS standard [PKCS#1]). Then, there are non- // zero random bytes to fill any unused space, a zero byte, and the data // to be encrypted in the least significant bytes, the last byte of the // data in the least significant byte. // Presumably the part of PKCS#1 they're refering to is "Section 7.2.1 Encryption Operation", // under "7.2 RSAES-PKCS1-v1.5" and "7 Encryption schemes" of the following URL: // ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1.pdf $modulus = $key[1]->toBytes(); $length = strlen($modulus) - strlen($m) - 3; $random = ''; while (strlen($random) != $length) { $block = Random::string($length - strlen($random)); $block = str_replace("\x00", '', $block); $random.= $block; } $temp = chr(0) . chr(2) . $random . chr(0) . $m; $m = new BigInteger($temp, 256); $m = $m->modPow($key[0], $key[1]); return $m->toBytes(); } /** * Define Array * * Takes any number of arrays whose indices are integers and whose values are strings and defines a bunch of * named constants from it, using the value as the name of the constant and the index as the value of the constant. * If any of the constants that would be defined already exists, none of the constants will be defined. * * @param $args[] * @access private */ private function define_array(...$args) { foreach ($args as $arg) { foreach ($arg as $key => $value) { if (!defined($value)) { define($value, $key); } else { break 2; } } } } /** * Returns a log of the packets that have been sent and received. * * Returns a string if NET_SSH1_LOGGING == self::LOG_COMPLEX, an array if NET_SSH1_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SSH1_LOGGING') * * @access public * @return array|false|string */ public function getLog() { if (!defined('NET_SSH1_LOGGING')) { return false; } switch (NET_SSH1_LOGGING) { case self::LOG_SIMPLE: return $this->message_number_log; break; case self::LOG_COMPLEX: return $this->format_log($this->message_log, $this->protocol_flags_log); break; default: return false; } } /** * Formats a log for printing * * @param array $message_log * @param array $message_number_log * @access private * @return string */ private function format_log($message_log, $message_number_log) { $output = ''; for ($i = 0; $i < count($message_log); $i++) { $output.= $message_number_log[$i] . "\r\n"; $current_log = $message_log[$i]; $j = 0; do { if (strlen($current_log)) { $output.= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0 '; } $fragment = Strings::shift($current_log, $this->log_short_width); $hex = substr(preg_replace_callback('#.#s', [$this, 'format_log_helper'], $fragment), strlen($this->log_boundary)); // replace non ASCII printable characters with dots // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters // also replace < with a . since < messes up the output on web browsers $raw = preg_replace('#[^\x20-\x7E]|<#', '.', $fragment); $output.= str_pad($hex, $this->log_long_width - $this->log_short_width, ' ') . $raw . "\r\n"; $j++; } while (strlen($current_log)); $output.= "\r\n"; } return $output; } /** * Helper function for _format_log * * For use with preg_replace_callback() * * @param array $matches * @access private * @return string */ private function format_log_helper($matches) { return $this->log_boundary . str_pad(dechex(ord($matches[0])), 2, '0', STR_PAD_LEFT); } /** * Return the server key public exponent * * Returns, by default, the base-10 representation. If $raw_output is set to true, returns, instead, * the raw bytes. This behavior is similar to PHP's md5() function. * * @param bool $raw_output * @return string * @access public */ public function getServerKeyPublicExponent($raw_output = false) { return $raw_output ? $this->server_key_public_exponent->toBytes() : $this->server_key_public_exponent->toString(); } /** * Return the server key public modulus * * Returns, by default, the base-10 representation. If $raw_output is set to true, returns, instead, * the raw bytes. This behavior is similar to PHP's md5() function. * * @param bool $raw_output * @return string * @access public */ public function getServerKeyPublicModulus($raw_output = false) { return $raw_output ? $this->server_key_public_modulus->toBytes() : $this->server_key_public_modulus->toString(); } /** * Return the host key public exponent * * Returns, by default, the base-10 representation. If $raw_output is set to true, returns, instead, * the raw bytes. This behavior is similar to PHP's md5() function. * * @param bool $raw_output * @return string * @access public */ public function getHostKeyPublicExponent($raw_output = false) { return $raw_output ? $this->host_key_public_exponent->toBytes() : $this->host_key_public_exponent->toString(); } /** * Return the host key public modulus * * Returns, by default, the base-10 representation. If $raw_output is set to true, returns, instead, * the raw bytes. This behavior is similar to PHP's md5() function. * * @param bool $raw_output * @return string * @access public */ public function getHostKeyPublicModulus($raw_output = false) { return $raw_output ? $this->host_key_public_modulus->toBytes() : $this->host_key_public_modulus->toString(); } /** * Return a list of ciphers supported by SSH1 server. * * Just because a cipher is supported by an SSH1 server doesn't mean it's supported by this library. If $raw_output * is set to true, returns, instead, an array of constants. ie. instead of ['Triple-DES in CBC mode'], you'll * get [self::CIPHER_3DES]. * * @param bool $raw_output * @return array * @access public */ public function getSupportedCiphers($raw_output = false) { return $raw_output ? array_keys($this->supported_ciphers) : array_values($this->supported_ciphers); } /** * Return a list of authentications supported by SSH1 server. * * Just because a cipher is supported by an SSH1 server doesn't mean it's supported by this library. If $raw_output * is set to true, returns, instead, an array of constants. ie. instead of ['password authentication'], you'll * get [self::AUTH_PASSWORD]. * * @param bool $raw_output * @return array * @access public */ public function getSupportedAuthentications($raw_output = false) { return $raw_output ? array_keys($this->supported_authentications) : array_values($this->supported_authentications); } /** * Return the server identification. * * @return string * @access public */ public function getServerIdentification() { return rtrim($this->server_identification); } /** * Logs data packets * * Makes sure that only the last 1MB worth of packets will be logged * * @param string $protocol_flags * @param string $message * @access private */ private function append_log($protocol_flags, $message) { switch (NET_SSH1_LOGGING) { // useful for benchmarks case self::LOG_SIMPLE: $this->protocol_flags_log[] = $protocol_flags; break; // the most useful log for SSH1 case self::LOG_COMPLEX: $this->protocol_flags_log[] = $protocol_flags; Strings::shift($message); $this->log_size+= strlen($message); $this->message_log[] = $message; while ($this->log_size > self::LOG_MAX_SIZE) { $this->log_size-= strlen(array_shift($this->message_log)); array_shift($this->protocol_flags_log); } break; // dump the output out realtime; packets may be interspersed with non packets, // passwords won't be filtered out and select other packets may not be correctly // identified case self::LOG_REALTIME: echo "<pre>\r\n" . $this->format_log([$message], [$protocol_flags]) . "\r\n</pre>\r\n"; @flush(); @ob_flush(); break; // basically the same thing as self::LOG_REALTIME with the caveat that self::LOG_REALTIME_FILE // needs to be defined and that the resultant log file will be capped out at self::LOG_MAX_SIZE. // the earliest part of the log file is denoted by the first <<< START >>> and is not going to necessarily // at the beginning of the file case self::LOG_REALTIME_FILE: if (!isset($this->realtime_log_file)) { // PHP doesn't seem to like using constants in fopen() $filename = self::LOG_REALTIME_FILE; $fp = fopen($filename, 'w'); $this->realtime_log_file = $fp; } if (!is_resource($this->realtime_log_file)) { break; } $entry = $this->format_log([$message], [$protocol_flags]); if ($this->realtime_log_wrap) { $temp = "<<< START >>>\r\n"; $entry.= $temp; fseek($this->realtime_log_file, ftell($this->realtime_log_file) - strlen($temp)); } $this->realtime_log_size+= strlen($entry); if ($this->realtime_log_size > self::LOG_MAX_SIZE) { fseek($this->realtime_log_file, 0); $this->realtime_log_size = strlen($entry); $this->realtime_log_wrap = true; } fputs($this->realtime_log_file, $entry); } } } <?php /** * Pure-PHP implementation of SFTP. * * PHP version 5 * * Currently only supports SFTPv2 and v3, which, according to wikipedia.org, "is the most widely used version, * implemented by the popular OpenSSH SFTP server". If you want SFTPv4/5/6 support, provide me with access * to an SFTPv4/5/6 server. * * The API for this library is modeled after the API from PHP's {@link http://php.net/book.ftp FTP extension}. * * Here's a short example of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * $sftp = new \phpseclib\Net\SFTP('www.domain.tld'); * if (!$sftp->login('username', 'password')) { * exit('Login Failed'); * } * * echo $sftp->pwd() . "\r\n"; * $sftp->put('filename.ext', 'hello, world!'); * print_r($sftp->nlist()); * ?> * </code> * * @category Net * @package SFTP * @author Jim Wigginton <terrafrost@php.net> * @copyright 2009 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Net; use ParagonIE\ConstantTime\Hex; use phpseclib\Exception\FileNotFoundException; use phpseclib\Common\Functions\Strings; /** * Pure-PHP implementations of SFTP. * * @package SFTP * @author Jim Wigginton <terrafrost@php.net> * @access public */ class SFTP extends SSH2 { /** * SFTP channel constant * * \phpseclib\Net\SSH2::exec() uses 0 and \phpseclib\Net\SSH2::read() / \phpseclib\Net\SSH2::write() use 1. * * @see \phpseclib\Net\SSH2::_send_channel_packet() * @see \phpseclib\Net\SSH2::_get_channel_packet() * @access private */ const CHANNEL = 0x100; /**#@+ * @access public * @see \phpseclib\Net\SFTP::put() */ /** * Reads data from a local file. */ const SOURCE_LOCAL_FILE = 1; /** * Reads data from a string. */ // this value isn't really used anymore but i'm keeping it reserved for historical reasons const SOURCE_STRING = 2; /** * Reads data from callback: * function callback($length) returns string to proceed, null for EOF */ const SOURCE_CALLBACK = 16; /** * Resumes an upload */ const RESUME = 4; /** * Append a local file to an already existing remote file */ const RESUME_START = 8; /**#@-*/ /** * Packet Types * * @see self::__construct() * @var array * @access private */ private $packet_types = []; /** * Status Codes * * @see self::__construct() * @var array * @access private */ private $status_codes = []; /** * The Request ID * * The request ID exists in the off chance that a packet is sent out-of-order. Of course, this library doesn't support * concurrent actions, so it's somewhat academic, here. * * @var int * @see self::_send_sftp_packet() * @access private */ private $request_id = false; /** * The Packet Type * * The request ID exists in the off chance that a packet is sent out-of-order. Of course, this library doesn't support * concurrent actions, so it's somewhat academic, here. * * @var int * @see self::_get_sftp_packet() * @access private */ private $packet_type = -1; /** * Packet Buffer * * @var string * @see self::_get_sftp_packet() * @access private */ private $packet_buffer = ''; /** * Extensions supported by the server * * @var array * @see self::_initChannel() * @access private */ private $extensions = []; /** * Server SFTP version * * @var int * @see self::_initChannel() * @access private */ private $version; /** * Current working directory * * @var string * @see self::realpath() * @see self::chdir() * @access private */ private $pwd = false; /** * Packet Type Log * * @see self::getLog() * @var array * @access private */ private $packet_type_log = []; /** * Packet Log * * @see self::getLog() * @var array * @access private */ private $packet_log = []; /** * Error information * * @see self::getSFTPErrors() * @see self::getLastSFTPError() * @var array * @access private */ private $sftp_errors = []; /** * Stat Cache * * Rather than always having to open a directory and close it immediately there after to see if a file is a directory * we'll cache the results. * * @see self::_update_stat_cache() * @see self::_remove_from_stat_cache() * @see self::_query_stat_cache() * @var array * @access private */ private $stat_cache = []; /** * Max SFTP Packet Size * * @see self::__construct() * @see self::get() * @var array * @access private */ private $max_sftp_packet; /** * Stat Cache Flag * * @see self::disableStatCache() * @see self::enableStatCache() * @var bool * @access private */ private $use_stat_cache = true; /** * Sort Options * * @see self::_comparator() * @see self::setListOrder() * @var array * @access private */ private $sortOptions = []; /** * Canonicalization Flag * * Determines whether or not paths should be canonicalized before being * passed on to the remote server. * * @see self::enablePathCanonicalization() * @see self::disablePathCanonicalization() * @see self::realpath() * @var bool * @access private */ private $canonicalize_paths = true; /** * Default Constructor. * * Connects to an SFTP server * * @param string $host * @param int $port * @param int $timeout * @return \phpseclib\Net\SFTP * @access public */ public function __construct($host, $port = 22, $timeout = 10) { parent::__construct($host, $port, $timeout); $this->max_sftp_packet = 1 << 15; $this->packet_types = [ 1 => 'NET_SFTP_INIT', 2 => 'NET_SFTP_VERSION', /* the format of SSH_FXP_OPEN changed between SFTPv4 and SFTPv5+: SFTPv5+: http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.1.1 pre-SFTPv5 : http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.3 */ 3 => 'NET_SFTP_OPEN', 4 => 'NET_SFTP_CLOSE', 5 => 'NET_SFTP_READ', 6 => 'NET_SFTP_WRITE', 7 => 'NET_SFTP_LSTAT', 9 => 'NET_SFTP_SETSTAT', 11 => 'NET_SFTP_OPENDIR', 12 => 'NET_SFTP_READDIR', 13 => 'NET_SFTP_REMOVE', 14 => 'NET_SFTP_MKDIR', 15 => 'NET_SFTP_RMDIR', 16 => 'NET_SFTP_REALPATH', 17 => 'NET_SFTP_STAT', /* the format of SSH_FXP_RENAME changed between SFTPv4 and SFTPv5+: SFTPv5+: http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.3 pre-SFTPv5 : http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.5 */ 18 => 'NET_SFTP_RENAME', 19 => 'NET_SFTP_READLINK', 20 => 'NET_SFTP_SYMLINK', 101=> 'NET_SFTP_STATUS', 102=> 'NET_SFTP_HANDLE', /* the format of SSH_FXP_NAME changed between SFTPv3 and SFTPv4+: SFTPv4+: http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-9.4 pre-SFTPv4 : http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#section-7 */ 103=> 'NET_SFTP_DATA', 104=> 'NET_SFTP_NAME', 105=> 'NET_SFTP_ATTRS', 200=> 'NET_SFTP_EXTENDED' ]; $this->status_codes = [ 0 => 'NET_SFTP_STATUS_OK', 1 => 'NET_SFTP_STATUS_EOF', 2 => 'NET_SFTP_STATUS_NO_SUCH_FILE', 3 => 'NET_SFTP_STATUS_PERMISSION_DENIED', 4 => 'NET_SFTP_STATUS_FAILURE', 5 => 'NET_SFTP_STATUS_BAD_MESSAGE', 6 => 'NET_SFTP_STATUS_NO_CONNECTION', 7 => 'NET_SFTP_STATUS_CONNECTION_LOST', 8 => 'NET_SFTP_STATUS_OP_UNSUPPORTED', 9 => 'NET_SFTP_STATUS_INVALID_HANDLE', 10 => 'NET_SFTP_STATUS_NO_SUCH_PATH', 11 => 'NET_SFTP_STATUS_FILE_ALREADY_EXISTS', 12 => 'NET_SFTP_STATUS_WRITE_PROTECT', 13 => 'NET_SFTP_STATUS_NO_MEDIA', 14 => 'NET_SFTP_STATUS_NO_SPACE_ON_FILESYSTEM', 15 => 'NET_SFTP_STATUS_QUOTA_EXCEEDED', 16 => 'NET_SFTP_STATUS_UNKNOWN_PRINCIPAL', 17 => 'NET_SFTP_STATUS_LOCK_CONFLICT', 18 => 'NET_SFTP_STATUS_DIR_NOT_EMPTY', 19 => 'NET_SFTP_STATUS_NOT_A_DIRECTORY', 20 => 'NET_SFTP_STATUS_INVALID_FILENAME', 21 => 'NET_SFTP_STATUS_LINK_LOOP', 22 => 'NET_SFTP_STATUS_CANNOT_DELETE', 23 => 'NET_SFTP_STATUS_INVALID_PARAMETER', 24 => 'NET_SFTP_STATUS_FILE_IS_A_DIRECTORY', 25 => 'NET_SFTP_STATUS_BYTE_RANGE_LOCK_CONFLICT', 26 => 'NET_SFTP_STATUS_BYTE_RANGE_LOCK_REFUSED', 27 => 'NET_SFTP_STATUS_DELETE_PENDING', 28 => 'NET_SFTP_STATUS_FILE_CORRUPT', 29 => 'NET_SFTP_STATUS_OWNER_INVALID', 30 => 'NET_SFTP_STATUS_GROUP_INVALID', 31 => 'NET_SFTP_STATUS_NO_MATCHING_BYTE_RANGE_LOCK' ]; // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-7.1 // the order, in this case, matters quite a lot - see \phpseclib\Net\SFTP::_parseAttributes() to understand why $this->attributes = [ 0x00000001 => 'NET_SFTP_ATTR_SIZE', 0x00000002 => 'NET_SFTP_ATTR_UIDGID', // defined in SFTPv3, removed in SFTPv4+ 0x00000004 => 'NET_SFTP_ATTR_PERMISSIONS', 0x00000008 => 'NET_SFTP_ATTR_ACCESSTIME', // 0x80000000 will yield a floating point on 32-bit systems and converting floating points to integers // yields inconsistent behavior depending on how php is compiled. so we left shift -1 (which, in // two's compliment, consists of all 1 bits) by 31. on 64-bit systems this'll yield 0xFFFFFFFF80000000. // that's not a problem, however, and 'anded' and a 32-bit number, as all the leading 1 bits are ignored. (-1 << 31) & 0xFFFFFFFF => 'NET_SFTP_ATTR_EXTENDED' ]; // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.3 // the flag definitions change somewhat in SFTPv5+. if SFTPv5+ support is added to this library, maybe name // the array for that $this->open5_flags and similarly alter the constant names. $this->open_flags = [ 0x00000001 => 'NET_SFTP_OPEN_READ', 0x00000002 => 'NET_SFTP_OPEN_WRITE', 0x00000004 => 'NET_SFTP_OPEN_APPEND', 0x00000008 => 'NET_SFTP_OPEN_CREATE', 0x00000010 => 'NET_SFTP_OPEN_TRUNCATE', 0x00000020 => 'NET_SFTP_OPEN_EXCL' ]; // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-5.2 // see \phpseclib\Net\SFTP::_parseLongname() for an explanation $this->file_types = [ 1 => 'NET_SFTP_TYPE_REGULAR', 2 => 'NET_SFTP_TYPE_DIRECTORY', 3 => 'NET_SFTP_TYPE_SYMLINK', 4 => 'NET_SFTP_TYPE_SPECIAL', 5 => 'NET_SFTP_TYPE_UNKNOWN', // the followin types were first defined for use in SFTPv5+ // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-05#section-5.2 6 => 'NET_SFTP_TYPE_SOCKET', 7 => 'NET_SFTP_TYPE_CHAR_DEVICE', 8 => 'NET_SFTP_TYPE_BLOCK_DEVICE', 9 => 'NET_SFTP_TYPE_FIFO' ]; $this->define_array( $this->packet_types, $this->status_codes, $this->attributes, $this->open_flags, $this->file_types ); if (!defined('NET_SFTP_QUEUE_SIZE')) { define('NET_SFTP_QUEUE_SIZE', 32); } } /** * Login * * @param string $username * @param $args[] string password * @throws \UnexpectedValueException on receipt of unexpected packets * @return bool * @access public */ public function login($username,...$args) { if (!$this->sublogin($username,...$args)) { return false; } $this->window_size_server_to_client[self::CHANNEL] = $this->window_size; $packet = pack( 'CNa*N3', NET_SSH2_MSG_CHANNEL_OPEN, strlen('session'), 'session', self::CHANNEL, $this->window_size, 0x4000 ); if (!$this->send_binary_packet($packet)) { return false; } $this->channel_status[self::CHANNEL] = NET_SSH2_MSG_CHANNEL_OPEN; $response = $this->get_channel_packet(self::CHANNEL, true); if ($response === false) { return false; } $packet = pack( 'CNNa*CNa*', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[self::CHANNEL], strlen('subsystem'), 'subsystem', 1, strlen('sftp'), 'sftp' ); if (!$this->send_binary_packet($packet)) { return false; } $this->channel_status[self::CHANNEL] = NET_SSH2_MSG_CHANNEL_REQUEST; $response = $this->get_channel_packet(self::CHANNEL, true); if ($response === false) { // from PuTTY's psftp.exe $command = "test -x /usr/lib/sftp-server && exec /usr/lib/sftp-server\n" . "test -x /usr/local/lib/sftp-server && exec /usr/local/lib/sftp-server\n" . "exec sftp-server"; // we don't do $this->exec($command, false) because exec() operates on a different channel and plus the SSH_MSG_CHANNEL_OPEN that exec() does // is redundant $packet = pack( 'CNNa*CNa*', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[self::CHANNEL], strlen('exec'), 'exec', 1, strlen($command), $command ); if (!$this->send_binary_packet($packet)) { return false; } $this->channel_status[self::CHANNEL] = NET_SSH2_MSG_CHANNEL_REQUEST; $response = $this->get_channel_packet(self::CHANNEL, true); if ($response === false) { return false; } } $this->channel_status[self::CHANNEL] = NET_SSH2_MSG_CHANNEL_DATA; if (!$this->send_sftp_packet(NET_SFTP_INIT, "\0\0\0\3")) { return false; } $response = $this->get_sftp_packet(); if ($this->packet_type != NET_SFTP_VERSION) { throw new \UnexpectedValueException('Expected NET_SFTP_VERSION. ' . 'Got packet type: ' . $this->packet_type); } if (strlen($response) < 4) { return false; } extract(unpack('Nversion', Strings::shift($response, 4))); /** @var integer $version */ $this->version = $version; while (!empty($response)) { if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ $key = Strings::shift($response, $length); if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ $value = Strings::shift($response, $length); $this->extensions[$key] = $value; } /* SFTPv4+ defines a 'newline' extension. SFTPv3 seems to have unofficial support for it via 'newline@vandyke.com', however, I'm not sure what 'newline@vandyke.com' is supposed to do (the fact that it's unofficial means that it's not in the official SFTPv3 specs) and 'newline@vandyke.com' / 'newline' are likely not drop-in substitutes for one another due to the fact that 'newline' comes with a SSH_FXF_TEXT bitmask whereas it seems unlikely that 'newline@vandyke.com' would. */ /* if (isset($this->extensions['newline@vandyke.com'])) { $this->extensions['newline'] = $this->extensions['newline@vandyke.com']; unset($this->extensions['newline@vandyke.com']); } */ $this->request_id = 1; /* A Note on SFTPv4/5/6 support: <http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-5.1> states the following: "If the client wishes to interoperate with servers that support noncontiguous version numbers it SHOULD send '3'" Given that the server only sends its version number after the client has already done so, the above seems to be suggesting that v3 should be the default version. This makes sense given that v3 is the most popular. <http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-5.5> states the following; "If the server did not send the "versions" extension, or the version-from-list was not included, the server MAY send a status response describing the failure, but MUST then close the channel without processing any further requests." So what do you do if you have a client whose initial SSH_FXP_INIT packet says it implements v3 and a server whose initial SSH_FXP_VERSION reply says it implements v4 and only v4? If it only implements v4, the "versions" extension is likely not going to have been sent so version re-negotiation as discussed in draft-ietf-secsh-filexfer-13 would be quite impossible. As such, what \phpseclib\Net\SFTP would do is close the channel and reopen it with a new and updated SSH_FXP_INIT packet. */ switch ($this->version) { case 2: case 3: break; default: return false; } $this->pwd = $this->realpath('.'); $this->update_stat_cache($this->pwd, []); return true; } /** * Disable the stat cache * * @access public */ function disableStatCache() { $this->use_stat_cache = false; } /** * Enable the stat cache * * @access public */ public function enableStatCache() { $this->use_stat_cache = true; } /** * Clear the stat cache * * @access public */ public function clearStatCache() { $this->stat_cache = []; } /** * Enable path canonicalization * * @access public */ public function enablePathCanonicalization() { $this->canonicalize_paths = true; } /** * Enable path canonicalization * * @access public */ public function disablePathCanonicalization() { $this->canonicalize_paths = false; } /** * Returns the current directory name * * @return mixed * @access public */ public function pwd() { return $this->pwd; } /** * Logs errors * * @param string $response * @param int $status * @access private */ private function logError($response, $status = -1) { if ($status == -1) { if (strlen($response) < 4) { return; } extract(unpack('Nstatus', Strings::shift($response, 4))); /** @var integer $status */ } $error = $this->status_codes[$status]; if ($this->version > 2 || strlen($response) < 4) { extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ $this->sftp_errors[] = $error . ': ' . Strings::shift($response, $length); } else { $this->sftp_errors[] = $error; } } /** * Canonicalize the Server-Side Path Name * * SFTP doesn't provide a mechanism by which the current working directory can be changed, so we'll emulate it. Returns * the absolute (canonicalized) path. * * If canonicalize_paths has been disabled using disablePathCanonicalization(), $path is returned as-is. * * @see self::chdir() * @see self::disablePathCanonicalization() * @param string $path * @throws \UnexpectedValueException on receipt of unexpected packets * @return mixed * @access public */ public function realpath($path) { if (!$this->canonicalize_paths) { return $path; } if ($this->pwd === false) { // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.9 if (!$this->send_sftp_packet(NET_SFTP_REALPATH, pack('Na*', strlen($path), $path))) { return false; } $response = $this->get_sftp_packet(); switch ($this->packet_type) { case NET_SFTP_NAME: // although SSH_FXP_NAME is implemented differently in SFTPv3 than it is in SFTPv4+, the following // should work on all SFTP versions since the only part of the SSH_FXP_NAME packet the following looks // at is the first part and that part is defined the same in SFTP versions 3 through 6. Strings::shift($response, 4); // skip over the count - it should be 1, anyway if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ return Strings::shift($response, $length); case NET_SFTP_STATUS: $this->logError($response); return false; default: throw new \UnexpectedValueException('Expected NET_SFTP_NAME or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } } if ($path[0] != '/') { $path = $this->pwd . '/' . $path; } $path = explode('/', $path); $new = []; foreach ($path as $dir) { if (!strlen($dir)) { continue; } switch ($dir) { case '..': array_pop($new); case '.': break; default: $new[] = $dir; } } return '/' . implode('/', $new); } /** * Changes the current directory * * @param string $dir * @throws \UnexpectedValueException on receipt of unexpected packets * @return bool * @access public */ public function chdir($dir) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } // assume current dir if $dir is empty if ($dir === '') { $dir = './'; // suffix a slash if needed } elseif ($dir[strlen($dir) - 1] != '/') { $dir.= '/'; } $dir = $this->realpath($dir); // confirm that $dir is, in fact, a valid directory if ($this->use_stat_cache && is_array($this->query_stat_cache($dir))) { $this->pwd = $dir; return true; } // we could do a stat on the alleged $dir to see if it's a directory but that doesn't tell us // the currently logged in user has the appropriate permissions or not. maybe you could see if // the file's uid / gid match the currently logged in user's uid / gid but how there's no easy // way to get those with SFTP if (!$this->send_sftp_packet(NET_SFTP_OPENDIR, pack('Na*', strlen($dir), $dir))) { return false; } // see \phpseclib\Net\SFTP::nlist() for a more thorough explanation of the following $response = $this->get_sftp_packet(); switch ($this->packet_type) { case NET_SFTP_HANDLE: $handle = substr($response, 4); break; case NET_SFTP_STATUS: $this->logError($response); return false; default: throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS' . 'Got packet type: ' . $this->packet_type); } if (!$this->close_handle($handle)) { return false; } $this->update_stat_cache($dir, []); $this->pwd = $dir; return true; } /** * Returns a list of files in the given directory * * @param string $dir * @param bool $recursive * @return mixed * @access public */ public function nlist($dir = '.', $recursive = false) { return $this->nlist_helper($dir, $recursive, ''); } /** * Helper method for nlist * * @param string $dir * @param bool $recursive * @param string $relativeDir * @return mixed * @access private */ private function nlist_helper($dir, $recursive, $relativeDir) { $files = $this->readlist($dir, false); if (!$recursive || $files === false) { return $files; } $result = []; foreach ($files as $value) { if ($value == '.' || $value == '..') { if ($relativeDir == '') { $result[] = $value; } continue; } if (is_array($this->query_stat_cache($this->realpath($dir . '/' . $value)))) { $temp = $this->nlist_helper($dir . '/' . $value, true, $relativeDir . $value . '/'); $result = array_merge($result, $temp); } else { $result[] = $relativeDir . $value; } } return $result; } /** * Returns a detailed list of files in the given directory * * @param string $dir * @param bool $recursive * @return mixed * @access public */ public function rawlist($dir = '.', $recursive = false) { $files = $this->readlist($dir, true); if (!$recursive || $files === false) { return $files; } static $depth = 0; foreach ($files as $key => $value) { if ($depth != 0 && $key == '..') { unset($files[$key]); continue; } if ($key != '.' && $key != '..' && is_array($this->query_stat_cache($this->realpath($dir . '/' . $key)))) { $depth++; $files[$key] = $this->rawlist($dir . '/' . $key, true); $depth--; } else { $files[$key] = (object) $value; } } return $files; } /** * Reads a list, be it detailed or not, of files in the given directory * * @param string $dir * @param bool $raw * @return mixed * @throws \UnexpectedValueException on receipt of unexpected packets * @access private */ private function readlist($dir, $raw = true) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } $dir = $this->realpath($dir . '/'); if ($dir === false) { return false; } // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.1.2 if (!$this->send_sftp_packet(NET_SFTP_OPENDIR, pack('Na*', strlen($dir), $dir))) { return false; } $response = $this->get_sftp_packet(); switch ($this->packet_type) { case NET_SFTP_HANDLE: // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-9.2 // since 'handle' is the last field in the SSH_FXP_HANDLE packet, we'll just remove the first four bytes that // represent the length of the string and leave it at that $handle = substr($response, 4); break; case NET_SFTP_STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED $this->logError($response); return false; default: throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } $this->update_stat_cache($dir, []); $contents = []; while (true) { // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.2.2 // why multiple SSH_FXP_READDIR packets would be sent when the response to a single one can span arbitrarily many // SSH_MSG_CHANNEL_DATA messages is not known to me. if (!$this->send_sftp_packet(NET_SFTP_READDIR, pack('Na*', strlen($handle), $handle))) { return false; } $response = $this->get_sftp_packet(); switch ($this->packet_type) { case NET_SFTP_NAME: if (strlen($response) < 4) { return false; } extract(unpack('Ncount', Strings::shift($response, 4))); /** @var integer $count */ for ($i = 0; $i < $count; $i++) { if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ $shortname = Strings::shift($response, $length); if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ $longname = Strings::shift($response, $length); $attributes = $this->parseAttributes($response); if (!isset($attributes['type'])) { $fileType = $this->parseLongname($longname); if ($fileType) { $attributes['type'] = $fileType; } } $contents[$shortname] = $attributes + ['filename' => $shortname]; if (isset($attributes['type']) && $attributes['type'] == NET_SFTP_TYPE_DIRECTORY && ($shortname != '.' && $shortname != '..')) { $this->update_stat_cache($dir . '/' . $shortname, []); } else { if ($shortname == '..') { $temp = $this->realpath($dir . '/..') . '/.'; } else { $temp = $dir . '/' . $shortname; } $this->update_stat_cache($temp, (object) ['lstat' => $attributes]); } // SFTPv6 has an optional boolean end-of-list field, but we'll ignore that, since the // final SSH_FXP_STATUS packet should tell us that, already. } break; case NET_SFTP_STATUS: if (strlen($response) < 4) { return false; } extract(unpack('Nstatus', Strings::shift($response, 4))); /** @var integer $status */ if ($status != NET_SFTP_STATUS_EOF) { $this->logError($response, $status); return false; } break 2; default: throw new \UnexpectedValueException('Expected NET_SFTP_NAME or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } } if (!$this->close_handle($handle)) { return false; } if (count($this->sortOptions)) { uasort($contents, [&$this, 'comparator']); } return $raw ? $contents : array_keys($contents); } /** * Compares two rawlist entries using parameters set by setListOrder() * * Intended for use with uasort() * * @param array $a * @param array $b * @return int * @access private */ private function comparator($a, $b) { switch (true) { case $a['filename'] === '.' || $b['filename'] === '.': if ($a['filename'] === $b['filename']) { return 0; } return $a['filename'] === '.' ? -1 : 1; case $a['filename'] === '..' || $b['filename'] === '..': if ($a['filename'] === $b['filename']) { return 0; } return $a['filename'] === '..' ? -1 : 1; case isset($a['type']) && $a['type'] === NET_SFTP_TYPE_DIRECTORY: if (!isset($b['type'])) { return 1; } if ($b['type'] !== $a['type']) { return -1; } break; case isset($b['type']) && $b['type'] === NET_SFTP_TYPE_DIRECTORY: return 1; } foreach ($this->sortOptions as $sort => $order) { if (!isset($a[$sort]) || !isset($b[$sort])) { if (isset($a[$sort])) { return -1; } if (isset($b[$sort])) { return 1; } return 0; } switch ($sort) { case 'filename': $result = strcasecmp($a['filename'], $b['filename']); if ($result) { return $order === SORT_DESC ? -$result : $result; } break; case 'permissions': case 'mode': $a[$sort]&= 07777; $b[$sort]&= 07777; default: if ($a[$sort] === $b[$sort]) { break; } return $order === SORT_ASC ? $a[$sort] - $b[$sort] : $b[$sort] - $a[$sort]; } } } /** * Defines how nlist() and rawlist() will be sorted - if at all. * * If sorting is enabled directories and files will be sorted independently with * directories appearing before files in the resultant array that is returned. * * Any parameter returned by stat is a valid sort parameter for this function. * Filename comparisons are case insensitive. * * Examples: * * $sftp->setListOrder('filename', SORT_ASC); * $sftp->setListOrder('size', SORT_DESC, 'filename', SORT_ASC); * $sftp->setListOrder(true); * Separates directories from files but doesn't do any sorting beyond that * $sftp->setListOrder(); * Don't do any sort of sorting * * @param $args[] * @access public */ public function setListOrder(...$args) { $this->sortOptions = []; if (empty($args)) { return; } $len = count($args) & 0x7FFFFFFE; for ($i = 0; $i < $len; $i+=2) { $this->sortOptions[$args[$i]] = $args[$i + 1]; } if (!count($this->sortOptions)) { $this->sortOptions = ['bogus' => true]; } } /** * Returns the file size, in bytes, or false, on failure * * Files larger than 4GB will show up as being exactly 4GB. * * @param string $filename * @return mixed * @access public */ public function size($filename) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } $result = $this->stat($filename); if ($result === false) { return false; } return isset($result['size']) ? $result['size'] : -1; } /** * Save files / directories to cache * * @param string $path * @param mixed $value * @access private */ private function update_stat_cache($path, $value) { if ($this->use_stat_cache === false) { return; } // preg_replace('#^/|/(?=/)|/$#', '', $dir) == str_replace('//', '/', trim($path, '/')) $dirs = explode('/', preg_replace('#^/|/(?=/)|/$#', '', $path)); $temp = &$this->stat_cache; $max = count($dirs) - 1; foreach ($dirs as $i => $dir) { // if $temp is an object that means one of two things. // 1. a file was deleted and changed to a directory behind phpseclib's back // 2. it's a symlink. when lstat is done it's unclear what it's a symlink to if (is_object($temp)) { $temp = []; } if (!isset($temp[$dir])) { $temp[$dir] = []; } if ($i === $max) { if (is_object($temp[$dir]) && is_object($value)) { if (!isset($value->stat) && isset($temp[$dir]->stat)) { $value->stat = $temp[$dir]->stat; } if (!isset($value->lstat) && isset($temp[$dir]->lstat)) { $value->lstat = $temp[$dir]->lstat; } } $temp[$dir] = $value; break; } $temp = &$temp[$dir]; } } /** * Remove files / directories from cache * * @param string $path * @return bool * @access private */ private function remove_from_stat_cache($path) { $dirs = explode('/', preg_replace('#^/|/(?=/)|/$#', '', $path)); $temp = &$this->stat_cache; $max = count($dirs) - 1; foreach ($dirs as $i => $dir) { if ($i === $max) { unset($temp[$dir]); return true; } if (!isset($temp[$dir])) { return false; } $temp = &$temp[$dir]; } } /** * Checks cache for path * * Mainly used by file_exists * * @param string $path * @return mixed * @access private */ private function query_stat_cache($path) { $dirs = explode('/', preg_replace('#^/|/(?=/)|/$#', '', $path)); $temp = &$this->stat_cache; foreach ($dirs as $dir) { if (!isset($temp[$dir])) { return null; } $temp = &$temp[$dir]; } return $temp; } /** * Returns general information about a file. * * Returns an array on success and false otherwise. * * @param string $filename * @return mixed * @access public */ public function stat($filename) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } $filename = $this->realpath($filename); if ($filename === false) { return false; } if ($this->use_stat_cache) { $result = $this->query_stat_cache($filename); if (is_array($result) && isset($result['.']) && isset($result['.']->stat)) { return $result['.']->stat; } if (is_object($result) && isset($result->stat)) { return $result->stat; } } $stat = $this->stat_helper($filename, NET_SFTP_STAT); if ($stat === false) { $this->remove_from_stat_cache($filename); return false; } if (isset($stat['type'])) { if ($stat['type'] == NET_SFTP_TYPE_DIRECTORY) { $filename.= '/.'; } $this->update_stat_cache($filename, (object) ['stat' => $stat]); return $stat; } $pwd = $this->pwd; $stat['type'] = $this->chdir($filename) ? NET_SFTP_TYPE_DIRECTORY : NET_SFTP_TYPE_REGULAR; $this->pwd = $pwd; if ($stat['type'] == NET_SFTP_TYPE_DIRECTORY) { $filename.= '/.'; } $this->update_stat_cache($filename, (object) ['stat' => $stat]); return $stat; } /** * Returns general information about a file or symbolic link. * * Returns an array on success and false otherwise. * * @param string $filename * @return mixed * @access public */ public function lstat($filename) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } $filename = $this->realpath($filename); if ($filename === false) { return false; } if ($this->use_stat_cache) { $result = $this->query_stat_cache($filename); if (is_array($result) && isset($result['.']) && isset($result['.']->lstat)) { return $result['.']->lstat; } if (is_object($result) && isset($result->lstat)) { return $result->lstat; } } $lstat = $this->stat_helper($filename, NET_SFTP_LSTAT); if ($lstat === false) { $this->remove_from_stat_cache($filename); return false; } if (isset($lstat['type'])) { if ($lstat['type'] == NET_SFTP_TYPE_DIRECTORY) { $filename.= '/.'; } $this->update_stat_cache($filename, (object) ['lstat' => $lstat]); return $lstat; } $stat = $this->stat_helper($filename, NET_SFTP_STAT); if ($lstat != $stat) { $lstat = array_merge($lstat, ['type' => NET_SFTP_TYPE_SYMLINK]); $this->update_stat_cache($filename, (object) ['lstat' => $lstat]); return $stat; } $pwd = $this->pwd; $lstat['type'] = $this->chdir($filename) ? NET_SFTP_TYPE_DIRECTORY : NET_SFTP_TYPE_REGULAR; $this->pwd = $pwd; if ($lstat['type'] == NET_SFTP_TYPE_DIRECTORY) { $filename.= '/.'; } $this->update_stat_cache($filename, (object) ['lstat' => $lstat]); return $lstat; } /** * Returns general information about a file or symbolic link * * Determines information without calling \phpseclib\Net\SFTP::realpath(). * The second parameter can be either NET_SFTP_STAT or NET_SFTP_LSTAT. * * @param string $filename * @param int $type * @throws \UnexpectedValueException on receipt of unexpected packets * @return mixed * @access private */ private function stat_helper($filename, $type) { // SFTPv4+ adds an additional 32-bit integer field - flags - to the following: $packet = pack('Na*', strlen($filename), $filename); if (!$this->send_sftp_packet($type, $packet)) { return false; } $response = $this->get_sftp_packet(); switch ($this->packet_type) { case NET_SFTP_ATTRS: return $this->parseAttributes($response); case NET_SFTP_STATUS: $this->logError($response); return false; } throw new \UnexpectedValueException('Expected NET_SFTP_ATTRS or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } /** * Truncates a file to a given length * * @param string $filename * @param int $new_size * @return bool * @access public */ public function truncate($filename, $new_size) { $attr = pack('N3', NET_SFTP_ATTR_SIZE, $new_size / 4294967296, $new_size); // 4294967296 == 0x100000000 == 1<<32 return $this->setstat($filename, $attr, false); } /** * Sets access and modification time of file. * * If the file does not exist, it will be created. * * @param string $filename * @param int $time * @param int $atime * @throws \UnexpectedValueException on receipt of unexpected packets * @return bool * @access public */ public function touch($filename, $time = null, $atime = null) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } $filename = $this->realpath($filename); if ($filename === false) { return false; } if (!isset($time)) { $time = time(); } if (!isset($atime)) { $atime = $time; } $flags = NET_SFTP_OPEN_WRITE | NET_SFTP_OPEN_CREATE | NET_SFTP_OPEN_EXCL; $attr = pack('N3', NET_SFTP_ATTR_ACCESSTIME, $time, $atime); $packet = pack('Na*Na*', strlen($filename), $filename, $flags, $attr); if (!$this->send_sftp_packet(NET_SFTP_OPEN, $packet)) { return false; } $response = $this->get_sftp_packet(); switch ($this->packet_type) { case NET_SFTP_HANDLE: return $this->close_handle(substr($response, 4)); case NET_SFTP_STATUS: $this->logError($response); break; default: throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } return $this->setstat($filename, $attr, false); } /** * Changes file or directory owner * * Returns true on success or false on error. * * @param string $filename * @param int $uid * @param bool $recursive * @return bool * @access public */ public function chown($filename, $uid, $recursive = false) { // quoting from <http://www.kernel.org/doc/man-pages/online/pages/man2/chown.2.html>, // "if the owner or group is specified as -1, then that ID is not changed" $attr = pack('N3', NET_SFTP_ATTR_UIDGID, $uid, -1); return $this->setstat($filename, $attr, $recursive); } /** * Changes file or directory group * * Returns true on success or false on error. * * @param string $filename * @param int $gid * @param bool $recursive * @return bool * @access public */ public function chgrp($filename, $gid, $recursive = false) { $attr = pack('N3', NET_SFTP_ATTR_UIDGID, -1, $gid); return $this->setstat($filename, $attr, $recursive); } /** * Set permissions on a file. * * Returns the new file permissions on success or false on error. * If $recursive is true than this just returns true or false. * * @param int $mode * @param string $filename * @param bool $recursive * @throws \UnexpectedValueException on receipt of unexpected packets * @return mixed * @access public */ public function chmod($mode, $filename, $recursive = false) { if (is_string($mode) && is_int($filename)) { $temp = $mode; $mode = $filename; $filename = $temp; } $attr = pack('N2', NET_SFTP_ATTR_PERMISSIONS, $mode & 07777); if (!$this->setstat($filename, $attr, $recursive)) { return false; } if ($recursive) { return true; } $filename = $this->realpath($filename); // rather than return what the permissions *should* be, we'll return what they actually are. this will also // tell us if the file actually exists. // incidentally, SFTPv4+ adds an additional 32-bit integer field - flags - to the following: $packet = pack('Na*', strlen($filename), $filename); if (!$this->send_sftp_packet(NET_SFTP_STAT, $packet)) { return false; } $response = $this->get_sftp_packet(); switch ($this->packet_type) { case NET_SFTP_ATTRS: $attrs = $this->parseAttributes($response); return $attrs['permissions']; case NET_SFTP_STATUS: $this->logError($response); return false; } throw new \UnexpectedValueException('Expected NET_SFTP_ATTRS or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } /** * Sets information about a file * * @param string $filename * @param string $attr * @param bool $recursive * @throws \UnexpectedValueException on receipt of unexpected packets * @return bool * @access private */ private function setstat($filename, $attr, $recursive) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } $filename = $this->realpath($filename); if ($filename === false) { return false; } $this->remove_from_stat_cache($filename); if ($recursive) { $i = 0; $result = $this->setstat_recursive($filename, $attr, $i); $this->read_put_responses($i); return $result; } // SFTPv4+ has an additional byte field - type - that would need to be sent, as well. setting it to // SSH_FILEXFER_TYPE_UNKNOWN might work. if not, we'd have to do an SSH_FXP_STAT before doing an SSH_FXP_SETSTAT. if (!$this->send_sftp_packet(NET_SFTP_SETSTAT, pack('Na*a*', strlen($filename), $filename, $attr))) { return false; } /* "Because some systems must use separate system calls to set various attributes, it is possible that a failure response will be returned, but yet some of the attributes may be have been successfully modified. If possible, servers SHOULD avoid this situation; however, clients MUST be aware that this is possible." -- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.6 */ $response = $this->get_sftp_packet(); if ($this->packet_type != NET_SFTP_STATUS) { throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } if (strlen($response) < 4) { return false; } extract(unpack('Nstatus', Strings::shift($response, 4))); /** @var integer $status */ if ($status != NET_SFTP_STATUS_OK) { $this->logError($response, $status); return false; } return true; } /** * Recursively sets information on directories on the SFTP server * * Minimizes directory lookups and SSH_FXP_STATUS requests for speed. * * @param string $path * @param string $attr * @param int $i * @return bool * @access private */ private function setstat_recursive($path, $attr, &$i) { if (!$this->read_put_responses($i)) { return false; } $i = 0; $entries = $this->readlist($path, true); if ($entries === false) { return $this->setstat($path, $attr, false); } // normally $entries would have at least . and .. but it might not if the directories // permissions didn't allow reading if (empty($entries)) { return false; } unset($entries['.'], $entries['..']); foreach ($entries as $filename => $props) { if (!isset($props['type'])) { return false; } $temp = $path . '/' . $filename; if ($props['type'] == NET_SFTP_TYPE_DIRECTORY) { if (!$this->setstat_recursive($temp, $attr, $i)) { return false; } } else { if (!$this->send_sftp_packet(NET_SFTP_SETSTAT, pack('Na*a*', strlen($temp), $temp, $attr))) { return false; } $i++; if ($i >= NET_SFTP_QUEUE_SIZE) { if (!$this->read_put_responses($i)) { return false; } $i = 0; } } } if (!$this->send_sftp_packet(NET_SFTP_SETSTAT, pack('Na*a*', strlen($path), $path, $attr))) { return false; } $i++; if ($i >= NET_SFTP_QUEUE_SIZE) { if (!$this->read_put_responses($i)) { return false; } $i = 0; } return true; } /** * Return the target of a symbolic link * * @param string $link * @throws \UnexpectedValueException on receipt of unexpected packets * @return mixed * @access public */ public function readlink($link) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } $link = $this->realpath($link); if (!$this->send_sftp_packet(NET_SFTP_READLINK, pack('Na*', strlen($link), $link))) { return false; } $response = $this->get_sftp_packet(); switch ($this->packet_type) { case NET_SFTP_NAME: break; case NET_SFTP_STATUS: $this->logError($response); return false; default: throw new \UnexpectedValueException('Expected NET_SFTP_NAME or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } if (strlen($response) < 4) { return false; } extract(unpack('Ncount', Strings::shift($response, 4))); /** @var integer $count */ // the file isn't a symlink if (!$count) { return false; } if (strlen($response) < 4) { return false; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ return Strings::shift($response, $length); } /** * Create a symlink * * symlink() creates a symbolic link to the existing target with the specified name link. * * @param string $target * @param string $link * @throws \UnexpectedValueException on receipt of unexpected packets * @return bool * @access public */ public function symlink($target, $link) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } //$target = $this->realpath($target); $link = $this->realpath($link); $packet = pack('Na*Na*', strlen($target), $target, strlen($link), $link); if (!$this->send_sftp_packet(NET_SFTP_SYMLINK, $packet)) { return false; } $response = $this->get_sftp_packet(); if ($this->packet_type != NET_SFTP_STATUS) { throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } if (strlen($response) < 4) { return false; } extract(unpack('Nstatus', Strings::shift($response, 4))); /** @var integer $status */ if ($status != NET_SFTP_STATUS_OK) { $this->logError($response, $status); return false; } return true; } /** * Creates a directory. * * @param string $dir * @param int $mode * @param bool $recursive * @return bool * @access public */ public function mkdir($dir, $mode = -1, $recursive = false) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } $dir = $this->realpath($dir); // by not providing any permissions, hopefully the server will use the logged in users umask - their // default permissions. $attr = $mode == -1 ? "\0\0\0\0" : pack('N2', NET_SFTP_ATTR_PERMISSIONS, $mode & 07777); if ($recursive) { $dirs = explode('/', preg_replace('#/(?=/)|/$#', '', $dir)); if (empty($dirs[0])) { array_shift($dirs); $dirs[0] = '/' . $dirs[0]; } for ($i = 0; $i < count($dirs); $i++) { $temp = array_slice($dirs, 0, $i + 1); $temp = implode('/', $temp); $result = $this->mkdir_helper($temp, $attr); } return $result; } return $this->mkdir_helper($dir, $attr); } /** * Helper function for directory creation * * @param string $dir * @param string $attr * @return bool * @access private */ private function mkdir_helper($dir, $attr) { if (!$this->send_sftp_packet(NET_SFTP_MKDIR, pack('Na*a*', strlen($dir), $dir, $attr))) { return false; } $response = $this->get_sftp_packet(); if ($this->packet_type != NET_SFTP_STATUS) { throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } if (strlen($response) < 4) { return false; } extract(unpack('Nstatus', Strings::shift($response, 4))); /** @var integer $status */ if ($status != NET_SFTP_STATUS_OK) { $this->logError($response, $status); return false; } return true; } /** * Removes a directory. * * @param string $dir * @throws \UnexpectedValueException on receipt of unexpected packets * @return bool * @access public */ public function rmdir($dir) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } $dir = $this->realpath($dir); if ($dir === false) { return false; } if (!$this->send_sftp_packet(NET_SFTP_RMDIR, pack('Na*', strlen($dir), $dir))) { return false; } $response = $this->get_sftp_packet(); if ($this->packet_type != NET_SFTP_STATUS) { throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } if (strlen($response) < 4) { return false; } extract(unpack('Nstatus', Strings::shift($response, 4))); /** @var integer $status */ if ($status != NET_SFTP_STATUS_OK) { // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED? $this->logError($response, $status); return false; } $this->remove_from_stat_cache($dir); // the following will do a soft delete, which would be useful if you deleted a file // and then tried to do a stat on the deleted file. the above, in contrast, does // a hard delete //$this->update_stat_cache($dir, false); return true; } /** * Uploads a file to the SFTP server. * * By default, \phpseclib\Net\SFTP::put() does not read from the local filesystem. $data is dumped directly into $remote_file. * So, for example, if you set $data to 'filename.ext' and then do \phpseclib\Net\SFTP::get(), you will get a file, twelve bytes * long, containing 'filename.ext' as its contents. * * Setting $mode to self::SOURCE_LOCAL_FILE will change the above behavior. With self::SOURCE_LOCAL_FILE, $remote_file will * contain as many bytes as filename.ext does on your local filesystem. If your filename.ext is 1MB then that is how * large $remote_file will be, as well. * * Setting $mode to self::SOURCE_CALLBACK will use $data as callback function, which gets only one parameter -- number of bytes to return, and returns a string if there is some data or null if there is no more data * * If $data is a resource then it'll be used as a resource instead. * * Currently, only binary mode is supported. As such, if the line endings need to be adjusted, you will need to take * care of that, yourself. * * $mode can take an additional two parameters - self::RESUME and self::RESUME_START. These are bitwise AND'd with * $mode. So if you want to resume upload of a 300mb file on the local file system you'd set $mode to the following: * * self::SOURCE_LOCAL_FILE | self::RESUME * * If you wanted to simply append the full contents of a local file to the full contents of a remote file you'd replace * self::RESUME with self::RESUME_START. * * If $mode & (self::RESUME | self::RESUME_START) then self::RESUME_START will be assumed. * * $start and $local_start give you more fine grained control over this process and take precident over self::RESUME * when they're non-negative. ie. $start could let you write at the end of a file (like self::RESUME) or in the middle * of one. $local_start could let you start your reading from the end of a file (like self::RESUME_START) or in the * middle of one. * * Setting $local_start to > 0 or $mode | self::RESUME_START doesn't do anything unless $mode | self::SOURCE_LOCAL_FILE. * * @param string $remote_file * @param string|resource $data * @param int $mode * @param int $start * @param int $local_start * @param callable|null $progressCallback * @throws \UnexpectedValueException on receipt of unexpected packets * @throws \BadFunctionCallException if you're uploading via a callback and the callback function is invalid * @throws \phpseclib\Exception\FileNotFoundException if you're uploading via a file and the file doesn't exist * @return bool * @access public * @internal ASCII mode for SFTPv4/5/6 can be supported by adding a new function - \phpseclib\Net\SFTP::setMode(). */ public function put($remote_file, $data, $mode = self::SOURCE_STRING, $start = -1, $local_start = -1, $progressCallback = null) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } $remote_file = $this->realpath($remote_file); if ($remote_file === false) { return false; } $this->remove_from_stat_cache($remote_file); $flags = NET_SFTP_OPEN_WRITE | NET_SFTP_OPEN_CREATE; // according to the SFTP specs, NET_SFTP_OPEN_APPEND should "force all writes to append data at the end of the file." // in practice, it doesn't seem to do that. //$flags|= ($mode & self::RESUME) ? NET_SFTP_OPEN_APPEND : NET_SFTP_OPEN_TRUNCATE; if ($start >= 0) { $offset = $start; } elseif ($mode & self::RESUME) { // if NET_SFTP_OPEN_APPEND worked as it should _size() wouldn't need to be called $size = $this->size($remote_file); $offset = $size !== false ? $size : 0; } else { $offset = 0; $flags|= NET_SFTP_OPEN_TRUNCATE; } $packet = pack('Na*N2', strlen($remote_file), $remote_file, $flags, 0); if (!$this->send_sftp_packet(NET_SFTP_OPEN, $packet)) { return false; } $response = $this->get_sftp_packet(); switch ($this->packet_type) { case NET_SFTP_HANDLE: $handle = substr($response, 4); break; case NET_SFTP_STATUS: $this->logError($response); return false; default: throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.2.3 $dataCallback = false; switch (true) { case $mode & self::SOURCE_CALLBACK: if (!is_callable($data)) { throw new \BadFunctionCallException("\$data should be is_callable() if you specify SOURCE_CALLBACK flag"); } $dataCallback = $data; // do nothing break; case is_resource($data): $mode = $mode & ~self::SOURCE_LOCAL_FILE; $info = stream_get_meta_data($data); if ($info['wrapper_type'] == 'PHP' && $info['stream_type'] == 'Input') { $fp = fopen('php://memory', 'w+'); stream_copy_to_stream($data, $fp); rewind($fp); } else { $fp = $data; } break; case $mode & self::SOURCE_LOCAL_FILE: if (!is_file($data)) { throw new FileNotFoundException("$data is not a valid file"); } $fp = @fopen($data, 'rb'); if (!$fp) { return false; } } if (isset($fp)) { $stat = fstat($fp); $size = !empty($stat) ? $stat['size'] : 0; if ($local_start >= 0) { fseek($fp, $local_start); $size-= $local_start; } } elseif ($dataCallback) { $size = 0; } else { $size = strlen($data); } $sent = 0; $size = $size < 0 ? ($size & 0x7FFFFFFF) + 0x80000000 : $size; $sftp_packet_size = 4096; // PuTTY uses 4096 // make the SFTP packet be exactly 4096 bytes by including the bytes in the NET_SFTP_WRITE packets "header" $sftp_packet_size-= strlen($handle) + 25; $i = 0; while ($dataCallback || ($size === 0 || $sent < $size)) { if ($dataCallback) { $temp = call_user_func($dataCallback, $sftp_packet_size); if (is_null($temp)) { break; } } else { $temp = isset($fp) ? fread($fp, $sftp_packet_size) : substr($data, $sent, $sftp_packet_size); if ($temp === false || $temp === '') { break; } } $subtemp = $offset + $sent; $packet = pack('Na*N3a*', strlen($handle), $handle, $subtemp / 4294967296, $subtemp, strlen($temp), $temp); if (!$this->send_sftp_packet(NET_SFTP_WRITE, $packet)) { if ($mode & self::SOURCE_LOCAL_FILE) { fclose($fp); } return false; } $sent+= strlen($temp); if (is_callable($progressCallback)) { call_user_func($progressCallback, $sent); } $i++; if ($i == NET_SFTP_QUEUE_SIZE) { if (!$this->read_put_responses($i)) { $i = 0; break; } $i = 0; } } if (!$this->read_put_responses($i)) { if ($mode & self::SOURCE_LOCAL_FILE) { fclose($fp); } $this->close_handle($handle); return false; } if ($mode & self::SOURCE_LOCAL_FILE) { fclose($fp); } return $this->close_handle($handle); } /** * Reads multiple successive SSH_FXP_WRITE responses * * Sending an SSH_FXP_WRITE packet and immediately reading its response isn't as efficient as blindly sending out $i * SSH_FXP_WRITEs, in succession, and then reading $i responses. * * @param int $i * @return bool * @throws \UnexpectedValueException on receipt of unexpected packets * @access private */ private function read_put_responses($i) { while ($i--) { $response = $this->get_sftp_packet(); if ($this->packet_type != NET_SFTP_STATUS) { throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } if (strlen($response) < 4) { return false; } extract(unpack('Nstatus', Strings::shift($response, 4))); /** @var integer $status */ if ($status != NET_SFTP_STATUS_OK) { $this->logError($response, $status); break; } } return $i < 0; } /** * Close handle * * @param string $handle * @return bool * @throws \UnexpectedValueException on receipt of unexpected packets * @access private */ private function close_handle($handle) { if (!$this->send_sftp_packet(NET_SFTP_CLOSE, pack('Na*', strlen($handle), $handle))) { return false; } // "The client MUST release all resources associated with the handle regardless of the status." // -- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.1.3 $response = $this->get_sftp_packet(); if ($this->packet_type != NET_SFTP_STATUS) { throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } if (strlen($response) < 4) { return false; } extract(unpack('Nstatus', Strings::shift($response, 4))); /** @var integer $status */ if ($status != NET_SFTP_STATUS_OK) { $this->logError($response, $status); return false; } return true; } /** * Downloads a file from the SFTP server. * * Returns a string containing the contents of $remote_file if $local_file is left undefined or a boolean false if * the operation was unsuccessful. If $local_file is defined, returns true or false depending on the success of the * operation. * * $offset and $length can be used to download files in chunks. * * @param string $remote_file * @param string|bool|resource $local_file * @param int $offset * @param int $length * @throws \UnexpectedValueException on receipt of unexpected packets * @return mixed * @access public */ public function get($remote_file, $local_file = false, $offset = 0, $length = -1) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } $remote_file = $this->realpath($remote_file); if ($remote_file === false) { return false; } $packet = pack('Na*N2', strlen($remote_file), $remote_file, NET_SFTP_OPEN_READ, 0); if (!$this->send_sftp_packet(NET_SFTP_OPEN, $packet)) { return false; } $response = $this->get_sftp_packet(); switch ($this->packet_type) { case NET_SFTP_HANDLE: $handle = substr($response, 4); break; case NET_SFTP_STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED $this->logError($response); return false; default: throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } if (is_resource($local_file)) { $fp = $local_file; $stat = fstat($fp); $res_offset = $stat['size']; } else { $res_offset = 0; if ($local_file !== false) { $fp = fopen($local_file, 'wb'); if (!$fp) { return false; } } else { $content = ''; } } $fclose_check = $local_file !== false && !is_resource($local_file); $start = $offset; $read = 0; while (true) { $i = 0; while ($i < NET_SFTP_QUEUE_SIZE && ($length < 0 || $read < $length)) { $tempoffset = $start + $read; $packet_size = $length > 0 ? min($this->max_sftp_packet, $length - $read) : $this->max_sftp_packet; $packet = pack('Na*N3', strlen($handle), $handle, $tempoffset / 4294967296, $tempoffset, $packet_size); if (!$this->send_sftp_packet(NET_SFTP_READ, $packet)) { if ($fclose_check) { fclose($fp); } return false; } $packet = null; $read+= $packet_size; $i++; } if (!$i) { break; } $clear_responses = false; while ($i > 0) { $i--; if ($clear_responses) { $this->get_sftp_packet(); continue; } else { $response = $this->get_sftp_packet(); } switch ($this->packet_type) { case NET_SFTP_DATA: $temp = substr($response, 4); $offset+= strlen($temp); if ($local_file === false) { $content.= $temp; } else { fputs($fp, $temp); } $temp = null; break; case NET_SFTP_STATUS: // could, in theory, return false if !strlen($content) but we'll hold off for the time being $this->logError($response); $clear_responses = true; // don't break out of the loop yet, so we can read the remaining responses break; default: if ($fclose_check) { fclose($fp); } throw new \UnexpectedValueException('Expected NET_SFTP_DATA or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } $response = null; } if ($clear_responses) { break; } } if ($length > 0 && $length <= $offset - $start) { if ($local_file === false) { $content = substr($content, 0, $length); } else { ftruncate($fp, $length + $res_offset); } } if ($fclose_check) { fclose($fp); } if (!$this->close_handle($handle)) { return false; } // if $content isn't set that means a file was written to return isset($content) ? $content : true; } /** * Deletes a file on the SFTP server. * * @param string $path * @param bool $recursive * @return bool * @throws \UnexpectedValueException on receipt of unexpected packets * @access public */ public function delete($path, $recursive = true) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } if (is_object($path)) { // It's an object. Cast it as string before we check anything else. $path = (string) $path; } if (!is_string($path) || $path == '') { return false; } $path = $this->realpath($path); if ($path === false) { return false; } // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.3 if (!$this->send_sftp_packet(NET_SFTP_REMOVE, pack('Na*', strlen($path), $path))) { return false; } $response = $this->get_sftp_packet(); if ($this->packet_type != NET_SFTP_STATUS) { throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } // if $status isn't SSH_FX_OK it's probably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED if (strlen($response) < 4) { return false; } extract(unpack('Nstatus', Strings::shift($response, 4))); /** @var integer $status */ if ($status != NET_SFTP_STATUS_OK) { $this->logError($response, $status); if (!$recursive) { return false; } $i = 0; $result = $this->delete_recursive($path, $i); $this->read_put_responses($i); return $result; } $this->remove_from_stat_cache($path); return true; } /** * Recursively deletes directories on the SFTP server * * Minimizes directory lookups and SSH_FXP_STATUS requests for speed. * * @param string $path * @param int $i * @return bool * @access private */ private function delete_recursive($path, &$i) { if (!$this->read_put_responses($i)) { return false; } $i = 0; $entries = $this->readlist($path, true); // normally $entries would have at least . and .. but it might not if the directories // permissions didn't allow reading if (empty($entries)) { return false; } unset($entries['.'], $entries['..']); foreach ($entries as $filename => $props) { if (!isset($props['type'])) { return false; } $temp = $path . '/' . $filename; if ($props['type'] == NET_SFTP_TYPE_DIRECTORY) { if (!$this->delete_recursive($temp, $i)) { return false; } } else { if (!$this->send_sftp_packet(NET_SFTP_REMOVE, pack('Na*', strlen($temp), $temp))) { return false; } $this->remove_from_stat_cache($temp); $i++; if ($i >= NET_SFTP_QUEUE_SIZE) { if (!$this->read_put_responses($i)) { return false; } $i = 0; } } } if (!$this->send_sftp_packet(NET_SFTP_RMDIR, pack('Na*', strlen($path), $path))) { return false; } $this->remove_from_stat_cache($path); $i++; if ($i >= NET_SFTP_QUEUE_SIZE) { if (!$this->read_put_responses($i)) { return false; } $i = 0; } return true; } /** * Checks whether a file or directory exists * * @param string $path * @return bool * @access public */ public function file_exists($path) { if ($this->use_stat_cache) { $path = $this->realpath($path); $result = $this->query_stat_cache($path); if (isset($result)) { // return true if $result is an array or if it's an stdClass object return $result !== false; } } return $this->stat($path) !== false; } /** * Tells whether the filename is a directory * * @param string $path * @return bool * @access public */ public function is_dir($path) { $result = $this->get_stat_cache_prop($path, 'type'); if ($result === false) { return false; } return $result === NET_SFTP_TYPE_DIRECTORY; } /** * Tells whether the filename is a regular file * * @param string $path * @return bool * @access public */ public function is_file($path) { $result = $this->get_stat_cache_prop($path, 'type'); if ($result === false) { return false; } return $result === NET_SFTP_TYPE_REGULAR; } /** * Tells whether the filename is a symbolic link * * @param string $path * @return bool * @access public */ public function is_link($path) { $result = $this->get_lstat_cache_prop($path, 'type'); if ($result === false) { return false; } return $result === NET_SFTP_TYPE_SYMLINK; } /** * Tells whether a file exists and is readable * * @param string $path * @return bool * @access public */ public function is_readable($path) { $path = $this->realpath($path); $packet = pack('Na*N2', strlen($path), $path, NET_SFTP_OPEN_READ, 0); if (!$this->send_sftp_packet(NET_SFTP_OPEN, $packet)) { return false; } $response = $this->get_sftp_packet(); switch ($this->packet_type) { case NET_SFTP_HANDLE: return true; case NET_SFTP_STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED return false; default: throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } } /** * Tells whether the filename is writable * * @param string $path * @return bool * @access public */ public function is_writable($path) { $path = $this->realpath($path); $packet = pack('Na*N2', strlen($path), $path, NET_SFTP_OPEN_WRITE, 0); if (!$this->send_sftp_packet(NET_SFTP_OPEN, $packet)) { return false; } $response = $this->get_sftp_packet(); switch ($this->packet_type) { case NET_SFTP_HANDLE: return true; case NET_SFTP_STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED return false; default: user_error('Expected SSH_FXP_HANDLE or SSH_FXP_STATUS'); return false; } } /** * Tells whether the filename is writeable * * Alias of is_writable * * @param string $path * @return bool * @access public */ public function is_writeable($path) { return $this->is_writable($path); } /** * Gets last access time of file * * @param string $path * @return mixed * @access public */ public function fileatime($path) { return $this->get_stat_cache_prop($path, 'atime'); } /** * Gets file modification time * * @param string $path * @return mixed * @access public */ public function filemtime($path) { return $this->get_stat_cache_prop($path, 'mtime'); } /** * Gets file permissions * * @param string $path * @return mixed * @access public */ public function fileperms($path) { return $this->get_stat_cache_prop($path, 'permissions'); } /** * Gets file owner * * @param string $path * @return mixed * @access public */ public function fileowner($path) { return $this->get_stat_cache_prop($path, 'uid'); } /** * Gets file group * * @param string $path * @return mixed * @access public */ public function filegroup($path) { return $this->get_stat_cache_prop($path, 'gid'); } /** * Gets file size * * @param string $path * @return mixed * @access public */ public function filesize($path) { return $this->get_stat_cache_prop($path, 'size'); } /** * Gets file type * * @param string $path * @return mixed * @access public */ public function filetype($path) { $type = $this->get_stat_cache_prop($path, 'type'); if ($type === false) { return false; } switch ($type) { case NET_SFTP_TYPE_BLOCK_DEVICE: return 'block'; case NET_SFTP_TYPE_CHAR_DEVICE: return 'char'; case NET_SFTP_TYPE_DIRECTORY: return 'dir'; case NET_SFTP_TYPE_FIFO: return 'fifo'; case NET_SFTP_TYPE_REGULAR: return 'file'; case NET_SFTP_TYPE_SYMLINK: return 'link'; default: return false; } } /** * Return a stat properity * * Uses cache if appropriate. * * @param string $path * @param string $prop * @return mixed * @access private */ private function get_stat_cache_prop($path, $prop) { return $this->get_xstat_cache_prop($path, $prop, 'stat'); } /** * Return an lstat properity * * Uses cache if appropriate. * * @param string $path * @param string $prop * @return mixed * @access private */ private function get_lstat_cache_prop($path, $prop) { return $this->get_xstat_cache_prop($path, $prop, 'lstat'); } /** * Return a stat or lstat properity * * Uses cache if appropriate. * * @param string $path * @param string $prop * @param string $type * @return mixed * @access private */ private function get_xstat_cache_prop($path, $prop, $type) { if ($this->use_stat_cache) { $path = $this->realpath($path); $result = $this->query_stat_cache($path); if (is_object($result) && isset($result->$type)) { return $result->{$type}[$prop]; } } $result = $this->$type($path); if ($result === false || !isset($result[$prop])) { return false; } return $result[$prop]; } /** * Renames a file or a directory on the SFTP server * * @param string $oldname * @param string $newname * @return bool * @throws \UnexpectedValueException on receipt of unexpected packets * @access public */ public function rename($oldname, $newname) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; } $oldname = $this->realpath($oldname); $newname = $this->realpath($newname); if ($oldname === false || $newname === false) { return false; } // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.3 $packet = pack('Na*Na*', strlen($oldname), $oldname, strlen($newname), $newname); if (!$this->send_sftp_packet(NET_SFTP_RENAME, $packet)) { return false; } $response = $this->get_sftp_packet(); if ($this->packet_type != NET_SFTP_STATUS) { throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); } // if $status isn't SSH_FX_OK it's probably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED if (strlen($response) < 4) { return false; } extract(unpack('Nstatus', Strings::shift($response, 4))); /** @var integer $status */ if ($status != NET_SFTP_STATUS_OK) { $this->logError($response, $status); return false; } // don't move the stat cache entry over since this operation could very well change the // atime and mtime attributes //$this->update_stat_cache($newname, $this->query_stat_cache($oldname)); $this->remove_from_stat_cache($oldname); $this->remove_from_stat_cache($newname); return true; } /** * Parse Attributes * * See '7. File Attributes' of draft-ietf-secsh-filexfer-13 for more info. * * @param string $response * @return array * @access private */ private function parseAttributes(&$response) { $attr = []; if (strlen($response) < 4) { //user_error('Malformed file attributes'); return []; } extract(unpack('Nflags', Strings::shift($response, 4))); /** @var integer $flags */ // SFTPv4+ have a type field (a byte) that follows the above flag field foreach ($this->attributes as $key => $value) { switch ($flags & $key) { case NET_SFTP_ATTR_SIZE: // 0x00000001 // The size attribute is defined as an unsigned 64-bit integer. // The following will use floats on 32-bit platforms, if necessary. // As can be seen in the BigInteger class, floats are generally // IEEE 754 binary64 "double precision" on such platforms and // as such can represent integers of at least 2^50 without loss // of precision. Interpreted in filesize, 2^50 bytes = 1024 TiB. $attr['size'] = hexdec(Hex::encode(Strings::shift($response, 8))); break; case NET_SFTP_ATTR_UIDGID: // 0x00000002 (SFTPv3 only) if (strlen($response) < 8) { //user_error('Malformed file attributes'); return $attr; } $attr+= unpack('Nuid/Ngid', Strings::shift($response, 8)); break; case NET_SFTP_ATTR_PERMISSIONS: // 0x00000004 if (strlen($response) < 4) { //user_error('Malformed file attributes'); return $attr; } $attr+= unpack('Npermissions', Strings::shift($response, 4)); // mode == permissions; permissions was the original array key and is retained for bc purposes. // mode was added because that's the more industry standard terminology $attr+= ['mode' => $attr['permissions']]; $fileType = $this->parseMode($attr['permissions']); if ($fileType !== false) { $attr+= ['type' => $fileType]; } break; case NET_SFTP_ATTR_ACCESSTIME: // 0x00000008 if (strlen($response) < 8) { //user_error('Malformed file attributes'); return $attr; } $attr+= unpack('Natime/Nmtime', Strings::shift($response, 8)); break; case NET_SFTP_ATTR_EXTENDED: // 0x80000000 if (strlen($response) < 4) { //user_error('Malformed file attributes'); return $attr; } extract(unpack('Ncount', Strings::shift($response, 4))); /** @var integer $count */ for ($i = 0; $i < $count; $i++) { if (strlen($response) < 4) { //user_error('Malformed file attributes'); return $attr; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ $key = Strings::shift($response, $length); if (strlen($response) < 4) { //user_error('Malformed file attributes'); return $attr; } extract(unpack('Nlength', Strings::shift($response, 4))); /** @var integer $length */ $attr[$key] = Strings::shift($response, $length); } } } return $attr; } /** * Attempt to identify the file type * * Quoting the SFTP RFC, "Implementations MUST NOT send bits that are not defined" but they seem to anyway * * @param int $mode * @return int * @access private */ private function parseMode($mode) { // values come from http://lxr.free-electrons.com/source/include/uapi/linux/stat.h#L12 // see, also, http://linux.die.net/man/2/stat switch ($mode & 0170000) {// ie. 1111 0000 0000 0000 case 0000000: // no file type specified - figure out the file type using alternative means return false; case 0040000: return NET_SFTP_TYPE_DIRECTORY; case 0100000: return NET_SFTP_TYPE_REGULAR; case 0120000: return NET_SFTP_TYPE_SYMLINK; // new types introduced in SFTPv5+ // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-05#section-5.2 case 0010000: // named pipe (fifo) return NET_SFTP_TYPE_FIFO; case 0020000: // character special return NET_SFTP_TYPE_CHAR_DEVICE; case 0060000: // block special return NET_SFTP_TYPE_BLOCK_DEVICE; case 0140000: // socket return NET_SFTP_TYPE_SOCKET; case 0160000: // whiteout // "SPECIAL should be used for files that are of // a known type which cannot be expressed in the protocol" return NET_SFTP_TYPE_SPECIAL; default: return NET_SFTP_TYPE_UNKNOWN; } } /** * Parse Longname * * SFTPv3 doesn't provide any easy way of identifying a file type. You could try to open * a file as a directory and see if an error is returned or you could try to parse the * SFTPv3-specific longname field of the SSH_FXP_NAME packet. That's what this function does. * The result is returned using the * {@link http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-5.2 SFTPv4 type constants}. * * If the longname is in an unrecognized format bool(false) is returned. * * @param string $longname * @return mixed * @access private */ private function parseLongname($longname) { // http://en.wikipedia.org/wiki/Unix_file_types // http://en.wikipedia.org/wiki/Filesystem_permissions#Notation_of_traditional_Unix_permissions if (preg_match('#^[^/]([r-][w-][xstST-]){3}#', $longname)) { switch ($longname[0]) { case '-': return NET_SFTP_TYPE_REGULAR; case 'd': return NET_SFTP_TYPE_DIRECTORY; case 'l': return NET_SFTP_TYPE_SYMLINK; default: return NET_SFTP_TYPE_SPECIAL; } } return false; } /** * Sends SFTP Packets * * See '6. General Packet Format' of draft-ietf-secsh-filexfer-13 for more info. * * @param int $type * @param string $data * @see self::_get_sftp_packet() * @see self::_send_channel_packet() * @return bool * @access private */ private function send_sftp_packet($type, $data) { $packet = $this->request_id !== false ? pack('NCNa*', strlen($data) + 5, $type, $this->request_id, $data) : pack('NCa*', strlen($data) + 1, $type, $data); $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 $result = $this->send_channel_packet(self::CHANNEL, $packet); $stop = strtok(microtime(), ' ') + strtok(''); if (defined('NET_SFTP_LOGGING')) { $packet_type = '-> ' . $this->packet_types[$type] . ' (' . round($stop - $start, 4) . 's)'; if (NET_SFTP_LOGGING == self::LOG_REALTIME) { echo "<pre>\r\n" . $this->format_log([$data], [$packet_type]) . "\r\n</pre>\r\n"; flush(); ob_flush(); } else { $this->packet_type_log[] = $packet_type; if (NET_SFTP_LOGGING == self::LOG_COMPLEX) { $this->packet_log[] = $data; } } } return $result; } /** * Receives SFTP Packets * * See '6. General Packet Format' of draft-ietf-secsh-filexfer-13 for more info. * * Incidentally, the number of SSH_MSG_CHANNEL_DATA messages has no bearing on the number of SFTP packets present. * There can be one SSH_MSG_CHANNEL_DATA messages containing two SFTP packets or there can be two SSH_MSG_CHANNEL_DATA * messages containing one SFTP packet. * * @see self::_send_sftp_packet() * @return string * @access private */ private function get_sftp_packet() { $this->curTimeout = false; $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 // SFTP packet length while (strlen($this->packet_buffer) < 4) { $temp = $this->get_channel_packet(self::CHANNEL, true); if (is_bool($temp)) { $this->packet_type = false; $this->packet_buffer = ''; return false; } $this->packet_buffer.= $temp; } if (strlen($this->packet_buffer) < 4) { return false; } extract(unpack('Nlength', Strings::shift($this->packet_buffer, 4))); /** @var integer $length */ $tempLength = $length; $tempLength-= strlen($this->packet_buffer); // SFTP packet type and data payload while ($tempLength > 0) { $temp = $this->get_channel_packet(self::CHANNEL, true); if (is_bool($temp)) { $this->packet_type = false; $this->packet_buffer = ''; return false; } $this->packet_buffer.= $temp; $tempLength-= strlen($temp); } $stop = strtok(microtime(), ' ') + strtok(''); $this->packet_type = ord(Strings::shift($this->packet_buffer)); if ($this->request_id !== false) { Strings::shift($this->packet_buffer, 4); // remove the request id $length-= 5; // account for the request id and the packet type } else { $length-= 1; // account for the packet type } $packet = Strings::shift($this->packet_buffer, $length); if (defined('NET_SFTP_LOGGING')) { $packet_type = '<- ' . $this->packet_types[$this->packet_type] . ' (' . round($stop - $start, 4) . 's)'; if (NET_SFTP_LOGGING == self::LOG_REALTIME) { echo "<pre>\r\n" . $this->format_log([$packet], [$packet_type]) . "\r\n</pre>\r\n"; flush(); ob_flush(); } else { $this->packet_type_log[] = $packet_type; if (NET_SFTP_LOGGING == self::LOG_COMPLEX) { $this->packet_log[] = $packet; } } } return $packet; } /** * Returns a log of the packets that have been sent and received. * * Returns a string if NET_SFTP_LOGGING == self::LOG_COMPLEX, an array if NET_SFTP_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SFTP_LOGGING') * * @access public * @return array|string */ public function getSFTPLog() { if (!defined('NET_SFTP_LOGGING')) { return false; } switch (NET_SFTP_LOGGING) { case self::LOG_COMPLEX: return $this->format_log($this->packet_log, $this->packet_type_log); break; //case self::LOG_SIMPLE: default: return $this->packet_type_log; } } /** * Returns all errors * * @return array * @access public */ public function getSFTPErrors() { return $this->sftp_errors; } /** * Returns the last error * * @return string * @access public */ public function getLastSFTPError() { return count($this->sftp_errors) ? $this->sftp_errors[count($this->sftp_errors) - 1] : ''; } /** * Get supported SFTP versions * * @return array * @access public */ public function getSupportedVersions() { $temp = ['version' => $this->version]; if (isset($this->extensions['versions'])) { $temp['extensions'] = $this->extensions['versions']; } return $temp; } /** * Disconnect * * @param int $reason * @return bool * @access protected */ protected function disconnect_helper($reason) { $this->pwd = false; parent::disconnect_helper($reason); } } <?php /** * SFTP Stream Wrapper * * Creates an sftp:// protocol handler that can be used with, for example, fopen(), dir(), etc. * * PHP version 5 * * @category Net * @package SFTP * @author Jim Wigginton <terrafrost@php.net> * @copyright 2013 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Net\SFTP; use phpseclib\Crypt\RSA; use phpseclib\Net\SFTP; use phpseclib\Net\SSH2; /** * SFTP Stream Wrapper * * @package SFTP * @author Jim Wigginton <terrafrost@php.net> * @access public */ class Stream { /** * SFTP instances * * Rather than re-create the connection we re-use instances if possible * * @var array */ static $instances; /** * SFTP instance * * @var object * @access private */ private $sftp; /** * Path * * @var string * @access private */ private $path; /** * Mode * * @var string * @access private */ private $mode; /** * Position * * @var int * @access private */ private $pos; /** * Size * * @var int * @access private */ private $size; /** * Directory entries * * @var array * @access private */ private $entries; /** * EOF flag * * @var bool * @access private */ private $eof; /** * Context resource * * Technically this needs to be publically accessible so PHP can set it directly * * @var resource * @access public */ public $context; /** * Notification callback function * * @var callable * @access public */ private $notification; /** * Registers this class as a URL wrapper. * * @param string $protocol The wrapper name to be registered. * @return bool True on success, false otherwise. * @access public */ public static function register($protocol = 'sftp') { if (in_array($protocol, stream_get_wrappers(), true)) { return false; } return stream_wrapper_register($protocol, get_called_class()); } /** * The Constructor * * @access public */ public function __construct() { if (defined('NET_SFTP_STREAM_LOGGING')) { echo "__construct()\r\n"; } } /** * Path Parser * * Extract a path from a URI and actually connect to an SSH server if appropriate * * If "notification" is set as a context parameter the message code for successful login is * NET_SSH2_MSG_USERAUTH_SUCCESS. For a failed login it's NET_SSH2_MSG_USERAUTH_FAILURE. * * @param string $path * @return string * @access private */ private function parse_path($path) { $orig = $path; extract(parse_url($path) + ['port' => 22]); if (isset($query)) { $path.= '?' . $query; } elseif (preg_match('/(\?|\?#)$/', $orig)) { $path.= '?'; } if (isset($fragment)) { $path.= '#' . $fragment; } elseif ($orig[strlen($orig) - 1] == '#') { $path.= '#'; } if (!isset($host)) { return false; } if (isset($this->context)) { $context = stream_context_get_params($this->context); if (isset($context['notification'])) { $this->notification = $context['notification']; } } if (preg_match('/^{[a-z0-9]+}$/i', $host)) { $host = SSH2::getConnectionByResourceId($host); if ($host === false) { return false; } $this->sftp = $host; } else { if (isset($this->context)) { $context = stream_context_get_options($this->context); } if (isset($context[$scheme]['session'])) { $sftp = $context[$scheme]['session']; } if (isset($context[$scheme]['sftp'])) { $sftp = $context[$scheme]['sftp']; } if (isset($sftp) && $sftp instanceof SFTP) { $this->sftp = $sftp; return $path; } if (isset($context[$scheme]['username'])) { $user = $context[$scheme]['username']; } if (isset($context[$scheme]['password'])) { $pass = $context[$scheme]['password']; } if (isset($context[$scheme]['privkey']) && $context[$scheme]['privkey'] instanceof RSA) { $pass = $context[$scheme]['privkey']; } if (!isset($user) || !isset($pass)) { return false; } // casting $pass to a string is necessary in the event that it's a \phpseclib\Crypt\RSA object if (isset(self::$instances[$host][$port][$user][(string) $pass])) { $this->sftp = self::$instances[$host][$port][$user][(string) $pass]; } else { $this->sftp = new SFTP($host, $port); $this->sftp->disableStatCache(); if (isset($this->notification) && is_callable($this->notification)) { /* if !is_callable($this->notification) we could do this: user_error('fopen(): failed to call user notifier', E_USER_WARNING); the ftp wrapper gives errors like that when the notifier isn't callable. i've opted not to do that, however, since the ftp wrapper gives the line on which the fopen occurred as the line number - not the line that the user_error is on. */ call_user_func($this->notification, STREAM_NOTIFY_CONNECT, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0); call_user_func($this->notification, STREAM_NOTIFY_AUTH_REQUIRED, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0); if (!$this->sftp->login($user, $pass)) { call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_ERR, 'Login Failure', NET_SSH2_MSG_USERAUTH_FAILURE, 0, 0); return false; } call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_INFO, 'Login Success', NET_SSH2_MSG_USERAUTH_SUCCESS, 0, 0); } else { if (!$this->sftp->login($user, $pass)) { return false; } } self::$instances[$host][$port][$user][(string) $pass] = $this->sftp; } } return $path; } /** * Opens file or URL * * @param string $path * @param string $mode * @param int $options * @param string $opened_path * @return bool * @access public */ private function _stream_open($path, $mode, $options, &$opened_path) { $path = $this->parse_path($path); if ($path === false) { return false; } $this->path = $path; $this->size = $this->sftp->size($path); $this->mode = preg_replace('#[bt]$#', '', $mode); $this->eof = false; if ($this->size === false) { if ($this->mode[0] == 'r') { return false; } else { $this->sftp->touch($path); $this->size = 0; } } else { switch ($this->mode[0]) { case 'x': return false; case 'w': $this->sftp->truncate($path, 0); $this->size = 0; } } $this->pos = $this->mode[0] != 'a' ? 0 : $this->size; return true; } /** * Read from stream * * @param int $count * @return mixed * @access public */ private function _stream_read($count) { switch ($this->mode) { case 'w': case 'a': case 'x': case 'c': return false; } // commented out because some files - eg. /dev/urandom - will say their size is 0 when in fact it's kinda infinite //if ($this->pos >= $this->size) { // $this->eof = true; // return false; //} $result = $this->sftp->get($this->path, false, $this->pos, $count); if (isset($this->notification) && is_callable($this->notification)) { if ($result === false) { call_user_func($this->notification, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_SEVERITY_ERR, $this->sftp->getLastSFTPError(), NET_SFTP_OPEN, 0, 0); return 0; } // seems that PHP calls stream_read in 8k chunks call_user_func($this->notification, STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($result), $this->size); } if (empty($result)) { // ie. false or empty string $this->eof = true; return false; } $this->pos+= strlen($result); return $result; } /** * Write to stream * * @param string $data * @return mixed * @access public */ private function _stream_write($data) { switch ($this->mode) { case 'r': return false; } $result = $this->sftp->put($this->path, $data, SFTP::SOURCE_STRING, $this->pos); if (isset($this->notification) && is_callable($this->notification)) { if (!$result) { call_user_func($this->notification, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_SEVERITY_ERR, $this->sftp->getLastSFTPError(), NET_SFTP_OPEN, 0, 0); return 0; } // seems that PHP splits up strings into 8k blocks before calling stream_write call_user_func($this->notification, STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($data), strlen($data)); } if ($result === false) { return false; } $this->pos+= strlen($data); if ($this->pos > $this->size) { $this->size = $this->pos; } $this->eof = false; return strlen($data); } /** * Retrieve the current position of a stream * * @return int * @access public */ private function _stream_tell() { return $this->pos; } /** * Tests for end-of-file on a file pointer * * In my testing there are four classes functions that normally effect the pointer: * fseek, fputs / fwrite, fgets / fread and ftruncate. * * Only fgets / fread, however, results in feof() returning true. do fputs($fp, 'aaa') on a blank file and feof() * will return false. do fread($fp, 1) and feof() will then return true. do fseek($fp, 10) on ablank file and feof() * will return false. do fread($fp, 1) and feof() will then return true. * * @return bool * @access public */ private function _stream_eof() { return $this->eof; } /** * Seeks to specific location in a stream * * @param int $offset * @param int $whence * @return bool * @access public */ private function _stream_seek($offset, $whence) { switch ($whence) { case SEEK_SET: if ($offset >= $this->size || $offset < 0) { return false; } break; case SEEK_CUR: $offset+= $this->pos; break; case SEEK_END: $offset+= $this->size; } $this->pos = $offset; $this->eof = false; return true; } /** * Change stream options * * @param string $path * @param int $option * @param mixed $var * @return bool * @access public */ private function _stream_metadata($path, $option, $var) { $path = $this->parse_path($path); if ($path === false) { return false; } // stream_metadata was introduced in PHP 5.4.0 but as of 5.4.11 the constants haven't been defined // see http://www.php.net/streamwrapper.stream-metadata and https://bugs.php.net/64246 // and https://github.com/php/php-src/blob/master/main/php_streams.h#L592 switch ($option) { case 1: // PHP_STREAM_META_TOUCH return $this->sftp->touch($path, $var[0], $var[1]); case 2: // PHP_STREAM_OWNER_NAME case 3: // PHP_STREAM_GROUP_NAME return false; case 4: // PHP_STREAM_META_OWNER return $this->sftp->chown($path, $var); case 5: // PHP_STREAM_META_GROUP return $this->sftp->chgrp($path, $var); case 6: // PHP_STREAM_META_ACCESS return $this->sftp->chmod($path, $var) !== false; } } /** * Retrieve the underlaying resource * * @param int $cast_as * @return resource * @access public */ private function _stream_cast($cast_as) { return $this->sftp->fsock; } /** * Advisory file locking * * @param int $operation * @return bool * @access public */ private function _stream_lock($operation) { return false; } /** * Renames a file or directory * * Attempts to rename oldname to newname, moving it between directories if necessary. * If newname exists, it will be overwritten. This is a departure from what \phpseclib\Net\SFTP * does. * * @param string $path_from * @param string $path_to * @return bool * @access public */ private function _rename($path_from, $path_to) { $path1 = parse_url($path_from); $path2 = parse_url($path_to); unset($path1['path'], $path2['path']); if ($path1 != $path2) { return false; } $path_from = $this->parse_path($path_from); $path_to = parse_url($path_to); if ($path_from === false) { return false; } $path_to = $path_to['path']; // the $component part of parse_url() was added in PHP 5.1.2 // "It is an error if there already exists a file with the name specified by newpath." // -- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#section-6.5 if (!$this->sftp->rename($path_from, $path_to)) { if ($this->sftp->stat($path_to)) { return $this->sftp->delete($path_to, true) && $this->sftp->rename($path_from, $path_to); } return false; } return true; } /** * Open directory handle * * The only $options is "whether or not to enforce safe_mode (0x04)". Since safe mode was deprecated in 5.3 and * removed in 5.4 I'm just going to ignore it. * * Also, nlist() is the best that this function is realistically going to be able to do. When an SFTP client * sends a SSH_FXP_READDIR packet you don't generally get info on just one file but on multiple files. Quoting * the SFTP specs: * * The SSH_FXP_NAME response has the following format: * * uint32 id * uint32 count * repeats count times: * string filename * string longname * ATTRS attrs * * @param string $path * @param int $options * @return bool * @access public */ private function _dir_opendir($path, $options) { $path = $this->parse_path($path); if ($path === false) { return false; } $this->pos = 0; $this->entries = $this->sftp->nlist($path); return $this->entries !== false; } /** * Read entry from directory handle * * @return mixed * @access public */ private function _dir_readdir() { if (isset($this->entries[$this->pos])) { return $this->entries[$this->pos++]; } return false; } /** * Rewind directory handle * * @return bool * @access public */ private function _dir_rewinddir() { $this->pos = 0; return true; } /** * Close directory handle * * @return bool * @access public */ private function _dir_closedir() { return true; } /** * Create a directory * * Only valid $options is STREAM_MKDIR_RECURSIVE * * @param string $path * @param int $mode * @param int $options * @return bool * @access public */ private function _mkdir($path, $mode, $options) { $path = $this->parse_path($path); if ($path === false) { return false; } return $this->sftp->mkdir($path, $mode, $options & STREAM_MKDIR_RECURSIVE); } /** * Removes a directory * * Only valid $options is STREAM_MKDIR_RECURSIVE per <http://php.net/streamwrapper.rmdir>, however, * <http://php.net/rmdir> does not have a $recursive parameter as mkdir() does so I don't know how * STREAM_MKDIR_RECURSIVE is supposed to be set. Also, when I try it out with rmdir() I get 8 as * $options. What does 8 correspond to? * * @param string $path * @param int $options * @return bool * @access public */ private function _rmdir($path, $options) { $path = $this->parse_path($path); if ($path === false) { return false; } return $this->sftp->rmdir($path); } /** * Flushes the output * * See <http://php.net/fflush>. Always returns true because \phpseclib\Net\SFTP doesn't cache stuff before writing * * @return bool * @access public */ private function _stream_flush() { return true; } /** * Retrieve information about a file resource * * @return mixed * @access public */ private function _stream_stat() { $results = $this->sftp->stat($this->path); if ($results === false) { return false; } return $results; } /** * Delete a file * * @param string $path * @return bool * @access public */ private function _unlink($path) { $path = $this->parse_path($path); if ($path === false) { return false; } return $this->sftp->delete($path, false); } /** * Retrieve information about a file * * Ignores the STREAM_URL_STAT_QUIET flag because the entirety of \phpseclib\Net\SFTP\Stream is quiet by default * might be worthwhile to reconstruct bits 12-16 (ie. the file type) if mode doesn't have them but we'll * cross that bridge when and if it's reached * * @param string $path * @param int $flags * @return mixed * @access public */ private function _url_stat($path, $flags) { $path = $this->parse_path($path); if ($path === false) { return false; } $results = $flags & STREAM_URL_STAT_LINK ? $this->sftp->lstat($path) : $this->sftp->stat($path); if ($results === false) { return false; } return $results; } /** * Truncate stream * * @param int $new_size * @return bool * @access public */ private function _stream_truncate($new_size) { if (!$this->sftp->truncate($this->path, $new_size)) { return false; } $this->eof = false; $this->size = $new_size; return true; } /** * Change stream options * * STREAM_OPTION_WRITE_BUFFER isn't supported for the same reason stream_flush isn't. * The other two aren't supported because of limitations in \phpseclib\Net\SFTP. * * @param int $option * @param int $arg1 * @param int $arg2 * @return bool * @access public */ private function _stream_set_option($option, $arg1, $arg2) { return false; } /** * Close an resource * * @access public */ private function _stream_close() { } /** * __call Magic Method * * When you're utilizing an SFTP stream you're not calling the methods in this class directly - PHP is calling them for you. * Which kinda begs the question... what methods is PHP calling and what parameters is it passing to them? This function * lets you figure that out. * * If NET_SFTP_STREAM_LOGGING is defined all calls will be output on the screen and then (regardless of whether or not * NET_SFTP_STREAM_LOGGING is enabled) the parameters will be passed through to the appropriate method. * * @param string * @param array * @return mixed * @access public */ public function __call($name, $arguments) { if (defined('NET_SFTP_STREAM_LOGGING')) { echo $name . '('; $last = count($arguments) - 1; foreach ($arguments as $i => $argument) { var_export($argument); if ($i != $last) { echo ','; } } echo ")\r\n"; } $name = '_' . $name; if (!method_exists($this, $name)) { return false; } return call_user_func_array([$this, $name], $arguments); } } <?php /** * Pure-PHP implementation of SCP. * * PHP version 5 * * The API for this library is modeled after the API from PHP's {@link http://php.net/book.ftp FTP extension}. * * Here's a short example of how to use this library: * <code> * <?php * include 'vendor/autoload.php'; * * $ssh = new \phpseclib\Net\SSH2('www.domain.tld'); * if (!$ssh->login('username', 'password')) { * exit('bad login'); * } * $scp = new \phpseclib\Net\SCP($ssh); * * $scp->put('abcd', str_repeat('x', 1024*1024)); * ?> * </code> * * @category Net * @package SCP * @author Jim Wigginton <terrafrost@php.net> * @copyright 2010 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace phpseclib\Net; use phpseclib\Exception\FileNotFoundException; use phpseclib\Common\Functions\Strings; use phpseclib\Common\Functions\Objects; /** * Pure-PHP implementations of SCP. * * @package SCP * @author Jim Wigginton <terrafrost@php.net> * @access public */ class SCP { /**#@+ * @access public * @see \phpseclib\Net\SCP::put() */ /** * Reads data from a local file. */ const SOURCE_LOCAL_FILE = 1; /** * Reads data from a string. */ const SOURCE_STRING = 2; /**#@-*/ /**#@+ * @access private * @see \phpseclib\Net\SCP::_send() * @see \phpseclib\Net\SCP::_receive() */ /** * SSH1 is being used. */ const MODE_SSH1 = 1; /** * SSH2 is being used. */ const MODE_SSH2 = 2; /**#@-*/ /** * SSH Object * * @var object * @access private */ private $ssh; /** * Packet Size * * @var int * @access private */ private $packet_size; /** * Mode * * @var int * @access private */ private $mode; /** * Default Constructor. * * Connects to an SSH server * * @param \phpseclib\Net\SSH1|\phpseclib\Net\SSH2 $ssh * @access public */ public function __construct($ssh) { if ($ssh instanceof SSH2) { $this->mode = self::MODE_SSH2; } elseif ($ssh instanceof SSH1) { $this->packet_size = 50000; $this->mode = self::MODE_SSH1; } else { return; } $this->ssh = $ssh; } /** * Uploads a file to the SCP server. * * By default, \phpseclib\Net\SCP::put() does not read from the local filesystem. $data is dumped directly into $remote_file. * So, for example, if you set $data to 'filename.ext' and then do \phpseclib\Net\SCP::get(), you will get a file, twelve bytes * long, containing 'filename.ext' as its contents. * * Setting $mode to self::SOURCE_LOCAL_FILE will change the above behavior. With self::SOURCE_LOCAL_FILE, $remote_file will * contain as many bytes as filename.ext does on your local filesystem. If your filename.ext is 1MB then that is how * large $remote_file will be, as well. * * Currently, only binary mode is supported. As such, if the line endings need to be adjusted, you will need to take * care of that, yourself. * * @param string $remote_file * @param string $data * @param int $mode * @param callable $callback * @throws \phpseclib\Exception\FileNotFoundException if you're uploading via a file and the file doesn't exist * @return bool * @access public */ public function put($remote_file, $data, $mode = self::SOURCE_STRING, $callback = null) { if (!isset($this->ssh)) { return false; } if (!$this->ssh->exec('scp -t ' . escapeshellarg($remote_file), false)) { // -t = to return false; } $temp = $this->receive(); if ($temp !== chr(0)) { return false; } if ($this->mode == self::MODE_SSH2) { $this->packet_size = Objects::getVar($this->ssh, 'packet_size_client_to_server')[SSH2::CHANNEL_EXEC] - 4; } $remote_file = basename($remote_file); if ($mode == self::SOURCE_STRING) { $size = strlen($data); } else { if (!is_file($data)) { throw new FileNotFoundException("$data is not a valid file"); } $fp = @fopen($data, 'rb'); if (!$fp) { return false; } $size = filesize($data); } $this->send('C0644 ' . $size . ' ' . $remote_file . "\n"); $temp = $this->receive(); if ($temp !== chr(0)) { return false; } $sent = 0; while ($sent < $size) { $temp = $mode & self::SOURCE_STRING ? substr($data, $sent, $this->packet_size) : fread($fp, $this->packet_size); $this->send($temp); $sent+= strlen($temp); if (is_callable($callback)) { call_user_func($callback, $sent); } } $this->close(); if ($mode != self::SOURCE_STRING) { fclose($fp); } return true; } /** * Downloads a file from the SCP server. * * Returns a string containing the contents of $remote_file if $local_file is left undefined or a boolean false if * the operation was unsuccessful. If $local_file is defined, returns true or false depending on the success of the * operation * * @param string $remote_file * @param string|bool $local_file * @return mixed * @access public */ public function get($remote_file, $local_file = false) { if (!isset($this->ssh)) { return false; } if (!$this->ssh->exec('scp -f ' . escapeshellarg($remote_file), false)) { // -f = from return false; } $this->send("\0"); if (!preg_match('#(?<perms>[^ ]+) (?<size>\d+) (?<name>.+)#', rtrim($this->receive()), $info)) { return false; } $this->send("\0"); $size = 0; if ($local_file !== false) { $fp = @fopen($local_file, 'wb'); if (!$fp) { return false; } } $content = ''; while ($size < $info['size']) { $data = $this->receive(); // SCP usually seems to split stuff out into 16k chunks $size+= strlen($data); if ($local_file === false) { $content.= $data; } else { fputs($fp, $data); } } $this->close(); if ($local_file !== false) { fclose($fp); return true; } return $content; } /** * Sends a packet to an SSH server * * @param string $data * @access private */ private function send($data) { switch ($this->mode) { case self::MODE_SSH2: Objects::callFunc($this->ssh, 'send_channel_packet', [SSH2::CHANNEL_EXEC, $data]); break; case self::MODE_SSH1: $data = pack('CNa*', NET_SSH1_CMSG_STDIN_DATA, strlen($data), $data); Objects::callFunc($this->ssh, 'send_binary_packet', [$data]); } } /** * Receives a packet from an SSH server * * @return string * @throws \UnexpectedValueException on receipt of an unexpected packet * @access private */ private function receive() { switch ($this->mode) { case self::MODE_SSH2: return Objects::callFunc($this->ssh, 'get_channel_packet', [SSH2::CHANNEL_EXEC, true]); case self::MODE_SSH1: if (!Objects::getVar($this->ssh, 'bitmap')) { return false; } while (true) { $response = Objects::getFunc($this->ssh, 'get_binary_packet'); switch ($response[SSH1::RESPONSE_TYPE]) { case NET_SSH1_SMSG_STDOUT_DATA: if (strlen($response[SSH1::RESPONSE_DATA]) < 4) { return false; } extract(unpack('Nlength', $response[SSH1::RESPONSE_DATA])); /** @var integer $length */ return Strings::shift($response[SSH1::RESPONSE_DATA], $length); case NET_SSH1_SMSG_STDERR_DATA: break; case NET_SSH1_SMSG_EXITSTATUS: Objects::callFunc($this->ssh, 'send_binary_packet', [chr(NET_SSH1_CMSG_EXIT_CONFIRMATION)]); fclose(Objects::getVar($this->ssh, 'fsock')); Objects::setVar($this->ssh, 'bitmap', 0); return false; default: throw new \UnexpectedValueException('Unknown packet received'); } } } } /** * Closes the connection to an SSH server * * @access private */ private function close() { switch ($this->mode) { case self::MODE_SSH2: Objects::callFunc($this->ssh, 'close_channel', [SSH2::CHANNEL_EXEC, true]); break; case self::MODE_SSH1: Objects::callFunc($this->ssh, 'disconnect'); } } } { "name": "phpseclib/phpseclib", "type": "library", "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", "keywords": [ "security", "crypto", "cryptography", "encryption", "signature", "signing", "rsa", "aes", "blowfish", "twofish", "ssh", "sftp", "x509", "x.509", "asn1", "asn.1", "BigInteger" ], "homepage": "http://phpseclib.sourceforge.net", "license": "MIT", "authors": [ { "name": "Jim Wigginton", "email": "terrafrost@php.net", "role": "Lead Developer" }, { "name": "Patrick Monnerat", "email": "pm@datasphere.ch", "role": "Developer" }, { "name": "Andreas Fischer", "email": "bantu@phpbb.com", "role": "Developer" }, { "name": "Hans-Jürgen Petrich", "email": "petrich@tronic-media.com", "role": "Developer" }, { "name": "Graham Campbell", "email": "graham@alt-three.com", "role": "Developer" } ], "require": { "paragonie/constant_time_encoding": "^1", "paragonie/random_compat": "^1.4|^2.0", "php": ">=5.6.1" }, "require-dev": { "phing/phing": "~2.7", "phpunit/phpunit": "^4.8.35|^5.7|^6.0", "sami/sami": "~2.0", "squizlabs/php_codesniffer": "~2.0" }, "suggest": { "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations.", "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations." }, "autoload": { "files": [ "phpseclib/bootstrap.php" ], "psr-4": { "phpseclib\\": "phpseclib/" } } } <?php // Prevent e.g. 'Notice: Constant MATH_BIGINTEGER_MONTGOMERY already defined'. class MyArrayStore extends Sami\Store\ArrayStore { public function removeClass(Sami\Project $project, $name) { unset($this->classes[$name]); } } $iterator = Symfony\Component\Finder\Finder::create() ->files() ->name('*.php') ->in(__DIR__ . '/../phpseclib/') ; $versions = Sami\Version\GitVersionCollection::create(__DIR__ . '/../') ->add('1.0') ->add('2.0') ->add('master') ; return new Sami\Sami($iterator, array( 'theme' => 'enhanced', 'versions' => $versions, 'title' => 'phpseclib API Documentation', 'build_dir' => __DIR__.'/api/output/%version%', 'cache_dir' => __DIR__.'/api/cache/%version%', 'default_opened_level' => 2, 'store' => new MyArrayStore, )); { "name": "vlucas/phpdotenv", "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", "keywords": ["env", "dotenv", "environment"], "license" : "BSD-3-Clause", "authors" : [ { "name": "Vance Lucas", "email": "vance@vancelucas.com", "homepage": "http://www.vancelucas.com" } ], "require": { "php": ">=5.3.9" }, "require-dev": { "phpunit/phpunit": "^4.8.35 || ^5.0" }, "autoload": { "psr-4": { "Dotenv\\": "src/" } }, "extra": { "branch-alias": { "dev-master": "2.5-dev" } } } <?php namespace Dotenv; use Dotenv\Exception\InvalidCallbackException; use Dotenv\Exception\ValidationException; /** * This is the validator class. * * It's responsible for applying validations against a number of variables. */ class Validator { /** * The variables to validate. * * @var array */ protected $variables; /** * The loader instance. * * @var \Dotenv\Loader */ protected $loader; /** * Create a new validator instance. * * @param array $variables * @param \Dotenv\Loader $loader * * @return void */ public function __construct(array $variables, Loader $loader) { $this->variables = $variables; $this->loader = $loader; $this->assertCallback( function ($value) { return $value !== null; }, 'is missing' ); } /** * Assert that each variable is not empty. * * @return \Dotenv\Validator */ public function notEmpty() { return $this->assertCallback( function ($value) { return strlen(trim($value)) > 0; }, 'is empty' ); } /** * Assert that each specified variable is an integer. * * @return \Dotenv\Validator */ public function isInteger() { return $this->assertCallback( function ($value) { return ctype_digit($value); }, 'is not an integer' ); } /** * Assert that each specified variable is a boolean. * * @return \Dotenv\Validator */ public function isBoolean() { return $this->assertCallback( function ($value) { if ($value === '') { return false; } return (filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) !== NULL); }, 'is not a boolean' ); } /** * Assert that each variable is amongst the given choices. * * @param string[] $choices * * @return \Dotenv\Validator */ public function allowedValues(array $choices) { return $this->assertCallback( function ($value) use ($choices) { return in_array($value, $choices); }, 'is not an allowed value' ); } /** * Assert that the callback returns true for each variable. * * @param callable $callback * @param string $message * * @throws \Dotenv\Exception\InvalidCallbackException|\Dotenv\Exception\ValidationException * * @return \Dotenv\Validator */ protected function assertCallback($callback, $message = 'failed callback assertion') { if (!is_callable($callback)) { throw new InvalidCallbackException('The provided callback must be callable.'); } $variablesFailingAssertion = array(); foreach ($this->variables as $variableName) { $variableValue = $this->loader->getEnvironmentVariable($variableName); if (call_user_func($callback, $variableValue) === false) { $variablesFailingAssertion[] = $variableName." $message"; } } if (count($variablesFailingAssertion) > 0) { throw new ValidationException(sprintf( 'One or more environment variables failed assertions: %s.', implode(', ', $variablesFailingAssertion) )); } return $this; } } <?php namespace Dotenv; use Dotenv\Exception\InvalidFileException; use Dotenv\Exception\InvalidPathException; /** * This is the loaded class. * * It's responsible for loading variables by reading a file from disk and: * - stripping comments beginning with a `#`, * - parsing lines that look shell variable setters, e.g `export key = value`, `key="value"`. */ class Loader { /** * The file path. * * @var string */ protected $filePath; /** * Are we immutable? * * @var bool */ protected $immutable; /** * The list of environment variables declared inside the 'env' file. * * @var array */ public $variableNames = array(); /** * Create a new loader instance. * * @param string $filePath * @param bool $immutable * * @return void */ public function __construct($filePath, $immutable = false) { $this->filePath = $filePath; $this->immutable = $immutable; } /** * Set immutable value. * * @param bool $immutable * @return $this */ public function setImmutable($immutable = false) { $this->immutable = $immutable; return $this; } /** * Get immutable value. * * @return bool */ public function getImmutable() { return $this->immutable; } /** * Load `.env` file in given directory. * * @return array */ public function load() { $this->ensureFileIsReadable(); $filePath = $this->filePath; $lines = $this->readLinesFromFile($filePath); foreach ($lines as $line) { if (!$this->isComment($line) && $this->looksLikeSetter($line)) { $this->setEnvironmentVariable($line); } } return $lines; } /** * Ensures the given filePath is readable. * * @throws \Dotenv\Exception\InvalidPathException * * @return void */ protected function ensureFileIsReadable() { if (!is_readable($this->filePath) || !is_file($this->filePath)) { throw new InvalidPathException(sprintf('Unable to read the environment file at %s.', $this->filePath)); } } /** * Normalise the given environment variable. * * Takes value as passed in by developer and: * - ensures we're dealing with a separate name and value, breaking apart the name string if needed, * - cleaning the value of quotes, * - cleaning the name of quotes, * - resolving nested variables. * * @param string $name * @param string $value * * @return array */ protected function normaliseEnvironmentVariable($name, $value) { list($name, $value) = $this->processFilters($name, $value); $value = $this->resolveNestedVariables($value); return array($name, $value); } /** * Process the runtime filters. * * Called from `normaliseEnvironmentVariable` and the `VariableFactory`, passed as a callback in `$this->loadFromFile()`. * * @param string $name * @param string $value * * @return array */ public function processFilters($name, $value) { list($name, $value) = $this->splitCompoundStringIntoParts($name, $value); list($name, $value) = $this->sanitiseVariableName($name, $value); list($name, $value) = $this->sanitiseVariableValue($name, $value); return array($name, $value); } /** * Read lines from the file, auto detecting line endings. * * @param string $filePath * * @return array */ protected function readLinesFromFile($filePath) { // Read file into an array of lines with auto-detected line endings $autodetect = ini_get('auto_detect_line_endings'); ini_set('auto_detect_line_endings', '1'); $lines = file($filePath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); ini_set('auto_detect_line_endings', $autodetect); return $lines; } /** * Determine if the line in the file is a comment, e.g. begins with a #. * * @param string $line * * @return bool */ protected function isComment($line) { $line = ltrim($line); return isset($line[0]) && $line[0] === '#'; } /** * Determine if the given line looks like it's setting a variable. * * @param string $line * * @return bool */ protected function looksLikeSetter($line) { return strpos($line, '=') !== false; } /** * Split the compound string into parts. * * If the `$name` contains an `=` sign, then we split it into 2 parts, a `name` & `value` * disregarding the `$value` passed in. * * @param string $name * @param string $value * * @return array */ protected function splitCompoundStringIntoParts($name, $value) { if (strpos($name, '=') !== false) { list($name, $value) = array_map('trim', explode('=', $name, 2)); } return array($name, $value); } /** * Strips quotes from the environment variable value. * * @param string $name * @param string $value * * @throws \Dotenv\Exception\InvalidFileException * * @return array */ protected function sanitiseVariableValue($name, $value) { $value = trim($value); if (!$value) { return array($name, $value); } if ($this->beginsWithAQuote($value)) { // value starts with a quote $quote = $value[0]; $regexPattern = sprintf( '/^ %1$s # match a quote at the start of the value ( # capturing sub-pattern used (?: # we do not need to capture this [^%1$s\\\\]* # any character other than a quote or backslash |\\\\\\\\ # or two backslashes together |\\\\%1$s # or an escaped quote e.g \" )* # as many characters that match the previous rules ) # end of the capturing sub-pattern %1$s # and the closing quote .*$ # and discard any string after the closing quote /mx', $quote ); $value = preg_replace($regexPattern, '$1', $value); $value = str_replace("\\$quote", $quote, $value); $value = str_replace('\\\\', '\\', $value); } else { $parts = explode(' #', $value, 2); $value = trim($parts[0]); // Unquoted values cannot contain whitespace if (preg_match('/\s+/', $value) > 0) { // Check if value is a comment (usually triggered when empty value with comment) if (preg_match('/^#/', $value) > 0) { $value = ''; } else { throw new InvalidFileException('Dotenv values containing spaces must be surrounded by quotes.'); } } } return array($name, trim($value)); } /** * Resolve the nested variables. * * Look for ${varname} patterns in the variable value and replace with an * existing environment variable. * * @param string $value * * @return mixed */ protected function resolveNestedVariables($value) { if (strpos($value, '$') !== false) { $loader = $this; $value = preg_replace_callback( '/\${([a-zA-Z0-9_.]+)}/', function ($matchedPatterns) use ($loader) { $nestedVariable = $loader->getEnvironmentVariable($matchedPatterns[1]); if ($nestedVariable === null) { return $matchedPatterns[0]; } else { return $nestedVariable; } }, $value ); } return $value; } /** * Strips quotes and the optional leading "export " from the environment variable name. * * @param string $name * @param string $value * * @return array */ protected function sanitiseVariableName($name, $value) { $name = trim(str_replace(array('export ', '\'', '"'), '', $name)); return array($name, $value); } /** * Determine if the given string begins with a quote. * * @param string $value * * @return bool */ protected function beginsWithAQuote($value) { return isset($value[0]) && ($value[0] === '"' || $value[0] === '\''); } /** * Search the different places for environment variables and return first value found. * * @param string $name * * @return string|null */ public function getEnvironmentVariable($name) { switch (true) { case array_key_exists($name, $_ENV): return $_ENV[$name]; case array_key_exists($name, $_SERVER): return $_SERVER[$name]; default: $value = getenv($name); return $value === false ? null : $value; // switch getenv default to null } } /** * Set an environment variable. * * This is done using: * - putenv, * - $_ENV, * - $_SERVER. * * The environment variable value is stripped of single and double quotes. * * @param string $name * @param string|null $value * * @return void */ public function setEnvironmentVariable($name, $value = null) { list($name, $value) = $this->normaliseEnvironmentVariable($name, $value); $this->variableNames[] = $name; // Don't overwrite existing environment variables if we're immutable // Ruby's dotenv does this with `ENV[key] ||= value`. if ($this->immutable && $this->getEnvironmentVariable($name) !== null) { return; } // If PHP is running as an Apache module and an existing // Apache environment variable exists, overwrite it if (function_exists('apache_getenv') && function_exists('apache_setenv') && apache_getenv($name) !== false) { apache_setenv($name, $value); } if (function_exists('putenv')) { putenv("$name=$value"); } $_ENV[$name] = $value; $_SERVER[$name] = $value; } /** * Clear an environment variable. * * This is not (currently) used by Dotenv but is provided as a utility * method for 3rd party code. * * This is done using: * - putenv, * - unset($_ENV, $_SERVER). * * @param string $name * * @see setEnvironmentVariable() * * @return void */ public function clearEnvironmentVariable($name) { // Don't clear anything if we're immutable. if ($this->immutable) { return; } if (function_exists('putenv')) { putenv($name); } unset($_ENV[$name], $_SERVER[$name]); } } <?php namespace Dotenv; use Dotenv\Exception\InvalidPathException; /** * This is the dotenv class. * * It's responsible for loading a `.env` file in the given directory and * setting the environment vars. */ class Dotenv { /** * The file path. * * @var string */ protected $filePath; /** * The loader instance. * * @var \Dotenv\Loader|null */ protected $loader; /** * Create a new dotenv instance. * * @param string $path * @param string $file * * @return void */ public function __construct($path, $file = '.env') { $this->filePath = $this->getFilePath($path, $file); $this->loader = new Loader($this->filePath, true); } /** * Load environment file in given directory. * * @return array */ public function load() { return $this->loadData(); } /** * Load environment file in given directory, suppress InvalidPathException. * * @return array */ public function safeLoad() { try { return $this->loadData(); } catch (InvalidPathException $e) { // suppressing exception return array(); } } /** * Load environment file in given directory. * * @return array */ public function overload() { return $this->loadData(true); } /** * Returns the full path to the file. * * @param string $path * @param string $file * * @return string */ protected function getFilePath($path, $file) { if (!is_string($file)) { $file = '.env'; } $filePath = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$file; return $filePath; } /** * Actually load the data. * * @param bool $overload * * @return array */ protected function loadData($overload = false) { return $this->loader->setImmutable(!$overload)->load(); } /** * Required ensures that the specified variables exist, and returns a new validator object. * * @param string|string[] $variable * * @return \Dotenv\Validator */ public function required($variable) { return new Validator((array) $variable, $this->loader); } /** * Get the list of environment variables declared inside the 'env' file. * * @return array */ public function getEnvironmentVariableNames() { return $this->loader->variableNames; } } <?php namespace Dotenv\Exception; /** * This is the exception interface. */ interface ExceptionInterface { // } <?php namespace Dotenv\Exception; use InvalidArgumentException; /** * This is the invalid file exception class. */ class InvalidFileException extends InvalidArgumentException implements ExceptionInterface { // } <?php namespace Dotenv\Exception; use InvalidArgumentException; /** * This is the invalid path exception class. */ class InvalidPathException extends InvalidArgumentException implements ExceptionInterface { // } <?php namespace Dotenv\Exception; use RuntimeException; /** * This is the validation exception class. */ class ValidationException extends RuntimeException implements ExceptionInterface { // } <?php namespace Dotenv\Exception; use InvalidArgumentException; /** * This is the invalid callback exception class. */ class InvalidCallbackException extends InvalidArgumentException implements ExceptionInterface { // } <?php require_once 'lib/byte_safe_strings.php'; require_once 'lib/cast_to_int.php'; require_once 'lib/error_polyfill.php'; require_once 'other/ide_stubs/libsodium.php'; require_once 'lib/random.php'; $int = random_int(0, 65536); { "name": "paragonie/random_compat", "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", "keywords": [ "csprng", "random", "polyfill", "pseudorandom" ], "license": "MIT", "type": "library", "authors": [ { "name": "Paragon Initiative Enterprises", "email": "security@paragonie.com", "homepage": "https://paragonie.com" } ], "support": { "issues": "https://github.com/paragonie/random_compat/issues", "email": "info@paragonie.com", "source": "https://github.com/paragonie/random_compat" }, "require": { "php": ">=5.2.0" }, "require-dev": { "phpunit/phpunit": "4.*|5.*" }, "suggest": { "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." }, "autoload": { "files": [ "lib/random.php" ] } } <?php if (!is_callable('random_int')) { /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects * * The MIT License (MIT) * * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Fetch a random integer between $min and $max inclusive * * @param int $min * @param int $max * * @throws Exception * * @return int */ function random_int($min, $max) { /** * Type and input logic checks * * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX) * (non-inclusive), it will sanely cast it to an int. If you it's equal to * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats * lose precision, so the <= and => operators might accidentally let a float * through. */ try { /** @var int $min */ $min = RandomCompat_intval($min); } catch (TypeError $ex) { throw new TypeError( 'random_int(): $min must be an integer' ); } try { /** @var int $max */ $max = RandomCompat_intval($max); } catch (TypeError $ex) { throw new TypeError( 'random_int(): $max must be an integer' ); } /** * Now that we've verified our weak typing system has given us an integer, * let's validate the logic then we can move forward with generating random * integers along a given range. */ if ($min > $max) { throw new Error( 'Minimum value must be less than or equal to the maximum value' ); } if ($max === $min) { return (int) $min; } /** * Initialize variables to 0 * * We want to store: * $bytes => the number of random bytes we need * $mask => an integer bitmask (for use with the &) operator * so we can minimize the number of discards */ $attempts = $bits = $bytes = $mask = $valueShift = 0; /** @var int $attempts */ /** @var int $bits */ /** @var int $bytes */ /** @var int $mask */ /** @var int $valueShift */ /** * At this point, $range is a positive number greater than 0. It might * overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to * a float and we will lose some precision. * * @var int|float $range */ $range = $max - $min; /** * Test for integer overflow: */ if (!is_int($range)) { /** * Still safely calculate wider ranges. * Provided by @CodesInChaos, @oittaa * * @ref https://gist.github.com/CodesInChaos/03f9ea0b58e8b2b8d435 * * We use ~0 as a mask in this case because it generates all 1s * * @ref https://eval.in/400356 (32-bit) * @ref http://3v4l.org/XX9r5 (64-bit) */ $bytes = PHP_INT_SIZE; /** @var int $mask */ $mask = ~0; } else { /** * $bits is effectively ceil(log($range, 2)) without dealing with * type juggling */ while ($range > 0) { if ($bits % 8 === 0) { ++$bytes; } ++$bits; $range >>= 1; /** @var int $mask */ $mask = $mask << 1 | 1; } $valueShift = $min; } /** @var int $val */ $val = 0; /** * Now that we have our parameters set up, let's begin generating * random integers until one falls between $min and $max */ /** @psalm-suppress RedundantCondition */ do { /** * The rejection probability is at most 0.5, so this corresponds * to a failure probability of 2^-128 for a working RNG */ if ($attempts > 128) { throw new Exception( 'random_int: RNG is broken - too many rejections' ); } /** * Let's grab the necessary number of random bytes */ $randomByteString = random_bytes($bytes); /** * Let's turn $randomByteString into an integer * * This uses bitwise operators (<< and |) to build an integer * out of the values extracted from ord() * * Example: [9F] | [6D] | [32] | [0C] => * 159 + 27904 + 3276800 + 201326592 => * 204631455 */ $val &= 0; for ($i = 0; $i < $bytes; ++$i) { $val |= ord($randomByteString[$i]) << ($i * 8); } /** @var int $val */ /** * Apply mask */ $val &= $mask; $val += $valueShift; ++$attempts; /** * If $val overflows to a floating point number, *... or is larger than $max, *... or smaller than $min, * then try again. */ } while (!is_int($val) || $val > $max || $val < $min); return (int) $val; } } <?php /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects * * The MIT License (MIT) * * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ if (!is_callable('random_bytes')) { /** * If the libsodium PHP extension is loaded, we'll use it above any other * solution. * * libsodium-php project: * @ref https://github.com/jedisct1/libsodium-php * * @param int $bytes * * @throws Exception * * @return string */ function random_bytes($bytes) { try { /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( 'random_bytes(): $bytes must be an integer' ); } if ($bytes < 1) { throw new Error( 'Length must be greater than 0' ); } /** * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be * generated in one invocation. */ /** @var string|bool $buf */ if ($bytes > 2147483647) { $buf = ''; for ($i = 0; $i < $bytes; $i += 1073741824) { $n = ($bytes - $i) > 1073741824 ? 1073741824 : $bytes - $i; $buf .= \Sodium\randombytes_buf($n); } } else { /** @var string|bool $buf */ $buf = \Sodium\randombytes_buf($bytes); } if (is_string($buf)) { if (RandomCompat_strlen($buf) === $bytes) { return $buf; } } /** * If we reach here, PHP has failed us. */ throw new Exception( 'Could not gather sufficient random data' ); } } <?php /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects * * The MIT License (MIT) * * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ if (!is_callable('random_bytes')) { /** * If the libsodium PHP extension is loaded, we'll use it above any other * solution. * * libsodium-php project: * @ref https://github.com/jedisct1/libsodium-php * * @param int $bytes * * @throws Exception * * @return string */ function random_bytes($bytes) { try { /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( 'random_bytes(): $bytes must be an integer' ); } if ($bytes < 1) { throw new Error( 'Length must be greater than 0' ); } /** * @var string */ $buf = ''; /** * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be * generated in one invocation. */ if ($bytes > 2147483647) { for ($i = 0; $i < $bytes; $i += 1073741824) { $n = ($bytes - $i) > 1073741824 ? 1073741824 : $bytes - $i; $buf .= Sodium::randombytes_buf((int) $n); } } else { $buf .= Sodium::randombytes_buf((int) $bytes); } if (is_string($buf)) { if (RandomCompat_strlen($buf) === $bytes) { return $buf; } } /** * If we reach here, PHP has failed us. */ throw new Exception( 'Could not gather sufficient random data' ); } } <?php /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects * * The MIT License (MIT) * * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ if (!is_callable('random_bytes')) { /** * Windows with PHP < 5.3.0 will not have the function * openssl_random_pseudo_bytes() available, so let's use * CAPICOM to work around this deficiency. * * @param int $bytes * * @throws Exception * * @return string */ function random_bytes($bytes) { try { /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( 'random_bytes(): $bytes must be an integer' ); } if ($bytes < 1) { throw new Error( 'Length must be greater than 0' ); } /** @var string $buf */ $buf = ''; if (!class_exists('COM')) { throw new Error( 'COM does not exist' ); } /** @var COM $util */ $util = new COM('CAPICOM.Utilities.1'); $execCount = 0; /** * Let's not let it loop forever. If we run N times and fail to * get N bytes of random data, then CAPICOM has failed us. */ do { $buf .= base64_decode((string) $util->GetRandom($bytes, 0)); if (RandomCompat_strlen($buf) >= $bytes) { /** * Return our random entropy buffer here: */ return (string) RandomCompat_substr($buf, 0, $bytes); } ++$execCount; } while ($execCount < $bytes); /** * If we reach here, PHP has failed us. */ throw new Exception( 'Could not gather sufficient random data' ); } }<?php /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects * * The MIT License (MIT) * * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ if (!defined('RANDOM_COMPAT_READ_BUFFER')) { define('RANDOM_COMPAT_READ_BUFFER', 8); } if (!is_callable('random_bytes')) { /** * Unless open_basedir is enabled, use /dev/urandom for * random numbers in accordance with best practices * * Why we use /dev/urandom and not /dev/random * @ref http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers * * @param int $bytes * * @throws Exception * * @return string */ function random_bytes($bytes) { /** @var resource $fp */ static $fp = null; /** * This block should only be run once */ if (empty($fp)) { /** * We use /dev/urandom if it is a char device. * We never fall back to /dev/random */ /** @var resource|bool $fp */ $fp = fopen('/dev/urandom', 'rb'); if (is_resource($fp)) { /** @var array<string, int> $st */ $st = fstat($fp); if (($st['mode'] & 0170000) !== 020000) { fclose($fp); $fp = false; } } if (is_resource($fp)) { /** * stream_set_read_buffer() does not exist in HHVM * * If we don't set the stream's read buffer to 0, PHP will * internally buffer 8192 bytes, which can waste entropy * * stream_set_read_buffer returns 0 on success */ if (is_callable('stream_set_read_buffer')) { stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER); } if (is_callable('stream_set_chunk_size')) { stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER); } } } try { /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( 'random_bytes(): $bytes must be an integer' ); } if ($bytes < 1) { throw new Error( 'Length must be greater than 0' ); } /** * This if() block only runs if we managed to open a file handle * * It does not belong in an else {} block, because the above * if (empty($fp)) line is logic that should only be run once per * page load. */ if (is_resource($fp)) { /** * @var int */ $remaining = $bytes; /** * @var string|bool */ $buf = ''; /** * We use fread() in a loop to protect against partial reads */ do { /** * @var string|bool */ $read = fread($fp, $remaining); if (!is_string($read)) { if ($read === false) { /** * We cannot safely read from the file. Exit the * do-while loop and trigger the exception condition * * @var string|bool */ $buf = false; break; } } /** * Decrease the number of bytes returned from remaining */ $remaining -= RandomCompat_strlen($read); /** * @var string|bool */ $buf = $buf . $read; } while ($remaining > 0); /** * Is our result valid? */ if (is_string($buf)) { if (RandomCompat_strlen($buf) === $bytes) { /** * Return our random entropy buffer here: */ return $buf; } } } /** * If we reach here, PHP has failed us. */ throw new Exception( 'Error reading from source device' ); } } <?php /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects * * @version 2.0.17 * @released 2018-07-04 * * The MIT License (MIT) * * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ if (!defined('PHP_VERSION_ID')) { // This constant was introduced in PHP 5.2.7 $RandomCompatversion = array_map('intval', explode('.', PHP_VERSION)); define( 'PHP_VERSION_ID', $RandomCompatversion[0] * 10000 + $RandomCompatversion[1] * 100 + $RandomCompatversion[2] ); $RandomCompatversion = null; } /** * PHP 7.0.0 and newer have these functions natively. */ if (PHP_VERSION_ID >= 70000) { return; } if (!defined('RANDOM_COMPAT_READ_BUFFER')) { define('RANDOM_COMPAT_READ_BUFFER', 8); } $RandomCompatDIR = dirname(__FILE__); require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'byte_safe_strings.php'; require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'cast_to_int.php'; require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'error_polyfill.php'; if (!is_callable('random_bytes')) { /** * PHP 5.2.0 - 5.6.x way to implement random_bytes() * * We use conditional statements here to define the function in accordance * to the operating environment. It's a micro-optimization. * * In order of preference: * 1. Use libsodium if available. * 2. fread() /dev/urandom if available (never on Windows) * 3. mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM) * 4. COM('CAPICOM.Utilities.1')->GetRandom() * * See RATIONALE.md for our reasoning behind this particular order */ if (extension_loaded('libsodium')) { // See random_bytes_libsodium.php if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) { require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium.php'; } elseif (method_exists('Sodium', 'randombytes_buf')) { require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium_legacy.php'; } } /** * Reading directly from /dev/urandom: */ if (DIRECTORY_SEPARATOR === '/') { // DIRECTORY_SEPARATOR === '/' on Unix-like OSes -- this is a fast // way to exclude Windows. $RandomCompatUrandom = true; $RandomCompat_basedir = ini_get('open_basedir'); if (!empty($RandomCompat_basedir)) { $RandomCompat_open_basedir = explode( PATH_SEPARATOR, strtolower($RandomCompat_basedir) ); $RandomCompatUrandom = (array() !== array_intersect( array('/dev', '/dev/', '/dev/urandom'), $RandomCompat_open_basedir )); $RandomCompat_open_basedir = null; } if ( !is_callable('random_bytes') && $RandomCompatUrandom && @is_readable('/dev/urandom') ) { // Error suppression on is_readable() in case of an open_basedir // or safe_mode failure. All we care about is whether or not we // can read it at this point. If the PHP environment is going to // panic over trying to see if the file can be read in the first // place, that is not helpful to us here. // See random_bytes_dev_urandom.php require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_dev_urandom.php'; } // Unset variables after use $RandomCompat_basedir = null; } else { $RandomCompatUrandom = false; } /** * mcrypt_create_iv() * * We only want to use mcypt_create_iv() if: * * - random_bytes() hasn't already been defined * - the mcrypt extensions is loaded * - One of these two conditions is true: * - We're on Windows (DIRECTORY_SEPARATOR !== '/') * - We're not on Windows and /dev/urandom is readabale * (i.e. we're not in a chroot jail) * - Special case: * - If we're not on Windows, but the PHP version is between * 5.6.10 and 5.6.12, we don't want to use mcrypt. It will * hang indefinitely. This is bad. * - If we're on Windows, we want to use PHP >= 5.3.7 or else * we get insufficient entropy errors. */ if ( !is_callable('random_bytes') && // Windows on PHP < 5.3.7 is broken, but non-Windows is not known to be. (DIRECTORY_SEPARATOR === '/' || PHP_VERSION_ID >= 50307) && // Prevent this code from hanging indefinitely on non-Windows; // see https://bugs.php.net/bug.php?id=69833 ( DIRECTORY_SEPARATOR !== '/' || (PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613) ) && extension_loaded('mcrypt') ) { // See random_bytes_mcrypt.php require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_mcrypt.php'; } $RandomCompatUrandom = null; /** * This is a Windows-specific fallback, for when the mcrypt extension * isn't loaded. */ if ( !is_callable('random_bytes') && extension_loaded('com_dotnet') && class_exists('COM') ) { $RandomCompat_disabled_classes = preg_split( '#\s*,\s*#', strtolower(ini_get('disable_classes')) ); if (!in_array('com', $RandomCompat_disabled_classes)) { try { $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); if (method_exists($RandomCompatCOMtest, 'GetRandom')) { // See random_bytes_com_dotnet.php require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_com_dotnet.php'; } } catch (com_exception $e) { // Don't try to use it. } } $RandomCompat_disabled_classes = null; $RandomCompatCOMtest = null; } /** * throw new Exception */ if (!is_callable('random_bytes')) { /** * We don't have any more options, so let's throw an exception right now * and hope the developer won't let it fail silently. * * @param mixed $length * @psalm-suppress InvalidReturnType * @throws Exception * @return string */ function random_bytes($length) { unset($length); // Suppress "variable not used" warnings. throw new Exception( 'There is no suitable CSPRNG installed on your system' ); return ''; } } } if (!is_callable('random_int')) { require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_int.php'; } $RandomCompatDIR = null; <?php /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects * * The MIT License (MIT) * * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ if (!class_exists('Error', false)) { // We can't really avoid making this extend Exception in PHP 5. class Error extends Exception { } } if (!class_exists('TypeError', false)) { if (is_subclass_of('Error', 'Exception')) { class TypeError extends Error { } } else { class TypeError extends Exception { } } } <?php /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects * * The MIT License (MIT) * * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ if (!is_callable('random_bytes')) { /** * Powered by ext/mcrypt (and thankfully NOT libmcrypt) * * @ref https://bugs.php.net/bug.php?id=55169 * @ref https://github.com/php/php-src/blob/c568ffe5171d942161fc8dda066bce844bdef676/ext/mcrypt/mcrypt.c#L1321-L1386 * * @param int $bytes * * @throws Exception * * @return string */ function random_bytes($bytes) { try { /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( 'random_bytes(): $bytes must be an integer' ); } if ($bytes < 1) { throw new Error( 'Length must be greater than 0' ); } /** @var string|bool $buf */ $buf = @mcrypt_create_iv((int) $bytes, (int) MCRYPT_DEV_URANDOM); if ( is_string($buf) && RandomCompat_strlen($buf) === $bytes ) { /** * Return our random entropy buffer here: */ return $buf; } /** * If we reach here, PHP has failed us. */ throw new Exception( 'Could not gather sufficient random data' ); } } <?php /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects * * The MIT License (MIT) * * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ if (!is_callable('RandomCompat_intval')) { /** * Cast to an integer if we can, safely. * * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX) * (non-inclusive), it will sanely cast it to an int. If you it's equal to * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats * lose precision, so the <= and => operators might accidentally let a float * through. * * @param int|float $number The number we want to convert to an int * @param bool $fail_open Set to true to not throw an exception * * @return float|int * @psalm-suppress InvalidReturnType * * @throws TypeError */ function RandomCompat_intval($number, $fail_open = false) { if (is_int($number) || is_float($number)) { $number += 0; } elseif (is_numeric($number)) { /** @psalm-suppress InvalidOperand */ $number += 0; } /** @var int|float $number */ if ( is_float($number) && $number > ~PHP_INT_MAX && $number < PHP_INT_MAX ) { $number = (int) $number; } if (is_int($number)) { return (int) $number; } elseif (!$fail_open) { throw new TypeError( 'Expected an integer.' ); } return $number; } } <?php /** * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects * * The MIT License (MIT) * * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ if (!is_callable('RandomCompat_strlen')) { if ( defined('MB_OVERLOAD_STRING') && ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING ) { /** * strlen() implementation that isn't brittle to mbstring.func_overload * * This version uses mb_strlen() in '8bit' mode to treat strings as raw * binary rather than UTF-8, ISO-8859-1, etc * * @param string $binary_string * * @throws TypeError * * @return int */ function RandomCompat_strlen($binary_string) { if (!is_string($binary_string)) { throw new TypeError( 'RandomCompat_strlen() expects a string' ); } return (int) mb_strlen($binary_string, '8bit'); } } else { /** * strlen() implementation that isn't brittle to mbstring.func_overload * * This version just used the default strlen() * * @param string $binary_string * * @throws TypeError * * @return int */ function RandomCompat_strlen($binary_string) { if (!is_string($binary_string)) { throw new TypeError( 'RandomCompat_strlen() expects a string' ); } return (int) strlen($binary_string); } } } if (!is_callable('RandomCompat_substr')) { if ( defined('MB_OVERLOAD_STRING') && ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING ) { /** * substr() implementation that isn't brittle to mbstring.func_overload * * This version uses mb_substr() in '8bit' mode to treat strings as raw * binary rather than UTF-8, ISO-8859-1, etc * * @param string $binary_string * @param int $start * @param int|null $length (optional) * * @throws TypeError * * @return string */ function RandomCompat_substr($binary_string, $start, $length = null) { if (!is_string($binary_string)) { throw new TypeError( 'RandomCompat_substr(): First argument should be a string' ); } if (!is_int($start)) { throw new TypeError( 'RandomCompat_substr(): Second argument should be an integer' ); } if ($length === null) { /** * mb_substr($str, 0, NULL, '8bit') returns an empty string on * PHP 5.3, so we have to find the length ourselves. */ /** @var int $length */ $length = RandomCompat_strlen($binary_string) - $start; } elseif (!is_int($length)) { throw new TypeError( 'RandomCompat_substr(): Third argument should be an integer, or omitted' ); } // Consistency with PHP's behavior if ($start === RandomCompat_strlen($binary_string) && $length === 0) { return ''; } if ($start > RandomCompat_strlen($binary_string)) { return ''; } return (string) mb_substr( (string) $binary_string, (int) $start, (int) $length, '8bit' ); } } else { /** * substr() implementation that isn't brittle to mbstring.func_overload * * This version just uses the default substr() * * @param string $binary_string * @param int $start * @param int|null $length (optional) * * @throws TypeError * * @return string */ function RandomCompat_substr($binary_string, $start, $length = null) { if (!is_string($binary_string)) { throw new TypeError( 'RandomCompat_substr(): First argument should be a string' ); } if (!is_int($start)) { throw new TypeError( 'RandomCompat_substr(): Second argument should be an integer' ); } if ($length !== null) { if (!is_int($length)) { throw new TypeError( 'RandomCompat_substr(): Third argument should be an integer, or omitted' ); } return (string) substr( (string )$binary_string, (int) $start, (int) $length ); } return (string) substr( (string) $binary_string, (int) $start ); } } } <?php $dist = dirname(__DIR__).'/dist'; if (!is_dir($dist)) { mkdir($dist, 0755); } if (file_exists($dist.'/random_compat.phar')) { unlink($dist.'/random_compat.phar'); } $phar = new Phar( $dist.'/random_compat.phar', FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::KEY_AS_FILENAME, 'random_compat.phar' ); rename( dirname(__DIR__).'/lib/random.php', dirname(__DIR__).'/lib/index.php' ); $phar->buildFromDirectory(dirname(__DIR__).'/lib'); rename( dirname(__DIR__).'/lib/index.php', dirname(__DIR__).'/lib/random.php' ); /** * If we pass an (optional) path to a private key as a second argument, we will * sign the Phar with OpenSSL. * * If you leave this out, it will produce an unsigned .phar! */ if ($argc > 1) { if (!@is_readable($argv[1])) { echo 'Could not read the private key file:', $argv[1], "\n"; exit(255); } $pkeyFile = file_get_contents($argv[1]); $private = openssl_get_privatekey($pkeyFile); if ($private !== false) { $pkey = ''; openssl_pkey_export($private, $pkey); $phar->setSignatureAlgorithm(Phar::OPENSSL, $pkey); /** * Save the corresponding public key to the file */ if (!@is_readable($dist.'/random_compat.phar.pubkey')) { $details = openssl_pkey_get_details($private); file_put_contents( $dist.'/random_compat.phar.pubkey', $details['key'] ); } } else { echo 'An error occurred reading the private key from OpenSSL.', "\n"; exit(255); } } { "name": "paragonie/constant_time_encoding", "description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)", "keywords": [ "base64", "encoding", "rfc4648", "base32", "base16", "hex", "bin2hex", "hex2bin", "base64_encode", "base64_decode", "base32_encode", "base32_decode" ], "license": "MIT", "type": "library", "authors": [ { "name": "Paragon Initiative Enterprises", "email": "security@paragonie.com", "homepage": "https://paragonie.com", "role": "Maintainer" }, { "name": "Steve 'Sc00bz' Thomas", "email": "steve@tobtu.com", "homepage": "https://www.tobtu.com", "role": "Original Developer" } ], "support": { "issues": "https://github.com/paragonie/constant_time_encoding/issues", "email": "info@paragonie.com", "source": "https://github.com/paragonie/constant_time_encoding" }, "require": { "php": "^5.3|^7" }, "require-dev": { "phpunit/phpunit": "4.*|5.*", "paragonie/random_compat": "^1.4|^2", "vimeo/psalm": "^0.3|^1" }, "autoload": { "psr-4": { "ParagonIE\\ConstantTime\\": "src/" } } } <?php namespace ParagonIE\ConstantTime; /** * Copyright (c) 2016 - 2017 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Class Encoding * @package ParagonIE\ConstantTime */ abstract class Encoding { /** * RFC 4648 Base32 encoding * * @param string $str * @return string */ public static function base32Encode($str) { return Base32::encode($str); } /** * RFC 4648 Base32 encoding * * @param string $str * @return string */ public static function base32EncodeUpper($str) { return Base32::encodeUpper($str); } /** * RFC 4648 Base32 decoding * * @param string $str * @return string */ public static function base32Decode($str) { return Base32::decode($str); } /** * RFC 4648 Base32 decoding * * @param string $str * @return string */ public static function base32DecodeUpper($str) { return Base32::decodeUpper($str); } /** * RFC 4648 Base32 encoding * * @param string $str * @return string */ public static function base32HexEncode($str) { return Base32Hex::encode($str); } /** * RFC 4648 Base32 encoding * * @param string $str * @return string */ public static function base32HexEncodeUpper($str) { return Base32Hex::encodeUpper($str); } /** * RFC 4648 Base32 decoding * * @param string $str * @return string */ public static function base32HexDecode($str) { return Base32Hex::decode($str); } /** * RFC 4648 Base32 decoding * * @param string $str * @return string */ public static function base32HexDecodeUpper($str) { return Base32Hex::decodeUpper($str); } /** * RFC 4648 Base64 encoding * * @param string $str * @return string */ public static function base64Encode($str) { return Base64::encode($str); } /** * RFC 4648 Base32 decoding * * @param string $str * @return string */ public static function base64Decode($str) { return Base64::decode($str); } /** * Encode into Base64 * * Base64 character set "./[A-Z][a-z][0-9]" * @param string $src * @return string */ public static function base64EncodeDotSlash($src) { return Base64DotSlash::encode($src); } /** * Decode from base64 to raw binary * * Base64 character set "./[A-Z][a-z][0-9]" * * @param string $src * @return string * @throws \RangeException */ public static function base64DecodeDotSlash($src) { return Base64DotSlash::decode($src); } /** * Encode into Base64 * * Base64 character set "[.-9][A-Z][a-z]" or "./[0-9][A-Z][a-z]" * @param string $src * @return string */ public static function base64EncodeDotSlashOrdered($src) { return Base64DotSlashOrdered::encode($src); } /** * Decode from base64 to raw binary * * Base64 character set "[.-9][A-Z][a-z]" or "./[0-9][A-Z][a-z]" * * @param string $src * @return string * @throws \RangeException */ public static function base64DecodeDotSlashOrdered($src) { return Base64DotSlashOrdered::decode($src); } /** * Convert a binary string into a hexadecimal string without cache-timing * leaks * * @param string $bin_string (raw binary) * @return string */ public static function hexEncode($bin_string) { return Hex::encode($bin_string); } /** * Convert a hexadecimal string into a binary string without cache-timing * leaks * * @param string $hex_string * @return string (raw binary) * @throws \RangeException */ public static function hexDecode($hex_string) { return Hex::decode($hex_string); } /** * Convert a binary string into a hexadecimal string without cache-timing * leaks * * @param string $bin_string (raw binary) * @return string */ public static function hexEncodeUpper($bin_string) { return Hex::encodeUpper($bin_string); } /** * Convert a binary string into a hexadecimal string without cache-timing * leaks * * @param string $bin_string (raw binary) * @return string */ public static function hexDecodeUpper($bin_string) { return Hex::decode($bin_string); } } <?php namespace ParagonIE\ConstantTime; /** * Copyright (c) 2016 - 2017 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Interface EncoderInterface * @package ParagonIE\ConstantTime */ interface EncoderInterface { /** * Convert a binary string into a hexadecimal string without cache-timing * leaks * * @param string $bin_string (raw binary) * @return string */ public static function encode($bin_string); /** * Convert a binary string into a hexadecimal string without cache-timing * leaks * * @param string $encoded_string * @return string (raw binary) */ public static function decode($encoded_string); } <?php namespace ParagonIE\ConstantTime; /** * Copyright (c) 2016 - 2017 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Class Binary * * Binary string operators that don't choke on * mbstring.func_overload * * @package ParagonIE\ConstantTime */ abstract class Binary { /** * Safe string length * * @ref mbstring.func_overload * * @param string $str * @return int */ public static function safeStrlen($str) { if (\function_exists('mb_strlen')) { return (int) \mb_strlen($str, '8bit'); } else { return (int) \strlen($str); } } /** * Safe substring * * @ref mbstring.func_overload * * @staticvar boolean $exists * @param string $str * @param int $start * @param int $length * @return string * @throws \TypeError */ public static function safeSubstr( $str, $start = 0, $length = \null ) { if (\function_exists('mb_substr')) { // mb_substr($str, 0, null, '8bit') returns an empty string on PHP // 5.3, so we have to find the length ourselves. if (\is_null($length)) { if ($start >= 0) { $length = self::safeStrlen($str) - $start; } else { $length = -$start; } } // $length calculation above might result in a 0-length string if ($length === 0) { return ''; } return \mb_substr($str, $start, $length, '8bit'); } if ($length === 0) { return ''; } // Unlike mb_substr(), substr() doesn't accept null for length if (!is_null($length)) { return \substr($str, $start, $length); } else { return \substr($str, $start); } } } <?php namespace ParagonIE\ConstantTime; /** * Copyright (c) 2016 - 2017 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Class Hex * @package ParagonIE\ConstantTime */ abstract class Hex implements EncoderInterface { /** * Convert a binary string into a hexadecimal string without cache-timing * leaks * * @param string $bin_string (raw binary) * @return string */ public static function encode($bin_string) { $hex = ''; $len = Binary::safeStrlen($bin_string); for ($i = 0; $i < $len; ++$i) { $chunk = \unpack('C', Binary::safeSubstr($bin_string, $i, 2)); $c = $chunk[1] & 0xf; $b = $chunk[1] >> 4; $hex .= pack( 'CC', (87 + $b + ((($b - 10) >> 8) & ~38)), (87 + $c + ((($c - 10) >> 8) & ~38)) ); } return $hex; } /** * Convert a binary string into a hexadecimal string without cache-timing * leaks, returning uppercase letters (as per RFC 4648) * * @param string $bin_string (raw binary) * @return string */ public static function encodeUpper($bin_string) { $hex = ''; $len = Binary::safeStrlen($bin_string); for ($i = 0; $i < $len; ++$i) { $chunk = \unpack('C', Binary::safeSubstr($bin_string, $i, 2)); $c = $chunk[1] & 0xf; $b = $chunk[1] >> 4; $hex .= pack( 'CC', (55 + $b + ((($b - 10) >> 8) & ~6)), (55 + $c + ((($c - 10) >> 8) & ~6)) ); } return $hex; } /** * Convert a hexadecimal string into a binary string without cache-timing * leaks * * @param string $hex_string * @return string (raw binary) * @throws \RangeException */ public static function decode($hex_string) { $hex_pos = 0; $bin = ''; $c_acc = 0; $hex_len = Binary::safeStrlen($hex_string); $state = 0; if (($hex_len & 1) !== 0) { throw new \RangeException( 'Expected an even number of hexadecimal characters' ); } $chunk = \unpack('C*', $hex_string); while ($hex_pos < $hex_len) { ++$hex_pos; $c = $chunk[$hex_pos]; $c_num = $c ^ 48; $c_num0 = ($c_num - 10) >> 8; $c_alpha = ($c & ~32) - 55; $c_alpha0 = (($c_alpha - 10) ^ ($c_alpha - 16)) >> 8; if (($c_num0 | $c_alpha0) === 0) { throw new \RangeException( 'hexEncode() only expects hexadecimal characters' ); } $c_val = ($c_num0 & $c_num) | ($c_alpha & $c_alpha0); if ($state === 0) { $c_acc = $c_val * 16; } else { $bin .= \pack('C', $c_acc | $c_val); } $state ^= 1; } return $bin; } } <?php namespace ParagonIE\ConstantTime; /** * Copyright (c) 2016 - 2017 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Class Base64DotSlash * ./[A-Z][a-z][0-9] * * @package ParagonIE\ConstantTime */ abstract class Base64UrlSafe extends Base64 { /** * Uses bitwise operators instead of table-lookups to turn 6-bit integers * into 8-bit integers. * * Base64 character set: * [A-Z] [a-z] [0-9] - _ * 0x41-0x5a, 0x61-0x7a, 0x30-0x39, 0x2d, 0x5f * * @param int $src * @return int */ protected static function decode6Bits($src) { $ret = -1; // if ($src > 0x40 && $src < 0x5b) $ret += $src - 0x41 + 1; // -64 $ret += (((0x40 - $src) & ($src - 0x5b)) >> 8) & ($src - 64); // if ($src > 0x60 && $src < 0x7b) $ret += $src - 0x61 + 26 + 1; // -70 $ret += (((0x60 - $src) & ($src - 0x7b)) >> 8) & ($src - 70); // if ($src > 0x2f && $src < 0x3a) $ret += $src - 0x30 + 52 + 1; // 5 $ret += (((0x2f - $src) & ($src - 0x3a)) >> 8) & ($src + 5); // if ($src == 0x2c) $ret += 62 + 1; $ret += (((0x2c - $src) & ($src - 0x2e)) >> 8) & 63; // if ($src == 0x5f) ret += 63 + 1; $ret += (((0x5e - $src) & ($src - 0x60)) >> 8) & 64; return $ret; } /** * Uses bitwise operators instead of table-lookups to turn 8-bit integers * into 6-bit integers. * * @param int $src * @return string */ protected static function encode6Bits($src) { $diff = 0x41; // if ($src > 25) $diff += 0x61 - 0x41 - 26; // 6 $diff += ((25 - $src) >> 8) & 6; // if ($src > 51) $diff += 0x30 - 0x61 - 26; // -75 $diff -= ((51 - $src) >> 8) & 75; // if ($src > 61) $diff += 0x2d - 0x30 - 10; // -13 $diff -= ((61 - $src) >> 8) & 13; // if ($src > 62) $diff += 0x5f - 0x2b - 1; // 3 $diff += ((62 - $src) >> 8) & 49; return \pack('C', $src + $diff); } } <?php namespace ParagonIE\ConstantTime; /** * Copyright (c) 2016 - 2017 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Class RFC4648 * * This class conforms strictly to the RFC * * @package ParagonIE\ConstantTime */ abstract class RFC4648 { /** * RFC 4648 Base64 encoding * * "foo" -> "Zm9v" * * @param string $str * @return string */ public function base64Encode($str) { return Base64::encode($str); } /** * RFC 4648 Base64 decoding * * "Zm9v" -> "foo" * * @param string $str * @return string */ public function base64Decode($str) { return Base64::decode($str); } /** * RFC 4648 Base64 (URL Safe) encoding * * "foo" -> "Zm9v" * * @param string $str * @return string */ public function base64UrlSafeEncode($str) { return Base64UrlSafe::encode($str); } /** * RFC 4648 Base64 (URL Safe) decoding * * "Zm9v" -> "foo" * * @param string $str * @return string */ public function base64UrlSafeDecode($str) { return Base64UrlSafe::decode($str); } /** * RFC 4648 Base32 encoding * * "foo" -> "MZXW6===" * * @param string $str * @return string */ public function base32Encode($str) { return Base32::encodeUpper($str); } /** * RFC 4648 Base32 encoding * * "MZXW6===" -> "foo" * * @param string $str * @return string */ public function base32Decode($str) { return Base32::decodeUpper($str); } /** * RFC 4648 Base32-Hex encoding * * "foo" -> "CPNMU===" * * @param string $str * @return string */ public function base32HexEncode($str) { return Base32::encodeUpper($str); } /** * RFC 4648 Base32-Hex decoding * * "CPNMU===" -> "foo" * * @param string $str * @return string */ public function base32HexDecode($str) { return Base32::decodeUpper($str); } /** * RFC 4648 Base16 decoding * * "foo" -> "666F6F" * * @param string $str * @return string */ public function base16Encode($str) { return Hex::encodeUpper($str); } /** * RFC 4648 Base16 decoding * * "666F6F" -> "foo" * * @param string $str * @return string */ public function base16Decode($str) { return Hex::decode($str); } }<?php namespace ParagonIE\ConstantTime; /** * Copyright (c) 2016 - 2017 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Class Base64DotSlash * ./[A-Z][a-z][0-9] * * @package ParagonIE\ConstantTime */ abstract class Base64DotSlash extends Base64 { /** * Uses bitwise operators instead of table-lookups to turn 6-bit integers * into 8-bit integers. * * Base64 character set: * ./ [A-Z] [a-z] [0-9] * 0x2e-0x2f, 0x41-0x5a, 0x61-0x7a, 0x30-0x39 * * @param int $src * @return int */ protected static function decode6Bits($src) { $ret = -1; // if ($src > 0x2d && $src < 0x30) ret += $src - 0x2e + 1; // -45 $ret += (((0x2d - $src) & ($src - 0x30)) >> 8) & ($src - 45); // if ($src > 0x40 && $src < 0x5b) ret += $src - 0x41 + 2 + 1; // -62 $ret += (((0x40 - $src) & ($src - 0x5b)) >> 8) & ($src - 62); // if ($src > 0x60 && $src < 0x7b) ret += $src - 0x61 + 28 + 1; // -68 $ret += (((0x60 - $src) & ($src - 0x7b)) >> 8) & ($src - 68); // if ($src > 0x2f && $src < 0x3a) ret += $src - 0x30 + 54 + 1; // 7 $ret += (((0x2f - $src) & ($src - 0x3a)) >> 8) & ($src + 7); return $ret; } /** * Uses bitwise operators instead of table-lookups to turn 8-bit integers * into 6-bit integers. * * @param int $src * @return string */ protected static function encode6Bits($src) { $src += 0x2e; // if ($src > 0x2f) $src += 0x41 - 0x30; // 17 $src += ((0x2f - $src) >> 8) & 17; // if ($src > 0x5a) $src += 0x61 - 0x5b; // 6 $src += ((0x5a - $src) >> 8) & 6; // if ($src > 0x7a) $src += 0x30 - 0x7b; // -75 $src -= ((0x7a - $src) >> 8) & 75; return \pack('C', $src); } } <?php namespace ParagonIE\ConstantTime; /** * Copyright (c) 2016 - 2017 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Class Base32Hex * [0-9][A-V] * * @package ParagonIE\ConstantTime */ abstract class Base32Hex extends Base32 { /** * Uses bitwise operators instead of table-lookups to turn 5-bit integers * into 8-bit integers. * * @param int $src * @return int */ protected static function decode5Bits($src) { $ret = -1; // if ($src > 0x30 && $src < 0x3a) ret += $src - 0x2e + 1; // -47 $ret += (((0x2f - $src) & ($src - 0x3a)) >> 8) & ($src - 47); // if ($src > 0x60 && $src < 0x77) ret += $src - 0x61 + 10 + 1; // -86 $ret += (((0x60 - $src) & ($src - 0x77)) >> 8) & ($src - 86); return $ret; } /** * Uses bitwise operators instead of table-lookups to turn 5-bit integers * into 8-bit integers. * * @param int $src * @return int */ protected static function decode5BitsUpper($src) { $ret = -1; // if ($src > 0x30 && $src < 0x3a) ret += $src - 0x2e + 1; // -47 $ret += (((0x2f - $src) & ($src - 0x3a)) >> 8) & ($src - 47); // if ($src > 0x40 && $src < 0x57) ret += $src - 0x41 + 10 + 1; // -54 $ret += (((0x40 - $src) & ($src - 0x57)) >> 8) & ($src - 54); return $ret; } /** * Uses bitwise operators instead of table-lookups to turn 8-bit integers * into 5-bit integers. * * @param int $src * @return string */ protected static function encode5Bits($src) { $src += 0x30; // if ($src > 0x39) $src += 0x61 - 0x3a; // 39 $src += ((0x39 - $src) >> 8) & 39; return \pack('C', $src); } /** * Uses bitwise operators instead of table-lookups to turn 8-bit integers * into 5-bit integers. * * Uppercase variant. * * @param int $src * @return string */ protected static function encode5BitsUpper($src) { $src += 0x30; // if ($src > 0x39) $src += 0x41 - 0x3a; // 7 $src += ((0x39 - $src) >> 8) & 7; return \pack('C', $src); } }<?php namespace ParagonIE\ConstantTime; /** * Copyright (c) 2016 - 2017 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Class Base32 * [A-Z][2-7] * * @package ParagonIE\ConstantTime */ abstract class Base32 implements EncoderInterface { /** * Decode a Base32-encoded string into raw binary * * @param string $src * @param bool $strictPadding * @return string */ public static function decode($src, $strictPadding = \false) { return static::doDecode($src, \false, $strictPadding); } /** * Decode an uppercase Base32-encoded string into raw binary * * @param string $src * @param bool $strictPadding * @return string */ public static function decodeUpper($src, $strictPadding = \false) { return static::doDecode($src, \true, $strictPadding); } /** * Encode into Base32 (RFC 4648) * * @param string $src * @return string */ public static function encode($src) { return static::doEncode($src, \false); } /** * Encode into Base32 (RFC 4648) * * @param string $src * @return string * @throws \TypeError */ public static function encodeUnpadded($src) { return static::doEncode($src, false, false); } /** * Encode into uppercase Base32 (RFC 4648) * * @param string $src * @return string */ public static function encodeUpper($src) { return static::doEncode($src, \true); } /** * Encode into uppercase Base32 (RFC 4648) * * @param string $src * @return string * @throws \TypeError */ public static function encodeUpperUnpadded($src) { return static::doEncode($src, true, false); } /** * Uses bitwise operators instead of table-lookups to turn 5-bit integers * into 8-bit integers. * * @param int $src * @return int */ protected static function decode5Bits($src) { $ret = -1; // if ($src > 96 && $src < 123) $ret += $src - 97 + 1; // -64 $ret += (((0x60 - $src) & ($src - 0x7b)) >> 8) & ($src - 96); // if ($src > 0x31 && $src < 0x38) $ret += $src - 24 + 1; // -23 $ret += (((0x31 - $src) & ($src - 0x38)) >> 8) & ($src - 23); return $ret; } /** * Uses bitwise operators instead of table-lookups to turn 5-bit integers * into 8-bit integers. * * Uppercase variant. * * @param int $src * @return int */ protected static function decode5BitsUpper($src) { $ret = -1; // if ($src > 64 && $src < 91) $ret += $src - 65 + 1; // -64 $ret += (((0x40 - $src) & ($src - 0x5b)) >> 8) & ($src - 64); // if ($src > 0x31 && $src < 0x38) $ret += $src - 24 + 1; // -23 $ret += (((0x31 - $src) & ($src - 0x38)) >> 8) & ($src - 23); return $ret; } /** * Uses bitwise operators instead of table-lookups to turn 8-bit integers * into 5-bit integers. * * @param int $src * @return string */ protected static function encode5Bits($src) { $diff = 0x61; // if ($src > 25) $ret -= 72; $diff -= ((25 - $src) >> 8) & 73; return \pack('C', $src + $diff); } /** * Uses bitwise operators instead of table-lookups to turn 8-bit integers * into 5-bit integers. * * Uppercase variant. * * @param int $src * @return string */ protected static function encode5BitsUpper($src) { $diff = 0x41; // if ($src > 25) $ret -= 40; $diff -= ((25 - $src) >> 8) & 41; return \pack('C', $src + $diff); } /** * Base32 decoding * * @param string $src * @param bool $upper * @param bool $strictPadding * @return string */ protected static function doDecode($src, $upper = \false, $strictPadding = \true) { // We do this to reduce code duplication: $method = $upper ? 'decode5BitsUpper' : 'decode5Bits'; // Remove padding $srcLen = Binary::safeStrlen($src); if ($srcLen === 0) { return ''; } if ($strictPadding) { if (($srcLen & 7) === 0) { for ($j = 0; $j < 7; ++$j) { if ($src[$srcLen - 1] === '=') { $srcLen--; } else { break; } } } if (($srcLen & 7) === 1) { throw new \RangeException( 'Incorrect padding' ); } } else { $src = \rtrim($src, '='); $srcLen = Binary::safeStrlen($src); } $err = 0; $dest = ''; // Main loop (no padding): for ($i = 0; $i + 8 <= $srcLen; $i += 8) { $chunk = \unpack('C*', Binary::safeSubstr($src, $i, 8)); $c0 = static::$method($chunk[1]); $c1 = static::$method($chunk[2]); $c2 = static::$method($chunk[3]); $c3 = static::$method($chunk[4]); $c4 = static::$method($chunk[5]); $c5 = static::$method($chunk[6]); $c6 = static::$method($chunk[7]); $c7 = static::$method($chunk[8]); $dest .= \pack( 'CCCCC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff, (($c3 << 4) | ($c4 >> 1) ) & 0xff, (($c4 << 7) | ($c5 << 2) | ($c6 >> 3)) & 0xff, (($c6 << 5) | ($c7 ) ) & 0xff ); $err |= ($c0 | $c1 | $c2 | $c3 | $c4 | $c5 | $c6 | $c7) >> 8; } // The last chunk, which may have padding: if ($i < $srcLen) { $chunk = \unpack('C*', Binary::safeSubstr($src, $i, $srcLen - $i)); $c0 = static::$method($chunk[1]); if ($i + 6 < $srcLen) { $c1 = static::$method($chunk[2]); $c2 = static::$method($chunk[3]); $c3 = static::$method($chunk[4]); $c4 = static::$method($chunk[5]); $c5 = static::$method($chunk[6]); $c6 = static::$method($chunk[7]); $dest .= \pack( 'CCCC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff, (($c3 << 4) | ($c4 >> 1) ) & 0xff, (($c4 << 7) | ($c5 << 2) | ($c6 >> 3)) & 0xff ); $err |= ($c0 | $c1 | $c2 | $c3 | $c4 | $c5 | $c6) >> 8; } elseif ($i + 5 < $srcLen) { $c1 = static::$method($chunk[2]); $c2 = static::$method($chunk[3]); $c3 = static::$method($chunk[4]); $c4 = static::$method($chunk[5]); $c5 = static::$method($chunk[6]); $dest .= \pack( 'CCCC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff, (($c3 << 4) | ($c4 >> 1) ) & 0xff, (($c4 << 7) | ($c5 << 2) ) & 0xff ); $err |= ($c0 | $c1 | $c2 | $c3 | $c4 | $c5) >> 8; } elseif ($i + 4 < $srcLen) { $c1 = static::$method($chunk[2]); $c2 = static::$method($chunk[3]); $c3 = static::$method($chunk[4]); $c4 = static::$method($chunk[5]); $dest .= \pack( 'CCC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff, (($c3 << 4) | ($c4 >> 1) ) & 0xff ); $err |= ($c0 | $c1 | $c2 | $c3 | $c4) >> 8; } elseif ($i + 3 < $srcLen) { $c1 = static::$method($chunk[2]); $c2 = static::$method($chunk[3]); $c3 = static::$method($chunk[4]); $dest .= \pack( 'CC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) | ($c3 >> 4)) & 0xff ); $err |= ($c0 | $c1 | $c2 | $c3) >> 8; } elseif ($i + 2 < $srcLen) { $c1 = static::$method($chunk[2]); $c2 = static::$method($chunk[3]); $dest .= \pack( 'CC', (($c0 << 3) | ($c1 >> 2) ) & 0xff, (($c1 << 6) | ($c2 << 1) ) & 0xff ); $err |= ($c0 | $c1 | $c2) >> 8; } elseif ($i + 1 < $srcLen) { $c1 = static::$method($chunk[2]); $dest .= \pack( 'C', (($c0 << 3) | ($c1 >> 2) ) & 0xff ); $err |= ($c0 | $c1) >> 8; } else { $dest .= \pack( 'C', (($c0 << 3) ) & 0xff ); $err |= ($c0) >> 8; } } if ($err !== 0) { throw new \RangeException( 'Base32::doDecode() only expects characters in the correct base32 alphabet' ); } return $dest; } /** * Base32 Decoding * * @param string $src * @param bool $upper * @param bool $pad * @return string */ protected static function doEncode($src, $upper = \false, $pad = \true) { // We do this to reduce code duplication: $method = $upper ? 'encode5BitsUpper' : 'encode5Bits'; $dest = ''; $srcLen = Binary::safeStrlen($src); // Main loop (no padding): for ($i = 0; $i + 5 <= $srcLen; $i += 5) { $chunk = \unpack('C*', Binary::safeSubstr($src, $i, 5)); $b0 = $chunk[1]; $b1 = $chunk[2]; $b2 = $chunk[3]; $b3 = $chunk[4]; $b4 = $chunk[5]; $dest .= static::$method( ($b0 >> 3) & 31) . static::$method((($b0 << 2) | ($b1 >> 6)) & 31) . static::$method((($b1 >> 1) ) & 31) . static::$method((($b1 << 4) | ($b2 >> 4)) & 31) . static::$method((($b2 << 1) | ($b3 >> 7)) & 31) . static::$method((($b3 >> 2) ) & 31) . static::$method((($b3 << 3) | ($b4 >> 5)) & 31) . static::$method( $b4 & 31); } // The last chunk, which may have padding: if ($i < $srcLen) { $chunk = \unpack('C*', Binary::safeSubstr($src, $i, $srcLen - $i)); $b0 = $chunk[1]; if ($i + 3 < $srcLen) { $b1 = $chunk[2]; $b2 = $chunk[3]; $b3 = $chunk[4]; $dest .= static::$method( ($b0 >> 3) & 31) . static::$method((($b0 << 2) | ($b1 >> 6)) & 31) . static::$method((($b1 >> 1) ) & 31) . static::$method((($b1 << 4) | ($b2 >> 4)) & 31) . static::$method((($b2 << 1) | ($b3 >> 7)) & 31) . static::$method((($b3 >> 2) ) & 31) . static::$method((($b3 << 3) ) & 31); if ($pad) { $dest .= '='; } } elseif ($i + 2 < $srcLen) { $b1 = $chunk[2]; $b2 = $chunk[3]; $dest .= static::$method( ($b0 >> 3) & 31) . static::$method((($b0 << 2) | ($b1 >> 6)) & 31) . static::$method((($b1 >> 1) ) & 31) . static::$method((($b1 << 4) | ($b2 >> 4)) & 31) . static::$method((($b2 << 1) ) & 31); if ($pad) { $dest .= '==='; } } elseif ($i + 1 < $srcLen) { $b1 = $chunk[2]; $dest .= static::$method( ($b0 >> 3) & 31) . static::$method((($b0 << 2) | ($b1 >> 6)) & 31) . static::$method((($b1 >> 1) ) & 31) . static::$method((($b1 << 4) ) & 31); if ($pad) { $dest .= '===='; } } else { $dest .= static::$method( ($b0 >> 3) & 31) . static::$method( ($b0 << 2) & 31); if ($pad) { $dest .= '======'; } } } return $dest; } } <?php namespace ParagonIE\ConstantTime; /** * Copyright (c) 2016 - 2017 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Class Base64 * [A-Z][a-z][0-9]+/ * * @package ParagonIE\ConstantTime */ abstract class Base64 implements EncoderInterface { /** * Encode into Base64 * * Base64 character set "[A-Z][a-z][0-9]+/" * * @param string $src * @return string */ public static function encode($src) { return static::doEncode($src, \true); } /** * Encode into Base64, no = padding * * Base64 character set "[A-Z][a-z][0-9]+/" * * @param string $src * @return string */ public static function encodeUnpadded($src) { return static::doEncode($src, \false); } /** * @param string $src * @param bool $pad Include = padding? * @return string */ protected static function doEncode($src, $pad = \true) { $dest = ''; $srcLen = Binary::safeStrlen($src); // Main loop (no padding): for ($i = 0; $i + 3 <= $srcLen; $i += 3) { $chunk = \unpack('C*', Binary::safeSubstr($src, $i, 3)); $b0 = $chunk[1]; $b1 = $chunk[2]; $b2 = $chunk[3]; $dest .= static::encode6Bits( $b0 >> 2 ) . static::encode6Bits((($b0 << 4) | ($b1 >> 4)) & 63) . static::encode6Bits((($b1 << 2) | ($b2 >> 6)) & 63) . static::encode6Bits( $b2 & 63); } // The last chunk, which may have padding: if ($i < $srcLen) { $chunk = \unpack('C*', Binary::safeSubstr($src, $i, $srcLen - $i)); $b0 = $chunk[1]; if ($i + 1 < $srcLen) { $b1 = $chunk[2]; $dest .= static::encode6Bits( $b0 >> 2 ) . static::encode6Bits((($b0 << 4) | ($b1 >> 4)) & 63) . static::encode6Bits( ($b1 << 2) & 63); if ($pad) { $dest .= '='; } } else { $dest .= static::encode6Bits( $b0 >> 2) . static::encode6Bits(($b0 << 4) & 63); if ($pad) { $dest .= '=='; } } } return $dest; } /** * decode from base64 into binary * * Base64 character set "./[A-Z][a-z][0-9]" * * @param string $src * @param bool $strictPadding * @return string * @throws \RangeException */ public static function decode($src, $strictPadding = \false) { // Remove padding $srcLen = Binary::safeStrlen($src); if ($srcLen === 0) { return ''; } if ($strictPadding) { if (($srcLen & 3) === 0) { if ($src[$srcLen - 1] === '=') { $srcLen--; if ($src[$srcLen - 1] === '=') { $srcLen--; } } } if (($srcLen & 3) === 1) { throw new \RangeException( 'Incorrect padding' ); } } else { $src = \rtrim($src, '='); $srcLen = Binary::safeStrlen($src); } $err = 0; $dest = ''; // Main loop (no padding): for ($i = 0; $i + 4 <= $srcLen; $i += 4) { $chunk = \unpack('C*', Binary::safeSubstr($src, $i, 4)); $c0 = static::decode6Bits($chunk[1]); $c1 = static::decode6Bits($chunk[2]); $c2 = static::decode6Bits($chunk[3]); $c3 = static::decode6Bits($chunk[4]); $dest .= \pack( 'CCC', ((($c0 << 2) | ($c1 >> 4)) & 0xff), ((($c1 << 4) | ($c2 >> 2)) & 0xff), ((($c2 << 6) | $c3 ) & 0xff) ); $err |= ($c0 | $c1 | $c2 | $c3) >> 8; } // The last chunk, which may have padding: if ($i < $srcLen) { $chunk = \unpack('C*', Binary::safeSubstr($src, $i, $srcLen - $i)); $c0 = static::decode6Bits($chunk[1]); if ($i + 2 < $srcLen) { $c1 = static::decode6Bits($chunk[2]); $c2 = static::decode6Bits($chunk[3]); $dest .= \pack( 'CC', ((($c0 << 2) | ($c1 >> 4)) & 0xff), ((($c1 << 4) | ($c2 >> 2)) & 0xff) ); $err |= ($c0 | $c1 | $c2) >> 8; } elseif($i + 1 < $srcLen) { $c1 = static::decode6Bits($chunk[2]); $dest .= \pack( 'C', ((($c0 << 2) | ($c1 >> 4)) & 0xff) ); $err |= ($c0 | $c1) >> 8; } elseif ($i < $srcLen && $strictPadding) { $err |= 1; } } if ($err !== 0) { throw new \RangeException( 'Base64::decode() only expects characters in the correct base64 alphabet' ); } return $dest; } /** * Uses bitwise operators instead of table-lookups to turn 6-bit integers * into 8-bit integers. * * Base64 character set: * [A-Z] [a-z] [0-9] + / * 0x41-0x5a, 0x61-0x7a, 0x30-0x39, 0x2b, 0x2f * * @param int $src * @return int */ protected static function decode6Bits($src) { $ret = -1; // if ($src > 0x40 && $src < 0x5b) $ret += $src - 0x41 + 1; // -64 $ret += (((0x40 - $src) & ($src - 0x5b)) >> 8) & ($src - 64); // if ($src > 0x60 && $src < 0x7b) $ret += $src - 0x61 + 26 + 1; // -70 $ret += (((0x60 - $src) & ($src - 0x7b)) >> 8) & ($src - 70); // if ($src > 0x2f && $src < 0x3a) $ret += $src - 0x30 + 52 + 1; // 5 $ret += (((0x2f - $src) & ($src - 0x3a)) >> 8) & ($src + 5); // if ($src == 0x2b) $ret += 62 + 1; $ret += (((0x2a - $src) & ($src - 0x2c)) >> 8) & 63; // if ($src == 0x2f) ret += 63 + 1; $ret += (((0x2e - $src) & ($src - 0x30)) >> 8) & 64; return $ret; } /** * Uses bitwise operators instead of table-lookups to turn 8-bit integers * into 6-bit integers. * * @param int $src * @return string */ protected static function encode6Bits($src) { $diff = 0x41; // if ($src > 25) $diff += 0x61 - 0x41 - 26; // 6 $diff += ((25 - $src) >> 8) & 6; // if ($src > 51) $diff += 0x30 - 0x61 - 26; // -75 $diff -= ((51 - $src) >> 8) & 75; // if ($src > 61) $diff += 0x2b - 0x30 - 10; // -15 $diff -= ((61 - $src) >> 8) & 15; // if ($src > 62) $diff += 0x2f - 0x2b - 1; // 3 $diff += ((62 - $src) >> 8) & 3; return \pack('C', $src + $diff); } } <?php namespace ParagonIE\ConstantTime; /** * Copyright (c) 2016 - 2017 Paragon Initiative Enterprises. * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Class Base64DotSlashOrdered * ./[0-9][A-Z][a-z] * * @package ParagonIE\ConstantTime */ abstract class Base64DotSlashOrdered extends Base64 { /** * Uses bitwise operators instead of table-lookups to turn 6-bit integers * into 8-bit integers. * * Base64 character set: * [.-9] [A-Z] [a-z] * 0x2e-0x39, 0x41-0x5a, 0x61-0x7a * * @param int $src * @return int */ protected static function decode6Bits($src) { $ret = -1; // if ($src > 0x2d && $src < 0x3a) ret += $src - 0x2e + 1; // -45 $ret += (((0x2d - $src) & ($src - 0x3a)) >> 8) & ($src - 45); // if ($src > 0x40 && $src < 0x5b) ret += $src - 0x41 + 12 + 1; // -52 $ret += (((0x40 - $src) & ($src - 0x5b)) >> 8) & ($src - 52); // if ($src > 0x60 && $src < 0x7b) ret += $src - 0x61 + 38 + 1; // -58 $ret += (((0x60 - $src) & ($src - 0x7b)) >> 8) & ($src - 58); return $ret; } /** * Uses bitwise operators instead of table-lookups to turn 8-bit integers * into 6-bit integers. * * @param int $src * @return string */ protected static function encode6Bits($src) { $src += 0x2e; // if ($src > 0x39) $src += 0x41 - 0x3a; // 7 $src += ((0x39 - $src) >> 8) & 7; // if ($src > 0x5a) $src += 0x61 - 0x5b; // 6 $src += ((0x5a - $src) >> 8) & 6; return \pack('C', $src); } } <?php // autoload.php @generated by Composer require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInit2b406fc5980db47d49835190623f72fc::getLoader(); { "name": "danog/madelineprototests", "minimum-stability":"dev", "require": { "danog/madelineproto": "dev-alpha#a56672faf62017a58efc1d06c2773816ce99aec6", "amphp/dns": "dev-master#861cc857b1ba6e02e8a7439c30403682785fce96 as 0.9.9", "amphp/file": "dev-master#5a69fca406ac5fd220de0aa68c887bc8046eb93c as 0.3.3", "amphp/uri": "dev-master#f3195b163275383909ded7770a11d8eb865cbc86 as 0.1.3" }, "repositories": [ { "type": "git", "url": "https://github.com/danog/phpseclib" } ], "authors": [ { "name": "Daniil Gentili", "email": "daniil@daniil.it" } ] } a56672faf62017a58efc1d06c2773816ce99aec6a56672faf62017a58efc1d06c2773816ce99aec6z8�Nڲ}���GBMB