1.6 KiB
1.6 KiB
title | description | image |
---|---|---|
account.setPassword | Set 2FA password | https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png |
Method: account.setPassword
Set 2FA password
Parameters:
Name | Type | Description | Required |
---|---|---|---|
current_password_hash | 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); |
Yes |
new_salt | bytes | New salt | Yes |
new_password_hash | bytes | hash('sha256', $new_salt.$new_password.$new_salt, true) |
Yes |
hint | string | Hint | Yes |
Return type: Bool
Can bots use this method: YES
MadelineProto Example (now async!):
if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
define('MADELINE_BRANCH', '');
include 'madeline.php';
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();
$Bool = $MadelineProto->account->setPassword(['current_password_hash' => 'bytes', 'new_salt' => 'bytes', 'new_password_hash' => 'bytes', 'hint' => 'string', ]);
Or, if you're into Lua:
Bool = account.setPassword({current_password_hash='bytes', new_salt='bytes', new_password_hash='bytes', hint='string', })