# Secret chats
MadelineProto provides wrappers to work with secret chats.
# Requesting secret chats (now fully async!)
$secret_chat = yield $MadelineProto->requestSecretChat($InputUser);
requestSecretChat requests a secret secret chat to the InputUser, ID, or username specified, and returns the secret chat ID.
# Accepting secret chats (now fully async!)
Secret chats are accepted or refused automatically, based on a value in the settings (by default MadelineProto is set to accept all secret chats).
Before sending any message, you must check if the secret chat was accepted by the other client with the following method:
# Checking secret chat status (now fully async!)
$status = yield $MadelineProto->secretChatStatus($chat);
\danog\MadelineProto\MTProto::SECRET_EMPTY if the chat cannot be found in the local database,
MTProto::SECRET_REQUESTED if the chat was requested but not yet accepted, and
MTProto::SECRET_READY if it is a valid accepted secret chat.
# Sending secret messages (now fully async!)
To send messages/files/service messages, simply use the sendEncrypted methods with objects that use the same layer used by the other client (specified by the number after the underscore in decryptedMessage object names, to obtain the layer that must be used for a secret chat use the following wrapper method).
$secret_chat = yield $MadelineProto->getSecretChat($chat); /* [ 'key' => [ // The authorization key 'auth_key' => 'string', // 256 bytes long 'fingerprint' => 10387574747492, // a 64 bit signed integer 'visualization_orig' => 'string', // 16 bytes long 'visualization_46' => 'string', // 20 bytes long // The two visualization strings must be concatenated to generate a visual fingerprint ], 'admin' => false, // Am I the creator of the chat? 'user_id' => 101374607, // The user id of the other user 'InputEncryptedChat' => [...], // An inputEncryptedChat object that represents the current chat 'in_seq_no_x' => number, // in_seq_no must be multiplied by two and incremented by this before being sent over the network 'out_seq_no_x' => number, // out_seq_no must be multiplied by two and incremeneted this begore being sent over the network 'layer' => number, // The secret chat TL layer used by the other client 'ttl' => number, // The default time to live of messages in this chat 'ttr' => 100, // Time left before rekeying must be done, decremented by one every time a message as encrypted/decrypted with this key 'updated' => time(), // Last time the key of the current chat was changed 'incoming' => , // Incoming messages, TL serialized strings 'outgoing' => , // Outgoing messages, TL serialized strings 'created' => time(), // When was this chat created 'rekeying' =>  // Info for rekeying ]; */
This method gets info about a certain chat.