telegramauth

package
v0.0.0-...-9204231 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package telegramauth validates Telegram Mini App (WebApp) initData per https://core.telegram.org/bots/webapps#validating-data-received-via-the-mini-app

Index

Constants

View Source
const DefaultInitDataMaxAge = 24 * time.Hour

Variables

View Source
var (
	ErrInvalidInitData = errors.New("telegramauth: invalid initData signature")
	ErrInitDataExpired = errors.New("telegramauth: initData expired")
)

Functions

This section is empty.

Types

type WebAppUser

type WebAppUser struct {
	ID        int64  `json:"id"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Username  string `json:"username"`
}

func ValidateWebAppInitData

func ValidateWebAppInitData(initData, botToken string, now time.Time, maxAge time.Duration) (*WebAppUser, error)

Directories

Path Synopsis
Package telegramauthtest provides test helpers for building signed Telegram WebApp initData strings.
Package telegramauthtest provides test helpers for building signed Telegram WebApp initData strings.

Jump to

Keyboard shortcuts

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