Function parse

Source
pub fn parse(init_data: &str) -> Result<InitData, InitDataError>
Expand description

Parse converts passed init data presented as query string to InitData object.

§Errors

This function returns an Err in one of the following cases:

  • auth_date is missing
  • hash is missing
  • hash is invalid
  • init data has unexpected format
  • signature is invalid
  • the library has an internal error while hmac-ing the string. this should never happen

§Panics

This function will panic if the hash field is missing from the parameters after the initial existence check. This should never happen in normal usage as the function returns an error before reaching the unwrap call.