pub fn validate_third_party(
init_data: &str,
bot_id: i64,
expires_in: Option<u64>,
) -> Result<InitData, InitDataError>
Expand description
Validates init data using both primary and third-party bot tokens.
Similar to validate()
, but accepts an additional third-party bot token
for validation. The init data is considered valid if it matches either token.
§Arguments
init_data
- Raw init data string from Telegram Mini Appbot_id
- Bot IDexpires_in
- Optional expiration time in seconds
§Returns
Ok(InitData)
- Parsed and validated init dataErr(InitDataError)
- Various validation or parsing errors
§Example
use init_data_rs::validate_third_party;
let init_data = "query_id=123&auth_date=1662771648&hash=...&signature=...";
let result = validate_third_party(init_data, 1234567890, None);
§Errors
See init_data_rs::parse
for possible errors