Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticateTelegramWebApp ¶
func AuthenticateTelegramWebApp( w http.ResponseWriter, r *http.Request, getToken func(bot string) string, complete func(initData *InitData), )
AuthenticateTelegramWebApp validates Telegram web app init data https://core.telegram.org/bots/webapps#webappinitdata TODO: Move some of it into Telegram FW module?
Types ¶
type InitData ¶
type InitData struct { // QueryID - A unique identifier for the Web App session, required for sending messages via the answerWebAppQuery method. QueryID string `json:"query_id"` // ChatType - Type of the chat from which the Web App was opened. // Can be either “sender” for a private chat with the user opening the link, // “private”, “group”, “supergroup”, or “channel”. //Returned only for Web Apps launched from direct links. ChatType string `json:"chat_type,omitempty"` // ChatInstance - Global identifier, uniquely corresponding to the chat from which the Web App was opened. // Returned only for Web Apps launched from a direct link. ChatInstance string `json:"chat_instance,omitempty"` // StartParam - The value of the startattach parameter, passed via link. Only returned for Web Apps when launched from the attachment menu via link. StartParam string `json:"start_param,omitempty"` // CanSendAfter - Time in seconds, after which a message can be sent via the answerWebAppQuery method. CanSendAfter int `json:"can_send_after,omitempty"` // AuthDate - Unix time when the form was opened. AuthDate int `json:"auth_date"` // Hash of all passed parameters, which the bot server can use to check their validity. Hash string `json:"hash"` }
InitData describes Telegram web app init data https://core.telegram.org/bots/webapps#webappinitdata
func NewInitDataFromUrlValues ¶ added in v0.4.0
Click to show internal directories.
Click to hide internal directories.