telegram

package
v0.0.0-...-f0a2dc7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTelegramOAuthURL

func GenerateTelegramOAuthURL(botToken, embed, redirect string) string

GenerateTelegramOAuthURL generates a URL for Telegram OAuth

Types

type AuthData

type AuthData struct {
	Id        *int64  `json:"id,omitempty"`
	FirstName *string `json:"first_name,omitempty"`
	LastName  *string `json:"last_name,omitempty"`
	Username  *string `json:"username,omitempty"`
	PhotoUrl  *string `json:"photo_url,omitempty"`
	AuthDate  *int64  `json:"auth_date,omitempty"`
	Hash      *string `json:"hash,omitempty"`
}

func ParseAndValidateBase64

func ParseAndValidateBase64(content []byte, botToken string) (*AuthData, error)

ParseAndValidateBase64 parses base64 content for AuthData and validates it

func ParseAndValidateJson

func ParseAndValidateJson(content []byte, botToken []byte) (*AuthData, error)

ParseAndValidateJson parses json content for AuthData and validates it

func ParseAuthDataBase64

func ParseAuthDataBase64(content []byte) (*AuthData, error)

ParseAuthDataBase64 decodes provided content from base64 and parses result for AuthData

func ParseAuthDataJson

func ParseAuthDataJson(content []byte) (*AuthData, error)

ParseAuthDataJson parses provided json content for AuthData

func (*AuthData) Validate

func (d *AuthData) Validate(botToken []byte) error

Validate checks the hash of AuthData with computed one. To compute hash botToken is required. Ref: https://core.telegram.org/widgets/login#checking-authorization

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL